1import{a as me,F as ue}from"./BEZ0r1oH.js";import{c as pe,_ as fe,p as _e}from"./D5D19R9n.js";import{_ as he}from"./QgeNKk3Q.js";import{u as Y,r as g,B as ge,e as m,q as ve,ag as ye,z as ke,d as be,ak as xe,b as we,a as $e,w as Ce,D as Se,J as Fe,c as r,f as t,g as c,K as C,t as a,h as s,n as z,y,G as u,af as qe,H as f,l as Ue,o as n,p as E,s as D,al as S}from"./J0DG4uHJ.js";import{a as Q,c as Be}from"./CLPUje9K.js";import{c as Le,a as Ve}from"./CdRkV44r.js";import{c as je}from"./rJvS11i8.js";import{_ as Te}from"./DlAUqK2U.js";import{u as Ie}from"./B2G90K7M.js";import{_ as ze}from"./Btf2450Y.js";import{_ as Ee}from"./CkBk2Lh-.js";import{_ as De}from"./B84icV1E.js";import"./Cpj98o6Y.js";import"./CIlHeXhM.js";import"./BzW7g15y.js";import"./D0fustKo.js";import"./BBX6oorb.js";import"./B1dtsgaM.js";const Ne={class:"w-full max-w-md"},Pe={class:"confirm-account-card card bg-white shadow-2xl"},Ae={class:"card-body"},Re={class:"confirm-account-header text-center mb-4"},He={class:"text-3xl font-bold text-gray-800 mb-4"},Je={class:"flex justify-center mb-6"},We=["src"],Ge={class:"font-semibold text-gray-800 truncate"},Ke={class:"text-gray-600"},Oe={key:0,class:"text-center mt-4"},Ye={class:"text-xs text-gray-500"},Qe=["href"],Xe={key:1},Ze=["href"],Me={key:0,class:"confirm-account-no-token-state alert alert-error mb-6"},et={class:"text-sm"},tt={key:1,class:"confirm-account-loading-state flex flex-col items-center justify-center min-h-[40vh] text-center px-4"},st={class:"mt-4 text-gray-500"},ot={key:2,class:"confirm-account-expired-state flex flex-col items-center justify-center min-h-[60vh] text-center px-4"},at={class:"max-w-md"},nt={class:"text-4xl font-bold text-red-600 mb-4"},rt={class:"text-2xl font-semibold text-gray-900 mb-4"},it={class:"text-gray-600 mb-6"},ct={class:"flex flex-col sm:flex-row gap-4 justify-center"},lt=["onSubmit"],dt={class:"confirm-account-personal-section space-y-4"},mt={class:"text-lg font-medium text-gray-900 border-b border-gray-200 pb-2"},ut={class:"grid grid-cols-1 gap-4 sm:grid-cols-2"},pt={class:"confirm-account-first-name-field"},ft={class:"block text-sm font-medium text-gray-700 mb-2"},_t={key:0,class:"text-red-500 text-xs mt-1 block"},ht={class:"confirm-account-last-name-field"},gt={class:"block text-sm font-medium text-gray-700 mb-2"},vt={key:0,class:"text-red-500 text-xs mt-1 block"},yt={class:"confirm-account-security-section space-y-4"},kt={class:"text-lg font-medium text-gray-900 border-b border-gray-200 pb-2"},bt={class:"confirm-account-password-field"},xt={class:"block text-sm font-medium text-gray-700 mb-2"},wt={key:0,class:"text-red-500 text-xs mt-1 block"},$t={class:"confirm-account-password-confirmation-field"},Ct={class:"block text-sm font-medium text-gray-700 mb-2"},St={key:0,class:"text-red-500 text-xs mt-1 block"},Ft={key:0,class:"text-xs text-gray-500 mb-2 p-2 bg-gray-50 rounded"},qt={key:1,class:"confirm-account-terms-section space-y-4"},Ut={class:"text-lg font-medium text-gray-900 border-b border-gray-200 pb-2"},Bt={class:"space-y-4"},Lt={class:"confirm-account-terms-field"},Vt={class:"flex items-start"},jt={class:"text-sm text-gray-700"},Tt={class:"text-indigo-600 hover:text-indigo-500 underline cursor-pointer"},It={key:0,class:"text-error"},zt={key:0,class:"text-red-500 text-xs mt-1 block ml-8"},Et={class:"confirm-account-privacy-field"},Dt={class:"flex items-start"},Nt={class:"text-sm text-gray-700"},Pt={class:"text-indigo-600 hover:text-indigo-500 underline cursor-pointer"},At={key:0,class:"text-error"},Rt={key:0,class:"text-red-500 text-xs mt-1 block ml-8"},Ht={class:"pt-6"},Jt=["disabled"],Wt={key:0,class:"loading loading-spinner loading-sm"},Gt={key:1},Kt={key:2},Ot={__name:"confirm",async setup(Yt){let N,P;Y({title:"Confirm Account"}),g(!1);const A=g(!0),R=g(!1),w=g(!1),H=ge(),v=m(()=>H.query.token);m(()=>H.query.email);const k=Ie(),{t:J}=ve(),b=ye(),X=ke(),$=be(),_=m(()=>$.shopInfo);[N,P]=xe(()=>je(()=>b.loadCountries(),"$YicjWIE5Jx")),await N,P();const{getSignInLogoUrl:Z,isBrandingLoaded:M}=we(),{public:{shopName:ee}}=$e(),F=g(!0),q=g(!1),U=m(()=>$.signUpBackground),te=m(()=>U.value?"bg-cover bg-center bg-no-repeat":"bg-gradient-to-br from-blue-50 to-indigo-100"),se=m(()=>U.value?{backgroundImage:`url(${U.value})`}:{}),oe=e=>
1{const o=e.target,h=o.naturalWidth/o.naturalHeight;q.value=h>=.9&&h<=1.1,F.value=!1},ae=m(()=>{const e="transition-all duration-200";return q.value?`square-customer-logo ${e}`:`rectangle-customer-logo ${e}`}),ne=m(()=>{const e="flex items-center justify-center px-4 py-3 bg-gradient-to-r from-gray-50 to-gray-100 border border-gray-200 rounded-lg shadow-sm";return q.value?`min-h-[64px] min-w-[100px] sm:min-h-[80px] sm:min-w-[120px] md:min-h-[96px] md:min-w-[140px] text-sm sm:text-base md:text-lg ${e}`:`h-12 min-w-[150px] max-w-[200px] sm:h-16 sm:min-w-[180px] sm:max-w-[220px] md:h-20 md:min-w-[200px] md:max-w-[250px] text-sm sm:text-base md:text-lg ${e}`});Ce(()=>{M.value&&setTimeout(()=>{F.value=!1},100)});const re=m(()=>$.passwordSettings),B=m(()=>Le(re.value)),x=m(()=>$.signUpCustomFields),L=m(()=>x.value.filter(e=>!["terms_and_conditions","privacy_policy"].includes(e.code))),V=m(()=>x.value.find(e=>e.code==="terms_and_conditions")),j=m(()=>x.value.find(e=>e.code==="privacy_policy")),W=m(()=>{const e={name:Q().required("First name is required").min(2,"First name must be at least 2 characters"),surname:Q().required("Surname is required").min(2,"Surname must be at least 2 characters"),password:B.value.schema,passwordConfirmation:Ve("password")},o=pe(x.value,e);return Be(o)}),G=g({name:"",surname:"",password:"",passwordConfirmation:""}),ie=(e=null)=>{const o={name:"",surname:"",password:"",passwordConfirmation:""},h=e||b.requestAccountSignUpFields;return L.value.forEach(l=>{if(l.display){const p=h[l.code];l.type==="toggle"||l.type==="checkbox"?o[l.code]=p===!0||p==="true"||!1:l.type==="number"||l.type==="integer"?o[l.code]=p?Number(p):"":o[l.code]=p||l.default_value||""}}),o};Se(async()=>{if(v.value)try{const e=await b.checkConfirmationToken(v.value);if(R.value=e.valid,w.value=!e.valid,e.valid){await Fe();const o=e.data?.sign_up_fields||{};G.value=ie(o)}}catch(e){console.error("Error checking token:",e),w.value=!0}else w.value=!0;A.value=!1});async function ce(e){if(!v.value){k.error("Invalid confirmation link. Please check your email for the correct link.");return}try{await W.value.validate(e,{abortEarly:!1})}catch{k.error("Please fix all form validation errors");return}try{const o=_e(e,x.value),h={name:e.name,surname:e.surname,password:e.password,password_confirmation:e.passwordConfirmation,sign_up_fields:o};(await b.confirm(h,v.value)).success?(k.success(J("customer.successfully_registered")),await b.load(!0),await X.load(),await E(D("/"))):k.error(J("customer.fix_form_problems"))}catch(o){console.error("Confirmation error:",o),k.error("An error occurred during confirmation. Please try again.")}}return Y({title:"Confirm Account"}),(e,o)=>{const h=ze,l=Ee,p=ue,le=fe,K=he,O=De,de=me;return n(),r("div",{class:z(["confirm-account-page min-h-screen flex items-center justify-center p-4",s(te)]),style:Ue(s(se))},[t("div",Ne,[t("div",Pe,[t("div",Ae,[t("div",Re,[t("h1",He,a(e.$t("customer.confirm_account")),1),t("div",Je,[s(F)?(n(),r("div",{key:1,class:z(s(ne))},[t("span",Ge,a(s(ee)),1)],2)):(n(),r("img",{key:0,class:z(s(ae)),src:s(Z)(),alt:"shop logo",onLoad:oe},null,42,We))]),t("p",Ke,a(e.$t("customer.complete_setup")),1),s(_).contact_email||s(_).contact_phone?(n(),r("div",Oe,[t("p",Ye,[y(a(e.$t("customer.need_help"))+" ",1),s(_).contact_email?(n(),r("a",{key:0,href:`mailto:${s(_).contact_email}`,class:"link link-primary"},a(s(_).contact_email),9,Qe)):c("",!0),s(_).contact_email&&s(_).contact_phone?(n(),r("span",Xe," / ")):c("",!0),s(_).contact_phone?(n(),r("a",{key:2,href:`tel:${s(_).contact_phone}`,class:"link link-primary"},a(s(_).contact_phone),9,Ze)):c("",!0)])])):c("",!0)]),s(v)?c("",!0):(n(),r("div",Me,[o[2]||(o[2]=t("svg",{xmlns:"http://www.w3.org/2000/svg",class:"stroke-current shrink-0 h-6 w-6",fill:"none",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("span",et,a(e.$t("customer.invalid_confirmation_link")),1)])),s(A)?(n(),r("div",tt,[u(h,{size:"large"}),t("p",st,a(e.$t("customer.validating_token")),1)])):s(w)?(n(),r("div",ot,[o[5]||(o[5]=t("div",{class:"mb-8"},[t("svg",{class:"w-24 h-24 text-red-300 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.464 0L4.35 16.5c-.77.833.192 2.5 1.732 2.5z"}
1)])],-1)),t("div",at,[t("h1",nt,a(e.$t("customer.token_expired_heading")),1),t("h2",rt,a(e.$t("customer.confirmation_link_invalid")),1),t("p",it,a(e.$t("customer.token_expired_description")),1),t("div",ct,[t("button",{onClick:o[0]||(o[0]=T=>("navigateTo"in e?e.navigateTo:s(E))(("suffixLink"in e?e.suffixLink:s(D))("/"))),class:"btn bg-fullworks-cta-background text-fullworks-cta-text"},[o[3]||(o[3]=t("svg",{class:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})],-1)),y(" "+a(e.$t("customer.go_home")),1)]),t("button",{onClick:o[1]||(o[1]=T=>("navigateTo"in e?e.navigateTo:s(E))(("suffixLink"in e?e.suffixLink:s(D))("/customer/login"))),class:"btn bg-fullworks-cta-secondary-background text-fullworks-cta-secondary-text"},[o[4]||(o[4]=t("svg",{class:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1)),y(" "+a(e.$t("customer.register_again")),1)])])]),o[6]||(o[6]=qe('<div class="mt-16 opacity-20" data-v-aa9f26e9><div class="flex space-x-2 justify-center" data-v-aa9f26e9><div class="w-3 h-3 bg-red-400 rounded-full animate-bounce" data-v-aa9f26e9></div><div class="w-3 h-3 bg-orange-400 rounded-full animate-bounce" style="animation-delay:0.1s;" data-v-aa9f26e9></div><div class="w-3 h-3 bg-yellow-400 rounded-full animate-bounce" style="animation-delay:0.2s;" data-v-aa9f26e9></div></div></div>',1))])):s(R)&&s(v)?(n(),C(de,{key:3,"validation-schema":s(W),"initial-values":s(G),"initial-touched":{},"validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1,as:"div"},{default:f(({handleSubmit:T,isSubmitting:I})=>[t("form",{class:"confirm-account-form space-y-6",onSubmit:d=>T(d,ce)},[t("div",dt,[t("h3",mt,a(e.$t("customer.personal_information")),1),t("div",ut,[u(p,{name:"name","validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1},{default:f(({field:d,errorMessage:i})=>[t("div",pt,[t("label",ft,a(e.$t("common.first_name")),1),u(l,S(d,{placeholder:e.$t("customer.enter_first_name"),status:i?"error":void 0,class:"w-full"}),null,16,["placeholder","status"]),i?(n(),r("span",_t,a(i),1)):c("",!0)])]),_:1}),u(p,{name:"surname","validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1},{default:f(({field:d,errorMessage:i})=>[t("div",ht,[t("label",gt,a(e.$t("common.last_name")),1),u(l,S(d,{placeholder:e.$t("customer.enter_last_name"),status:i?"error":void 0,class:"w-full"}),null,16,["placeholder","status"]),i?(n(),r("span",vt,a(i),1)):c("",!0)])]),_:1})])]),s(L).length>0?(n(),C(le,{key:0,"custom-fields":s(L)},null,8,["custom-fields"])):c("",!0),t("div",yt,[t("h3",kt,a(e.$t("customer.security_information")),1),u(p,{name:"password","validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1},{default:f(({field:d,errorMessage:i})=>[t("div",bt,[t("label",xt,a(e.$t("common.password")),1),u(l,S(d,{type:"password",placeholder:e.$t("customer.enter_your_password"),status:i?"error":void 0,"show-password-on":"click",class:"w-full"}),null,16,["placeholder","status"]),i?(n(),r("span",wt,a(i),1)):c("",!0)])]),_:1}),u(p,{name:"passwordConfirmation","validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1},{default:f(({field:d,errorMessage:i})=>[t("div",$t,[t("label",Ct,a(e.$t("common.confirm_password")),1),u(l,S(d,{type:"password",placeholder:e.$t("customer.confirm_your_new_password"),status:i?"error":void 0,"show-password-on":"click",class:"w-full"}),null,16,["placeholder","status"]),i?(n(),r("span",St,a(i),1)):c("",!0)])]),_:1}),s(B).hasRequirements?(n(),r("div",Ft,[o[7]||(o[7]=t("i",{class:"text-blue-500"},"â¹ï¸",-1)),y(" "+a(s(B).requirementsText),1)])):c("",!0)]),s(V)?.display||s(j)?.display?(n(),r("div",qt,[t("h3",Ut,a(e.$t("customer.terms_conditions")),1),t("div",Bt,[s(V)?.display?(n(),C(p,{key:0,name:"terms_and_conditions",type:"checkbox","validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1},{default:f(({field:d,errorMessage:i})=>[t("div",Lt,[t("div",Vt,[u(O,{checked:d.value,"onUpdate:checked":d.onChange,class:"mt-1"},{default:f(()=>[t("span",jt,[y(a(e.$t("customer.confirm_terms"))+" ",1),u(K,{slug:"terms-and-conditions","modal-title":e.$t("customer.terms_conditions_link")},{trigger:f(()=>[t("span",Tt,a(e.$t("customer.terms_conditions_link")),1)]),_:1},8,["modal-title"]),s(V).required?(n(),r("span",It,"*")):c("",!0)])]),_:2},1032,["checked","onUpdate:checked"])]),i?(n(),r("span",zt,a(i),1)):c("",!0)])]),_:1})):c("",!0),s(j)?.display?(n(),C(p,{key:1,name:"privacy_policy",type:"checkbox","validate-on-input":!1,"validate-on-change":!1,"validate-on-blur":!1},{default:f(({field:d,errorMessage:i})=>[t("div",Et,[t("div",Dt,[u(O,{checked:d.value,"onUpdate:checked":d.onChange,class:"mt-1"},{default:f(()=>[t("span",Nt,[y(a(e.$t("customer.confirm_terms"))+" ",1),u(K,{slug:"privacy-policy","modal-title":e.$t("customer.privacy_policy_link")},{trigger:f(()=>[t("span",Pt,a(e.$t("customer.privacy_policy_link")),1)]),_:1},8,["modal-title"]),s(j).required?(n(),r("span",At,"*")):c("",!0)])]),_:2},1032,["checked","onUpdate:checked"])]),i?(n(),r("span",Rt,a(i),1)):c("",!0)])]),_:1})):c("",!0)])])):c("",!0),t("div",Ht,[t("button",{type:"submit",disabled:I,class:"confirm-account-submit-button btn btn-primary w-full bg-fullworks-cta-background text-fullworks-cta-text border-fullworks-cta-background hover:bg-fullworks-cta-background/90 disabled:cursor-not-allowed"},[I?(n(),r("span",Wt)):c("",!0),I?(n(),r("span",Kt,a(e.$t("customer.confirming")),1)):(n(),r("span",Gt,a(e.$t("customer.confirm_account_button")),1
1))],8,Jt)])],40,lt)]),_:1},8,["validation-schema","initial-values"])):c("",!0)])])])],6)}}},fs=Te(Ot,[["__scopeId","data-v-aa9f26e9"]]);export{fs 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.