PageSourceSearch

https://johku.fi/_nuxt/DHvtoKmP.js

js johku.fi collected 2026-10-09 04:39:53 UTC 10,739 bytes, 1 lines download raw bytes

1import{s as me,u as X,_ as ve,j as fe,a as _e}from"./BI5BN1rn.js";import{u as he,_ as ye,a as ge}from"./Bi7tZq7f.js";import{G as Z,z as be,N as xe,as as o,ak as i,al as t,I as e,aw as T,ah as O,aF as v,ax as n,ao as f,ag as ke,aC as k,aG as U,aK as Y,i as I,am as J,r as d,e as D,aT as we}from"./BA2cZanY.js";import{a as Q}from"./zypciNv-.js";import{n as Se}from"./tn3b78NZ.js";import{u as Ce}from"./DX5Qm-TS.js";import"./DyfadX0W.js";import"./oiGUARBV.js";const Ie={class:"breadcrumb-navi-wrap"},Te={class:"container"},Pe=["aria-label"],Ve={class:"breadcrumb-navi-item breadcrumb-navi-root"},Ne={class:"breadcrumb-navi-item breadcrumb-navi-current"},$e={id:"js-header-product",class:"page-header-bar text-center"},Ee={class:"container js-page-name page-header-title big-text"},je={class:"container main-content"},Ae={class:"page-content text-content infopage-content"},Oe={key:0,class:"text-center",style:{padding:"60px 0"}},Ue={style:{"margin-top":"20px"}},Ye={key:1,class:"alert alert-danger"},De={style:{"margin-top":"12px"}},Be={key:2,class:"text-center",style:{padding:"40px 0"}},Fe={key:3,style:{"max-width":"480px",margin:"auto"}},qe={key:0,class:"text-muted"},Me={class:"form-group"},Re=["value"],Ge={class:"form-group"},Le=["placeholder"],We={key:0,class:"alert alert-danger",style:{"margin-top":"12px"}},ze=["disabled"],He={key:0,class:"fa fa-spinner fa-spin fa-fw"},Ke={key:1,class:"fa fa-envelope fa-fw"},Je={key:4,style:{"max-width":"480px",margin:"auto"}},Qe={key:0,class:"text-muted"},Xe={class:"form-group"},Ze=["value"],et={key:0,class:"alert alert-danger",style:{"margin-top":"12px"}},tt=["disabled"],at={key:0,class:"fa fa-spinner fa-spin fa-fw"},st={key:1,class:"fa fa-envelope fa-fw"},nt={key:5,style:{"max-width":"480px",margin:"auto"}},ot={class:"alert alert-info"},it={class:"mb-2"},lt={class:"mb-0"},rt={class:"text-primary"},ct={class:"form-group"},ut=["placeholder"],dt={key:0,class:"alert alert-danger",style:{"margin-top":"12px"}},pt=["disabled"],mt={key:0,class:"fa fa-spinner fa-spin fa-fw"},vt={key:1,class:"fa fa-sign-in fa-fw"},ft={style:{"margin-top":"12px"}},_t={key:6,style:{"max-width":"480px",margin:"auto"}},ht={class:"form-group"},yt={key:0,class:"alert alert-danger",style:{"margin-top":"12px"}},gt=["disabled"],bt={key:0,class:"fa fa-spinner fa-spin fa-fw"},xt={style:{"margin-top":"12px"}},kt=["disabled"],wt={key:0,class:"fa fa-spinner fa-spin fa-fw"},St={key:7,style:{"max-width":"480px"}},Ct=Z({__name:"Invitepage",props:{token:{type:String,required:!0}},setup(B){const w=B,{$store:S,$translate:a}=be(),{locale:x,shopId:m}=me(S),{shopTitle:P,limitedStorefront:ee}=X(),V=Q.useSession(),{loadPrivateStorefronts:te}=Ce(),{termsAccepted:N,termsError:ae,completeSignupError:F,isCompletingSignup:$,isCancelingSignup:E,collectNameValue:y,resetCompleteSignupForm:se,submitCompleteSignup:ne,cancelIncompleteSignup:oe}=he(),{handleSignupExpired:ie}=ge(),q=d(!0),j=d(""),r=d(null),A=d(!1),p=d("send-otp"),_=d(""),g=d(""),c=d(!1),u=d(""),M=d(!1),R=d(!1),G=d(""),L=d(""),W=D(()=>a("Complete your account")),z=s=>{if(!s)return"";const l=String(s).slice(0,10),b=new Date(`${l}T00:00:00`);return Number.isNaN(b.getTime())?l:b.toLocaleDateString(x.value.replace("_","-"))},C=D(()=>{const s=z(r.value?.startdate),l=z(r.value?.enddate);return s&&l?a("Your access is valid from %s to %s.").replace("%s",s).replace("%s",l):s?a("Your access starts on %s.").replace("%s",s):l?a("Your access is valid until %s.").replace("%s",l):""});xe(async()=>{try{const s=await $fetch(`${S.apiUrl}${m.value}/userinvitations.json?token=${encodeURIComponent(w.token)}`);r.value={email:s.email,name:s.name||"",startdate:s.startdate||null,enddate:s.enddate||null},A.value=!s.hasaccount,s.name&&(_.value=s.name),p.value=s.hasaccount?"send-otp":"collect-name"}catch(s){j.value=s.data?.errorMessage||s.data?.message||s.message||a("This invitation link is invalid or has expired.")}finally{q.value=!1}});const H=async()=>{if(r.value){c.value=!0,u.value="";try{await $fetch("/api/auth/send-otp",{method:"POST",headers:{"x-johku-shop-id":m.value},body:{email:r.value.email,type:"sign-in",shopId:m.value}}),p.value="verify-otp"}catch(s){u.value=s.data?.message||s.message||a("Failed to send verification code. Please try again.")}finally{c.value=!1}}},le=async()=>
1{if(r.value){u.value="";try{await $fetch("/api/auth/send-otp",{method:"POST",headers:{"x-johku-shop-id":m.value},body:{email:r.value.email,type:"sign-in",shopId:m.value}})}catch(s){u.value=s.data?.message||s.message||a("Failed to resend verification code.")}}},re=async()=>{if(r.value){c.value=!0,u.value="";try{const{error:s}=await Q.signIn.emailOtp({email:r.value.email,otp:g.value});if(s){u.value=s.message||a("Invalid verification code. Please try again."),c.value=!1;return}await V.value?.refetch();const l=V.value?.data?.user;if(Se(l)){y.value=_.value.trim(),p.value="complete-signup",c.value=!1;return}await K()}catch(s){u.value=s.message||a("Something went wrong. Please try again.")}finally{c.value=!1}}},K=async()=>{await $fetch("/api/auth/invite-accept",{method:"POST",headers:{"x-johku-shop-id":m.value},body:{token:w.token,shopId:m.value,..._.value.trim()?{name:_.value.trim()}:{}}}),await $fetch("/api/auth/backend-sync",{method:"POST",headers:{"x-johku-shop-id":m.value},body:{shopId:m.value}}),await V.value?.refetch(),await te(),R.value=!0,G.value=a("Welcome!"),L.value=a("You have been signed in and your access has been granted."),M.value=!0},ce=async()=>{y.value.trim()&&(_.value=y.value.trim()),await ne({requireName:!0,onExpired:async()=>{p.value="signup-expired"},onSuccess:async()=>{await K()}})},ue=async()=>{await ie(()=>{se(),g.value="",p.value=A.value?"collect-name":"send-otp"})},de=async()=>{await oe({onSuccess:()=>{g.value="",p.value=A.value?"collect-name":"send-otp"}})};return(s,l)=>{const b=ve,pe=ye;return o(),i("div",null,[t("div",Ie,[t("div",Te,[e(ee)?f("",!0):(o(),i("ul",{key:0,class:"js-breadcrumb-navi hidden-xs","aria-label":e(a)("Breadcrumb")},[t("li",Ve,[T(b,{to:"/"+e(x)},{default:O(()=>[v(n(e(P)),1)]),_:1},8,["to"])]),t("li",Ne,[t("span",null,n(e(W)),1)])],8,Pe))])]),t("div",$e,[t("div",Ee,[t("h1",null,n(e(W)),1)])]),t("div",je,[t("div",Ae,[e(q)?(o(),i("div",Oe,[l[4]||(l[4]=t("i",{class:"fa fa-spinner fa-spin fa-3x"},null,-1)),t("p",Ue,n(e(a)("Loading...")),1)])):e(j)?(o(),i("div",Ye,[l[5]||(l[5]=t("i",{class:"fa fa-exclamation-triangle"},null,-1)),v(" "+n(e(j))+" ",1),t("p",De,[T(b,{to:"/"+e(x)},{default:O(()=>[v(n(e(a)("Go to front page")),1)]),_:1},8,["to"])])])):e(M)?(o(),i("div",Be,[l[6]||(l[6]=t("i",{class:"fa fa-check-circle fa-5x text-success",style:{"margin-bottom":"20px"}},null,-1)),t("h3",null,n(e(G)),1),t("p",null,n(e(L)),1),e(R)?(o(),ke(b,{key:0,to:"/"+e(x)+"/my-johku?tab=overview",class:"btn btn-primary btn-lg",style:{"margin-top":"12px"}},{default:O(()=>[v(n(e(a)("Continue")),1)]),_:1},8,["to"])):f("",!0)])):e(r)&&e(p)==="collect-name"?(o(),i("div",Fe,[t("p",null,n(e(a)("You have been invited to create an account. Please enter your name, and we'll send a verification code to your email.")),1),e(C)?(o(),i("p",qe,n(e(C)),1)):f("",!0),t("form",{onSubmit:k(H,["prevent"])},[t("div",Me,[t("label",null,n(e(a)("Email")),1),t("input",{type:"email",class:"form-control",value:e(r).email,readonly:"",disabled:""},null,8,Re)]),t("div",Ge,[t("label",null,n(e(a)("Name")),1),U(t("input",{type:"text",class:"form-control","onUpdate:modelValue":l[0]||(l[0]=h=>I(_)?_.value=h:null),placeholder:e(a)("Your name"),required:"",autofocus:""},null,8,Le),[[Y,e(_)]])]),e(u)?(o(),i("div",We,n(e(u)),1)):f("",!0),t("button",{type:"submit",class:"btn btn-primary btn-lg",disabled:e(c),style:{"margin-top":"8px"}},[e(c)?(o(),i("i",He)):(o(),i("i",Ke)),v(" "+n(e(c)?e(a)("Sending..."):e(a)("Send verification code")),1)],8,ze)],32)])):e(r)&&e(p)==="send-otp"?(o(),i("div",Je,[t("p",null,n(e(a)("Please verify your identity to accept the invitation. We'll send a verification code to your email.")),1),e(C)?(o(),i("p",Qe,n(e(C)),1)):f("",!0),t("form",{onSubmit:k(H,["prevent"])},[t("div",Xe,[t("label",null,n(e(a)("Email")),1),t("input",{type:"email",class:"form-control",value:e(r).email,readonly:"",disabled:""},null,8,Ze)]),e(u)?(o(),i("div",et,n(e(u)),1)):f("",!0),t("button",{type:"submit",class:"btn btn-primary btn-lg",disabled:e(c),style:{"margin-top":"8px"}},[e(c)?(o(),i("i",at)):(o(),i("i",st)),v(" "+n(e(c)?e(a)("Sending..."):e(a)("Send verification code")),1)],8,tt)],32)])):e(r)&&e(p)==="verify-otp"?(
1o(),i("div",nt,[t("div",ot,[t("p",it,n(e(a)("We've sent a verification code to:")),1),t("p",lt,[t("strong",rt,n(e(r).email),1)])]),t("form",{onSubmit:k(re,["prevent"]),style:{"margin-top":"16px"}},[t("div",ct,[t("label",null,n(e(a)("Verification Code")),1),U(t("input",{type:"text",class:"form-control","onUpdate:modelValue":l[1]||(l[1]=h=>I(g)?g.value=h:null),required:"",placeholder:e(a)("Enter 6-digit code"),pattern:"[0-9]{6}",maxlength:"6",autocomplete:"one-time-code",autofocus:""},null,8,ut),[[Y,e(g)]])]),e(u)?(o(),i("div",dt,n(e(u)),1)):f("",!0),t("button",{type:"submit",class:"btn btn-primary btn-lg",disabled:e(c),style:{"margin-top":"8px"}},[e(c)?(o(),i("i",mt)):(o(),i("i",vt)),v(" "+n(e(c)?e(a)("Verifying..."):e(a)("Verify and accept invitation")),1)],8,pt),t("div",ft,[t("a",{href:"#",onClick:k(le,["prevent"]),class:"resend-code-link"},n(e(a)("Didn't receive the code? Send again")),1)])],32)])):e(r)&&e(p)==="complete-signup"?(o(),i("div",_t,[t("form",{onSubmit:k(ce,["prevent"])},[t("div",ht,[t("label",null,n(e(a)("Your name")),1),U(t("input",{type:"text",class:"form-control","onUpdate:modelValue":l[2]||(l[2]=h=>I(y)?y.value=h:null),required:""},null,512),[[Y,e(y)]])]),T(pe,{modelValue:e(N),"onUpdate:modelValue":l[3]||(l[3]=h=>I(N)?N.value=h:null),"input-id":"invite-auth-terms-checkbox",error:e(ae)},null,8,["modelValue","error"]),e(F)?(o(),i("div",yt,n(e(F)),1)):f("",!0),t("button",{type:"submit",class:"btn btn-primary btn-lg",disabled:e($)||e(E),style:{"margin-top":"8px"}},[e($)?(o(),i("i",bt)):(o(),i(J,{key:1},[v(n(e(a)("Create Account")),1)],64))],8,gt),t("div",xt,[t("button",{type:"button",class:"btn btn-link",disabled:e($)||e(E),onClick:de},[e(E)?(o(),i("i",wt)):(o(),i(J,{key:1},[v(n(e(a)("Cancel")),1)],64))],8,kt)])],32)])):e(r)&&e(p)==="signup-expired"?(o(),i("div",St,[t("p",null,n(e(a)("Your signup session has expired. Please sign in again to create your account.")),1),t("button",{type:"button",class:"btn btn-primary btn-lg",onClick:ue},n(e(a)("Sign in again")),1)])):f("",!0)])])])}}}),It=fe(Ct,[["__scopeId","data-v-ec29a40d"]]),Ot=Z({__name:"invitepage",setup(B){const{token:w}=we().params,{shopTitle:S}=X(),a=D(()=>S.value);return _e({title:a}),(x,m)=>{const P=It;return o(),i("div",null,[T(P,{token:e(w)},null,8,["token"])])}}});export{Ot 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.