PageSourceSearch

https://nashobahub-prod.onrender.com/assets/LoginPage-5k_e05gV.js

js nashobahub-prod.onrender.com collected 2026-10-03 11:43:51 UTC 3,740 bytes, 1 lines download raw bytes

1import{bD as L,av as S,u as F,cu as E,r as m,j as e,B as r,aw as k,C as P,a1 as T,a2 as I,a3 as A,a4 as R,I as u,aq as B}from"./index-CU4TP-S4.js";import{u as D,F as O,a as p,b as h,c as x,d as b,f as g,t as q}from"./form-D-xzwno4.js";import{L as z}from"./log-in-Q6mtBUyK.js";import{E as W}from"./eye-off-DT88Dd3V.js";import{o as H,s as f}from"./types-BmAflJw1.js";const J=H({email:f().email("Invalid email address"),password:f().min(1,"Password is required")});function U(){const s=L().role||"customer",[,t]=S(),{toast:l}=F(),{refetch:j}=E(),[c,d]=m.useState(!1),[i,w]=m.useState(!1),o=D({resolver:q(J),defaultValues:{email:"",password:""}}),y=()=>{switch(s){case"admin":return"Admin Login";case"sales-rep":return"Sales Representative Login";default:return"Customer Login"}},v=()=>{switch(s){case"admin":return"/api/b2b/login/admin";case"sales-rep":return"/api/b2b/login/sales-rep";default:return"/api/b2b/login/customer"}},N=async a=>{d(!0);try{const n=await fetch(v(),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(a)}),C=await n.json();if(!n.ok)throw new Error(C.error||"Login failed");l({title:"Login Successful",description:"Welcome back!"}),await j(),t(s==="admin"||s==="sales-rep"?"/b2b/admin":"/b2b/catalog")}catch(n){l({title:"Login Failed",description:n.message,variant:"destructive"})}finally{d(!1)}};return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted flex items-center justify-center py-12",children:e.jsxs("div",{className:"w-full max-w-md px-4",children:[e.jsxs(r,{variant:"ghost",onClick:()=>t("/b2b"),className:"mb-4","data-testid":"button-back",children:[e.jsx(k,{className:"h-4 w-4 mr-2"}),"Back to Pricing"]}),e.jsxs(P,{children:[e.jsxs(T,{className:"text-center",children:[e.jsx(z,{className:"h-12 w-12 mx-auto mb-4 text-primary"}),e.jsx(I,{className:"font-serif text-2xl",children:y()}),e.jsx(A,{children:"Enter your credentials to access the wholesale portal"})]}),e.jsx(R,{children:e.jsx(O,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(N),className:"space-y-4",children:[e.jsx(p,{control:o.control,name:"email",render:({field:a})=>e.jsxs(h,{children:[e.jsx(x,{children:"Email Address"}),e.jsx(b,{children:e.jsx(u,{...a,type:"email",placeholder:"[email protected]","data-testid":"input-email",autoComplete:"email"})}),e.jsx(g,{})]})}),e.jsx(p,{control:o.control,name:"password",render:({field:a})=>e.jsxs(h,{children:[e.jsx(x,{children:"Password"}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(u,{...a,type:i?"text":"password",placeholder:"Enter your password","data-testid":"input-password",autoComplete:"current-password",className:"pr-10"}),e.jsx(r,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>w(!i),"data-testid":"button-toggle-password",children:i?e.jsx(W,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(B,{className:"h-4 w-4 text-muted-foreground"})})]})}),e.jsx(g,{})]})}),e.jsx("div",{className:"text-right",children:e.jsx(r,{type:"button",variant:"ghost",className:"px-0 h-auto text-sm hover:underline",onClick:()=>t(`/b2b/forgot-password?role=${s}`),"data-testid":"button-forgot-password",children:"Forgot Password?"})}),e.jsx(r,{type:"submit",className:"w-full",size:"lg",disabled:c,"data-testid":"button-login",children:c?"Logging in...":"Login"}),s==="customer"&&e.jsxs("div",{className:"pt-4 border-t text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Don't have an account yet?"}),e.jsx(r,{type:"button",variant:"outline",onClick:()=>t("/b2b"),"data-testid":"button-register",children:"Register for Wholesale Access"})]})]})})})]})]})})}export{U 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.