PageSourceSearch

https://fieldagent-radar.netlify.app/_next/static/chunks/app/(public)/signup/page-7a5af33e4ac5e8e7.js

js fieldagent-radar.netlify.app collected 2026-10-03 10:44:24 UTC 6,727 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[887],{8610:function(e,t,r){Promise.resolve().then(r.bind(r,2152))},9376:function(e,t,r){"use strict";var n=r(5475);r.o(n,"useParams")&&r.d(t,{useParams:function(){return n.useParams}}),r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},2152:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return l}});var n=r(7437),a=r(2265),o=r(7648),s=r(9376),c=r(8123);function l(){let e=(0,s.useRouter)(),{refresh:t}=(0,c.aC)();(0,a.useEffect)(()=>{(0,c.jl)()&&e.replace("/dashboard")},[e]);let[r,l]=(0,a.useState)(""),[i,u]=(0,a.useState)(""),[d,m]=(0,a.useState)(""),[p,x]=(0,a.useState)(""),[f,h]=(0,a.useState)(""),[b,g]=(0,a.useState)(!1);async function y(n){if(n.preventDefault(),h(""),p.length<8){h("Password must be at least 8 characters");return}g(!0);let a=await (0,c.IU)(r,i,d,p);a.ok?(t(),e.push("/dashboard")):(h(a.error),g(!1))}return(0,n.jsx)("div",{className:"min-h-[calc(100vh-4rem)] flex items-center justify-center px-6",children:(0,n.jsxs)("div",{className:"w-full max-w-sm",children:[(0,n.jsxs)("div",{className:"mb-8 text-center",children:[(0,n.jsx)("h1",{className:"font-display text-primary text-[24px] font-semibold tracking-wide",children:"Create account"}),(0,n.jsx)("p",{className:"font-editorial italic text-text/40 text-[15px] mt-1",children:"Start monitoring your fields with FieldAgent"})]}),(0,n.jsxs)("form",{onSubmit:y,className:"space-y-4",children:[f&&(0,n.jsx)("div",{className:"bg-critical/10 border border-critical/20 rounded-card px-4 py-3 text-critical text-[13px]",children:f}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"username",className:"block text-[11px] font-semibold tracking-[0.2em] uppercase text-text/40 mb-1.5",children:"Username"}),(0,n.jsx)("input",{id:"username",type:"text",required:!0,value:r,onChange:e=>l(e.target.value),className:"w-full bg-paper border border-grid rounded-card px-4 py-2.5 text-[14px] text-text placeholder:text-text/25 focus:outline-none focus:border-primary/40 transition-colors",placeholder:"farmer1"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"email",className:"block text-[11px] font-semibold tracking-[0.2em] uppercase text-text/40 mb-1.5",children:"Email"}),(0,n.jsx)("input",{id:"email",type:"email",value:i,onChange:e=>u(e.target.value),className:"w-full bg-paper border border-grid rounded-card px-4 py-2.5 text-[14px] text-text placeholder:text-text/25 focus:outline-none focus:border-primary/40 transition-colors",placeholder:"[email protected]"}),(0,n.jsx)("span",{className:"text-[11px] text-text/30 mt-1 block",children:"Optional"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"phone",className:"block text-[11px] font-semibold tracking-[0.2em] uppercase text-text/40 mb-1.5",children:"Phone Number"}),(0,n.jsx)("input",{id:"phone",type:"tel",required:!0,value:d,onChange:e=>m(e.target.value),className:"w-full bg-paper border border-grid rounded-card px-4 py-2.5 text-[14px] text-text placeholder:text-text/25 focus:outline-none focus:border-primary/40 transition-colors",placeholder:"+1 (480) 555-0142"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"password",className:"block text-[11px] font-semibold tracking-[0.2em] uppercase text-text/40 mb-1.5",children:"Password"}),(0,n.jsx)("input",{id:"password",type:"password",required:!0,value:p,onChange:e=>x(e.target.value),className:"w-full bg-paper border border-grid rounded-card px-4 py-2.5 text-[14px] text-text placeholder:text-text/25 focus:outline-none focus:border-primary/40 transition-colors",placeholder:"Minimum 8 characters"})]}),(0,n.jsx)("button",{type:"submit",disabled:b,className:"w-full bg-primary hover:bg-primary/90 disabled:bg-primary/50 text-white text-[15px] font-semibold px-7 py-3 rounded-full transition-colors",children:b?"Creating account...":"Create account"})]}),(0,n.jsxs)("p",{className:"mt-6 text-center text-[13px] text-text/40",children:["Already have an account?"," ",(0,n.jsx)(o.default,{href:"/login",className:"text-accent hover:text-accent/80 font-medium transition-colors",children:"Sign in"})]})]})})}},8123:function(e,t,r){"use strict";r.d(t,{IU:function(){return x},Ms:function(){return l},Vo:function(){return f},aC:function(){return h},hP:function(){return o},jb:function(){return m},jl:function(){return u},x4:function(){return p},yE:function(){return i}});var n=r(2265),a=r(3217);function o(){return localStorage.getItem("access_token")}function s(e,t){localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)}function c(e){localStorage.setItem("username",e)}function l(){return localStorage.getItem("username")}function i(){localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("username")}function u(){return!!o()}let d=null;async function m(){return d||(d=(async()=>{let e=localStorage.getItem("refresh_token");if(!e)return!1;try{let t=await fetch("".concat(a.T,"/auth/token/refresh/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh:e})});if(t.ok){let e=await t.json();return localStorage.setItem("access_token",e.access),!0}return i(),!1}catch(e){return!1}finally{d=null}})())}async function p(e,t){try{let r=await fetch("".concat(a.T,"/auth/login/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(r.ok){let t=await r.json();return s(t.access,t.refresh),c(t.username||e),{ok:!0}}let n=await r.json().catch(()=>null),o=(null==n?void 0:n.detail)||(null==n?void 0:n.error)||"Invalid credentials";return{ok:!1,error:o}}catch(e){return{ok:!1,error:"Network error — is the backend running?"}}}async function x(e,t,r,n){try{let o=await fetch("".concat(a.T,"/auth/signup/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,email:t,phone_number:r,password:n})});if(o.ok||201===o.status){let t=await o.json();return s(t.access,t.refresh),c(t.username||e),{ok:!0}}let l=await o.json().catch(()=>null);if(l){let e=Object.values(l).flat()[0];if("string"==typeof e)return{ok:!1,error:e}}return{ok:!1,error:"Signup failed"}}catch(e){return{ok:!1,error:"Network error — is the backend running?"}}}let f=(0,n.createContext)({loggedIn:!1,logout:()=>{},refresh:()=>{}});function h(){return(0,n.useContext)(f)}},3217:function(e,t,r){"use strict";r.d(t,{T:function(){return n}});let n="https://crop-advisor-922c34c099bf.herokuapp.com/api/v1"}}
1,function(e){e.O(0,[648,971,117,744],function(){return e(e.s=8610)}),_N_E=e.O()}]);

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.