PageSourceSearch

https://sistema.yacamba.com/assets/utils-CRdGQaGq.js

js yacamba.com collected 2026-09-24 11:06:06 UTC 17,701 bytes, 2 lines download raw bytes

1import{eO as u,dn as n,gF as h}from"./index-DfEzlclk.js";async function b(e){var o;const t=new FormData;t.append("file",e);const s=await fetch("https://saasbackend.yacamba.com/api/yacamba-mailing/upload-file",{method:"POST",body:t,headers:{Authorization:"Bearer "+n.get("token")}});if(!s.ok)throw new Error(h.t("Error al subir archivo: {{status}}",{status:s.status}));const a=await s.json();return((o=a==null?void 0:a.data)==null?void 0:o.url)||(a==null?void 0:a.url)||(a==null?void 0:a.data)}function k(e,t="image.png"){const[s,a]=e.split(","),o=s.match(/:(.*?);/),r=o?o[1]:"image/png",c=r.split("/")[1]||"png",p=t.includes(".")?t:`${t}.${c}`,i=atob(a),m=new ArrayBuffer(i.length),_=new Uint8Array(m);for(let d=0;d<i.length;d++)_[d]=i.charCodeAt(d);return new File([m],p,{type:r})}async function B(e){if(!e)return e;const t=/src="(data:image\/[^;]+;base64,[^"]+)"/g,s=[];let a;for(;(a=t.exec(e))!==null;)s.push({fullMatch:a[0],dataUrl:a[1],index:a.index});if(s.length===0)return e;console.log(h.t("📤 Subiendo {{length}} imagen(es) base64 al servidor...",{length:s.length}));const o=await Promise.allSettled(s.map(async(c,p)=>{const i=k(c.dataUrl,`template_image_${p+1}`),m=await b(i);return{...c,url:m}}));let r=e;for(const c of o)if(c.status==="fulfilled"&&c.value.url){const{fullMatch:p,url:i}=c.value;r=r.replace(p,`src="${i}"`),console.log(h.t("✅ Imagen subida: {{url}}",{url:i}))}else console.warn("⚠️ Falló la subida de una imagen:",c.reason);return r}async function l(){try{return(await fetch("https://saasbackend.yacamba.com/api/crm/get-leads",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function P(e){const[t,s,a]=await Promise.all([w(e),g(),f()]);return u({oneLead:t,salesProcess:s,users:a})}async function w({params:e}){try{const t=e.id;return(await fetch(`https://saasbackend.yacamba.com/api/crm/get-lead/${t}`,{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function T(e){try{return(await fetch(`https://saasbackend.yacamba.com/api/crm/get-lead/${e}`,{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function v(e){const t={type:e.get("register_type"),business_name:e.get("business_name"),business_phone:e.get("business_phone"),contact_name:e.get("contact_name"),contact_middle_name:e.get("contact_middle_name"),contact_last_name:e.get("contact_last_name"),contact_phone:e.get("contact_phone"),contact_email:e.get("contact_email"),channel:e.get("channel"),type_process_sale:e.get("type_process_sale"),description:e.get("description"),amount:e.get("amount"),currency:e.get("currency")};return(await fetch("https://saasbackend.yacamba.com/api/crm/store-lead",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function N(e){const t={lead_id:e.get("lead_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/delete-lead",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function J(e){const t={lead_id:e.get("lead_id"),status:e.get("status"),type:e.get("type"),type_process_sale:e.get("type_process_sale"),tax_id:e.get("tax_id"),business_name:e.get("bussines_name"),business_phone:e.get("bussines_phone"),contact_name:e.get("contact_name"),contact_middle_name:e.get("contact_middle_name"),contact_last_name:e.get("contact_last_name"),contact_phone:e.get("contact_phone"),contact_email:e.get("contact_email"),channel:e.get("channel"),email:e.get("email"),assigned_id:e.get("assigned_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/edit-lead",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function g(){try{return(await fetch("https://saasbackend.yacamba.com/api/crm/get-sale-process",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function j(e){const t={name:e.get("name"),description:e.get("description"),color:"N/A"};return await fetch("https://saasbackend.yacamba.com/api/crm/store-sale-process",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function R(e){const t={sale_process_id:e.get("sale_process_id"),name:e.get("name"),description:e.get("description"),color:""};return await fetch("https://saasbackend.yacamba.com/api/crm/edit-sale-process",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function L(e){const t={sale_process_id:e.get("process_sale_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/delete-sale-process",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function S(){try{return(await fetch("https://saasbackend.yacamba.com/api/crm/get-selected-process",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function C(e){const t={process_ids:e.getAll("process_ids")};return await fetch("https://saasbackend.yacamba.com/api/crm/store-selected-process",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function U(e){const t={sale_process_id:e.get("sale_process_id"),stage_id:e.get("stage_id"),color:e.get("color"),name:e.get("name"),description:e.get("description")};return await fetch("https://saasbackend.yacamba.com/api/crm/store-sale-process-stage",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function D(e){const t={stage_id:e.get("stage_id"),color:e.get("color"),name:e.get("name")};return await fetch("https://saasbackend.yacamba.com/api/crm/edit-sale-process-stage",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function E(e){const t={stage_id:e.get("stage_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/destroy-sale-process-stage",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function O(){try{return(await fetch("https://saasbackend.yacamba.com/api/auth/get-user",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Something went wrong...",{status:500})}}async function F({params:e}){try{const t=e.id;return(await fetch(`https://saasbackend.yacamba.com/api/crm/get-selected-process/${t}`,{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Something went wrong...",{status:500})}}async function I(e){try{return(await fetch(`https://saasbackend.yacamba.com/api/crm/get-selected-process/${e}`,{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Something went wrong...",{status:500})}}async function x(e,t,s=null,a=null){return await fetch("https://saasbackend.yacamba.com/api/crm/change-lead-stage",{method:"POST",body:JSON.stringify({step_id:e,lead_id:t,position:s,previous_lead_id:a}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+n.get("token")}})}async function M(e){return await fetch("https://saasbackend.yacamba.com/api/crm/save-lead-comments",{method:"POST",body:e,headers:{Authorization:"Bearer "+n.get("token")}})}async function W(e){const t={id:e.get("id")};return await fetch("https://saasbackend.yacamba.com/api/crm/destroy-selected-product-services",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function q(e){const t={type:e.get("type"),id:e.get("lead_id"),title:e.get("title"),comment:e.get("comment"),mail:e.get("mail"),date:e.get("date"),hour:e.get("hour"),select:e.get("select"),size:e.get("size"),send_account:e.get("send_account")||null,products:JSON.parse(e.get("products")),services:JSON.parse(e.get("services"))},s=new FormData;return e.getAll("document[]").forEach(r=>{s.append("document[]",r)}),s.append("info",JSON.stringify(t)),(await fetch("https://saasbackend.yacamba.com/api/crm/save-lead-activity",{method:"POST",body:s,headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function G(e){const t={lead_id:e.get("lead_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/convert-to-client",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function H(e){const t={lead_id:e.get("lead_id"),lost_reason:e.get("lost_reason"),lost_note:e.get("lost_note")};return await fetch("https://saasbackend.yacamba.com/api/crm/cancel-oportunity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function A(){try{return(await fetch("https://saasbackend.yacamba.com/api/organization/get-system-info",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Error",{status:500})}}async function K(){const[e,t,s,a,o,r]=await Promise.all([l(),g(),y(),$(),f(),A()]);return u({leads:e,process:t,permissions:s,opportunities:a,users:o,info:r})}async function Q(){const[e,t,s]=await Promise.all([g(),y(),l()]);return u({process:e,permissions:t,leads:s})}async function V(){const[e,t,s]=await Promise.all([g(),S(),O()]);return u({process:e,selected:t,user:s})}async function y(){try{return(await fetch("https://saasbackend.yacamba.com/api/organization/permission-validate-module/3",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Something went wrong...",{status:500})}}async function X(e){return(await fetch("https://saasbackend.yacamba.com/api/crm/save-lead-comments",{method:"POST",body:e,headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function Y(e){return(await fetch(`https://saasbackend.yacamba.com/api/crm/edit-comment-lead
2`,{method:"POST",body:e,headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function Z(e){const t=e.get("comment_id");return(await fetch(`https://saasbackend.yacamba.com/api/crm/delete-comment-lead/${t}`,{method:"get",headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function ee(e){const t={activity_id:e.get("activity_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/check-activity/",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function te(e){const t={activity_id:e.get("activity_id"),title:e.get("title"),comment:e.get("comment"),date:e.get("date"),hour:e.get("hour"),select:e.get("select")};return await fetch("https://saasbackend.yacamba.com/api/crm/edit-activity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function se(e){const t={activity_id:e.get("activity_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/destroy-activity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function ne(e){const t=e.get("create_lead")==="1",s={description:e.get("description"),type_process_sale:e.get("type_process_sale"),amount:e.get("amount"),currency:e.get("
2currency"),process_sale_step:e.get("process_sale_step")||null},a=t?{...s,create_lead:!0,type:e.get("type"),business_name:e.get("business_name"),business_phone:e.get("business_phone"),contact_name:e.get("contact_name"),contact_middle_name:e.get("contact_middle_name"),contact_last_name:e.get("contact_last_name"),contact_phone:e.get("contact_phone"),contact_email:e.get("contact_email"),channel:e.get("channel")}:{...s,lead_id:e.get("lead_id")},o=e.get("assigned_id");return o&&(a.assigned_id=o),await fetch("https://saasbackend.yacamba.com/api/crm/store-oportunity",{method:"POST",body:JSON.stringify(a),headers:{Authorization:"Bearer "+n.get("token")}})}async function ae(e){const t={oportunity_id:e.get("oportunity_id")};return await fetch("https://saasbackend.yacamba.com/api/crm/destroy-oportunity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function oe(e){const t={oportunity_id:e.get("oportunity_id"),description:e.get("description"),type_process_sale:e.get("type_process_sale"),ammount:e.get("ammount"),assigned_id:e.get("assigned_id"),currency:e.get("currency"),status:""};return await fetch("https://saasbackend.yacamba.com/api/crm/edit-oportunity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function re(e){const t={lead_id:e.get("lead_id"),oportunity_id:e.get("oportunity_id"),description:e.get("description"),ammount:e.get("ammount"),business_name:e.get("bussines_name"),business_phone:e.get("bussines_phone"),contact_name:e.get("contact_name"),contact_middle_name:e.get("contact_middle_name"),contact_last_name:e.get("contact_last_name"),contact_phone:e.get("contact_phone"),contact_email:e.get("contact_email"),rating:e.get("rating"),close_date:e.get("close_date")};return(await fetch("https://saasbackend.yacamba.com/api/crm/edit-lead-oportunity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function ce(e,t){return(await fetch("https://saasbackend.yacamba.com/api/crm/edit-lead-oportunity",{method:"POST",body:JSON.stringify({oportunity_id:e,rating:t}),headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function f(){try{return(await fetch("https://saasbackend.yacamba.com/api/organization/get-users",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Something went wrong...",{status:500})}}async function ie(e){const t={status:e.get("status"),oportunity_id:e.get("oportunity_id"),type_process_sale:"",assigned_id:"",ammount:"",description:""};return await fetch("https://saasbackend.yacamba.com/api/crm/edit-oportunity",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}async function $(){try{return(await fetch("https://saasbackend.yacamba.com/api/crm/get-oportunities",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function pe(){try{return(await fetch("https://saasbackend.yacamba.com/api/crm/get-activities",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function me(e){const t=new FormData;return t.append("title",e.get("title")),t.append("comments",e.get("comments")),t.append("template",e.get("template")),await fetch("https://saasbackend.yacamba.com/api/marketing-campaigns/store-mail-template",{method:"POST",body:t,headers:{Authorization:"Bearer "+n.get("token")}})}async function de(){try{return(await fetch("https://saasbackend.yacamba.com/api/marketing-campaigns/get-mail-templates",{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function ue(){try{const t=await(await fetch("https://saasbackend.yacamba.com/api/marketing-campaigns/template-organization",{headers:{Authorization:"Bearer "+n.get("token")}})).json();return(t==null?void 0:t.data)??{folders:{},usage:{}}}catch{return{folders:{},usage:{}}}}async function ge({channel:e,templateRef:t,folder:s}){const a=new FormData;return a.append("channel",e),a.append("template_ref",t),a.append("folder",s??""),(await fetch("https://saasbackend.yacamba.com/api/marketing-campaigns/template-folder",{method:"POST",body:a,headers:{Authorization:"Bearer "+n.get("token")}})).ok}async function he({params:e}){try{const t=e.id;return(await fetch(`https://saasbackend.yacamba.com/api/marketing-campaigns/get-mail-template/${t}`,{headers:{Authorization:"Bearer "+n.get("token")}})).json()}catch{return new Response("Ups",{status:500})}}async function le(e){return(await fetch(`https://saasbackend.yacamba.com/api/marketing-campaigns/get-mail-template/${e}`,{headers:{Authorization:"Bearer "+n.get("token")}})).json()}async function ye(e){const t=new FormData;return t.append("template_id",e.get("template_id")),t.append("title",e.get("title")),t.append("comments",e.get("comments")),t.append("template",e.get("template")),await fetch("https://saasbackend.yacamba.com/api/marketing-campaigns/edit-mail-template",{method:"POST",body:t,headers:{Authorization:"Bearer "+n.get("token")}})}async function fe(e){const t={template_id:e.get("template_id")};return await fetch("https://saasbackend.yacamba.com/api/marketing-campaigns/destroy-mail-template",{method:"POST",body:JSON.stringify(t),headers:{Authorization:"Bearer "+n.get("token")}})}export{x as changeLeadStage,X as createCommentCRM,y as crmPermissions,Z as deleteCommentCRM,se as deleteLeadActivity,fe as deleteTemplateEmail,N as destroyLead,ae as destroyOpportunity,W as destroyProductService,ee as editActivity,Y as editCommentCRM,J as editLead,re as editLeadOp
2portunity,oe as editOpportunity,ie as editOpportunityStatus,ye as editTemplateEmail,j as functionCreateNewSaleProcess,U as functionCreateSaleProcessStage,L as functionDestroyNewSaleProcess,E as functionDestroySaleProcessStage,R as functionEditSaleProcess,D as functionEditSaleProcessStage,v as functionSaveNewLead,C as functionUpdateSelectedProcess,O as getAuthUser,pe as getCrmActivities,l as getLeads,w as getOneLead,T as getOneLeadId,$ as getOpportunities,A as getOrganizationInfo,F as getProcessInfo,I as getProcessInfoId,g as getSalesProcess,S as getSelectedProcess,he as getTemplateEmail,le as getTemplateEmailById,ue as getTemplateOrganization,de as getTemplatesEmail,f as getUsers,H as modalCancelOpportunity,G as modalConvertClient,V as multiLoaderCrmDasboard,Q as multiLoaderCrmLayout,P as multiLoaderCrmLeads,K as multiLoaderCrmTables,B as replaceBase64ImagesWithUrls,q as saveLeadActivity,M as saveLeadComments,ne as saveOpportunity,me as saveTemplateEmail,ce as setOpportunityRating,ge as setTemplateFolder,te as updateLeadActivity,b as uploadFileToMailing};

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.