PageSourceSearch

https://newtral.ai/_next/static/chunks/9633.678e165c5c329339.js

js newtral.ai collected 2026-10-05 14:25:04 UTC 15,794 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9633],{49633:function(e,t,i){i.r(t),i.d(t,{GftMappingClient:function(){return I}});var r=i(57437),n=i(2265),s=i(23738),l=i(6144),a=i(59112),o=i(34166),d=i(95480);let c=(0,d.Z)("droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]),p=(0,d.Z)("recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);var x=i(87227);let h=(0,d.Z)("sprout",[["path",{d:"M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3",key:"139s4v"}],["path",{d:"M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4",key:"1dlkgp"}],["path",{d:"M5 21h14",key:"11awu3"}]]);var g=i(34906);let y=(0,d.Z)("waves-horizontal",[["path",{d:"M2 12q2.5 2 5 0t5 0 5 0 5 0",key:"8ddzzs"}],["path",{d:"M2 19q2.5 2 5 0t5 0 5 0 5 0",key:"1wj4st"}],["path",{d:"M2 5q2.5 2 5 0t5 0 5 0 5 0",key:"69x50u"}]]);var v=i(6194),f=i(17166),u=i(41119);let m=(0,d.Z)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var j=i(3883),b=i(16325),k=i(35344),z=i(11066),w=i(5526),S=i(60878);let C={leaf:a.Z,shield:o.Z,droplet:c,recycle:p,flag:x.Z,sprout:h,zap:g.Z,waves:y,"alert-triangle":v.Z};function I(e){var t,i;let{client:n,expenses:s,rules:l,moneyGroups:a,taxonomyOptions:o,totals:d}=e;return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,r.jsx)(A,{client:n,totals:d,expensesCount:s.length}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1.1fr 1fr",gap:16,alignItems:"flex-start"},children:[(0,r.jsx)(Z,{moneyGroups:a,totalAll:d.totalAmt,ccy:null!==(i=null===(t=s[0])||void 0===t?void 0:t.currency)&&void 0!==i?i:"USD"}),(0,r.jsx)(W,{expenses:s,taxonomyOptions:o})]}),(0,r.jsx)(N,{rules:l})]})}function A(e){let{client:t,totals:i,expensesCount:n}=e;return(0,r.jsx)(k.Zb,{padding:18,children:(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24},children:(0,r.jsxs)("div",{style:{flex:1},children:[(0,r.jsxs)(k.fv,{style:{marginBottom:6,display:"block"},children:[t.name.toUpperCase()," \xb7 THIS PERIOD"]}),(0,r.jsxs)("div",{style:{fontSize:15,color:"var(--text-primary)",lineHeight:1.5},children:[(0,r.jsxs)("span",{style:{fontSize:32,fontFamily:"var(--font-display)",fontWeight:500,letterSpacing:"-0.02em",color:(0,w._E)(t.alignment),display:"inline-block",marginRight:8},children:[i.greenPct,"%"]}),"of this client's spend is mapped to ",(0,r.jsx)("b",{children:"green activities"}),"."," ",(0,r.jsxs)("span",{style:{color:"var(--text-secondary)"},children:[i.autoClassified," of ",n," items classified automatically;"," ",i.needHuman>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("b",{style:{color:"var(--warning)"},children:i.needHuman})," need your review."]}):"nothing waiting on you."]})]})]})})})}function Z(e){let{moneyGroups:t,totalAll:i,ccy:s}=e,[l,o]=(0,n.useState)(null),d=i||1;return(0,r.jsxs)(k.Zb,{padding:0,children:[(0,r.jsxs)("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[(0,r.jsx)("div",{style:{fontSize:13,fontWeight:600},children:"Where the money is going"}),(0,r.jsx)("div",{style:{fontSize:11.5,color:"var(--text-tertiary)",marginTop:2},children:"Spend grouped by green category. Click a row to see the specific activities."})]}),(0,r.jsx)("div",{children:t.map((e,i)=>{var n;let c=e.sum/d*100,p=l===e.id,x=e.sum>0,h=null!==(n=C[e.icon])&&void 0!==n?n:a.Z,g=!!e.activities,y="brown"===e.kind&&x?"color-mix(in srgb, var(--error) 4%, transparent)":"transparent";return(0,r.jsxs)("div",{style:{borderBottom:i<t.length-1?"1px solid var(--border-subtle)":"none"},children:[(0,r.jsxs)("button",{type:"button",onClick:()=>g&&o(p?null:e.id),disabled:!g,style:{width:"100%",display:"grid",gridTemplateColumns:"14px 28px 1fr 140px 60px",gap:12,alignItems:"center",padding:"12px 16px",background:y,textAlign:"left",cursor:g?"pointer":"default",border:"none",fontFamily:"inherit",color:"inherit"},children:[g?p?(0,r.jsx)(f.Z,{size:11,style:{color:"var(--text-tertiary)"}}):(0,r.jsx)(u.Z,{size:11,style:{color:"var(--text-tertiary)"}}):(0,r.jsx)("span",{}),(0,r.jsx)("span",{style:{width:26,height:26,borderRadius:6,flexShrink:0,background:e.color+"20",color:e.color,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(h,{size:13})}),(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{fontSize:13,fontWeight:500,color:"var(--text-primary)"},children:e.name}),(0,r.jsx)("div",{style:{fontSize:11.5,color:"var(--text-tertiary)",marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.blurb})]}),(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:8},children:(0,r.jsx)("div",{style:{flex:1,height:6,background:"var(--bg-sunken)",borderRadius:3,overflow:"hidden"},children:(0,r.jsx)("div",{style:{width:"".concat(c,"%"),height:"100%",background:e.color}})})}),(0,r.jsxs)("div",{style:{textAlign:"right"},children:[(0,r.jsxs)("div",{style:{fontSize:13,fontFamily:"var(--font-mono)",fontWeight:600,color:x?"var(--text-primary)":"var(--text-tertiary)"},children:[c.toFixed(0),"%"]}),(0,r.jsx)(k.fv,{children:x?(0,w.ZY)(e.sum,s):"-"})]})]}),p&&e.activities&&(0,r.jsx)("div",{style:{padding:"4px 16px 12px 60px",background:"var(--bg-sunken)"},children:e.activities.map(t=>{let i=t.sum/d*100,n=t.sum>0;return(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 100px 80px",gap:12,alignItems:"center",padding:"6px 0"},children:[(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{fontSize:12,fontWeight:500,color:"var(--text-primary)"},children:t.name}),(0,r.jsx)("div",{style:{fontSize:11,color:"var(--text-tertiary)"},children:t.examples})]}),(0,r.jsx)(k.fv,{color:n?"var(--text-primary)":"var(--text-tertiary)",style:{textAlign:"right"},children:n?(0,w.ZY)(t.sum,s):"-"}),(0,r.jsxs)(k.fv,{color:n?e.color:"var(--text-tertiary)",style:{textAlign:"right"},children:[i.toFixed(0),"%"]})]},t.id)})})]},e.id)})})]})}function W(e){let{expenses:t,taxonomyOptions:i}=e,n=t.filter(e=>"pending"===e.status||"unmapped"===e.status||"flag"===e.status).slice(0,8);return(0,r.jsxs)(k.Zb,{padding:0,children:[(0,r.jsx)("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{fontSize:13,fontWeight:600},children:"Needs your review"}),(0,r.jsxs)("div",{style:{fontSize:11.5,color:"var(--text-tertiary)",marginTop:2},children:[n.length," item",1!==n.length?"s":""," the AI couldn't confidently classify."]})]})}),0===n.length?(0,r.jsxs)("div",{style:{padding:32,textAlign:"center",color:"var(--text-tertiary)",fontSize:13,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[(0,r.jsx)(m,{size:20,style:{color:"var(--success)"}}),(0,r.jsx)("span",{children:"All clear. Nothing waiting on you."})]}):n.map((e,t)=>(0,r.jsx)(T,{expense:e,taxonomyOptions:i,isLast:t===n.length-1},e.id))]})}function T(e){let{expense:t,taxonomyOptions:i,isLast:l}
1=e,a=(0,s.t)(),[o,d]=(0,n.useState)(!1),[c,p]=(0,n.useState)(null),[x,h]=(0,n.useTransition)();function g(){p(null),h(async()=>{let e=await (0,S.$S)(t.id);e.ok?a.refresh():p(e.error)})}let y=!!t.mappedTo;return(0,r.jsxs)("div",{style:{padding:"12px 16px",borderBottom:l?"none":"1px solid var(--border-subtle)",borderLeft:"flag"===t.status?"2px solid var(--error)":"2px solid transparent"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6,flexWrap:"wrap"},children:["flag"===t.status&&(0,r.jsx)(k.DR,{tone:"error",icon:(0,r.jsx)(v.Z,{size:9}),children:"DIVERSION"}),"pending"===t.status&&(0,r.jsx)(k.DR,{tone:"warning",children:"PENDING"}),"unmapped"===t.status&&(0,r.jsx)(k.DR,{tone:"muted",children:"UNMAPPED"}),(0,r.jsx)("span",{style:{fontSize:12.5,color:"var(--text-primary)",fontWeight:600},children:(0,w.ZY)(t.amount,t.currency)})]}),(0,r.jsxs)("div",{style:{fontSize:12.5,color:"var(--text-primary)",marginBottom:4,lineHeight:1.4},children:[(0,r.jsx)("b",{children:t.vendor})," - ",t.description]}),t.flagReason?(0,r.jsx)("div",{style:{fontSize:11.5,color:"var(--error)",lineHeight:1.4,marginBottom:8},children:t.flagReason}):(0,r.jsxs)("div",{style:{fontSize:11.5,color:"var(--text-tertiary)",lineHeight:1.4,marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,r.jsx)("span",{children:"AI suggests"}),t.activity?(0,r.jsx)(k.W$,{resolved:t.activity}):(0,r.jsx)("span",{style:{fontStyle:"italic"},children:"no confident match"})]}),o?(0,r.jsx)(B,{taxonomyOptions:i,currentCode:t.mappedTo,isPending:x,onSave:function(e){p(null),h(async()=>{let i=await (0,S.cV)(t.id,e);i.ok?(d(!1),a.refresh()):p(i.error)})},onCancel:()=>{d(!1),p(null)}}):(0,r.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,r.jsx)(z.Btn,{size:"sm",variant:"primary",onClick:g,disabled:x||!y,title:y?void 0:"No mapping to accept - Change category first.",children:x?"Saving…":"Accept"}),(0,r.jsx)(z.Btn,{size:"sm",variant:"default",onClick:()=>d(!0),disabled:x,children:"Change category"}),"flag"===t.status&&y&&(0,r.jsx)(z.Btn,{size:"sm",variant:"ghost",onClick:g,disabled:x,title:"Acknowledge as non-green and exclude from green-alignment math.",children:"Carve out from green"})]}),c&&(0,r.jsx)("div",{style:{marginTop:8,padding:"6px 8px",background:"var(--error-bg)",color:"var(--error)",borderRadius:"var(--radius-sm)",fontSize:11.5,lineHeight:1.4},children:c})]})}function B(e){let{taxonomyOptions:t,currentCode:i,isPending:s,onSave:a,onCancel:o}=e,[d,c]=(0,n.useState)(null!=i?i:""),p=new Map,x=[];return t.forEach(e=>{if(e.isNonGreen)x.push(e);else if(e.objectiveName){var t;let i=null!==(t=p.get(e.objectiveName))&&void 0!==t?t:[];i.push(e),p.set(e.objectiveName,i)}}),(0,r.jsxs)("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[(0,r.jsx)(l.D,{value:d,onChange:c,disabled:s,size:"sm",style:{flex:1,minWidth:220,background:"var(--bg-base)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)",fontFamily:"var(--font-sans)"},options:[{value:"",label:"- Unmapped (no category) -"},...Array.from(p.entries()).flatMap(e=>{let[t,i]=e;return i.map(e=>({value:e.code,label:e.name,group:t}))}),...x.map(e=>({value:e.code,label:e.name,group:"Non-green / DNSH"}))]}),(0,r.jsx)(z.Btn,{size:"sm",variant:"primary",onClick:()=>a(d||null),disabled:s,children:s?"Saving…":"Save"}),(0,r.jsx)(z.Btn,{size:"sm",variant:"ghost",onClick:o,disabled:s,children:"Cancel"})]})}function N(e){let{rules:t}=e,[i,s]=(0,n.useState)(!1),l=(0,n.useMemo)(()=>t.filter(e=>e.active),[t]);return(0,r.jsxs)(k.Zb,{padding:0,children:[(0,r.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"12px 16px",background:"transparent",textAlign:"left",border:"none",borderBottom:i?"1px solid var(--border-subtle)":"none",cursor:"pointer",fontFamily:"inherit",color:"inherit"},children:[i?(0,r.jsx)(f.Z,{size:12,style:{color:"var(--text-tertiary)"}}):(0,r.jsx)(u.Z,{size:12,style:{color:"var(--text-tertiary)"}}),(0,r.jsx)(j.Z,{size:13,style:{color:"var(--text-tertiary)"}}),(0,r.jsxs)("div",{style:{flex:1},children:[(0,r.jsx)("div",{style:{fontSize:13,fontWeight:600},children:"How classification works"}),(0,r.jsxs)("div",{style:{fontSize:11.5,color:"var(--text-tertiary)",marginTop:2},children:[l.length," active rules \xb7 AI fills the gaps \xb7 admin view"]})]}),(0,r.jsx)(k.fv,{children:"OPTIONAL"})]}),i&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{padding:"14px 16px",background:"var(--bg-sunken)",borderBottom:"1px solid var(--border-subtle)",display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[(0,r.jsx)(R,{n:1,title:"Rules try first",body:"Vendor names, keywords and GL codes that everyone agrees on - like 'any invoice from Vestas → Wind energy'. Deterministic and transparent."}),(0,r.jsx)(R,{n:2,title:"AI fills the gaps",body:"For items no rule catches, the AI mapper reads the document text and proposes a category with a confidence score. Low confidence → you review."})]}),(0,r.jsxs)("div",{style:{padding:"10px 16px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsxs)(k.fv,{children:["RULE LIBRARY \xb7 ",l.length," ACTIVE"]}),(0,r.jsx)(z.Btn,{size:"sm",variant:"default",icon:(0,r.jsx)(b.Z,{size:12}),children:"New rule"})]}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"70px 90px 1.4fr 1.2fr 70px",gap:10,alignItems:"center",padding:"7px 16px",background:"var(--bg-sunken)",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:[(0,r.jsx)(k.fv,{children:"TYPE"}),(0,r.jsx)(k.fv,{children:"CATEGORY"}),(0,r.jsx)(k.fv,{children:"WHEN…"}),(0,r.jsx)(k.fv,{children:"HITS / OWNER"}),(0,r.jsx)(k.fv,{style:{textAlign:"right"},children:"CONF"})]}),l.map((e,t)=>(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"70px 90px 1.4fr 1.2fr 70px",gap:10,alignItems:"center",padding:"10px 16px",borderBottom:t<l.length-1?"1px solid var(--border-subtle)":"none"},children:[(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-mono)",textTransform:"uppercase"},children:e.type}),(0,r.jsx)(k.W$,{resolved:e.activity,compact:!0}),(0,r.jsx)("span",{style:{fontSize:11.5,fontFamily:"var(--font-mono)",color:"var(--text-primary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.match}),(0,r.jsxs)(k.fv,{children:[e.hits," hits \xb7 ",e.owner]}),(0,r.jsxs)("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:e.confidence>=.95?"var(--success)":"var(--warning)",textAlign:"right"},children:[(100*e.confidence).toFixed(0),"%"]})]},e.id))]})]})}function R(e){let{n:t,title:i,body:n}=e;return(0,r.jsxs)("div",{style:{padding:"12px 14px",background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-md)"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,r.jsx)("span",{style:{width:22,height:22,borderRadius:"50%",background:"var(--accent-subtle)",color:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700},children:t}),(0,r.jsx)("div",{style:{fontSize:12.5,fontWeight:600},children:i})]}),(0,r.jsx)("p",{style:{fontSize:12,color:"var(--text-secondary)",margin:0,lineHeight:1.5},children:n})]})}},3883:function(e,t,i){i.d(t,{Z:function(){return r}});let r=(0,i(95480).Z)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},34906:function(e,t,i){i.d(t,{Z:function(){return r}});let r=(0,i(95480).Z)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])}}]);

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.