PageSourceSearch

https://silva.gr/assets/Onboarding-yJU7R1a3.js

js silva.gr collected 2026-09-27 14:03:05 UTC 14,274 bytes, 1 lines download raw bytes

1import{w as Q,u as L,r as i,C as e,aC as Y,ap as f,au as A,F as P}from"./index-85vHsyJ2.js";import{bE as $,a0 as H}from"./main-B2dcDIOH.js";import{u as V}from"./use-portal-graduate-29k-y6YC.js";import{g as W,E as J}from"./EraBadge-CHO5N1Uw.js";import{B as T}from"./BirthdayInput-DvnuAFJO.js";async function C(t,s){const{error:u}=await P.functions.invoke("graduate-portal-action",{body:{action:"update_onboarding",email:t,...s}});if(u)throw u}function X(t,s){return s==="seminar_registrations"?t.toLocaleDateString("el-GR",{day:"numeric",month:"long",year:"numeric"}):t.getMonth()===0?String(t.getFullYear()):t.toLocaleDateString("el-GR",{month:"long",year:"numeric"})}function Z(t){return Math.floor((Date.now()-t.getTime())/(1e3*60*60*24*365.25))}const U=["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],ee=[{value:"bls",label:"Βασικό Σεμινάριο Silva (BLS)"},{value:"ultra",label:"Ultra Healing"},{value:"sis",label:"Silva Intuition System (SIS)"},{value:"manifesting",label:"Silva Manifesting"},{value:"mastery",label:"Silva Method Mastery (Online)"},{value:"digital_bls",label:"Ψηφιακό Σεμινάριο (Online BLS)"}];function te({graduate:t,blsDate:s,blsCity:u,blsInstructor:d,blsSource:a,onConfirm:p,onSkip:x}){var B;const[m,g]=i.useState(""),[b,v]=i.useState(""),[y,F]=i.useState(u||""),[h,N]=i.useState("bls"),[l,n]=i.useState(!1),[r,o]=i.useState({birth_date:null,precision:null}),[w,S]=i.useState(!1),q=!!s,R=(t==null?void 0:t.first_name)||((B=t==null?void 0:t.full_name)==null?void 0:B.split(" ")[0])||"Απόφοιτε",z=s?W(s.getFullYear()):null,k=s?Z(s):null,I=new Date().getFullYear(),_=parseInt(m,10),M=!isNaN(_)&&_>=1976&&_<=I,G=async()=>{if(!(t!=null&&t.email)){p(null,"","");return}if(n(!0),M){const c=b?parseInt(b,10):1,E=String(c).padStart(2,"0"),D=`${_}-${E}-01`,O=new Date(`${D}T12:00:00`);await C(t.email,{bls_date:D,bls_city:y.trim()||"",seminar_type:h,...r.birth_date&&{birth_date:r.birth_date,birth_date_precision:r.precision}}).catch(console.error),n(!1),p(O,y.trim(),h)}else n(!1),p(null,"","")},K=async()=>{t!=null&&t.email&&r.birth_date&&await C(t.email,{birth_date:r.birth_date,birth_date_precision:r.precision}).catch(console.error),p(s,u||"","")};return e.jsx("div",{className:"min-h-screen flex flex-col items-center justify-center p-6",style:{backgroundColor:"var(--portal-navy)"},children:e.jsxs(f.div,{initial:{opacity:0,y:32},animate:{opacity:1,y:0},transition:{duration:.45,ease:"easeOut"},className:"w-full max-w-lg text-center",children:[z&&e.jsx(f.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},transition:{delay:.15,duration:.35},className:"flex justify-center mb-6",children:e.jsx(J,{decade:z,size:48})}),e.jsxs("h1",{className:"text-white mb-3",style:{fontFamily:"'Fraunces', Georgia, serif",fontSize:"clamp(26px, 5vw, 36px)",fontWeight:700,lineHeight:1.2},children:[R,","]}),q?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-white/80 text-lg mb-2",style:{fontFamily:"'DM Sans', system-ui, sans-serif"},children:"έγινες απόφοιτος της μεθόδου Silva"}),e.jsx("p",{className:"text-white mb-2",style:{fontFamily:"'Fraunces', Georgia, serif",fontSize:"clamp(18px, 3vw, 24px)",fontWeight:600},children:X(s,a)}),u&&e.jsx("p",{className:"text-white/60 text-base mb-2",children:u}),d&&e.jsxs("p",{className:"text-white/60 text-sm mb-4",children:["με τον/την ",d]}),k!==null&&k>0&&e.jsxs("p",{className:"text-white/75 text-base mb-8",children:["Ασκείσαι εδώ και ",e.jsxs("span",{className:"text-white font-semibold",children:[k," ",k===1?"χρόνο":"χρόνια"]}),"."]}),e.jsx("div",{className:"mb-4",children:w?e.jsx("div",{className:"text-left",children:e.jsx(T,{variant:"dark",onChange:o})}):e.jsx("button",{onClick:()=>S(!0),className:"text-sm hover:underline transition-colors",style:{color:"rgba(255,255,255,0.55)"},children:"+ Πρόσθεσε τα γενέθλιά σου"})}),e.jsxs("button",{onClick:K,className:"flex items-center gap-2 mx-auto px-8 py-3.5 rounded-xl font-semibold text-white transition-opacity hover:opacity-90",style:{backgroundColor:"var(--portal-teal)",fontFamily:"'DM Sans', system-ui, sans-serif"},children:["Συνέχεια ",e.jsx(A,{size:18})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-white/80 text-base mb-2",children:"Βοήθησέ μας να συμπληρώσουμε το προφίλ σου."}),e.jsxs("p",{className:"text-white/55 text-sm mb-6 leading-relaxed",children:["Δεν χρειάζεται να θυμάσαι την ακριβή ημερομηνία.",e.jsx("br",{}),"Αρκεί η χρονιά που παρακολούθησες το σεμινάριο."]}),e.jsxs("div",{className:"text-left mb-3",children:[e.jsx("label",{className:"block text-white/70 text-sm mb-1.5",children:"Χρονιά σεμιναρίου *"}),e.jsx("input",{type:"number",value:m,onChange:c=>g(c.target.value),placeholder:"π.χ. 2018",min:1976,max:I,className:"w-full rounded-lg px-4 py-3 text-base outline-none placeholder-white/30",style:{backgroundColor:"rgba(255,255,255,0.1)",border:`1.5px solid ${m&&!M?"#FF6B6B":"rgba(255,255,255,0.25)"}`,color:"#FFFFFF",fontFamily:"'DM Sans', system-ui, sans-serif"}}),m&&!M&&e.jsxs("p",{className:"text-red-400 text-xs mt-1",children:["Παρακαλώ εισάγετε μια έγκυρη χρονιά (1976–",I,")"]})]}),e.jsxs("div",{className:"text-left mb-3",children:[e.jsxs("label",{className:"block text-white/70 text-sm mb-1.5",children:["Μήνας ",e.jsx("span",{className:"text-white/40",children:"(προαιρετικό)"})]}),e.jsxs("select",{value:b,onChange:c=>v(c.target.value),className:"w-full rounded-lg px-4 py-3 text-base outline-none",style:{backgroundColor:"rgba(255,255,255,0.1)",border:"1.5px solid rgba(255,255,255,0.25)",color:b?"#FFFFFF":"rgba(255,255,255,0.4)",fontFamily:"'DM Sans', system-ui, sans-serif"},children:[e.jsx("option",{value:"",style:{backgroundColor:"#1A1E2E",color:"rgba(255,255,255,0.4)"},children:"Δεν θυμάμαι τον μήνα"}),U.map((c,E)=>e.jsx("option",{value:String(E+1),style:{backgroundColor:"#1A1E2E",color:"#FFFFFF"},children:c}
1,E))]})]}),e.jsxs("div",{className:"text-left mb-3",children:[e.jsxs("label",{className:"block text-white/70 text-sm mb-1.5",children:["Σεμινάριο ",e.jsx("span",{className:"text-white/40",children:"(προαιρετικό)"})]}),e.jsxs("select",{value:h,onChange:c=>N(c.target.value),className:"w-full rounded-lg px-4 py-3 text-base outline-none",style:{backgroundColor:"rgba(255,255,255,0.1)",border:"1.5px solid rgba(255,255,255,0.25)",color:"#FFFFFF",fontFamily:"'DM Sans', system-ui, sans-serif"},children:[e.jsx("option",{value:"",style:{backgroundColor:"#1A1E2E",color:"rgba(255,255,255,0.4)"},children:"Δεν ξέρω / Άλλο"}),ee.map(c=>e.jsx("option",{value:c.value,style:{backgroundColor:"#1A1E2E",color:"#FFFFFF"},children:c.label},c.value))]})]}),e.jsxs("div",{className:"text-left mb-4",children:[e.jsxs("label",{className:"block text-white/70 text-sm mb-1.5",children:["Πόλη ",e.jsx("span",{className:"text-white/40",children:"(προαιρετικό)"})]}),e.jsx("input",{type:"text",value:y,onChange:c=>F(c.target.value),placeholder:"π.χ. Αθήνα",className:"w-full rounded-lg px-4 py-3 text-base outline-none placeholder-white/30",style:{backgroundColor:"rgba(255,255,255,0.1)",border:"1.5px solid rgba(255,255,255,0.25)",color:"#FFFFFF",fontFamily:"'DM Sans', system-ui, sans-serif"}})]}),e.jsx("div",{className:"text-left mb-6",children:e.jsx(T,{variant:"dark",onChange:o})}),e.jsxs("button",{onClick:G,disabled:l||!M,className:"flex items-center gap-2 mx-auto px-8 py-3.5 rounded-xl font-semibold text-white transition-opacity hover:opacity-90 disabled:opacity-50",style:{backgroundColor:"var(--portal-teal)",fontFamily:"'DM Sans', system-ui, sans-serif"},children:[l?"Αποθήκευση…":"Συνέχεια",!l&&e.jsx(A,{size:18})]}),e.jsx("button",{onClick:x,className:"block mx-auto mt-4 text-sm hover:underline transition-colors",style:{color:"rgba(255,255,255,0.35)"},children:"Δεν θυμάμαι πότε έγινα απόφοιτος"})]})]})})}const j=["Γιατί ήρθες στη μέθοδο Silva;","Τι δυσκολίες αντιμετώπιζες τότε;","Σε βοήθησε η μέθοδος;","Τι έχει αλλάξει στη ζωή σου;"];function ae({email:t,onComplete:s,onSkip:u,isSaving:d}){const[a,p]=i.useState(Array(j.length).fill("")),[x,m]=i.useState(1),[g,b]=i.useState(!1),[v,y]=i.useState(!1),F=(l,n)=>{const r=[...a];r[l]=n,p(r),n.trim().length>=3&&l+1<j.length&&x<=l+1&&setTimeout(()=>m(o=>Math.max(o,l+2)),300)},h=async()=>{y(!0);const l=j.reduce((n,r,o)=>(n[`q${o+1}`]=a[o],n),{consent:g?"true":"false"});await C(t,{survey:l}).catch(console.error),y(!1),s(a,g)},N=a.every(l=>l.trim().length>=2);return e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-start pt-10 p-6",style:{backgroundColor:"var(--portal-canvas)"},children:[e.jsxs("div",{className:"w-full max-w-lg",children:[e.jsxs(f.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35},className:"mb-8",children:[e.jsx("h2",{className:"mb-2",style:{fontFamily:"'Fraunces', Georgia, serif",fontSize:"clamp(20px, 4vw, 26px)",fontWeight:700,color:"var(--portal-text)"},children:"Πες μας την ιστορία σου"}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--portal-text-2)"},children:"Πριν εξερευνήσεις την Πύλη, θέλουμε να σε γνωρίσουμε καλύτερα. Οι απαντήσεις σου βοηθούν να προσωποποιήσουμε την εμπειρία σου."})]}),e.jsx("div",{className:"space-y-4",children:j.slice(0,x).map((l,n)=>e.jsx(Y,{children:e.jsxs(f.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:n===x-1?.2:0},children:[e.jsx("div",{className:"rounded-2xl rounded-tl-sm px-4 py-3 mb-2 inline-block max-w-[85%]",style:{backgroundColor:"var(--portal-navy)",color:"#FFFFFF",fontFamily:"'DM Sans', system-ui, sans-serif",fontSize:"15px"},children:l}),e.jsx("textarea",{value:a[n],onChange:r=>F(n,r.target.value),placeholder:"Γράψε εδώ…",rows:3,className:"w-full rounded-xl px-4 py-3 text-sm outline-none resize-none",style:{backgroundColor:"#FFFFFF",border:"1.5px solid var(--portal-border)",color:"var(--portal-text)",fontFamily:"'DM Sans', system-ui, sans-serif"},onFocus:r=>{r.target.style.borderColor="var(--portal-teal)"},onBlur:r=>{r.target.style.borderColor="var(--portal-border)",a[n].trim().length>=3&&n+1<j.length&&x<=n+1&&m(o=>Math.max(o,n+2))}})]})}
1,n))}),x>=j.length&&e.jsxs(f.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.25},className:"flex items-start gap-3 mt-6 mb-6",children:[e.jsx("input",{type:"checkbox",id:"consent",checked:g,onChange:l=>b(l.target.checked),className:"mt-1 accent-teal-600 w-4 h-4 flex-shrink-0"}),e.jsx("label",{htmlFor:"consent",className:"text-sm",style:{color:"var(--portal-text-2)"},children:"Συμφωνώ να χρησιμοποιηθεί η ιστορία μου ως μαρτυρία"})]}),x>=j.length&&e.jsxs(f.button,{initial:{opacity:0},animate:{opacity:1},onClick:h,disabled:v||!N,className:"flex items-center gap-2 px-8 py-3.5 rounded-xl font-semibold text-white transition-opacity hover:opacity-90 disabled:opacity-50",style:{backgroundColor:"var(--portal-teal)",fontFamily:"'DM Sans', system-ui, sans-serif"},children:[v?"Αποθήκευση…":"Ολοκλήρωση",!v&&e.jsx(A,{size:18})]})]}),e.jsx("div",{className:"flex justify-center mt-6 pb-10",children:e.jsx("button",{onClick:u,disabled:d,className:"px-8 py-3 rounded-xl text-sm font-semibold border-2 transition-colors disabled:opacity-40 hover:bg-black/5",style:{color:"var(--portal-text-2)",borderColor:"var(--portal-border)",fontFamily:"'DM Sans', system-ui, sans-serif",minHeight:"48px"},children:d?"Αποθήκευση…":"Παράλειψη για τώρα"})})]})}function oe(){const{softUser:t}=$(),s=Q(),[u]=H(),d=L(),{data:a,isLoading:p}=V(t==null?void 0:t.email),[x,m]=i.useState(1),[g,b]=i.useState(!1),[v,y]=i.useState(!1),F=i.useRef(!1),h=u.get("step")==="date";if(i.useEffect(()=>{if(p||!a||F.current)return;F.current=!0;const{portalOnboarded:o,surveyCompleted:w,surveySkipCount:S}=a;if(!o||h)m(1);else if(!w&&S<3)m(2);else{s("/graduate-portal",{replace:!0});return}b(!0)},[p,a,s,h]),!(t!=null&&t.email))return s("/soft-signin",{replace:!0}),null;if(p||!g)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{backgroundColor:"var(--portal-navy)"},children:e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-white/20 border-t-white animate-spin"})});const N=()=>{if(h){s("/graduate-portal/journey",{replace:!0});return}m(2)},l=(o,w,S)=>{if(h){d.invalidateQueries({queryKey:["portal-graduate",t==null?void 0:t.email]}),s("/graduate-portal/journey",{replace:!0});return}m(2)},n=async(o,w)=>{try{await C(t.email,{set_onboarded:!0})}catch(S){console.error(S);return}d.invalidateQueries({queryKey:["portal-graduate",t.email]}),d.removeQueries({queryKey:["graduate-record-portal",t.email]}),s("/graduate-portal",{replace:!0})},r=async()=>{y(!0);try{await C(t.email,{increment_survey_skip:!0,set_onboarded:!0})}catch(o){console.error(o),y(!1);return}d.invalidateQueries({queryKey:["portal-graduate",t.email]}),d.removeQueries({queryKey:["graduate-record-portal",t.email]}),s("/graduate-portal",{replace:!0})};return e.jsxs(Y,{mode:"wait",children:[x===1&&e.jsx(f.div,{exit:{opacity:0,x:-30},transition:{duration:.2},children:e.jsx(te,{graduate:a==null?void 0:a.graduate,blsDate:(a==null?void 0:a.blsDate)||null,blsCity:(a==null?void 0:a.blsCity)||null,blsInstructor:(a==null?void 0:a.blsInstructor)||null,blsSource:(a==null?void 0:a.blsSource)||null,onConfirm:l,onSkip:N})},"screen1"),x===2&&e.jsx(f.div,{initial:{opacity:0,x:30},animate:{opacity:1,x:0},exit:{opacity:0,x:-30},transition:{duration:.2},children:e.jsx(ae,{email:t.email,onComplete:n,onSkip:r,isSaving:v})},"screen2")]})}export{oe 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.