PageSourceSearch

https://goneat.co.uk/assets/signin-page-D2sMDP9N.js

js goneat.co.uk collected 2026-09-24 15:15:01 UTC 7,667 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-query-D1Mshrk-.js";import{d as I,h as z,u as A,r as d,L as y}from"./vendor-react-BfQMi0FG.js";import{aW as M,aX as $,bo as H,b4 as B,q as O,r as F,y as W,B as u,bG as q,at as L,bH as U,L as C,I as E,bI as V,bJ as R,bK as P,t as k}from"./index-D3kn74s7.js";import{E as D}from"./eye-off-zrBqI2ew.js";import{E as J}from"./eye-CxQatQkF.js";import"./vendor-ui-nQy3bJlE.js";const K=o=>R({email:P().email(o("storefront.auth.validation.invalidEmail")),password:P().min(1,o("storefront.auth.validation.passwordRequired"))}),X=o=>R({email:P().email(o("storefront.auth.validation.invalidEmail"))});function re(){const{clientSlug:o,data:a}=M(),{t:s}=$(),h=I(),[l]=z(),x=A(),t=h.clientSlug?`/order/${o}`:"",n=l.get("redirect")||`${t}/menu`,[g,p]=d.useState("login"),[v,j]=d.useState(!1),[f,c]=d.useState(null),m=()=>{x(n,{replace:!0})};d.useEffect(()=>{const r=new URLSearchParams(window.location.search),i=r.get("google_auth_code"),b=r.get("google_error");if(b){c(decodeURIComponent(b)),r.delete("google_error");const w=r.toString()?`${window.location.pathname}?${r.toString()}`:window.location.pathname;window.history.replaceState({},"",w);return}if(i){j(!0);const w=r.get("redirect")||`${t}/menu`;r.delete("google_auth_code");const T=r.toString()?`${window.location.pathname}?${r.toString()}`:window.location.pathname;window.history.replaceState({},"",T),H.post("/auth/customer/google/exchange",{code:i}
1,{withCredentials:!0}).then(N=>{const{accessToken:_,customer:G}=N.data.data;B.getState().setAuth(_,G,o),window.location.href=w}).catch(N=>{j(!1),c(N.response?.data?.error?.message||s("storefront.auth.toast.googleFailed"))})}},[]);const S=()=>{c(null);const i=`${window.location.origin+window.location.pathname}?redirect=${encodeURIComponent(n)}`;window.location.href=`/api/v1/auth/customer/google/redirect?clientSlug=${o}&returnUrl=${encodeURIComponent(i)}`};return e.jsxs("div",{className:"flex flex-1 flex-col overflow-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:[e.jsx(y,{to:`${t}/menu`,className:"text-muted-foreground hover:text-foreground",children:e.jsx(O,{className:"h-5 w-5"})}),e.jsx("h2",{className:"text-lg font-semibold",children:s("storefront.auth.signIn")})]}),e.jsx("div",{className:"mx-auto w-full max-w-sm px-4 py-10",children:v?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-10",children:[e.jsx(F,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("storefront.auth.completingGoogle")})]}):g==="forgot"?e.jsx(Y,{onBack:()=>p("login")}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-center text-lg font-semibold mb-6",children:s("storefront.auth.haveAnAccount")}),f&&e.jsx("div",{className:"mb-4 rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2.5 text-sm text-destructive",children:f}),e.jsx(Q,{onSuccess:m,onForgotPassword:()=>p("forgot"),onError:c,clearError:()=>c(null)}),e.jsxs("div",{className:"relative my-6",children:[e.jsx(W,{}),e.jsx("span",{className:"absolute start-1/2 top-1/2 -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 bg-background px-3 text-xs text-muted-foreground",children:s("storefront.auth.or")}
1)]}),e.jsxs(u,{type:"button",variant:"outline",className:"w-full gap-2",onClick:S,children:[e.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),s("storefront.auth.continueWithGoogle")]}),e.jsxs("div",{className:"mt-6 space-y-2 text-center text-sm",children:[e.jsxs("p",{children:[e.jsxs("span",{className:"text-muted-foreground",children:[s("storefront.auth.noAccount")," "]}),e.jsx(y,{to:`${t}/register`,className:"font-medium text-primary hover:underline",children:s("storefront.auth.signUpHere")})]}),a.client.allowGuestCheckout&&n.includes("/checkout")&&e.jsx("p",{children:e.jsx(y,{to:`${t}/checkout?guest=1`,className:"font-medium text-primary hover:underline",children:s("storefront.auth.guestCheckout")})})]})]})})]})}function Q({onSuccess:o,onForgotPassword:a,onError:s,clearError:h}){const[l,x]=d.useState(!1),{t}=$(),n=V(),g=A(),p=I(),v=p.clientSlug?`/order/${p.clientSlug}`:"",j=d.useMemo(()=>K(t),[t]),{register:f,handleSubmit:c,formState:{errors:m}}=L({resolver:U(j)}),S=r=>{h(),n.mutate(r,{onSuccess:()=>{k.success(t("storefront.auth.toast.signedIn")),o()},onError:i=>{if(i.response?.data?.error?.code==="PASSWORD_NOT_SET"){const w=i.response?.data?.data?.token;g(`${v}/set-password?token=${w}`);return}s(i.response?.data?.error?.message||t("storefront.auth.toast.invalidCredentials"))}})};return e.jsxs("form",{onSubmit:c(S),className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"signin-email",children:t("storefront.auth.email")}),e.jsx(E,{id:"signin-email",type:"email",...f("email")}),m.email&&e.jsx("p",{className:"text-xs text-destructive",children:m.email.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"signin-password",children:t("storefront.auth.password")}),e.jsxs("div",{className:"relative",children:[e.jsx(E,{id:"signin-password",type:l?"text":"password",className:"pe-10",...f("password")}),e.jsx(u,{type:"button",variant:"ghost",size:"icon",className:"absolute end-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>x(!l),tabIndex:-1,children:l?e.jsx(D,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(J,{className:"h-4 w-4 text-muted-foreground"})})]}),m.password&&e.jsx("p",{className:"text-xs text-destructive",children:m.password.message})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:a,children:t("storefront.auth.forgotPassword")})}),e.jsxs(u,{type:"submit",className:"w-full",disabled:n.isPending,children:[n.isPending&&e.jsx(F,{className:"me-2 h-4 w-4 animate-spin"}),t("storefront.auth.signIn")]})]})}function Y({onBack:o}){const{t:a}=$(),s=q(),h=d.useMemo(()=>X(a),[a]),{register:l,handleSubmit:x,formState:{errors:t}}=L({resolver:U(h)}),n=g=>{s.mutate(g,{onSuccess:()=>{k.success(a("storefront.auth.toast.resetSent")),o()},onError:()=>{k.success(a("storefront.auth.toast.resetSent")),o()}})};return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-center text-lg font-semibold mb-6",children:a("storefront.auth.resetPassword")}),e.jsxs("form",{onSubmit:x(n),className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a("storefront.auth.forgotIntro")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"forgot-email",children:a("storefront.auth.email")}),e.jsx(E,{id:"forgot-email",type:"email",...l("email")}),t.email&&e.jsx("p",{className:"text-xs text-destructive",children:t.email.message})]}),e.jsxs(u,{type:"submit",className:"w-full",disabled:s.isPending,children:[s.isPending&&e.jsx(F,{className:"me-2 h-4 w-4 animate-spin"}
1),a("storefront.auth.sendResetLink")]}),e.jsx(u,{type:"button",variant:"ghost",className:"w-full",onClick:o,children:a("storefront.auth.backToSignIn")})]})]})}export{re as SignInPage};

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.