Files
aletheia/frontend/.next/static/chunks/app/history/page-baa6bd45e403ad88.js
bigtux 20a26affaa 📚 Documentação inicial do ALETHEIA
- MANUAL-PRODUTO.md: Manual do usuário final
- MANUAL-VENDAS.md: Estratégia comercial e vendas
- MANUAL-TECNICO.md: Infraestrutura e deploy
- README.md: Visão geral do projeto
2026-02-10 15:08:15 -03:00

1 line
5.9 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[811],{454:function(e,t,r){Promise.resolve().then(r.bind(r,8090))},9376:function(e,t,r){"use strict";var n=r(5475);r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}})},257:function(e,t,r){"use strict";var n,o;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(o=r.g.process)?void 0:o.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,o=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],l=!1,u=-1;function f(){l&&n&&(l=!1,n.length?c=n.concat(c):u=-1,c.length&&d())}function d(){if(!l){var e=i(f);l=!0;for(var t=c.length;t;){for(n=c,c=[];++u<t;)n&&n[u].run();u=-1,t=c.length}n=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new h(e,t)),1!==c.length||l||i(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}},s=!0;try{t[e](a,a.exports,n),s=!1}finally{s&&delete r[e]}return a.exports}n.ab="//";var o=n(229);e.exports=o}()},8090:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return l}});var n=r(7437),o=r(2265),a=r(9376),s=r(7648),i=r(1837),c=r(1768);function l(){let[e,t]=(0,o.useState)([]),[r,l]=(0,o.useState)(!0),{hydrate:u}=(0,c.t)(),f=(0,a.useRouter)();(0,o.useEffect)(()=>{if(u(),!localStorage.getItem("token")){f.push("/login");return}i.h.history().then(t).catch(()=>{}).finally(()=>l(!1))},[]);let d=e=>e>=71?"text-green-400":e>=51?"text-yellow-400":e>=31?"text-orange-400":"text-red-400";return(0,n.jsxs)("div",{className:"min-h-screen bg-dark px-4 py-6 max-w-lg mx-auto",children:[(0,n.jsxs)("nav",{className:"flex items-center justify-between mb-8",children:[(0,n.jsx)(s.default,{href:"/scan",className:"text-gray-400 hover:text-white",children:"← Voltar"}),(0,n.jsx)("span",{className:"font-bold tracking-wider text-primary",children:"Hist\xf3rico"}),(0,n.jsx)("div",{})]}),r?(0,n.jsx)("div",{className:"text-center py-20 text-gray-400",children:"Carregando..."}):0===e.length?(0,n.jsxs)("div",{className:"text-center py-20",children:[(0,n.jsx)("p",{className:"text-gray-500 text-lg mb-4",children:"Nenhum scan ainda"}),(0,n.jsx)(s.default,{href:"/scan",className:"bg-primary text-dark px-6 py-3 rounded-xl font-bold",children:"Escanear agora"})]}):(0,n.jsx)("div",{className:"space-y-3",children:e.map(e=>(0,n.jsxs)("div",{className:"bg-dark-light rounded-xl p-4 flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"font-medium text-sm",children:e.product_name||e.barcode}),e.brand&&(0,n.jsx)("p",{className:"text-gray-500 text-xs",children:e.brand}),(0,n.jsx)("p",{className:"text-gray-600 text-xs mt-1",children:new Date(e.scanned_at).toLocaleDateString("pt-BR")})]}),(0,n.jsx)("span",{className:"text-2xl font-black ".concat(d(e.score)),children:e.score})]},e.id))})]})}},1837:function(e,t,r){"use strict";r.d(t,{h:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_URL||"http://localhost:8090";async function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=localStorage.getItem("token"),o={"Content-Type":"application/json",...t.headers||{}};r&&(o.Authorization="Bearer ".concat(r));let a=await fetch("".concat(n).concat(e),{...t,headers:o});if(!a.ok)throw Error((await a.json().catch(()=>({detail:"Erro de rede"}))).detail||"HTTP ".concat(a.status));return a.json()}let a={register:e=>o("/api/auth/register",{method:"POST",body:JSON.stringify(e)}),login:e=>o("/api/auth/login",{method:"POST",body:JSON.stringify(e)}),me:()=>o("/api/auth/me"),scan:e=>o("/api/scan",{method:"POST",body:JSON.stringify({barcode:e})}),history:()=>o("/api/history")}},1768:function(e,t,r){"use strict";let n;r.d(t,{t:function(){return l}});var o=r(2265);let a=e=>{let t;let r=new Set,n=(e,n)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach(r=>r(t,e))}},o=()=>t,a={setState:n,getState:o,getInitialState:()=>s,subscribe:e=>(r.add(e),()=>r.delete(e))},s=t=e(n,o,a);return a},s=e=>e?a(e):a,i=e=>e,c=e=>{let t=s(e),r=e=>(function(e,t=i){let r=o.useSyncExternalStore(e.subscribe,o.useCallback(()=>t(e.getState()),[e,t]),o.useCallback(()=>t(e.getInitialState()),[e,t]));return o.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},l=(n=e=>({user:null,token:null,setAuth:(t,r)=>{localStorage.setItem("token",t),localStorage.setItem("user",JSON.stringify(r)),e({token:t,user:r})},logout:()=>{localStorage.removeItem("token"),localStorage.removeItem("user"),e({token:null,user:null})},hydrate:()=>{let t=localStorage.getItem("token"),r=localStorage.getItem("user");t&&r&&e({token:t,user:JSON.parse(r)})}}))?c(n):c}},function(e){e.O(0,[648,971,117,744],function(){return e(e.s=454)}),_N_E=e.O()}]);