PageSourceSearch

https://sammysonline.co.uk/assets/register-page-CXM8W46m.js

js sammysonline.co.uk collected 2026-10-09 04:46:28 UTC 4,781 bytes, 1 lines download raw bytes

1import{j as s}from"./vendor-query-D1Mshrk-.js";import{d as X,u as C,r as h,L as x}from"./vendor-react-BfQMi0FG.js";import{b4 as E,b5 as F,bU as R,ay as L,bQ as k,q,L as o,I as i,B as M,r as $,bS as A,bT as n,t as u}from"./index-COwa1fRJ.js";import{E as f}from"./eye-off-BtqxH6EC.js";import{E as p}from"./eye-DMDeXtX-.js";import"./vendor-ui-Cib_-4so.js";const T=a=>A({firstName:n().min(1,a("storefront.auth.validation.firstNameRequired")),lastName:n().min(1,a("storefront.auth.validation.lastNameRequired")),email:n().email(a("storefront.auth.validation.invalidEmail")),phone:n().min(1,a("storefront.auth.validation.phoneRequired")).refine(e=>/^(?:07\d{9}|447\d{9}|\+447\d{9})$/.test(e.replace(/\s/g,"")),a("storefront.auth.validation.invalidMobile")),password:n().min(8,a("storefront.auth.validation.passwordMin")),confirmPassword:n().min(1,a("storefront.auth.validation.confirmRequired"))}).refine(e=>e.password===e.confirmPassword,{message:a("storefront.auth.validation.passwordsMismatch"),path:["confirmPassword"]});function D(){const{clientSlug:a}=E(),{t:e}=F(),l=X().clientSlug?`/order/${a}`:"",g=C(),[c,j]=h.useState(!1),[m,N]=h.useState(!1),d=R(),v=h.useMemo(()=>T(e),[e]),{register:r,handleSubmit:w,formState:{errors:t}}=L({resolver:k(v),mode:"onChange"}),y=b=>{const{confirmPassword:B,...P}=b;d.mutate(P,{onSuccess:()=>{u.success(e("storefront.auth.toast.accountCreated")),g(`${l}/menu`,{replace:!0})},onError:S=>{u.error(S.response?.data?.error?.message||e("storefront.auth.toast.registrationFailed"))}})};return s.jsxs("div",{className:"flex flex-1 flex-col overflow-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:[s.jsx(x,{to:`${l}/menu`,className:"text-muted-foreground hover:text-foreground",children:s.jsx(q,{className:"h-5 w-5"})}),s.jsx("h2",{className:"text-lg font-semibold",children:e("storefront.auth.createAccount")})]}),s.jsxs("div",{className:"mx-auto w-full max-w-sm px-4 py-8",children:[s.jsxs("form",{onSubmit:w(y),className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(o,{htmlFor:"reg-first",children:e("storefront.auth.firstName")}),s.jsx(i,{id:"reg-first",...r("firstName")}),t.firstName&&s.jsx("p",{className:"text-xs text-destructive",children:t.firstName.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(o,{htmlFor:"reg-last",children:e("storefront.auth.lastName")}),s.jsx(i,{id:"reg-last",...r("lastName")}),t.lastName&&s.jsx("p",{className:"text-xs text-destructive",children:t.lastName.message})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(o,{htmlFor:"reg-email",children:e("storefront.auth.email")}),s.jsx(i,{id:"reg-email",type:"email",...r("email")}),t.email&&s.jsx("p",{className:"text-xs text-destructive",children:t.email.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(o,{htmlFor:"reg-phone",children:e("storefront.auth.phone")}),s.jsx(i,{id:"reg-phone",type:"tel",placeholder:"07XXXXXXXXX",...r("phone")}),t.phone&&s.jsx("p",{className:"text-xs text-destructive",children:t.phone.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(o,{htmlFor:"reg-password",children:e("storefront.auth.password")}),s.jsxs("div",{className:"relative",children:[s.jsx(i,{id:"reg-password",type:c?"text":"password",...r("password"),className:"pe-10"}),s.jsx("button",{type:"button",onClick:()=>j(!c),className:"absolute end-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c?s.jsx(f,{className:"h-4 w-4"}):s.jsx(p,{className:"h-4 w-4"})})]}),t.password&&s.jsx("p",{className:"text-xs text-destructive",children:t.password.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(o,{htmlFor:"reg-confirm",children:e("storefront.auth.confirmPassword")}),s.jsxs("div",{className:"relative",children:[s.jsx(i,{id:"reg-confirm",type:m?"text":"password",...r("confirmPassword"),className:"pe-10"}),s.jsx("button",{type:"button",onClick:()=>N(!m),className:"absolute end-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:m?s.jsx(f,{className:"h-4 w-4"}):s.jsx(p,{className:"h-4 w-4"})})]}),t.confirmPassword&&s.jsx("p",{className:"text-xs text-destructive",children:t.confirmPassword.message})]}),s.jsxs(M,{type:"submit",className:"w-full",disabled:d.isPending,children:[d.isPending&&s.jsx($,{className:"me-2 h-4 w-4 animate-spin"}),e("storefront.auth.createAccount")]})]}),s.jsxs("p",{className:"mt-6 text-center text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:[e("storefront.auth.alreadyHaveAccount")," "]}),s.jsx(x,{to:`${l}/signin`,className:"font-medium text-primary hover:underline",children:e("storefront.auth.signInLink")})]})]})]})}export{D as RegisterPage};

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.