PageSourceSearch

https://www.instagem.ai/assets/SalesTodayPage-BasJSrU8.js

js instagem.ai collected 2026-10-05 12:05:24 UTC 9,025 bytes, 6 lines download raw bytes

1import{D as S,j as e,L as B,a2 as j,u as M,r as f,S as T}from"./main-DX7XzkoU.js";import{S as L}from"./skeleton-DN2cjZOe.js";import{f as $,S as D,t as _,K as I}from"./stages-mBi-FRq5.js";import{m as A,p as E}from"./goals-W4goCnrL.js";import{e as F,f as H,g as R,h as V}from"./useSalesCrm-BbMwVkcj.js";import{O as K,W as O,T as N,S as P}from"./ScoreChip-nlg2Hl4H.js";import{S as z}from"./StageBadge-BW9Q2ZJD.js";import{T as C}from"./target-JN3xQfTR.js";import{F as G}from"./flame-O0ay5Qs9.js";import"./circle-BXmX70XD.js";import"./plus-C6FQ2-b-.js";import"./arrow-up-right-BkEMUkZ0.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const W=S("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);function k({subscriberId:a,contactId:r,email:o,phone:n,userName:m,stage:l,origin:c,planSlug:d,hint:i,hintTone:u="default",className:x}){const s=(m==null?void 0:m.trim())||$(null,o);return e.jsxs("div",{className:j("flex items-center gap-3 rounded-lg px-2 py-2 transition-colors hover:bg-muted/60",x),children:[e.jsxs(B,{to:`${D}/lead/${a}`,className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted font-mono text-xs uppercase text-muted-foreground","aria-hidden":!0,children:s.slice(0,2)}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:s}),e.jsx(z,{stage:l}),c&&e.jsx(K,{origin:c}),d&&d!=="free"&&e.jsx("span",{className:"rounded bg-muted px-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:d})]}),e.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:o})]}),i&&e.jsx("span",{className:j("shrink-0 font-mono text-[11px] tabular-nums",u==="bad"?"text-destructive":u==="warn"?"text-amber-600 dark:text-amber-400":"text-muted-foreground"),children:i})]}),e.jsx(O,{phone:n,email:o,userName:m,contactId:r,subscriberId:a})]})}function g(a){return a.toLocaleString("pt-BR",{style:"currency",currency:"BRL",maximumFractionDigits:0})}function v(a){const r=Math.floor((Date.now()-new Date(a).getTime())/36e5);return r<1?"agora":r<24?`há ${r} h`:`há ${Math.floor(r/24)} d`}function J(a){return a<12?"Bom dia":a<18?"Boa tarde":"Boa noite"}function b({title:a,count:r,icon:o,tone:n,children:m}){return e.jsxs("section",{className:"rounded-xl border border-border bg-card",children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-2.5",children:[e.jsx("span",{className:j("flex h-6 w-6 items-center justify-center rounded-md",n),"aria-hidden":!0,children:o}),e.jsx("h2",{className:"text-sm font-semibold",children:a}),e.jsx("span",{className:"font-mono text-xs tabular-nums text-muted-foreground",children:r})]}),e.jsx("div",{className:"p-2",children:m})]})}function Q({goals:a,userId:r,name:o}){const n=f.useMemo(()=>((a==null?void 0:a.salespeople)??[]).filter(s=>s.salesperson_id===r),[a,r]),m=n.reduce((s,p)=>s+Number(p.target_revenue_brl),0),l=n.reduce((s,p)=>s+Number(p.revenue_brl),0),c=n.reduce((s,p)=>s+Number(p.sales),0),d=(a==null?void 0:a.business_days)??{total:0,passed:0},i=E(l,m,d.passed,d.total),u=new Date().getHours(),x=n.filter(s=>s.target_revenue_brl>0||s.sales>0);return e.jsxs("section",{className:"rounded-xl border border-border bg-card p-4 md:p-5",children:[e.jsxs("h1",{className:"text-xl font-semibold tracking-tight",children:[J(u),", ",o,"."]}),!a&&e.jsx(L,{className:"mt-2 h-10 w-2/3"}),a&&m>0&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mt-1 text-base",children:["Sua meta hoje é vender ",e.jsx("b",{className:"font-mono tabular-nums",children:g(i.perDayNeeded)}),i.remaining===0&&e.jsx("span",{className:"text-emerald-700 dark:text-emerald-300",children:" — a meta do mês já está batida"}),d.total-d.passed===0&&i.remaining>0&&e.jsx("span",{className:"text-muted-foreground",children:" — o mÃ
6ªs fechou"})]}),e.jsxs("p",{className:"mt-0.5 text-sm text-muted-foreground",children:["Você já vendeu ",e.jsx("b",{className:"font-mono tabular-nums text-foreground",children:g(l)})," este mês (",c," ",c===1?"venda":"vendas","), ",Math.round(i.pct*100),"% da meta de ",g(m)," · ",e.jsx("span",{className:j("font-medium",i.onTrack?"text-emerald-700 dark:text-emerald-300":"text-amber-700 dark:text-amber-300"),children:i.onTrack?"no ritmo":"atrás"})," · ","dia útil ",d.passed," de ",d.total]}),x.length>1&&e.jsx("p",{className:"mt-1 font-mono text-[11px] tabular-nums text-muted-foreground",children:x.map(s=>`${I[s.kind]} ${g(Number(s.revenue_brl))}${s.target_revenue_brl>0?` de ${g(Number(s.target_revenue_brl))}`:""}`).join(" · ")})]}),a&&m===0&&e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Você ainda não tem meta neste mês.",l>0?e.jsxs(e.Fragment,{children:[" Já vendeu ",e.jsx("b",{className:"font-mono tabular-nums text-foreground",children:g(l)})," (",c," ",c===1?"venda":"vendas",")."]}):""]})]})}function de(){var p,y,w;const{user:a}=M(),r=F("open",void 0,!0),o=H(!0),n=R(),m=V(A()),l=((y=(p=a==null?void 0:a.user_metadata)==null?void 0:p.full_name)==null?void 0:y.trim().split(" ")[0])||((w=a==null?void 0:a.email)==null?void 0:w.split("@")[0])||"",{overdue:c,today:d,later:i}=f.useMemo(()=>{const t=r.data??[];return{overdue:t.filter(h=>_(h.due_at)==="overdue"),today:t.filter(h=>_(h.due_at)==="today"),later:t.filter(h=>_(h.due_at)==="later")}},[r.data]),u=f.useMemo(()=>(o.data??[]).filter(t=>t.status==="novo"),[o.data]),x=f.useMemo(()=>(o.data??[]).filter(t=>t.status!=="novo"&&t.status!=="convertido"&&t.status!=="perdido"&&!t.next_task_at&&t.score!==null&&t.score!==void 0).sort((t,h)=>(h.score??0)-(t.score??0)).slice(0,20),[o.data]),s=f.useMemo(()=>(n.data??[]).slice(0,30),[n.data]);return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx(Q,{goals:m.data,userId:a.id,name:l}),(r.isLoading||o.isLoading||n.isLoading)&&e.jsx(L,{className:"h-40 w-full"}),r.data&&e.jsxs(b,{title:"Suas tarefas",count:c.length+d.length,icon:e.jsx(T,{className:"h-3.5 w-3.5"}),tone:"bg-primary/15 text-primary",children:[c.length+d.length+i.length===0&&e.jsx("p",{className:"px-2 py-4 text-sm text-muted-foreground",children:"Nenhuma tarefa aberta. Toda conversa deveria sair com uma próxima ação."}),c.length>0&&e.jsx("p",{className:"px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-destructive",children:"Vencidas"}),c.map(t=>e.jsx(N,{task:t,showLead:!0},t.task_id)),d.length>0&&e.jsx("p",{className:"px-2 pt-2 text-[11px] font-medium uppercase tracking-wide text-amber-600 dark:text-amber-400",children:"Hoje"}),d.map(t=>e.jsx(N,{task:t,showLead:!0},t.task_id)),i.length>0&&e.jsxs("p",{className:"px-2 pt-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:["Depois (",i.length,")"]}),i.slice(0,5).map(t=>e.jsx(N,{task:t,showLead:!0},t.task_id))]}),o.data&&e.jsxs(b,{title:"Chegaram para você e ninguém respondeu",count:u.length,icon:e.jsx(W,{className:"h-3.5 w-3.5"}),tone:"bg-[#25D366]/20 text-emerald-800 dark:text-emerald-200",children:[u.length===0&&e.jsx("p",{className:"px-2 py-4 text-sm text-muted-foreground",children:"Nenhum lead novo esperando por você."}),u.map(t=>e.jsx(k,{subscriberId:t.subscriber_id,contactId:t.contact_id,email:t.email,phone:t.phone,userName:t.user_name,stage:t.status,origin:t.contact_origin,planSlug:t.plan_slug,hint:v(t.status_changed_at),hintTone:"warn"},t.contact_id))]}),o.data&&x.length>0&&e.jsx(b,{title:"Prioridade: seus contatados sem próxima ação",count:x.length,icon:e.jsx(C,{className:"h-3.5 w-3.5"}),tone:"bg-sky-500/20 text-sky-700 dark:text-sky-300",children:x.map(t=>e.jsx(k,{subscriberId:t.subscriber_id,contactId:t.contact_id,email:t.email,phone:t.phone,userName:t.user_name,stage:t.status,origin:t.contact_origin,planSlug:t.plan_slug,hint:e.jsx(P,{score:t.score,kind:t.kind})},t.contact_id))}),n.data&&e.jsxs(b,{title:"Quentes sem contato (sem dono ainda)",count:n.data.length,icon:e.jsx(G,{className:"h-3.5 w-3.5"}),tone:"bg-amber-500/20 text-amber-700 dark:text-amber-300",children:[s.length===0&&e.jsx("p",{className:"px-2 py-4 text-sm text-muted-foreground",children:"Ninguém viu preço ou abriu checkout sem ser contatado."}),s.map(t=>e.jsx(k,{subscriberId:t.subscriber_id,contactId:null,email:t.email,phone:t.phone,userName:t.user_name,stage:null,hint:t.checkout_start_at?`checkout ${v(t.checkout_start_at)}`:t.pricing_open_at?`viu preço ${v(t.pricing_open_at)}`:void 0,hintTone:t.checkout_start_at?"bad":"warn"},t.subscriber_id)),n.data.length>30&&e.jsxs("p",{className:"px-2 py-2 text-center text-[11px] text-muted-foreground",children:["Mostrando 30 de ",n.data.length,". Os demais estão em Leads."]})]})]})}export{de 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.