1import{b as l}from"./chunk-NXEK45RC.js";import{Bc as w,H as c,ba as u,ga as g,ka as b,p as h,u as r}from"./chunk-EKZMVQ4B.js";var o="[CRM][svc]",I=(()=>{let i=class i{constructor(){this.http=b(w),this.base=l.plutus_api_url?`${l.plutus_api_url}/api/crm`:"https://api-plutus.rmscorretora.com.br/api/crm",console.log(`${o} base URL =`,this.base)}unwrap(){return r(t=>t.data)}logRequest(t,s){return n=>n.pipe(u({subscribe:()=>console.log(`${o} \u2192`,t,s),next:e=>console.log(`${o} \u2713`,t,s,e)}),c(e=>(console.error(`${o} \u2717`,t,s,{status:e==null?void 0:e.status,message:e==null?void 0:e.message,body:e==null?void 0:e.error}),h(()=>e))))}listLeads(t){let s=new URLSearchParams;t!=null&&t.stage&&s.set("stage",t.stage),t!=null&&t.source&&s.set("source",t.source),t!=null&&t.search&&s.set("search",t.search);let n=s.toString()?`?${s.toString()}`:"",e=`${this.base}/leads${n}`;return console.log("[CRM][svc] GET leads URL:",e),this.http.get(e,{observe:"response"}).pipe(u(a=>{console.log("[CRM][svc] GET leads response status:",a.status),console.log("[CRM][svc] GET leads headers:",a.headers)}),r(a=>{var d,$;return($=(d=a.body)==null?void 0:d.data)!=null?$:{items:[],total:0}}),c(a=>(console.error("[CRM][svc] GET leads error:",{status:a.status,statusText:a.statusText,headers:a.headers,body:a.error}),h(()=>a))))}getLead(t){return this.http.get(`${this.base}/leads/${t}`).pipe(this.unwrap())}listEvents(t,s){let n=s?`?limit=${s}`:"";return this.http.get(`${this.base}/leads/${t}/events${n}`).pipe(this.unwrap())}moveStage(t,s,n){return this.http.patch(`${this.base}/leads/${t}/stage`,{stage:s,reason:n}).pipe(this.unwrap())}addNote(t,s){return this.http.post(`${this.base}/leads/${t}/notes`,{text:s})}getConversation(t){return this.http.get(`${this.base}/leads/${t}/conversation`).pipe(this.unwrap())}sendMessage(t,s,n){return this.http.post(`${this.base}/leads/${t}/messages`,{content:s,mediaUrl:n}).pipe(this.unwrap())}markRead(t){return this.http.post(`${this.base}/conversations/${t}/read`,{})}getWhatsappInstance(){return this.http.get(`${this.base}/whatsapp/instance`).pipe(this.unwrap())}createOrGetWhatsappInstance(){return this.http.post(`${this.base}/whatsapp/instance`,{}).pipe(this.unwrap())}connectWhatsapp(){return this.http.post(`${this.base}/whatsapp/connect`,{}).pipe(this.unwrap())}getWhatsappStatus(){return this.http.get(`${this.base}/whatsapp/status`).pipe(this.unwrap())}disconnectWhatsapp(){return this.http.post(`${this.base}/whatsapp/disconnect`,{}).pipe(this.unwrap())}deleteWhatsappInstance(){return this.http.delete(`${this.base}/whatsapp/instance`).pipe(this.unwrap())}};i.\u0275fac=function(s){return new(s||i)},i.\u0275prov=g({token:i,factory:i.\u0275fac,providedIn:"root"});let p=i;return p})();export{I as a}; 2//# sourceMappingURL=chunk-LRIRNS3R.js.map
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.