@ecodrix/erix-api 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/esm/index.d.ts +40 -40
- package/dist/ts/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/ts/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _n=Object.create;var E=Object.defineProperty,Vn=Object.defineProperties,jn=Object.getOwnPropertyDescriptor,Wn=Object.getOwnPropertyDescriptors,Hn=Object.getOwnPropertyNames,En=Object.getOwnPropertySymbols,Kn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty,zn=Object.prototype.propertyIsEnumerable;var Qn=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var un=(t,e,n)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T=(t,e)=>{for(var n in e||(e={}))Ln.call(e,n)&&un(t,n,e[n]);if(En)for(var n of En(e))zn.call(e,n)&&un(t,n,e[n]);return t},k=(t,e)=>Vn(t,Wn(e));var Gn=(t,e)=>{for(var n in e)E(t,n,{get:e[n],enumerable:!0})},Dn=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Hn(e))!Ln.call(t,o)&&o!==n&&E(t,o,{get:()=>e[o],enumerable:!(a=jn(e,o))||a.enumerable});return t};var L=(t,e,n)=>(n=t!=null?_n(Kn(t)):{},Dn(e||!t||!t.__esModule?E(n,"default",{value:t,enumerable:!0}):n,t)),Yn=t=>Dn(E({},"__esModule",{value:!0}),t);var s=(t,e,n)=>un(t,typeof e!="symbol"?e+"":e,n);var mn=function(t,e){this[0]=t,this[1]=e},qn=(t,e,n)=>{var a=(l,d,f,y)=>{try{var b=n[l](d),x=(d=b.value)instanceof mn,R=b.done;Promise.resolve(x?d[0]:d).then(u=>x?a(l==="return"?l:"next",d[1]?{done:u.done,value:u.value}:u,f,y):f({value:u,done:R})).catch(u=>a("throw",u,f,y))}catch(u){y(u)}},o=(l,d,f,y)=>p[l]=b=>(d=new Promise((x,R,u)=>(u=()=>a(l,b,x,R),c?c.then(u):u())),y=()=>c===f&&(c=0),c=f=d.then(y,y),d),c,p={};return n=n.apply(t,e),p[Qn("asyncIterator")]=()=>p,o("next"),o("throw"),o("return"),p};var rt={};Gn(rt,{APIError:()=>g,AdminOnboarding:()=>v,AuthenticationError:()=>m,ConnectInfra:()=>U,ECODrIx:()=>w,ECODrIxAPI:()=>w,ERROR_RETRY_CONFIG:()=>In,EcodrixError:()=>W,EmailConnect:()=>N,ErixChat:()=>D,ErixProduct:()=>q,HTTP_STATUS_ERROR_MAP:()=>Mn,InfraDomain:()=>$,LEAD_STATUS_VALUES:()=>Fn,Onboarding:()=>A,Persona:()=>C,PlatformAdmin:()=>V,PlatformDomain:()=>O,PlatformTenants:()=>M,PlatformUsers:()=>_,ProductDomain:()=>I,RateLimitError:()=>h,StorageInfra:()=>B,WhatsAppConnect:()=>F,default:()=>tt,getErrorDetails:()=>et,getRetryConfig:()=>nt,handleAPIError:()=>Xn,isAPIError:()=>Zn});module.exports=Yn(rt);var Bn=L(require("axios"),1),gn=L(require("axios-retry"),1);var yn="https://api.ecodrix.com";function Nn(t="v1",e=yn){return`${e.replace(/\/+$/,"")}/${t}/api`}var W=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},g=class extends W{constructor(n,a,o){super(n);s(this,"status");s(this,"code");this.name="APIError",this.status=a,this.code=o}},m=class extends g{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},h=class extends g{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var r=class{constructor(e){s(this,"client",e)}async post(e,n,a){try{let o=this.buildConfig(a);return(await this.client.post(e,n,o)).data}catch(o){this.handleError(o)}}async get(e,n){try{let a=this.buildConfig(n);return(await this.client.get(e,a)).data}catch(a){this.handleError(a)}}async patch(e,n,a){try{let o=this.buildConfig(a);return(await this.client.patch(e,n,o)).data}catch(o){this.handleError(o)}}async put(e,n,a){try{let o=this.buildConfig(a);return(await this.client.put(e,n,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,n){try{let a=this.buildConfig(n);return(await this.client.delete(e,a)).data}catch(a){this.handleError(a)}}buildConfig(e){if(!e)return;let n=T({},e);return e.idempotencyKey&&(n.headers=k(T({},n.headers),{"Idempotency-Key":e.idempotencyKey})),n}handleError(e){var n,a,o;if(e.response){let c=e.response.status,p=((n=e.response.data)==null?void 0:n.message)||((a=e.response.data)==null?void 0:a.error)||"API Request Failed",l=(o=e.response.data)==null?void 0:o.code;switch(c){case 401:throw new m(p);case 403:throw new m(p);case 429:throw new h(p);default:throw new g(p,c,l)}}throw new g(e.message||"Network Error")}};var fn=class extends r{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,n){return this.post(`/product/erix/crm/leads/${e}/notes`,n)}async update(e,n){return this.patch(`/product/erix/crm/notes/${e}`,{content:n})}async pin(e,n=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:n})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},H=class extends r{constructor(n){super(n);s(this,"notes");this.notes=new fn(n)}async timeline(n,a){return this.get(`/product/erix/crm/leads/${n}/timeline`,{params:a})}async list(n,a){return this.get(`/product/erix/crm/leads/${n}/activities`,{params:T({},a)})}async log(n){return this.post(`/product/erix/crm/leads/${n.leadId}/activities`,n)}async logCall(n,a){return this.post(`/product/erix/crm/leads/${n}/calls`,a)}};var K=class extends r{async overview(e){return this.get("/product/erix/crm/analytics/overview",{params:e})}async funnel(e){return this.get("/product/erix/crm/analytics/funnel",{params:{pipelineId:e}})}async forecast(e){return this.get("/product/erix/crm/analytics/forecast",{params:{pipelineId:e}})}async sources(e){return this.get("/product/erix/crm/analytics/sources",{params:e})}async team(e){return this.get("/product/erix/crm/analytics/team",{params:e})}async heatmap(e){return this.get("/product/erix/crm/analytics/heatmap",{params:e})}async scores(){return this.get("/product/erix/crm/analytics/scores")}async stageTime(e){return this.get("/product/erix/crm/analytics/stage-time",{params:{pipelineId:e}})}async tiered(e){return this.get("/product/erix/crm/analytics/tiered",{params:e})}async summary(e){return this.get("/product/erix/crm/analytics/summary",{params:e})}async whatsapp(e){return this.get("/product/erix/crm/analytics/whatsapp",{params:e})}};var z=class extends r{async stats(){return this.get("/product/erix/crm/automation/stats")}async logs(e){return this.get("/product/erix/crm/automation/logs",{params:e})}async retryFailedEvent(e){return this.post(`/product/erix/crm/automation/logs/${e}/retry`,{})}};var Q=class extends r{async list(){return this.get("/product/erix/crm/automations")}async create(e){return this.post("/product/erix/crm/automations",e)}async update(e,n){return this.patch(`/product/erix/crm/automations/${e}`,n)}async toggle(e){return this.patch(`/product/erix/crm/automations/${e}/toggle`)}async delete(e){return this.deleteRequest(`/product/erix/crm/automations/${e}`)}async bulkDelete(e){return this.post("/product/erix/crm/automations/bulk-delete",{ids:e})}async test(e,n){return this.post(`/product/erix/crm/automations/${e}/test`,{leadId:n})}async getAvailableEvents(){return this.post("/product/erix/crm/events",{})}async enrollments(e,n){return this.get(`/product/erix/crm/${e}/enrollments`,{params:n})}async getEnrollment(e){return this.get(`/product/erix/crm/enrollments/${e}`)}async pauseEnrollment(e,n){return this.post(`/product/erix/crm/${e}/enrollments/${n}/pause`,{})}async resumeEnrollment(e,n){return this.post(`/product/erix/crm/${e}/enrollments/${n}/resume`,{})}async runs(e){return this.get(`/product/erix/crm/${e}/runs`)}async getRun(e){return this.get(`/product/erix/crm/runs/${e}`)}async resumeRun(e){return this.post(`/product/erix/crm/runs/${e}/resume`,{})}async abortRun(e){return this.post(`/product/erix/crm/runs/${e}/abort`,{})}async webhookEvent(e,n,a){return this.post("/product/erix/crm/webhook-event",{ruleId:e,eventName:n,payload:a})}async trigger(e){return this.post("/product/erix/events/trigger",e)}};var Fn=["open","won","lost","archived"],G=class extends r{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),n=Array.isArray(e.data)?e.data:[],a=[{key:"firstName",label:"First Name",type:"string",required:!0,group:"Basic Info"},{key:"lastName",label:"Last Name",type:"string",required:!1,group:"Basic Info"},{key:"phone",label:"Phone Number",type:"phone",required:!0,group:"Contact"},{key:"email",label:"Email Address",type:"email",required:!1,group:"Contact"},{key:"status",label:"Status",type:"select",required:!0,options:[{label:"New",value:"new"},{label:"Contacted",value:"contacted"},{label:"Qualified",value:"qualified"},{label:"Won",value:"won"},{label:"Lost",value:"lost"}]},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],o=n.map(c=>({key:`metadata.extra.${c.name}`,label:c.label||c.name,type:c.type||"string",required:!!c.required,options:c.options,group:"Custom Fields"}));return{name:"Lead",fields:[...a,...o],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}}async upsert(e){return this.post("/product/erix/crm/leads/upsert",e)}async createMany(e,n=50){let a=[];for(let o=0;o<e.length;o+=n){let p=e.slice(o,o+n).map(d=>this.create(d)),l=await Promise.allSettled(p);for(let d of l)if(d.status==="fulfilled")a.push(d.value);else throw d.reason}return a}async import(e){return this.post("/product/erix/crm/leads/import",{leads:e})}async bulkUpsert(e){return this.import(e)}async list(e){let n=T({},e);return Array.isArray(n.tags)&&(n.tags=n.tags.join(",")),this.get("/product/erix/crm/leads",{params:n})}listAutoPaging(e){return qn(this,null,function*(){let n=(e==null?void 0:e.page)||1,a=!0;for(;a;){let o=yield new mn(this.list(k(T({},e),{page:n}))),c=Array.isArray(o.data)?o.data:o||[];if(c.length===0){a=!1;break}for(let p of c)yield p;o.pagination&&n<o.pagination.pages||!o.pagination&&c.length>0?n++:a=!1}})}async retrieve(e){return this.get(`/product/erix/crm/leads/${e}`)}async retrieveByPhone(e){return this.get(`/product/erix/crm/leads/phone/${encodeURIComponent(e)}`)}async byStage(e,n,a={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${n}/leads`,{params:a})}async retrieveByRef(e,n){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(n)}`)}async update(e,n){return this.patch(`/product/erix/crm/leads/${e}`,n)}async move(e,n){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:n})}async convert(e,n,a){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:n,reason:a})}async tags(e,n){return this.patch(`/product/erix/crm/leads/${e}/tags`,n)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,n){return this.patch(`/product/erix/crm/leads/${e}/metadata`,n)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,n){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:n})}async createNote(e,n){return this.post(`/product/erix/crm/leads/${e}/notes`,n)}async updateNote(e,n,a){return this.patch(`/product/erix/crm/notes/${n}`,a)}async deleteNote(e,n){return this.deleteRequest(`/product/erix/crm/notes/${n}`)}async delete(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async bulkArchive(e){return this.patch("/product/erix/crm/leads/bulk-archive",{ids:e})}async bulkDelete(e){return this.deleteRequest("/product/erix/crm/leads",{data:{ids:e}})}async archive(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async profile(e){return this.get(`/product/erix/crm/leads/${e}/profile`)}async invoices(e){return this.get(`/product/erix/crm/leads/${e}/invoices`)}async projects(e){return this.get(`/product/erix/crm/leads/${e}/projects`)}async conversations(e){return this.get(`/product/erix/crm/leads/${e}/conversations`)}async meetings(e){return this.get(`/product/erix/crm/leads/${e}/meetings`)}async sequences(e){return this.get(`/product/erix/crm/leads/${e}/sequences`)}};var Y=class extends r{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var J=class extends r{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,c;let n=await this.retrieve(e),a=Array.isArray((o=n.data)==null?void 0:o.stages)?n.data.stages:[];return{name:`Pipeline: ${((c=n.data)==null?void 0:c.name)||e}`,fields:a.map(p=>({key:p._id,label:p.name,type:"string",required:!0,options:[{label:p.name,value:p._id}],group:"Stages",uiHints:{color:p.color||"#cbd5e1",probability:p.probability}})),uiHints:{icon:"Columns",primaryColor:"#6366f1"}}}async create(e){return this.post("/product/erix/crm/pipelines",e)}async retrieve(e){return this.get(`/product/erix/crm/pipelines/${e}`)}async update(e,n){return this.patch(`/product/erix/crm/pipelines/${e}`,n)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,n){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{newName:n})}async archive(e){return this.patch(`/product/erix/crm/pipelines/${e}/archive`,{})}async delete(e){return this.deleteRequest(`/product/erix/crm/pipelines/${e}`)}async checkInUse(e){return this.get(`/product/erix/crm/pipelines/${e}/in-use`)}async board(e){return this.get(`/product/erix/crm/pipelines/${e}/board`)}async forecast(e){return this.get(`/product/erix/crm/pipelines/${e}/forecast`)}async addStage(e,n){return this.post(`/product/erix/crm/pipelines/${e}/stages`,n)}async reorderStages(e,n){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:n})}async updateStage(e,n){return this.patch(`/product/erix/crm/stages/${e}`,n)}async deleteStage(e,n){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:n?{moveLeadsToStageId:n}:void 0})}};var X=class extends r{async getConfig(){return this.get("/product/erix/crm/scoring")}async updateConfig(e){return this.patch("/product/erix/crm/scoring",e)}async recalculate(e){return this.post(`/product/erix/crm/scoring/${e}/recalculate`,{})}};var Z=class extends r{async enroll(e){return this.post("/product/erix/crm/sequences/enroll",e)}async unenroll(e){return this.deleteRequest(`/product/erix/crm/sequences/unenroll/${e}`)}async listForLead(e){return this.get(`/product/erix/crm/sequences/lead/${e}`)}};var ee=class extends r{async list(e){return this.get("/product/erix/chat/broadcasts",{params:e})}async retrieve(e){return this.get(`/product/erix/chat/broadcasts/${e}`)}async create(e){return this.post("/product/erix/chat/broadcast",e)}async update(e,n){return this.patch(`/product/erix/chat/broadcasts/${e}`,n)}async delete(e){return this.deleteRequest(`/product/erix/chat/broadcasts/${e}`)}};var ne=class extends r{async list(e){return this.get("/product/erix/chat/conversations",{params:e})}async create(e){return this.post("/product/erix/chat/conversations",e)}async retrieve(e){return this.get(`/product/erix/chat/conversations/${e}`)}async messages(e,n){return this.get(`/product/erix/chat/conversations/${e}/messages`,{params:n})}async linkLead(e,n,a){return this.post(`/product/erix/chat/conversations/${e}/link-lead`,{leadId:n,leadData:a})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`,{})}async delete(e){return this.deleteRequest(`/product/erix/chat/conversations/${e}`)}async bulkDelete(e){return this.post("/product/erix/chat/conversations/bulk-delete",{ids:e})}};var te=class extends r{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",k(T({},e),{templateLanguage:e.language||e.templateLanguage||"en_US"}))}async star(e,n){return this.post(`/product/erix/chat/messages/${e}/star`,{isStarred:n})}async react(e,n){return this.post(`/product/erix/chat/messages/${e}/react`,{reaction:n})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`)}async upload(e){let n=new FormData;return n.append("file",e),this.post("/product/erix/chat/upload",n,{headers:{"Content-Type":"multipart/form-data"}})}};var re=class extends r{async list(e){return this.get("/product/erix/crm/campaigns",{params:e})}async create(e){return this.post("/product/erix/crm/campaigns",e)}async stats(e){return this.get(`/product/erix/crm/campaigns/${e}/analytics`)}};var se=class extends r{async getProduct(e){return this.get(`/product/erix/commerce/checkout/products/${e}`)}async createSession(e){return this.post("/product/erix/commerce/checkout/session",e)}async applyCoupon(e){return this.post("/product/erix/commerce/checkout/coupon",e)}async verify(e){return this.post("/product/erix/commerce/checkout/verify",e)}async createOrder(e){return this.post("/product/erix/commerce/checkout/order",e)}};var ae=class extends r{async trigger(e){return this.post("/product/erix/events/trigger",e)}async listCustomEvents(){return this.get("/product/erix/crm/custom-events")}async createCustomEvent(e){return this.post("/product/erix/crm/custom-events",e)}async deleteCustomEvent(e){return this.deleteRequest(`/product/erix/crm/custom-events/${e}`)}};var ie=class extends r{async list(e){return this.get("/product/erix/commerce/invoices",{params:e})}async getInvoice(e){return this.get(`/product/erix/commerce/invoices/${e}`)}async create(e){return this.post("/product/erix/commerce/invoices",e)}async update(e,n){return this.patch(`/product/erix/commerce/invoices/${e}`,n)}async delete(e){return this.deleteRequest(`/product/erix/commerce/invoices/${e}`)}async sendViaWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${e}/send-whatsapp`,{})}async getSettings(){return this.get("/product/erix/commerce/settings")}async updateSettings(e){return this.put("/product/erix/commerce/settings",e)}};var oe=class extends r{async listEventLogs(e){return this.get("/product/erix/event-log/events/logs",{params:e})}async getEventLog(e){return this.get(`/product/erix/event-log/events/logs/${e}`)}async listCallbackLogs(e){return this.get("/product/erix/event-log/callbacks/logs",{params:e})}async getStats(){return this.get("/product/erix/event-log/events/stats")}};var ce=class extends r{async conversations(){return this.get("/product/erix/portal-inbox/conversations")}async messages(e){return this.get(`/product/erix/portal-inbox/conversations/${e}/messages`)}async reply(e,n){return this.post(`/product/erix/portal-inbox/conversations/${e}/messages`,n)}};var pe=class extends r{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,n){return this.post(`/product/erix/commerce/projects/${e}/documents`,n)}async toggleSignature(e,n,a){return this.patch(`/product/erix/commerce/projects/${e}/documents/${n}/signature`,{required:a})}async addSigner(e,n,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/signers`,a)}async sign(e,n,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/sign`,a!=null?a:{})}async decline(e,n){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/decline`,{})}async stampSign(e,n,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/stamp-sign`,a)}};var de=class extends r{async providers(){return this.get("/infra/connect/providers")}async list(){return this.get("/infra/connect/connections")}async get_(e){return this.get(`/infra/connect/connections/${e}`)}async connect(e,n){return this.post(`/infra/connect/connections/${e}/connect`,n)}async configure(e,n){return this.put(`/infra/connect/connections/${e}/configure`,n)}async disconnect(e){return this.post(`/infra/connect/connections/${e}/disconnect`,{})}async reveal(e){return this.post(`/infra/connect/connections/${e}/reveal`,{})}async test(e){return this.post(`/infra/connect/connections/${e}/test`,{})}async setAccess(e,n){return this.put(`/infra/connect/connections/${e}/access`,n)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var le=class extends r{async sendTest(e){return this.post("/infra/connect/email/test",{to:e})}async listTemplates(e){return this.get("/infra/connect/email/templates",{params:e})}async getTemplate(e){return this.get(`/infra/connect/email/templates/${e}`)}async createTemplate(e){return this.post("/infra/connect/email/templates",e)}async updateTemplate(e,n){return this.put(`/infra/connect/email/templates/${e}`,n)}async deleteTemplate(e,n=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:n}})}async previewTemplate(e,n){return this.post(`/infra/connect/email/templates/${e}/preview`,n)}};var ge=class extends r{async create(e){return this.post("/infra/connect/meet",e)}async list(e){return this.get("/infra/connect/meet",{params:e})}async retrieve(e){return this.get(`/infra/connect/meet/${e}`)}async update(e,n){return this.patch(`/infra/connect/meet/${e}`,n)}async reschedule(e,n){return this.patch(`/infra/connect/meet/${e}`,n)}async delete(e){return this.update(e,{status:"cancelled"})}};var ue=class extends r{async getConfig(){return this.get("/infra/connect/email/config")}async initDomainVerification(e){return this.post("/infra/connect/email/config/ses/domain",{domain:e})}async saveEmailConfig(e){return this.post("/infra/connect/email/config/ses/config",e)}async checkSesVerification(){return this.get("/infra/connect/email/config/ses/verify")}async removeSesIdentity(){return this.deleteRequest("/infra/connect/email/config/ses/domain")}async sendTest(e){return this.post("/infra/connect/email/config/test",{toEmail:e})}async saveAdvancedConfig(e){return this.post("/infra/connect/email/config/advanced",e)}async getHealth(){return this.get("/infra/connect/email/config/health")}async fixDmarc(){return this.post("/infra/connect/email/config/ses/fix-dmarc",{})}async listProviders(){return this.get("/infra/connect/email/config/providers")}};var me=class extends r{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(){return this.post("/infra/connect/whatsapp/templates/sync",{})}async retrieve(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}`)}async create(e){return this.post("/infra/connect/whatsapp/templates",e)}async update(e,n){return this.put(`/infra/connect/whatsapp/templates/${e}`,n)}async deleteTemplate(e,n){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${n?"?force=true":""}`)}async mappingConfig(){return this.get("/infra/connect/whatsapp/templates/mapping/config")}async collections(){return this.get("/infra/connect/whatsapp/templates/collections")}async collectionFields(e){return this.get(`/infra/connect/whatsapp/templates/collections/${encodeURIComponent(e)}/fields`)}async updateMapping(e,n){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,n)}async validate(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`)}async preview(e,n){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:n})}async getVariableManifest(e){var c,p;let n=await this.retrieve(e),a=Array.isArray((c=n.data)==null?void 0:c.components)?n.data.components:[],o=[];for(let l of a)if(l.text){let d=l.text.match(/{{(\d+)}}/g);if(d)for(let f of d){let y=f.replace(/{{|}}/g,"");o.push({key:`var_${y}`,label:`${l.type} Var {{${y}}}`,type:"string",required:!0,group:l.type,description:`Variable placeholder in template ${l.type}`})}}return{name:`Template variables: ${((p=n.data)==null?void 0:p.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}async checkUsage(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/usage`)}};var Un=L(require("axios"),1);var ye=class extends r{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,n){return this.get(`/infra/storage/files/files/${e}`,{params:n})}async delete(e){return this.deleteRequest("/infra/storage/files/files",{params:{key:e}})}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async aiDescribe(e){return this.post("/infra/storage/files/ai/describe",{key:e})}async upload(e,n){let a=await this.post("/infra/storage/files/upload-url",n),{uploadUrl:o,key:c}=a.data;await Un.default.put(o,e,{headers:{"Content-Type":n.contentType}});let p=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:c,sizeBytes:p})}};var fe=class extends r{async create(e){return this.post("/infra/storage/files/folders",{name:e})}async delete(e){return this.deleteRequest(`/infra/storage/files/folders/${encodeURIComponent(e)}`)}},he=class extends r{async list(e,n){return this.get(`/infra/storage/files/files/${e}`,{params:n})}async getUploadUrl(e){return this.post("/infra/storage/files/upload-url",e)}async confirmUpload(e){return this.post("/infra/storage/files/confirm-upload",e)}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async delete(e){return this.deleteRequest("/infra/storage/files",{params:{key:e}})}};var v=class extends r{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/admin/onboarding/niche-packs",{params:P(e)})}async getNichePack(e,n){let a=n?{version:n}:void 0;return this.get(`/platform/admin/onboarding/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,{params:a})}async createNichePack(e){return this.post("/platform/admin/onboarding/admin/onboarding/niche-packs",e)}async updateNichePack(e,n,a){let o=a?{version:a}:void 0;return this.patch(`/platform/admin/onboarding/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,n,{params:o})}async publishNichePack(e,n){let a=n?{version:n}:void 0;return this.post(`/platform/admin/onboarding/admin/onboarding/niche-packs/${encodeURIComponent(e)}/publish`,void 0,{params:a})}async unpublishNichePack(e,n){let a=n?{version:n}:void 0;return this.post(`/platform/admin/onboarding/admin/onboarding/niche-packs/${encodeURIComponent(e)}/unpublish`,void 0,{params:a})}async forkNichePack(e,n={}){return this.post(`/platform/admin/onboarding/admin/onboarding/niche-packs/${encodeURIComponent(e)}/fork`,n)}async smokeTestNichePack(e,n={},a){let o=a?{version:a}:void 0;return this.post(`/platform/admin/onboarding/admin/onboarding/niche-packs/${encodeURIComponent(e)}/smoke-test`,n,{params:o})}async listOnboardingConfigs(e={}){return this.get("/platform/admin/onboarding/admin/onboarding/configs",{params:P(e)})}async createOnboardingConfig(e){return this.post("/platform/admin/onboarding/admin/onboarding/configs",e)}async updateOnboardingConfig(e,n,a){return this.patch(`/platform/admin/onboarding/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(n)}`,a)}async publishOnboardingConfig(e,n){return this.post(`/platform/admin/onboarding/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(n)}/publish`)}async listOnboardingExperiments(e={}){return this.get("/platform/admin/onboarding/admin/onboarding/experiments",{params:P(e)})}async getOnboardingExperiment(e){return this.get(`/platform/admin/onboarding/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async createOnboardingExperiment(e){return this.post("/platform/admin/onboarding/admin/onboarding/experiments",e)}async updateOnboardingExperiment(e,n){return this.patch(`/platform/admin/onboarding/admin/onboarding/experiments/${encodeURIComponent(e)}`,n)}async deleteOnboardingExperiment(e){return this.deleteRequest(`/platform/admin/onboarding/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async getOnboardingFunnel(e={}){return this.get("/platform/admin/onboarding/admin/onboarding/analytics/funnel",{params:P(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/admin/onboarding/analytics/time-on-step",{params:P(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/admin/onboarding/analytics/abandonment",{params:P(e)})}};function P(t){let e={};for(let[n,a]of Object.entries(t))a!==void 0&&(e[n]=a);return e}var Te=class extends r{async list(){return this.get("/platform/admin/cors/cors")}async create(e){return this.post("/platform/admin/cors/cors",e)}async update(e,n){return this.patch(`/platform/admin/cors/cors/${e}`,n)}async delete(e){return this.deleteRequest(`/platform/admin/cors/cors/${e}`)}};var be=class extends r{async system(){return(await this.get("/health")).data}};var xe=class extends r{async listLogs(e){return this.get("/product/erix/event-log/events/logs",{params:e})}async retrieveLog(e){return this.get(`/product/erix/event-log/events/logs/${e}`)}async getStats(e){return this.get("/product/erix/event-log/events/stats",{params:e})}async listCallbacks(e){return this.get("/product/erix/event-log/callbacks/logs",{params:e})}async listAlerts(e){return this.get("/platform/users/notifications",{params:e})}async dismissAlert(e){return this.patch(`/platform/users/notifications/${e}/dismiss`)}async clearAllAlerts(){return this.deleteRequest("/platform/users/notifications/dismiss-all")}async retryAction(e){return this.post(`/platform/users/notifications/${e}/retry`,{})}};var A=class extends r{async global(e){return this.post("/platform/tenants/onboarding/onboarding/global",e)}async start(e){return this.post(`/platform/tenants/onboarding/onboarding/${e.productId}/start`,e)}async answer(e){return this.post("/api/onboarding/answer",e)}async state(e){return this.get(`/platform/tenants/onboarding/onboarding/${e}/state`,{params:{productId:e}})}async complete(e){return this.post("/platform/tenants/onboarding/onboarding/complete",e)}async edit(e){return this.post("/api/onboarding/edit",e)}async previewWorkspace(e){return this.get("/api/onboarding/preview-workspace",{params:{sessionId:e}})}};var C=class extends r{async get(e){return super.get(`/platform/tenants/persona/persona/${e}`)}async reinforce(e){return this.post(`/platform/tenants/persona/persona/${e.productId}/reinforce`,e)}async confidence(e){return super.get(`/platform/tenants/persona/persona/${e}/confidence`,{params:{productId:e}})}async timeline(e,n){var o;let a=await super.get(`/platform/tenants/persona/persona/${e}/timeline`,{params:n});return(o=a==null?void 0:a.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var a,o;let n=await super.get(`/platform/tenants/persona/persona/${e}/followups`);return(o=(a=n==null?void 0:n.data)==null?void 0:a.entries)!=null?o:[]}};var hn=class extends r{async list(){return this.get("/platform/admin/clients")}async getCountAndGenerateCode(){return this.get("/platform/admin/clients/count")}async retrieve(e){return this.get(`/platform/admin/clients/${e}`)}async getApiKey(e){return this.get(`/platform/admin/clients/${e}/api-key`)}async rotateApiKey(e){return this.post(`/platform/admin/clients/${e}/api-key`,{})}async create(e){return this.post("/platform/admin/clients",e)}async getConfig(e){return this.get(`/platform/admin/clients/${e}/config`)}async updateConfig(e,n){return this.patch(`/platform/admin/clients/${e}/config`,n)}async getConnections(e){return this.get(`/platform/admin/clients/${e}/connections`)}async getConnectProviders(e){return this.get(`/platform/admin/clients/${e}/connections/providers`)}async connectProvider(e,n,a){return this.post(`/platform/admin/clients/${e}/connections/${n}/connect`,a)}async configureProvider(e,n,a){return this.put(`/platform/admin/clients/${e}/connections/${n}/configure`,a)}async disconnectProvider(e,n){return this.post(`/platform/admin/clients/${e}/connections/${n}/disconnect`,{})}async revealConnection(e,n){return this.post(`/platform/admin/clients/${e}/connections/${n}/reveal`,{})}async setConnectionAccess(e,n,a){return this.put(`/platform/admin/clients/${e}/connections/${n}/access`,a)}async getDataSource(e){return this.get(`/api/clients/${e}/datasource`)}async manageDataSource(e,n){return this.post(`/api/clients/${e}/datasource`,n)}async updateIdentity(e,n){return this.patch(`/platform/admin/clients/${e}/identity`,n)}async googleReauth(e,n={}){return this.post(`/platform/admin/clients/${e}/google/reauth`,n)}async delete(e){return this.deleteRequest(`/platform/admin/clients/${e}`)}},Tn=class extends r{async list(){return this.get("/platform/admin/blogs/services/blogs")}},bn=class extends r{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},we=class extends r{constructor(n){super(n);s(this,"clients");s(this,"blogs");s(this,"globalLeads");this.clients=new hn(n),this.blogs=new Tn(n),this.globalLeads=new bn(n)}};var xn=class extends r{async chatSync(e){return this.post("/platform/ai/copilot/chat/sync",e)}async confirm(e){return this.post("/platform/ai/copilot/confirm",e)}async listSessions(){return this.get("/platform/ai/copilot/sessions")}async getSession(e){return this.get(`/platform/ai/copilot/sessions/${e}`)}async deleteSession(e){return this.deleteRequest(`/platform/ai/copilot/sessions/${e}`)}chatStreamUrl(){return"/platform/ai/copilot/chat"}},Re=class{constructor(e){s(this,"copilot");this.copilot=new xn(e)}};var ke=class extends r{async register(e){return this.post("/platform/auth/register",e)}async login(e){return this.post("/platform/auth/login",e)}async logout(e){return this.post("/platform/auth/logout",e)}async logoutAll(e){return this.post("/platform/auth/logout-all",e)}async validateSession(e){return this.post("/platform/auth/session/validate",e)}async listSessions(){return this.get("/platform/auth/sessions")}async revokeSession(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}async requestPasswordOtp(e){return this.post("/platform/auth/password/request-otp",e)}async setPassword(e){return this.post("/platform/auth/password/set",e)}async changePassword(e){return this.post("/platform/auth/password/change",e)}async forgotPassword(e){return this.post("/platform/auth/forgot",e)}async resetPassword(e){return this.post("/platform/auth/reset",e)}async linkOAuth(e){return this.post("/platform/auth/oauth-link",e)}async getInvitation(e){return this.get(`/platform/auth/invitations/${e}`)}async acceptInvitation(e,n){return this.post(`/platform/auth/invitations/${e}/accept`,n)}};var wn=class extends r{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},Rn=class extends r{async upgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/upgrade",e)}async downgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/downgrade",e)}async cancel(e){return this.post("/platform/billing/subscriptions/subscriptions/cancel",e)}async purchaseAddon(e){return this.post("/platform/billing/subscriptions/addons/purchase",e)}async cancelAddon(e){return this.post("/platform/billing/subscriptions/addons/cancel",e)}},kn=class extends r{async listPublic(){return this.get("/platform/billing/plans/public")}},Pn=class extends r{async plans(){return this.get("/platform/billing/checkout/plans")}async subscribe(e){return this.post("/platform/billing/checkout/subscribe",e)}async verify(e){return this.post("/platform/billing/checkout/verify",e)}async cancel(e){return this.post("/platform/billing/checkout/cancel",e)}async status(){return this.get("/platform/billing/checkout/status")}async syncPlan(e){return this.post("/platform/billing/checkout/sync-plan",e)}},vn=class extends r{async transactions(){return this.get("/platform/billing/user/transactions")}async subscription(){return this.get("/platform/billing/user/subscription")}async raiseDispute(e){return this.post("/platform/billing/user/dispute",e)}async disputes(){return this.get("/platform/billing/user/disputes")}},An=class extends r{async balance(){return this.get("/platform/billing/credits/balance")}async transactions(){return this.get("/platform/billing/credits/transactions")}async packs(){return this.get("/platform/billing/credits/packs")}async topupOrder(e){return this.post("/platform/billing/credits/topup/order",e)}async verifyTopup(e){return this.post("/platform/billing/credits/topup/verify",e)}async setAutoTopup(e){return this.patch("/platform/billing/credits/auto-topup",e)}async setSpendCap(e){return this.patch("/platform/billing/credits/spend-cap",e)}},Pe=class{constructor(e){s(this,"entitlements");s(this,"subscriptions");s(this,"plans");s(this,"checkout");s(this,"user");s(this,"credits");this.entitlements=new wn(e),this.subscriptions=new Rn(e),this.plans=new kn(e),this.checkout=new Pn(e),this.user=new vn(e),this.credits=new An(e)}};var ve=class extends r{async categories(){return this.get("/platform/support/categories")}async listTickets(e){return this.get("/platform/support/tickets",{params:e})}async createTicket(e){return this.post("/platform/support/tickets",e)}async getTicket(e){return this.get(`/platform/support/tickets/${e}`)}async reply(e,n){return this.post(`/platform/support/tickets/${e}/reply`,n)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}};var Ae=class extends r{async get(){return super.get("/platform/users/me")}async update(e){return this.patch("/platform/users/me",e)}async updateOrganization(e){return this.patch("/platform/users/me/organization",e)}async toggleModules(e){return this.post("/platform/users/me/modules",e)}async workspaces(){return super.get("/platform/users/me/workspaces")}async setActiveOrg(e){return this.post("/platform/users/me/active-org",e)}async dismissWorkspaceSetup(){return this.post("/platform/users/me/workspace/dismiss-setup",{})}},Ce=class extends r{async list(){return this.get("/platform/users/members/members")}async invite(e){return this.post("/platform/users/members/members/invite",e)}async remove(e){return this.deleteRequest(`/platform/users/members/members/${e}`)}},Ie=class extends r{async list(){return this.get("/platform/users/sessions")}async revoke(e){return this.deleteRequest(`/platform/users/sessions/${e}`)}async revokeAll(){return this.deleteRequest("/platform/users/sessions")}};var $e=class extends r{async list(e){return this.get("/platform/admin/logs",{params:e})}async export(e){return this.get("/platform/admin/logs/export",{params:e})}};var Oe=class extends r{async getSettings(){return this.get("/platform/admin/agency-invoices/admin/invoice-settings")}async updateSettings(e){return this.patch("/platform/admin/agency-invoices/admin/invoice-settings",e)}async list(e){return this.get("/platform/admin/agency-invoices/admin/invoices",{params:e})}async create(e){return this.post("/platform/admin/agency-invoices/admin/invoices",e)}async retrieve(e){return this.get(`/platform/admin/agency-invoices/admin/invoices/${e}`)}async update(e,n){return this.patch(`/platform/admin/agency-invoices/admin/invoices/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/agency-invoices/admin/invoices/${e}`)}};var Se=class extends r{async stats(e){return this.get("/platform/admin/agents/stats",{params:e})}async list(e){return this.get("/platform/admin/agents",{params:e})}async retrieve(e){return this.get(`/platform/admin/agents/${e}`)}async update(e,n){return this.patch(`/platform/admin/agents/${e}`,n)}async runs(e){return this.get(`/platform/admin/agents/${e}/runs`)}};var Ee=class extends r{async overview(e){return this.get("/platform/admin/analytics/overview",{params:e})}async endpoints(e){return this.get("/platform/admin/analytics/endpoints",{params:e})}async errors(e){return this.get("/platform/admin/analytics/errors",{params:e})}async tenants(e){return this.get("/platform/admin/analytics/tenants",{params:e})}};var Le=class extends r{async list(e){return this.get("/platform/admin/comms",{params:e})}async create(e){return this.post("/platform/admin/comms",e)}async update(e,n){return this.patch(`/platform/admin/comms/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/comms/${e}`)}async publish(e,n){return this.post(`/platform/admin/comms/${e}/publish`,n)}async broadcast(e){return this.post("/platform/admin/comms/broadcast",e)}async setMaintenance(e){return this.post("/platform/admin/comms/maintenance",e)}async getMaintenance(e){return this.get("/platform/admin/comms/maintenance",{params:e})}async changelog(e){return this.post("/platform/admin/comms/changelog",e)}};var De=class extends r{async stats(e){return this.get("/platform/admin/audit/stats",{params:e})}async list(e){return this.get("/platform/admin/audit",{params:e})}async export(e){return this.get("/platform/admin/audit/export",{params:e})}};var qe=class extends r{async events(e){return this.get("/platform/admin/billing/events",{params:e})}async orgEvents(e){return this.get(`/platform/admin/billing/events/${e}`)}async failed(e){return this.get("/platform/admin/billing/failed",{params:e})}async recordEvent(e){return this.post("/platform/admin/billing/record-event",e)}async extendTrial(e){return this.post("/platform/admin/billing/extend-trial",e)}async grandfather(e){return this.post("/platform/admin/billing/grandfather",e)}async reconcile(e){return this.get("/platform/admin/billing/reconcile",{params:e})}};var Ne=class extends r{async list(e){return this.get("/platform/admin/blogs/services/blogs",{params:e})}async retrieve(e){return this.get(`/platform/admin/blogs/services/blogs/${e}`)}async create(e){return this.post("/platform/admin/blogs/services/blogs",e)}async update(e,n){return this.put(`/platform/admin/blogs/services/blogs/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/blogs/services/blogs/${e}`)}};var Fe=class extends r{async requests(e){return this.get("/platform/admin/compliance/requests",{params:e})}async createRequest(e){return this.post("/platform/admin/compliance/requests",e)}async updateRequest(e,n){return this.patch(`/platform/admin/compliance/requests/${e}`,n)}async exportOrg(e,n){return this.post(`/platform/admin/compliance/export/${e}`,n)}};var Ue=class extends r{async rateCard(e){return this.get("/platform/admin/credits/rate-card",{params:e})}async packs(e){return this.get("/platform/admin/credits/packs",{params:e})}async createPack(e){return this.post("/platform/admin/credits/packs",e)}async updatePack(e,n){return this.patch(`/platform/admin/credits/packs/${e}`,n)}async deletePack(e){return this.deleteRequest(`/platform/admin/credits/packs/${e}`)}async wallet(e){return this.get(`/platform/admin/credits/wallet/${e}`)}async adjustWallet(e,n){return this.post(`/platform/admin/credits/wallet/${e}/adjust`,n)}};var Be=class extends r{async stats(e){return this.get("/platform/admin/dashboard/admin/dashboard/stats",{params:e})}};var Me=class extends r{async overview(e){return this.get("/platform/admin/email/overview",{params:e})}async campaigns(e){return this.get("/platform/admin/email/campaigns",{params:e})}async events(e){return this.get("/platform/admin/email/events",{params:e})}async sesHealth(e){return this.get("/platform/admin/email/ses-health",{params:e})}};var _e=class extends r{async createTenant(e){return this.post("/platform/admin/erix/tenants",e)}async tenants(e){return this.get("/platform/admin/erix/tenants",{params:e})}async tenant(e){return this.get(`/platform/admin/erix/tenants/${e}`)}async updatePlan(e,n){return this.patch(`/platform/admin/erix/tenants/${e}/plan`,n)}async suspend(e,n){return this.post(`/platform/admin/erix/tenants/${e}/suspend`,n)}async reactivate(e,n){return this.post(`/platform/admin/erix/tenants/${e}/reactivate`,n)}async rotateKey(e,n){return this.post(`/platform/admin/erix/tenants/${e}/rotate-key`,n)}async usage(e){return this.get(`/platform/admin/erix/tenants/${e}/usage`)}};var Ve=class extends r{async list(e){return this.get("/platform/admin/flags",{params:e})}async create(e){return this.post("/platform/admin/flags",e)}async update(e,n){return this.patch(`/platform/admin/flags/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/flags/${e}`)}async listOverrides(e){return this.get(`/platform/admin/flags/${e}/overrides`)}async addOverride(e,n){return this.post(`/platform/admin/flags/${e}/overrides`,n)}async removeOverride(e,n){return this.deleteRequest(`/platform/admin/flags/${e}/overrides/${n}`)}async forOrg(e){return this.get(`/platform/admin/flags/org/${e}`)}};var je=class extends r{async overview(e){return this.get("/platform/admin/flow/overview",{params:e})}async runs(e){return this.get("/platform/admin/flow/runs",{params:e})}async failures(e){return this.get("/platform/admin/flow/failures",{params:e})}async run(e){return this.get(`/platform/admin/flow/runs/${e}`)}async retryRun(e,n){return this.post(`/platform/admin/flow/runs/${e}/retry`,n)}};var We=class extends r{async list(e){return this.get(`/platform/admin/integrations/${e}/integrations`)}async connect(e,n,a){return this.post(`/platform/admin/integrations/${e}/integrations/${n}`,a)}async disconnect(e,n){return this.deleteRequest(`/platform/admin/integrations/${e}/integrations/${n}`)}async test(e,n,a){return this.post(`/platform/admin/integrations/${e}/integrations/${n}/test`,a)}async invite(e,n){return this.post(`/platform/admin/integrations/${e}/invite`,n)}};var He=class extends r{async overview(e){return this.get("/platform/admin/laie/overview",{params:e})}async queue(e){return this.get("/platform/admin/laie/queue",{params:e})}async proxies(e){return this.get("/platform/admin/laie/proxies",{params:e})}async vaultStats(e){return this.get("/platform/admin/laie/vault-stats",{params:e})}async credits(e){return this.get("/platform/admin/laie/credits",{params:e})}async actors(e){return this.get("/platform/admin/laie/actors",{params:e})}async actorRegistry(e){return this.get("/platform/admin/laie/actors/registry",{params:e})}async runActor(e,n){return this.post(`/platform/admin/laie/actors/${e}/run`,n)}async getEnrichmentConfig(){return this.get("/platform/admin/laie/enrichment/config")}async setEnrichmentConfig(e){return this.put("/platform/admin/laie/enrichment/config",e)}async audits(e){return this.get("/platform/admin/laie/audits",{params:e})}async audit(e){return this.get(`/platform/admin/laie/audits/${e}`)}};var Ke=class extends r{async queueStats(e){return this.get("/platform/admin/laie-runtime/queue/stats",{params:e})}async proxyHealth(e){return this.get("/platform/admin/laie-runtime/proxy/health",{params:e})}async browserPoolStats(e){return this.get("/platform/admin/laie-runtime/browser-pool/stats",{params:e})}async replayDlq(e){return this.post("/platform/admin/laie-runtime/dlq/replay",e)}async runStats(e){return this.get("/platform/admin/laie-runtime/runs/stats",{params:e})}};var ze=class extends r{async overview(e){return this.get("/platform/admin/laie-vault/admin/laie/vault",{params:e})}};var Qe=class extends r{async addLead(e){return this.post("/platform/admin/leads/add-lead",e)}async list(e){return this.get("/platform/admin/leads/leads",{params:e})}async retrieve(e){return this.get(`/platform/admin/leads/leads/${e}`)}async update(e,n){return this.patch(`/platform/admin/leads/leads/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/leads/leads/${e}`)}async updateStatus(e,n){return this.patch(`/platform/admin/leads/leads/${e}/status`,n)}async qualification(e,n){return this.post(`/platform/admin/leads/leads/${e}/qualification`,n)}async firstContact(e,n){return this.post(`/platform/admin/leads/leads/${e}/first-contact`,n)}async followup(e,n){return this.post(`/platform/admin/leads/leads/${e}/followup`,n)}async notes(e){return this.get(`/platform/admin/leads/leads/${e}/notes`)}async addNote(e,n){return this.post(`/platform/admin/leads/leads/${e}/notes`,n)}async updateNote(e,n,a){return this.patch(`/platform/admin/leads/leads/${e}/notes/${n}`,a)}async deleteNote(e,n){return this.deleteRequest(`/platform/admin/leads/leads/${e}/notes/${n}`)}};var Ge=class extends r{async json(){return this.get("/platform/admin/openapi/openapi.json")}async spec(){return this.get("/platform/admin/openapi/openapi")}async health(){return this.get("/platform/admin/openapi/openapi/health")}};var Ye=class extends r{async stats(e){return this.get("/platform/admin/partners/stats",{params:e})}async list(e){return this.get("/platform/admin/partners",{params:e})}async create(e){return this.post("/platform/admin/partners",e)}async retrieve(e){return this.get(`/platform/admin/partners/${e}`)}async update(e,n){return this.patch(`/platform/admin/partners/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/partners/${e}`)}async referrals(e){return this.get(`/platform/admin/partners/${e}/referrals`)}async updateReferral(e,n,a){return this.patch(`/platform/admin/partners/${e}/referrals/${n}`,a)}};var Je=class extends r{async refund(e){return this.post("/platform/admin/payments/refund",e)}async validate(e){return this.get(`/platform/admin/payments/validate/${e}`)}async fetch(e){return this.get(`/platform/admin/payments/fetch/${e}`)}async subscription(e){return this.get(`/platform/admin/payments/subscription/${e}`)}async failed(e){return this.get("/platform/admin/payments/failed",{params:e})}async retry(e,n){return this.post(`/platform/admin/payments/retry/${e}`,n)}async timeline(e){return this.get(`/platform/admin/payments/timeline/${e}`)}async risk(e){return this.get(`/platform/admin/payments/risk/${e}`)}};var Xe=class extends r{async stats(e){return this.get("/platform/admin/persona-history/stats",{params:e})}async list(e){return this.get("/platform/admin/persona-history",{params:e})}async retrieve(e){return this.get(`/platform/admin/persona-history/${e}`)}async version(e,n){return this.get(`/platform/admin/persona-history/${e}/${n}`)}};var Ze=class extends r{async templates(e){return this.get("/platform/admin/pipelines/templates",{params:e})}async createTemplate(e){return this.post("/platform/admin/pipelines/templates",e)}async updateTemplate(e,n){return this.patch(`/platform/admin/pipelines/templates/${e}`,n)}async deleteTemplate(e){return this.deleteRequest(`/platform/admin/pipelines/templates/${e}`)}async provision(e){return this.post("/platform/admin/pipelines/provision",e)}async overview(e){return this.get("/platform/admin/pipelines/overview",{params:e})}};var en=class extends r{async list(e){return this.get("/platform/admin/plans",{params:e})}async create(e){return this.post("/platform/admin/plans",e)}async update(e,n){return this.patch(`/platform/admin/plans/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/plans/${e}`)}async tenants(e){return this.get(`/platform/admin/plans/${e}/tenants`)}};var nn=class extends r{async summary(e){return this.get("/platform/admin/revenue/summary",{params:e})}async snapshots(e){return this.get("/platform/admin/revenue/snapshots",{params:e})}async generateSnapshot(e){return this.post("/platform/admin/revenue/snapshot/generate",e)}};var tn=class extends r{async verifyCredentials(e){return this.post("/platform/admin/auth/admin/staff/verify-credentials",e)}async findOrCreate(e){return this.post("/platform/admin/auth/admin/staff/find-or-create",e)}async list(e){return this.get("/platform/admin/auth/admin/staff",{params:e})}async create(e){return this.post("/platform/admin/auth/admin/staff",e)}async update(e,n){return this.patch(`/platform/admin/auth/admin/staff/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/auth/admin/staff/${e}`)}};var rn=class extends r{async stats(e){return this.get("/platform/admin/storage/stats",{params:e})}async events(e){return this.get("/platform/admin/storage/events",{params:e})}async usage(e){return this.get("/platform/admin/storage/usage",{params:e})}};var sn=class extends r{async overview(e){return this.get("/platform/admin/health",{params:e})}};var an=class extends r{async list(e){return this.get("/platform/admin/templates",{params:e})}async create(e){return this.post("/platform/admin/templates",e)}async retrieve(e){return this.get(`/platform/admin/templates/${e}`)}async update(e,n){return this.patch(`/platform/admin/templates/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/templates/${e}`)}async clone(e,n){return this.post(`/platform/admin/templates/${e}/clone`,n)}async versions(e){return this.get(`/platform/admin/templates/${e}/versions`)}async assignPlans(e,n){return this.post(`/platform/admin/templates/${e}/plans`,n)}};var on=class extends r{async deep(e){return this.get(`/platform/admin/tenants/${e}/deep`)}async usage(e){return this.get(`/platform/admin/tenants/${e}/usage`)}async team(e){return this.get(`/platform/admin/tenants/${e}/team`)}async billing(e){return this.get(`/platform/admin/tenants/${e}/billing`)}async whatsapp(e){return this.get(`/platform/admin/tenants/${e}/whatsapp`)}async flows(e){return this.get(`/platform/admin/tenants/${e}/flows`)}async crmStats(e){return this.get(`/platform/admin/tenants/${e}/crm-stats`)}async impersonate(e,n){return this.post(`/platform/admin/tenants/${e}/impersonate`,n)}async suspend(e,n){return this.post(`/platform/admin/tenants/${e}/suspend`,n)}async reactivate(e,n){return this.post(`/platform/admin/tenants/${e}/reactivate`,n)}async updatePlan(e,n){return this.patch(`/platform/admin/tenants/${e}/plan`,n)}async updateLimits(e,n){return this.patch(`/platform/admin/tenants/${e}/limits`,n)}async bulkAssignPlan(e){return this.post("/platform/admin/tenants/bulk-assign-plan",e)}async unassigned(){return this.get("/platform/admin/tenants/unassigned")}};var cn=class extends r{async stats(e){return this.get("/platform/admin/tickets/stats",{params:e})}async list(e){return this.get("/platform/admin/tickets",{params:e})}async create(e){return this.post("/platform/admin/tickets",e)}async retrieve(e){return this.get(`/platform/admin/tickets/${e}`)}async update(e,n){return this.patch(`/platform/admin/tickets/${e}`,n)}async addMessage(e,n){return this.post(`/platform/admin/tickets/${e}/messages`,n)}async resolve(e,n){return this.post(`/platform/admin/tickets/${e}/resolve`,n)}async close(e,n){return this.post(`/platform/admin/tickets/${e}/close`,n)}};var pn=class extends r{async stats(e){return this.get("/platform/admin/waitlist/stats",{params:e})}async list(e){return this.get("/platform/admin/waitlist",{params:e})}async retrieve(e){return this.get(`/platform/admin/waitlist/${e}`)}async update(e,n){return this.patch(`/platform/admin/waitlist/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/waitlist/${e}`)}async bulk(e){return this.post("/platform/admin/waitlist/bulk",e)}};var dn=class extends r{async overview(e){return this.get("/platform/admin/whatsapp/overview",{params:e})}async wabas(e){return this.get("/platform/admin/whatsapp/wabas",{params:e})}async templates(e){return this.get("/platform/admin/whatsapp/templates",{params:e})}async delivery(e){return this.get("/platform/admin/whatsapp/delivery",{params:e})}async webhooks(e){return this.get("/platform/admin/whatsapp/webhooks",{params:e})}};var D=class{constructor(e){s(this,"messages");s(this,"conversations");s(this,"broadcasts");this.messages=new te(e),this.conversations=new ne(e),this.broadcasts=new ee(e)}},q=class{constructor(e){s(this,"leads");s(this,"pipelines");s(this,"automations");s(this,"activities");s(this,"analytics");s(this,"scoring");s(this,"payments");s(this,"sequences");s(this,"automationDashboard");s(this,"chat");s(this,"events");s(this,"eventLog");s(this,"invoices");s(this,"checkout");s(this,"projects");s(this,"campaigns");s(this,"portalInbox");this.leads=new G(e),this.pipelines=new J(e),this.automations=new Q(e),this.activities=new H(e),this.analytics=new K(e),this.scoring=new X(e),this.payments=new Y(e),this.sequences=new Z(e),this.automationDashboard=new z(e),this.chat=new D(e),this.events=new ae(e),this.eventLog=new oe(e),this.invoices=new ie(e),this.checkout=new se(e),this.projects=new pe(e),this.campaigns=new re(e),this.portalInbox=new ce(e)}},I=class{constructor(e){s(this,"erix");this.erix=new q(e)}},N=class{constructor(e){s(this,"config");s(this,"templates");this.config=new ue(e),this.templates=new le(e)}},F=class{constructor(e){s(this,"templates");this.templates=new me(e)}},U=class{constructor(e){s(this,"email");s(this,"whatsapp");s(this,"meet");s(this,"connections");this.email=new N(e),this.whatsapp=new F(e),this.meet=new ge(e),this.connections=new de(e)}},B=class{constructor(e){s(this,"files");s(this,"folders");s(this,"media");this.files=new he(e),this.folders=new fe(e),this.media=new ye(e)}},$=class{constructor(e){s(this,"connect");s(this,"storage");this.connect=new U(e),this.storage=new B(e)}},M=class{constructor(e){s(this,"onboarding");s(this,"persona");this.onboarding=new A(e),this.persona=new C(e)}},_=class{constructor(e){s(this,"me");s(this,"members");s(this,"sessions");s(this,"notifications");this.me=new Ae(e),this.members=new Ce(e),this.sessions=new Ie(e),this.notifications=new xe(e)}},V=class{constructor(e){s(this,"revenue");s(this,"billing");s(this,"payments");s(this,"credits");s(this,"plans");s(this,"agencyInvoices");s(this,"flags");s(this,"activityLogs");s(this,"auditLogs");s(this,"analytics");s(this,"health");s(this,"storage");s(this,"announcements");s(this,"compliance");s(this,"tickets");s(this,"templates");s(this,"agents");s(this,"personaHistory");s(this,"openapi");s(this,"staff");s(this,"tenants");s(this,"whatsapp");s(this,"laie");s(this,"laieRuntime");s(this,"laieVault");s(this,"flow");s(this,"email");s(this,"pipelines");s(this,"integrations");s(this,"erix");s(this,"dashboard");s(this,"partners");s(this,"waitlist");s(this,"blogs");s(this,"leads");s(this,"onboarding");s(this,"cors");s(this,"clients");this.revenue=new nn(e),this.billing=new qe(e),this.payments=new Je(e),this.credits=new Ue(e),this.plans=new en(e),this.agencyInvoices=new Oe(e),this.flags=new Ve(e),this.activityLogs=new $e(e),this.auditLogs=new De(e),this.analytics=new Ee(e),this.health=new sn(e),this.storage=new rn(e),this.announcements=new Le(e),this.compliance=new Fe(e),this.tickets=new cn(e),this.templates=new an(e),this.agents=new Se(e),this.personaHistory=new Xe(e),this.openapi=new Ge(e),this.staff=new tn(e),this.tenants=new on(e),this.whatsapp=new dn(e),this.laie=new He(e),this.laieRuntime=new Ke(e),this.laieVault=new ze(e),this.flow=new je(e),this.email=new Me(e),this.pipelines=new Ze(e),this.integrations=new We(e),this.erix=new _e(e),this.dashboard=new Be(e),this.partners=new Ye(e),this.waitlist=new pn(e),this.blogs=new Ne(e),this.leads=new Qe(e),this.onboarding=new v(e),this.cors=new Te(e),this.clients=new we(e)}},O=class{constructor(e){s(this,"auth");s(this,"users");s(this,"tenants");s(this,"billing");s(this,"support");s(this,"ai");s(this,"admin");s(this,"health");this.auth=new ke(e),this.users=new _(e),this.tenants=new M(e),this.billing=new Pe(e),this.support=new ve(e),this.ai=new Re(e),this.admin=new V(e),this.health=new be(e)}};var S=class extends g{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},ln=class{async constructEvent(e,n,a){if(!n)throw new S("No webhook signature provided");let o=Array.isArray(n)?n[0]:n;o.startsWith("sha256=")&&(o=o.slice(7));try{let c=await import("crypto"),l=c.createHmac("sha256",a).update(e).digest("hex");if(!c.timingSafeEqual(Buffer.from(l),Buffer.from(o)))throw new S("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(c){throw c instanceof S?c:new S(`Webhook payload parsing failed: ${c.message}`)}}};var Cn=typeof process!="undefined"&&"2.1.0"||"2.0.0";var w=class{constructor(e){s(this,"client");s(this,"socket",null);s(this,"socketPromise",null);s(this,"socketQueue",[]);s(this,"clientCode");s(this,"apiVersion");s(this,"platform");s(this,"product");s(this,"infra");s(this,"webhooks");var f,y,b,x,R;if(!e.apiKey)throw new m("API Key is required");this.clientCode=(f=e.clientCode)==null?void 0:f.toUpperCase(),this.apiVersion=(y=e.version)!=null?y:"v1";let n=(b=e.baseUrl)!=null?b:yn,a=Nn(this.apiVersion,n),o=e.socketUrl||n,c=typeof window!="undefined"&&typeof window.document!="undefined",p=c?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",l=c?((x=globalThis.navigator)==null?void 0:x.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",d={"x-api-key":e.apiKey,"x-client-code":((R=e.clientCode)==null?void 0:R.toUpperCase())||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:Cn,runtime:p,os:l})};if(e.coreApiKey&&(d["x-core-api-key"]=e.coreApiKey),this.client=Bn.default.create({baseURL:a,headers:d}),(0,gn.default)(this.client,{retries:3,retryDelay:gn.default.exponentialDelay,retryCondition:u=>{var j;return gn.default.isNetworkOrIdempotentRequestError(u)||((j=u.response)==null?void 0:j.status)===429},onRetry:(u,j,$n)=>{var On,Sn;typeof process!="undefined"&&((On=process.env)==null?void 0:On.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${u}/3): ${(Sn=$n.method)==null?void 0:Sn.toUpperCase()} ${$n.url}. Reason: ${j.message}`)}}),this.platform=new O(this.client),this.product=new I(this.client),this.infra=new $(this.client),this.webhooks=new ln,this.initSocket(o,e.apiKey,e.clientCode),c){let u={version:Cn,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=u,window.ecodrix||(window.ecodrix=this)}}initSocket(e,n,a){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:o})=>{this.socket=o(e,{extraHeaders:{"x-api-key":n,"x-client-code":(a==null?void 0:a.toUpperCase())||""}}),this.setupSocket(a);for(let{type:c,args:p}of this.socketQueue)c==="joinRoom"?this.socket.emit("join-room",p[0]):c==="leaveRoom"?this.socket.emit("leave-room",p[0]):c==="on"?this.socket.on(p[0],p[1]):c==="off"?this.socket.off(p[0],p[1]):c==="disconnect"&&this.socket.disconnect();this.socketQueue=[]}),this.socketPromise)}joinRoom(e){this.socket?this.socket.emit("join-room",e):this.socketQueue.push({type:"joinRoom",args:[e]})}leaveRoom(e){this.socket?this.socket.emit("leave-room",e):this.socketQueue.push({type:"leaveRoom",args:[e]})}setupSocket(e){this.socket&&this.socket.on("connect",()=>{e&&this.socket.emit("join-room",e.toUpperCase())})}on(e,n){return this.socket?this.socket.on(e,n):this.socketQueue.push({type:"on",args:[e,n]}),this}disconnect(){this.socket?this.socket.disconnect():this.socketQueue.push({type:"disconnect",args:[]})}off(e,n){return this.socket?this.socket.off(e,n):this.socketQueue.push({type:"off",args:[e,n]}),this}async request(e,n,a,o){var c,p,l;try{return(await this.client.request({method:e,url:n,data:a,params:o})).data}catch(d){throw d.response?new g(((c=d.response.data)==null?void 0:c.message)||((p=d.response.data)==null?void 0:p.error)||"Raw Execution Failed",d.response.status,(l=d.response.data)==null?void 0:l.code):new g(d.message||"Network Error")}}};var Mn={401:m,403:m,429:h};function Xn(t){var e,n,a;if(t.response){let o=t.response.status,c=((e=t.response.data)==null?void 0:e.message)||((n=t.response.data)==null?void 0:n.error)||"API Request Failed",p=(a=t.response.data)==null?void 0:a.code,l=Mn[o]||g;throw l===m?new m(c):l===h?new h(c):new g(c,o,p)}throw new g(t.message||"Network Error")}function Zn(t,e){return t instanceof e}function et(t){return t instanceof m?{message:t.message,status:t.status,code:t.code,type:"AuthenticationError"}:t instanceof h?{message:t.message,status:t.status,code:t.code,type:"RateLimitError"}:t instanceof g?{message:t.message,status:t.status,code:t.code,type:"APIError"}:{message:t.message||"Unknown error",type:"UnknownError"}}var In={[m.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[h.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[g.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function nt(t){let e=t.constructor.name;return In[e]||In[g.name]}var tt=w;0&&(module.exports={APIError,AdminOnboarding,AuthenticationError,ConnectInfra,ECODrIx,ECODrIxAPI,ERROR_RETRY_CONFIG,EcodrixError,EmailConnect,ErixChat,ErixProduct,HTTP_STATUS_ERROR_MAP,InfraDomain,LEAD_STATUS_VALUES,Onboarding,Persona,PlatformAdmin,PlatformDomain,PlatformTenants,PlatformUsers,ProductDomain,RateLimitError,StorageInfra,WhatsAppConnect,getErrorDetails,getRetryConfig,handleAPIError,isAPIError});
|
|
1
|
+
"use strict";var _n=Object.create;var E=Object.defineProperty,Vn=Object.defineProperties,jn=Object.getOwnPropertyDescriptor,Wn=Object.getOwnPropertyDescriptors,Hn=Object.getOwnPropertyNames,En=Object.getOwnPropertySymbols,Kn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty,zn=Object.prototype.propertyIsEnumerable;var Qn=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var gn=(t,e,n)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T=(t,e)=>{for(var n in e||(e={}))Ln.call(e,n)&&gn(t,n,e[n]);if(En)for(var n of En(e))zn.call(e,n)&&gn(t,n,e[n]);return t},k=(t,e)=>Vn(t,Wn(e));var Gn=(t,e)=>{for(var n in e)E(t,n,{get:e[n],enumerable:!0})},Dn=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Hn(e))!Ln.call(t,o)&&o!==n&&E(t,o,{get:()=>e[o],enumerable:!(a=jn(e,o))||a.enumerable});return t};var L=(t,e,n)=>(n=t!=null?_n(Kn(t)):{},Dn(e||!t||!t.__esModule?E(n,"default",{value:t,enumerable:!0}):n,t)),Yn=t=>Dn(E({},"__esModule",{value:!0}),t);var s=(t,e,n)=>gn(t,typeof e!="symbol"?e+"":e,n);var mn=function(t,e){this[0]=t,this[1]=e},qn=(t,e,n)=>{var a=(l,d,f,y)=>{try{var b=n[l](d),x=(d=b.value)instanceof mn,R=b.done;Promise.resolve(x?d[0]:d).then(g=>x?a(l==="return"?l:"next",d[1]?{done:g.done,value:g.value}:g,f,y):f({value:g,done:R})).catch(g=>a("throw",g,f,y))}catch(g){y(g)}},o=(l,d,f,y)=>p[l]=b=>(d=new Promise((x,R,g)=>(g=()=>a(l,b,x,R),c?c.then(g):g())),y=()=>c===f&&(c=0),c=f=d.then(y,y),d),c,p={};return n=n.apply(t,e),p[Qn("asyncIterator")]=()=>p,o("next"),o("throw"),o("return"),p};var rt={};Gn(rt,{APIError:()=>u,AdminOnboarding:()=>v,AuthenticationError:()=>m,ConnectInfra:()=>U,ECODrIx:()=>w,ECODrIxAPI:()=>w,ERROR_RETRY_CONFIG:()=>In,EcodrixError:()=>W,EmailConnect:()=>N,ErixChat:()=>D,ErixProduct:()=>q,HTTP_STATUS_ERROR_MAP:()=>Mn,InfraDomain:()=>$,LEAD_STATUS_VALUES:()=>Fn,Onboarding:()=>A,Persona:()=>C,PlatformAdmin:()=>V,PlatformDomain:()=>O,PlatformTenants:()=>M,PlatformUsers:()=>_,ProductDomain:()=>I,RateLimitError:()=>h,StorageInfra:()=>B,WhatsAppConnect:()=>F,default:()=>tt,getErrorDetails:()=>et,getRetryConfig:()=>nt,handleAPIError:()=>Xn,isAPIError:()=>Zn});module.exports=Yn(rt);var Bn=L(require("axios"),1),un=L(require("axios-retry"),1);var yn="https://api.ecodrix.com";function Nn(t="v1",e=yn){return`${e.replace(/\/+$/,"")}/${t}/api`}var W=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},u=class extends W{constructor(n,a,o){super(n);s(this,"status");s(this,"code");this.name="APIError",this.status=a,this.code=o}},m=class extends u{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},h=class extends u{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var r=class{constructor(e){s(this,"client",e)}async post(e,n,a){try{let o=this.buildConfig(a);return(await this.client.post(e,n,o)).data}catch(o){this.handleError(o)}}async get(e,n){try{let a=this.buildConfig(n);return(await this.client.get(e,a)).data}catch(a){this.handleError(a)}}async patch(e,n,a){try{let o=this.buildConfig(a);return(await this.client.patch(e,n,o)).data}catch(o){this.handleError(o)}}async put(e,n,a){try{let o=this.buildConfig(a);return(await this.client.put(e,n,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,n){try{let a=this.buildConfig(n);return(await this.client.delete(e,a)).data}catch(a){this.handleError(a)}}buildConfig(e){if(!e)return;let n=T({},e);return e.idempotencyKey&&(n.headers=k(T({},n.headers),{"Idempotency-Key":e.idempotencyKey})),n}handleError(e){var n,a,o;if(e.response){let c=e.response.status,p=((n=e.response.data)==null?void 0:n.message)||((a=e.response.data)==null?void 0:a.error)||"API Request Failed",l=(o=e.response.data)==null?void 0:o.code;switch(c){case 401:throw new m(p);case 403:throw new m(p);case 429:throw new h(p);default:throw new u(p,c,l)}}throw new u(e.message||"Network Error")}};var fn=class extends r{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,n){return this.post(`/product/erix/crm/leads/${e}/notes`,n)}async update(e,n){return this.patch(`/product/erix/crm/notes/${e}`,{content:n})}async pin(e,n=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:n})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},H=class extends r{constructor(n){super(n);s(this,"notes");this.notes=new fn(n)}async timeline(n,a){return this.get(`/product/erix/crm/leads/${n}/timeline`,{params:a})}async list(n,a){return this.get(`/product/erix/crm/leads/${n}/activities`,{params:T({},a)})}async log(n){return this.post(`/product/erix/crm/leads/${n.leadId}/activities`,n)}async logCall(n,a){return this.post(`/product/erix/crm/leads/${n}/calls`,a)}};var K=class extends r{async overview(e){return this.get("/product/erix/crm/analytics/overview",{params:e})}async funnel(e){return this.get("/product/erix/crm/analytics/funnel",{params:{pipelineId:e}})}async forecast(e){return this.get("/product/erix/crm/analytics/forecast",{params:{pipelineId:e}})}async sources(e){return this.get("/product/erix/crm/analytics/sources",{params:e})}async team(e){return this.get("/product/erix/crm/analytics/team",{params:e})}async heatmap(e){return this.get("/product/erix/crm/analytics/heatmap",{params:e})}async scores(){return this.get("/product/erix/crm/analytics/scores")}async stageTime(e){return this.get("/product/erix/crm/analytics/stage-time",{params:{pipelineId:e}})}async tiered(e){return this.get("/product/erix/crm/analytics/tiered",{params:e})}async summary(e){return this.get("/product/erix/crm/analytics/summary",{params:e})}async whatsapp(e){return this.get("/product/erix/crm/analytics/whatsapp",{params:e})}};var z=class extends r{async stats(){return this.get("/product/erix/crm/automation/stats")}async logs(e){return this.get("/product/erix/crm/automation/logs",{params:e})}async retryFailedEvent(e){return this.post(`/product/erix/crm/automation/logs/${e}/retry`,{})}};var Q=class extends r{async list(){return this.get("/product/erix/crm/automations")}async create(e){return this.post("/product/erix/crm/automations",e)}async update(e,n){return this.patch(`/product/erix/crm/automations/${e}`,n)}async toggle(e){return this.patch(`/product/erix/crm/automations/${e}/toggle`)}async delete(e){return this.deleteRequest(`/product/erix/crm/automations/${e}`)}async bulkDelete(e){return this.post("/product/erix/crm/automations/bulk-delete",{ids:e})}async test(e,n){return this.post(`/product/erix/crm/automations/${e}/test`,{leadId:n})}async getAvailableEvents(){return this.post("/product/erix/crm/events",{})}async enrollments(e,n){return this.get(`/product/erix/crm/${e}/enrollments`,{params:n})}async getEnrollment(e){return this.get(`/product/erix/crm/enrollments/${e}`)}async pauseEnrollment(e,n){return this.post(`/product/erix/crm/${e}/enrollments/${n}/pause`,{})}async resumeEnrollment(e,n){return this.post(`/product/erix/crm/${e}/enrollments/${n}/resume`,{})}async runs(e){return this.get(`/product/erix/crm/${e}/runs`)}async getRun(e){return this.get(`/product/erix/crm/runs/${e}`)}async resumeRun(e){return this.post(`/product/erix/crm/runs/${e}/resume`,{})}async abortRun(e){return this.post(`/product/erix/crm/runs/${e}/abort`,{})}async webhookEvent(e,n,a){return this.post("/product/erix/crm/webhook-event",{ruleId:e,eventName:n,payload:a})}async trigger(e){return this.post("/product/erix/events/trigger",e)}};var Fn=["open","won","lost","archived"],G=class extends r{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),n=Array.isArray(e.data)?e.data:[],a=[{key:"firstName",label:"First Name",type:"string",required:!0,group:"Basic Info"},{key:"lastName",label:"Last Name",type:"string",required:!1,group:"Basic Info"},{key:"phone",label:"Phone Number",type:"phone",required:!0,group:"Contact"},{key:"email",label:"Email Address",type:"email",required:!1,group:"Contact"},{key:"status",label:"Status",type:"select",required:!0,options:[{label:"New",value:"new"},{label:"Contacted",value:"contacted"},{label:"Qualified",value:"qualified"},{label:"Won",value:"won"},{label:"Lost",value:"lost"}]},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],o=n.map(c=>({key:`metadata.extra.${c.name}`,label:c.label||c.name,type:c.type||"string",required:!!c.required,options:c.options,group:"Custom Fields"}));return{name:"Lead",fields:[...a,...o],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}}async upsert(e){return this.post("/product/erix/crm/leads/upsert",e)}async createMany(e,n=50){let a=[];for(let o=0;o<e.length;o+=n){let p=e.slice(o,o+n).map(d=>this.create(d)),l=await Promise.allSettled(p);for(let d of l)if(d.status==="fulfilled")a.push(d.value);else throw d.reason}return a}async import(e){return this.post("/product/erix/crm/leads/import",{leads:e})}async bulkUpsert(e){return this.import(e)}async list(e){let n=T({},e);return Array.isArray(n.tags)&&(n.tags=n.tags.join(",")),this.get("/product/erix/crm/leads",{params:n})}listAutoPaging(e){return qn(this,null,function*(){let n=(e==null?void 0:e.page)||1,a=!0;for(;a;){let o=yield new mn(this.list(k(T({},e),{page:n}))),c=Array.isArray(o.data)?o.data:o||[];if(c.length===0){a=!1;break}for(let p of c)yield p;o.pagination&&n<o.pagination.pages||!o.pagination&&c.length>0?n++:a=!1}})}async retrieve(e){return this.get(`/product/erix/crm/leads/${e}`)}async retrieveByPhone(e){return this.get(`/product/erix/crm/leads/phone/${encodeURIComponent(e)}`)}async byStage(e,n,a={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${n}/leads`,{params:a})}async retrieveByRef(e,n){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(n)}`)}async update(e,n){return this.patch(`/product/erix/crm/leads/${e}`,n)}async move(e,n){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:n})}async convert(e,n,a){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:n,reason:a})}async tags(e,n){return this.patch(`/product/erix/crm/leads/${e}/tags`,n)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,n){return this.patch(`/product/erix/crm/leads/${e}/metadata`,n)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,n){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:n})}async createNote(e,n){return this.post(`/product/erix/crm/leads/${e}/notes`,n)}async updateNote(e,n,a){return this.patch(`/product/erix/crm/notes/${n}`,a)}async deleteNote(e,n){return this.deleteRequest(`/product/erix/crm/notes/${n}`)}async delete(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async bulkArchive(e){return this.patch("/product/erix/crm/leads/bulk-archive",{ids:e})}async bulkDelete(e){return this.deleteRequest("/product/erix/crm/leads",{data:{ids:e}})}async archive(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async profile(e){return this.get(`/product/erix/crm/leads/${e}/profile`)}async invoices(e){return this.get(`/product/erix/crm/leads/${e}/invoices`)}async projects(e){return this.get(`/product/erix/crm/leads/${e}/projects`)}async conversations(e){return this.get(`/product/erix/crm/leads/${e}/conversations`)}async meetings(e){return this.get(`/product/erix/crm/leads/${e}/meetings`)}async sequences(e){return this.get(`/product/erix/crm/leads/${e}/sequences`)}};var Y=class extends r{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var J=class extends r{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,c;let n=await this.retrieve(e),a=Array.isArray((o=n.data)==null?void 0:o.stages)?n.data.stages:[];return{name:`Pipeline: ${((c=n.data)==null?void 0:c.name)||e}`,fields:a.map(p=>({key:p._id,label:p.name,type:"string",required:!0,options:[{label:p.name,value:p._id}],group:"Stages",uiHints:{color:p.color||"#cbd5e1",probability:p.probability}})),uiHints:{icon:"Columns",primaryColor:"#6366f1"}}}async create(e){return this.post("/product/erix/crm/pipelines",e)}async retrieve(e){return this.get(`/product/erix/crm/pipelines/${e}`)}async update(e,n){return this.patch(`/product/erix/crm/pipelines/${e}`,n)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,n){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{newName:n})}async archive(e){return this.patch(`/product/erix/crm/pipelines/${e}/archive`,{})}async delete(e){return this.deleteRequest(`/product/erix/crm/pipelines/${e}`)}async checkInUse(e){return this.get(`/product/erix/crm/pipelines/${e}/in-use`)}async board(e){return this.get(`/product/erix/crm/pipelines/${e}/board`)}async forecast(e){return this.get(`/product/erix/crm/pipelines/${e}/forecast`)}async addStage(e,n){return this.post(`/product/erix/crm/pipelines/${e}/stages`,n)}async reorderStages(e,n){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:n})}async updateStage(e,n){return this.patch(`/product/erix/crm/stages/${e}`,n)}async deleteStage(e,n){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:n?{moveLeadsToStageId:n}:void 0})}};var X=class extends r{async getConfig(){return this.get("/product/erix/crm/scoring")}async updateConfig(e){return this.patch("/product/erix/crm/scoring",e)}async recalculate(e){return this.post(`/product/erix/crm/scoring/${e}/recalculate`,{})}};var Z=class extends r{async enroll(e){return this.post("/product/erix/crm/sequences/enroll",e)}async unenroll(e){return this.deleteRequest(`/product/erix/crm/sequences/unenroll/${e}`)}async listForLead(e){return this.get(`/product/erix/crm/sequences/lead/${e}`)}};var ee=class extends r{async list(e){return this.get("/product/erix/chat/broadcasts",{params:e})}async retrieve(e){return this.get(`/product/erix/chat/broadcasts/${e}`)}async create(e){return this.post("/product/erix/chat/broadcast",e)}async update(e,n){return this.patch(`/product/erix/chat/broadcasts/${e}`,n)}async delete(e){return this.deleteRequest(`/product/erix/chat/broadcasts/${e}`)}};var ne=class extends r{async list(e){return this.get("/product/erix/chat/conversations",{params:e})}async create(e){return this.post("/product/erix/chat/conversations",e)}async retrieve(e){return this.get(`/product/erix/chat/conversations/${e}`)}async messages(e,n){return this.get(`/product/erix/chat/conversations/${e}/messages`,{params:n})}async linkLead(e,n,a){return this.post(`/product/erix/chat/conversations/${e}/link-lead`,{leadId:n,leadData:a})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`,{})}async delete(e){return this.deleteRequest(`/product/erix/chat/conversations/${e}`)}async bulkDelete(e){return this.post("/product/erix/chat/conversations/bulk-delete",{ids:e})}};var te=class extends r{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",k(T({},e),{templateLanguage:e.language||e.templateLanguage||"en_US"}))}async star(e,n){return this.post(`/product/erix/chat/messages/${e}/star`,{isStarred:n})}async react(e,n){return this.post(`/product/erix/chat/messages/${e}/react`,{reaction:n})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`)}async upload(e){let n=new FormData;return n.append("file",e),this.post("/product/erix/chat/upload",n,{headers:{"Content-Type":"multipart/form-data"}})}};var re=class extends r{async list(e){return this.get("/product/erix/crm/campaigns",{params:e})}async create(e){return this.post("/product/erix/crm/campaigns",e)}async stats(e){return this.get(`/product/erix/crm/campaigns/${e}/analytics`)}};var se=class extends r{async getProduct(e){return this.get(`/product/erix/commerce/checkout/products/${e}`)}async createSession(e){return this.post("/product/erix/commerce/checkout/session",e)}async applyCoupon(e){return this.post("/product/erix/commerce/checkout/coupon",e)}async verify(e){return this.post("/product/erix/commerce/checkout/verify",e)}async createOrder(e){return this.post("/product/erix/commerce/checkout/order",e)}};var ae=class extends r{async trigger(e){return this.post("/product/erix/events/trigger",e)}async listCustomEvents(){return this.get("/product/erix/crm/custom-events")}async createCustomEvent(e){return this.post("/product/erix/crm/custom-events",e)}async deleteCustomEvent(e){return this.deleteRequest(`/product/erix/crm/custom-events/${e}`)}};var ie=class extends r{async list(e){return this.get("/product/erix/commerce/invoices",{params:e})}async getInvoice(e){return this.get(`/product/erix/commerce/invoices/${e}`)}async create(e){return this.post("/product/erix/commerce/invoices",e)}async update(e,n){return this.patch(`/product/erix/commerce/invoices/${e}`,n)}async delete(e){return this.deleteRequest(`/product/erix/commerce/invoices/${e}`)}async sendViaWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${e}/send-whatsapp`,{})}async getSettings(){return this.get("/product/erix/commerce/settings")}async updateSettings(e){return this.put("/product/erix/commerce/settings",e)}};var oe=class extends r{async listEventLogs(e){return this.get("/product/erix/event-log/events/logs",{params:e})}async getEventLog(e){return this.get(`/product/erix/event-log/events/logs/${e}`)}async listCallbackLogs(e){return this.get("/product/erix/event-log/callbacks/logs",{params:e})}async getStats(){return this.get("/product/erix/event-log/events/stats")}};var ce=class extends r{async conversations(){return this.get("/product/erix/portal-inbox/conversations")}async messages(e){return this.get(`/product/erix/portal-inbox/conversations/${e}/messages`)}async reply(e,n){return this.post(`/product/erix/portal-inbox/conversations/${e}/messages`,n)}};var pe=class extends r{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,n){return this.post(`/product/erix/commerce/projects/${e}/documents`,n)}async toggleSignature(e,n,a){return this.patch(`/product/erix/commerce/projects/${e}/documents/${n}/signature`,{required:a})}async addSigner(e,n,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/signers`,a)}async sign(e,n,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/sign`,a!=null?a:{})}async decline(e,n){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/decline`,{})}async stampSign(e,n,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/stamp-sign`,a)}};var de=class extends r{async providers(){return this.get("/infra/connect/providers")}async list(){return this.get("/infra/connect/connections")}async get_(e){return this.get(`/infra/connect/connections/${e}`)}async connect(e,n){return this.post(`/infra/connect/connections/${e}/connect`,n)}async configure(e,n){return this.put(`/infra/connect/connections/${e}/configure`,n)}async disconnect(e){return this.post(`/infra/connect/connections/${e}/disconnect`,{})}async reveal(e){return this.post(`/infra/connect/connections/${e}/reveal`,{})}async test(e){return this.post(`/infra/connect/connections/${e}/test`,{})}async setAccess(e,n){return this.put(`/infra/connect/connections/${e}/access`,n)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var le=class extends r{async sendTest(e){return this.post("/infra/connect/email/test",{to:e})}async listTemplates(e){return this.get("/infra/connect/email/templates",{params:e})}async getTemplate(e){return this.get(`/infra/connect/email/templates/${e}`)}async createTemplate(e){return this.post("/infra/connect/email/templates",e)}async updateTemplate(e,n){return this.put(`/infra/connect/email/templates/${e}`,n)}async deleteTemplate(e,n=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:n}})}async previewTemplate(e,n){return this.post(`/infra/connect/email/templates/${e}/preview`,n)}};var ue=class extends r{async create(e){return this.post("/infra/connect/meet",e)}async list(e){return this.get("/infra/connect/meet",{params:e})}async retrieve(e){return this.get(`/infra/connect/meet/${e}`)}async update(e,n){return this.patch(`/infra/connect/meet/${e}`,n)}async reschedule(e,n){return this.patch(`/infra/connect/meet/${e}`,n)}async delete(e){return this.update(e,{status:"cancelled"})}};var ge=class extends r{async getConfig(){return this.get("/infra/connect/email/config")}async initDomainVerification(e){return this.post("/infra/connect/email/config/ses/domain",{domain:e})}async saveEmailConfig(e){return this.post("/infra/connect/email/config/ses/config",e)}async checkSesVerification(){return this.get("/infra/connect/email/config/ses/verify")}async removeSesIdentity(){return this.deleteRequest("/infra/connect/email/config/ses/domain")}async sendTest(e){return this.post("/infra/connect/email/config/test",{toEmail:e})}async saveAdvancedConfig(e){return this.post("/infra/connect/email/config/advanced",e)}async getHealth(){return this.get("/infra/connect/email/config/health")}async fixDmarc(){return this.post("/infra/connect/email/config/ses/fix-dmarc",{})}async listProviders(){return this.get("/infra/connect/email/config/providers")}};var me=class extends r{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(){return this.post("/infra/connect/whatsapp/templates/sync",{})}async retrieve(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}`)}async create(e){return this.post("/infra/connect/whatsapp/templates",e)}async update(e,n){return this.put(`/infra/connect/whatsapp/templates/${e}`,n)}async deleteTemplate(e,n){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${n?"?force=true":""}`)}async mappingConfig(){return this.get("/infra/connect/whatsapp/templates/mapping/config")}async collections(){return this.get("/infra/connect/whatsapp/templates/collections")}async collectionFields(e){return this.get(`/infra/connect/whatsapp/templates/collections/${encodeURIComponent(e)}/fields`)}async updateMapping(e,n){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,n)}async validate(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`)}async preview(e,n){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:n})}async getVariableManifest(e){var c,p;let n=await this.retrieve(e),a=Array.isArray((c=n.data)==null?void 0:c.components)?n.data.components:[],o=[];for(let l of a)if(l.text){let d=l.text.match(/{{(\d+)}}/g);if(d)for(let f of d){let y=f.replace(/{{|}}/g,"");o.push({key:`var_${y}`,label:`${l.type} Var {{${y}}}`,type:"string",required:!0,group:l.type,description:`Variable placeholder in template ${l.type}`})}}return{name:`Template variables: ${((p=n.data)==null?void 0:p.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}async checkUsage(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/usage`)}};var Un=L(require("axios"),1);var ye=class extends r{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,n){return this.get(`/infra/storage/files/files/${e}`,{params:n})}async delete(e){return this.deleteRequest("/infra/storage/files/files",{params:{key:e}})}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async aiDescribe(e){return this.post("/infra/storage/files/ai/describe",{key:e})}async upload(e,n){let a=await this.post("/infra/storage/files/upload-url",n),{uploadUrl:o,key:c}=a.data;await Un.default.put(o,e,{headers:{"Content-Type":n.contentType}});let p=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:c,sizeBytes:p})}};var fe=class extends r{async create(e){return this.post("/infra/storage/files/folders",{name:e})}async delete(e){return this.deleteRequest(`/infra/storage/files/folders/${encodeURIComponent(e)}`)}},he=class extends r{async list(e,n){return this.get(`/infra/storage/files/files/${e}`,{params:n})}async getUploadUrl(e){return this.post("/infra/storage/files/upload-url",e)}async confirmUpload(e){return this.post("/infra/storage/files/confirm-upload",e)}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async delete(e){return this.deleteRequest("/infra/storage/files",{params:{key:e}})}};var v=class extends r{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/niche-packs",{params:P(e)})}async getNichePack(e,n){let a=n?{version:n}:void 0;return this.get(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,{params:a})}async createNichePack(e){return this.post("/platform/admin/onboarding/niche-packs",e)}async updateNichePack(e,n,a){let o=a?{version:a}:void 0;return this.patch(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,n,{params:o})}async publishNichePack(e,n){let a=n?{version:n}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/publish`,void 0,{params:a})}async unpublishNichePack(e,n){let a=n?{version:n}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/unpublish`,void 0,{params:a})}async forkNichePack(e,n={}){return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/fork`,n)}async smokeTestNichePack(e,n={},a){let o=a?{version:a}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/smoke-test`,n,{params:o})}async listOnboardingConfigs(e={}){return this.get("/platform/admin/onboarding/configs",{params:P(e)})}async createOnboardingConfig(e){return this.post("/platform/admin/onboarding/configs",e)}async updateOnboardingConfig(e,n,a){return this.patch(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(n)}`,a)}async publishOnboardingConfig(e,n){return this.post(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(n)}/publish`)}async listOnboardingExperiments(e={}){return this.get("/platform/admin/onboarding/experiments",{params:P(e)})}async getOnboardingExperiment(e){return this.get(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async createOnboardingExperiment(e){return this.post("/platform/admin/onboarding/experiments",e)}async updateOnboardingExperiment(e,n){return this.patch(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`,n)}async deleteOnboardingExperiment(e){return this.deleteRequest(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async getOnboardingFunnel(e={}){return this.get("/platform/admin/onboarding/analytics/funnel",{params:P(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/analytics/time-on-step",{params:P(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/analytics/abandonment",{params:P(e)})}};function P(t){let e={};for(let[n,a]of Object.entries(t))a!==void 0&&(e[n]=a);return e}var Te=class extends r{async list(){return this.get("/platform/admin/cors")}async create(e){return this.post("/platform/admin/cors",e)}async update(e,n){return this.patch(`/platform/admin/cors/${e}`,n)}async delete(e){return this.deleteRequest(`/platform/admin/cors/${e}`)}};var be=class extends r{async system(){return(await this.get("/health")).data}};var xe=class extends r{async listLogs(e){return this.get("/product/erix/event-log/events/logs",{params:e})}async retrieveLog(e){return this.get(`/product/erix/event-log/events/logs/${e}`)}async getStats(e){return this.get("/product/erix/event-log/events/stats",{params:e})}async listCallbacks(e){return this.get("/product/erix/event-log/callbacks/logs",{params:e})}async listAlerts(e){return this.get("/platform/users/notifications",{params:e})}async dismissAlert(e){return this.patch(`/platform/users/notifications/${e}/dismiss`)}async clearAllAlerts(){return this.deleteRequest("/platform/users/notifications/dismiss-all")}async retryAction(e){return this.post(`/platform/users/notifications/${e}/retry`,{})}};var A=class extends r{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async start(e){return this.post(`/platform/tenants/onboarding/${e.productId}/start`,e)}async answer(e){return this.post("/api/onboarding/answer",e)}async state(e){return this.get(`/platform/tenants/onboarding/${e}/state`,{params:{productId:e}})}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}async edit(e){return this.post("/api/onboarding/edit",e)}async previewWorkspace(e){return this.get("/api/onboarding/preview-workspace",{params:{sessionId:e}})}};var C=class extends r{async get(e){return super.get(`/platform/tenants/persona/${e}`)}async reinforce(e){return this.post(`/platform/tenants/persona/${e.productId}/reinforce`,e)}async confidence(e){return super.get(`/platform/tenants/persona/${e}/confidence`,{params:{productId:e}})}async timeline(e,n){var o;let a=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:n});return(o=a==null?void 0:a.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var a,o;let n=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(a=n==null?void 0:n.data)==null?void 0:a.entries)!=null?o:[]}};var hn=class extends r{async list(){return this.get("/platform/admin/clients")}async getCountAndGenerateCode(){return this.get("/platform/admin/clients/count")}async retrieve(e){return this.get(`/platform/admin/clients/${e}`)}async getApiKey(e){return this.get(`/platform/admin/clients/${e}/api-key`)}async rotateApiKey(e){return this.post(`/platform/admin/clients/${e}/api-key`,{})}async create(e){return this.post("/platform/admin/clients",e)}async getConfig(e){return this.get(`/platform/admin/clients/${e}/config`)}async updateConfig(e,n){return this.patch(`/platform/admin/clients/${e}/config`,n)}async getConnections(e){return this.get(`/platform/admin/clients/${e}/connections`)}async getConnectProviders(e){return this.get(`/platform/admin/clients/${e}/connections/providers`)}async connectProvider(e,n,a){return this.post(`/platform/admin/clients/${e}/connections/${n}/connect`,a)}async configureProvider(e,n,a){return this.put(`/platform/admin/clients/${e}/connections/${n}/configure`,a)}async disconnectProvider(e,n){return this.post(`/platform/admin/clients/${e}/connections/${n}/disconnect`,{})}async revealConnection(e,n){return this.post(`/platform/admin/clients/${e}/connections/${n}/reveal`,{})}async setConnectionAccess(e,n,a){return this.put(`/platform/admin/clients/${e}/connections/${n}/access`,a)}async getDataSource(e){return this.get(`/api/clients/${e}/datasource`)}async manageDataSource(e,n){return this.post(`/api/clients/${e}/datasource`,n)}async updateIdentity(e,n){return this.patch(`/platform/admin/clients/${e}/identity`,n)}async googleReauth(e,n={}){return this.post(`/platform/admin/clients/${e}/google/reauth`,n)}async delete(e){return this.deleteRequest(`/platform/admin/clients/${e}`)}},Tn=class extends r{async list(){return this.get("/platform/admin/blogs")}},bn=class extends r{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},we=class extends r{constructor(n){super(n);s(this,"clients");s(this,"blogs");s(this,"globalLeads");this.clients=new hn(n),this.blogs=new Tn(n),this.globalLeads=new bn(n)}};var xn=class extends r{async chatSync(e){return this.post("/platform/ai/copilot/chat/sync",e)}async confirm(e){return this.post("/platform/ai/copilot/confirm",e)}async listSessions(){return this.get("/platform/ai/copilot/sessions")}async getSession(e){return this.get(`/platform/ai/copilot/sessions/${e}`)}async deleteSession(e){return this.deleteRequest(`/platform/ai/copilot/sessions/${e}`)}chatStreamUrl(){return"/platform/ai/copilot/chat"}},Re=class{constructor(e){s(this,"copilot");this.copilot=new xn(e)}};var ke=class extends r{async register(e){return this.post("/platform/auth/register",e)}async login(e){return this.post("/platform/auth/login",e)}async logout(e){return this.post("/platform/auth/logout",e)}async logoutAll(e){return this.post("/platform/auth/logout-all",e)}async validateSession(e){return this.post("/platform/auth/session/validate",e)}async listSessions(){return this.get("/platform/auth/sessions")}async revokeSession(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}async requestPasswordOtp(e){return this.post("/platform/auth/password/request-otp",e)}async setPassword(e){return this.post("/platform/auth/password/set",e)}async changePassword(e){return this.post("/platform/auth/password/change",e)}async forgotPassword(e){return this.post("/platform/auth/forgot",e)}async resetPassword(e){return this.post("/platform/auth/reset",e)}async linkOAuth(e){return this.post("/platform/auth/oauth-link",e)}async getInvitation(e){return this.get(`/platform/auth/invitations/${e}`)}async acceptInvitation(e,n){return this.post(`/platform/auth/invitations/${e}/accept`,n)}};var wn=class extends r{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},Rn=class extends r{async upgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/upgrade",e)}async downgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/downgrade",e)}async cancel(e){return this.post("/platform/billing/subscriptions/subscriptions/cancel",e)}async purchaseAddon(e){return this.post("/platform/billing/subscriptions/addons/purchase",e)}async cancelAddon(e){return this.post("/platform/billing/subscriptions/addons/cancel",e)}},kn=class extends r{async listPublic(){return this.get("/platform/billing/plans/public")}},Pn=class extends r{async plans(){return this.get("/platform/billing/checkout/plans")}async subscribe(e){return this.post("/platform/billing/checkout/subscribe",e)}async verify(e){return this.post("/platform/billing/checkout/verify",e)}async cancel(e){return this.post("/platform/billing/checkout/cancel",e)}async status(){return this.get("/platform/billing/checkout/status")}async syncPlan(e){return this.post("/platform/billing/checkout/sync-plan",e)}},vn=class extends r{async transactions(){return this.get("/platform/billing/user/transactions")}async subscription(){return this.get("/platform/billing/user/subscription")}async raiseDispute(e){return this.post("/platform/billing/user/dispute",e)}async disputes(){return this.get("/platform/billing/user/disputes")}},An=class extends r{async balance(){return this.get("/platform/billing/credits/balance")}async transactions(){return this.get("/platform/billing/credits/transactions")}async packs(){return this.get("/platform/billing/credits/packs")}async topupOrder(e){return this.post("/platform/billing/credits/topup/order",e)}async verifyTopup(e){return this.post("/platform/billing/credits/topup/verify",e)}async setAutoTopup(e){return this.patch("/platform/billing/credits/auto-topup",e)}async setSpendCap(e){return this.patch("/platform/billing/credits/spend-cap",e)}},Pe=class{constructor(e){s(this,"entitlements");s(this,"subscriptions");s(this,"plans");s(this,"checkout");s(this,"user");s(this,"credits");this.entitlements=new wn(e),this.subscriptions=new Rn(e),this.plans=new kn(e),this.checkout=new Pn(e),this.user=new vn(e),this.credits=new An(e)}};var ve=class extends r{async categories(){return this.get("/platform/support/categories")}async listTickets(e){return this.get("/platform/support/tickets",{params:e})}async createTicket(e){return this.post("/platform/support/tickets",e)}async getTicket(e){return this.get(`/platform/support/tickets/${e}`)}async reply(e,n){return this.post(`/platform/support/tickets/${e}/reply`,n)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}};var Ae=class extends r{async get(){return super.get("/platform/users/me")}async update(e){return this.patch("/platform/users/me",e)}async updateOrganization(e){return this.patch("/platform/users/me/organization",e)}async toggleModules(e){return this.post("/platform/users/me/modules",e)}async workspaces(){return super.get("/platform/users/me/workspaces")}async setActiveOrg(e){return this.post("/platform/users/me/active-org",e)}async dismissWorkspaceSetup(){return this.post("/platform/users/me/workspace/dismiss-setup",{})}},Ce=class extends r{async list(){return this.get("/platform/users/members")}async invite(e){return this.post("/platform/users/members/invite",e)}async remove(e){return this.deleteRequest(`/platform/users/members/${e}`)}},Ie=class extends r{async list(){return this.get("/platform/users/sessions")}async revoke(e){return this.deleteRequest(`/platform/users/sessions/${e}`)}async revokeAll(){return this.deleteRequest("/platform/users/sessions")}};var $e=class extends r{async list(e){return this.get("/platform/admin/logs",{params:e})}async export(e){return this.get("/platform/admin/logs/export",{params:e})}};var Oe=class extends r{async getSettings(){return this.get("/platform/admin/invoices/settings")}async updateSettings(e){return this.patch("/platform/admin/invoices/settings",e)}async list(e){return this.get("/platform/admin/invoices",{params:e})}async create(e){return this.post("/platform/admin/invoices",e)}async retrieve(e){return this.get(`/platform/admin/invoices/${e}`)}async update(e,n){return this.patch(`/platform/admin/invoices/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/invoices/${e}`)}};var Se=class extends r{async stats(e){return this.get("/platform/admin/agents/stats",{params:e})}async list(e){return this.get("/platform/admin/agents",{params:e})}async retrieve(e){return this.get(`/platform/admin/agents/${e}`)}async update(e,n){return this.patch(`/platform/admin/agents/${e}`,n)}async runs(e){return this.get(`/platform/admin/agents/${e}/runs`)}};var Ee=class extends r{async overview(e){return this.get("/platform/admin/analytics/overview",{params:e})}async endpoints(e){return this.get("/platform/admin/analytics/endpoints",{params:e})}async errors(e){return this.get("/platform/admin/analytics/errors",{params:e})}async tenants(e){return this.get("/platform/admin/analytics/tenants",{params:e})}};var Le=class extends r{async list(e){return this.get("/platform/admin/comms",{params:e})}async create(e){return this.post("/platform/admin/comms",e)}async update(e,n){return this.patch(`/platform/admin/comms/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/comms/${e}`)}async publish(e,n){return this.post(`/platform/admin/comms/${e}/publish`,n)}async broadcast(e){return this.post("/platform/admin/comms/broadcast",e)}async setMaintenance(e){return this.post("/platform/admin/comms/maintenance",e)}async getMaintenance(e){return this.get("/platform/admin/comms/maintenance",{params:e})}async changelog(e){return this.post("/platform/admin/comms/changelog",e)}};var De=class extends r{async stats(e){return this.get("/platform/admin/audit/stats",{params:e})}async list(e){return this.get("/platform/admin/audit",{params:e})}async export(e){return this.get("/platform/admin/audit/export",{params:e})}};var qe=class extends r{async events(e){return this.get("/platform/admin/billing/events",{params:e})}async orgEvents(e){return this.get(`/platform/admin/billing/events/${e}`)}async failed(e){return this.get("/platform/admin/billing/failed",{params:e})}async recordEvent(e){return this.post("/platform/admin/billing/record-event",e)}async extendTrial(e){return this.post("/platform/admin/billing/extend-trial",e)}async grandfather(e){return this.post("/platform/admin/billing/grandfather",e)}async reconcile(e){return this.get("/platform/admin/billing/reconcile",{params:e})}};var Ne=class extends r{async list(e){return this.get("/platform/admin/blogs",{params:e})}async retrieve(e){return this.get(`/platform/admin/blogs/${e}`)}async create(e){return this.post("/platform/admin/blogs",e)}async update(e,n){return this.put(`/platform/admin/blogs/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/blogs/${e}`)}};var Fe=class extends r{async requests(e){return this.get("/platform/admin/compliance/requests",{params:e})}async createRequest(e){return this.post("/platform/admin/compliance/requests",e)}async updateRequest(e,n){return this.patch(`/platform/admin/compliance/requests/${e}`,n)}async exportOrg(e,n){return this.post(`/platform/admin/compliance/export/${e}`,n)}};var Ue=class extends r{async rateCard(e){return this.get("/platform/admin/credits/rate-card",{params:e})}async packs(e){return this.get("/platform/admin/credits/packs",{params:e})}async createPack(e){return this.post("/platform/admin/credits/packs",e)}async updatePack(e,n){return this.patch(`/platform/admin/credits/packs/${e}`,n)}async deletePack(e){return this.deleteRequest(`/platform/admin/credits/packs/${e}`)}async wallet(e){return this.get(`/platform/admin/credits/wallet/${e}`)}async adjustWallet(e,n){return this.post(`/platform/admin/credits/wallet/${e}/adjust`,n)}};var Be=class extends r{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var Me=class extends r{async overview(e){return this.get("/platform/admin/email/overview",{params:e})}async campaigns(e){return this.get("/platform/admin/email/campaigns",{params:e})}async events(e){return this.get("/platform/admin/email/events",{params:e})}async sesHealth(e){return this.get("/platform/admin/email/ses-health",{params:e})}};var _e=class extends r{async createTenant(e){return this.post("/platform/admin/erix/tenants",e)}async tenants(e){return this.get("/platform/admin/erix/tenants",{params:e})}async tenant(e){return this.get(`/platform/admin/erix/tenants/${e}`)}async updatePlan(e,n){return this.patch(`/platform/admin/erix/tenants/${e}/plan`,n)}async suspend(e,n){return this.post(`/platform/admin/erix/tenants/${e}/suspend`,n)}async reactivate(e,n){return this.post(`/platform/admin/erix/tenants/${e}/reactivate`,n)}async rotateKey(e,n){return this.post(`/platform/admin/erix/tenants/${e}/rotate-key`,n)}async usage(e){return this.get(`/platform/admin/erix/tenants/${e}/usage`)}};var Ve=class extends r{async list(e){return this.get("/platform/admin/flags",{params:e})}async create(e){return this.post("/platform/admin/flags",e)}async update(e,n){return this.patch(`/platform/admin/flags/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/flags/${e}`)}async listOverrides(e){return this.get(`/platform/admin/flags/${e}/overrides`)}async addOverride(e,n){return this.post(`/platform/admin/flags/${e}/overrides`,n)}async removeOverride(e,n){return this.deleteRequest(`/platform/admin/flags/${e}/overrides/${n}`)}async forOrg(e){return this.get(`/platform/admin/flags/org/${e}`)}};var je=class extends r{async overview(e){return this.get("/platform/admin/flow/overview",{params:e})}async runs(e){return this.get("/platform/admin/flow/runs",{params:e})}async failures(e){return this.get("/platform/admin/flow/failures",{params:e})}async run(e){return this.get(`/platform/admin/flow/runs/${e}`)}async retryRun(e,n){return this.post(`/platform/admin/flow/runs/${e}/retry`,n)}};var We=class extends r{async list(e){return this.get(`/platform/admin/integrations/${e}/integrations`)}async connect(e,n,a){return this.post(`/platform/admin/integrations/${e}/integrations/${n}`,a)}async disconnect(e,n){return this.deleteRequest(`/platform/admin/integrations/${e}/integrations/${n}`)}async test(e,n,a){return this.post(`/platform/admin/integrations/${e}/integrations/${n}/test`,a)}async invite(e,n){return this.post(`/platform/admin/integrations/${e}/invite`,n)}};var He=class extends r{async overview(e){return this.get("/platform/admin/laie/overview",{params:e})}async queue(e){return this.get("/platform/admin/laie/queue",{params:e})}async proxies(e){return this.get("/platform/admin/laie/proxies",{params:e})}async vaultStats(e){return this.get("/platform/admin/laie/vault-stats",{params:e})}async credits(e){return this.get("/platform/admin/laie/credits",{params:e})}async actors(e){return this.get("/platform/admin/laie/actors",{params:e})}async actorRegistry(e){return this.get("/platform/admin/laie/actors/registry",{params:e})}async runActor(e,n){return this.post(`/platform/admin/laie/actors/${e}/run`,n)}async getEnrichmentConfig(){return this.get("/platform/admin/laie/enrichment/config")}async setEnrichmentConfig(e){return this.put("/platform/admin/laie/enrichment/config",e)}async audits(e){return this.get("/platform/admin/laie/audits",{params:e})}async audit(e){return this.get(`/platform/admin/laie/audits/${e}`)}};var Ke=class extends r{async queueStats(e){return this.get("/platform/admin/laie-runtime/queue/stats",{params:e})}async proxyHealth(e){return this.get("/platform/admin/laie-runtime/proxy/health",{params:e})}async browserPoolStats(e){return this.get("/platform/admin/laie-runtime/browser-pool/stats",{params:e})}async replayDlq(e){return this.post("/platform/admin/laie-runtime/dlq/replay",e)}async runStats(e){return this.get("/platform/admin/laie-runtime/runs/stats",{params:e})}};var ze=class extends r{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var Qe=class extends r{async addLead(e){return this.post("/platform/admin/leads/add-lead",e)}async list(e){return this.get("/platform/admin/leads",{params:e})}async retrieve(e){return this.get(`/platform/admin/leads/${e}`)}async update(e,n){return this.patch(`/platform/admin/leads/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/leads/${e}`)}async updateStatus(e,n){return this.patch(`/platform/admin/leads/${e}/status`,n)}async qualification(e,n){return this.post(`/platform/admin/leads/${e}/qualification`,n)}async firstContact(e,n){return this.post(`/platform/admin/leads/${e}/first-contact`,n)}async followup(e,n){return this.post(`/platform/admin/leads/${e}/followup`,n)}async notes(e){return this.get(`/platform/admin/leads/${e}/notes`)}async addNote(e,n){return this.post(`/platform/admin/leads/${e}/notes`,n)}async updateNote(e,n,a){return this.patch(`/platform/admin/leads/${e}/notes/${n}`,a)}async deleteNote(e,n){return this.deleteRequest(`/platform/admin/leads/${e}/notes/${n}`)}};var Ge=class extends r{async json(){return this.get("/platform/admin/openapi/spec.json")}async docs(){return this.get("/platform/admin/openapi")}async health(){return this.get("/platform/admin/openapi/health")}};var Ye=class extends r{async stats(e){return this.get("/platform/admin/partners/stats",{params:e})}async list(e){return this.get("/platform/admin/partners",{params:e})}async create(e){return this.post("/platform/admin/partners",e)}async retrieve(e){return this.get(`/platform/admin/partners/${e}`)}async update(e,n){return this.patch(`/platform/admin/partners/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/partners/${e}`)}async referrals(e){return this.get(`/platform/admin/partners/${e}/referrals`)}async updateReferral(e,n,a){return this.patch(`/platform/admin/partners/${e}/referrals/${n}`,a)}};var Je=class extends r{async refund(e){return this.post("/platform/admin/payments/refund",e)}async validate(e){return this.get(`/platform/admin/payments/validate/${e}`)}async fetch(e){return this.get(`/platform/admin/payments/fetch/${e}`)}async subscription(e){return this.get(`/platform/admin/payments/subscription/${e}`)}async failed(e){return this.get("/platform/admin/payments/failed",{params:e})}async retry(e,n){return this.post(`/platform/admin/payments/retry/${e}`,n)}async timeline(e){return this.get(`/platform/admin/payments/timeline/${e}`)}async risk(e){return this.get(`/platform/admin/payments/risk/${e}`)}};var Xe=class extends r{async stats(e){return this.get("/platform/admin/persona-history/stats",{params:e})}async list(e){return this.get("/platform/admin/persona-history",{params:e})}async retrieve(e){return this.get(`/platform/admin/persona-history/${e}`)}async version(e,n){return this.get(`/platform/admin/persona-history/${e}/${n}`)}};var Ze=class extends r{async templates(e){return this.get("/platform/admin/pipelines/templates",{params:e})}async createTemplate(e){return this.post("/platform/admin/pipelines/templates",e)}async updateTemplate(e,n){return this.patch(`/platform/admin/pipelines/templates/${e}`,n)}async deleteTemplate(e){return this.deleteRequest(`/platform/admin/pipelines/templates/${e}`)}async provision(e){return this.post("/platform/admin/pipelines/provision",e)}async overview(e){return this.get("/platform/admin/pipelines/overview",{params:e})}};var en=class extends r{async list(e){return this.get("/platform/admin/plans",{params:e})}async create(e){return this.post("/platform/admin/plans",e)}async update(e,n){return this.patch(`/platform/admin/plans/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/plans/${e}`)}async tenants(e){return this.get(`/platform/admin/plans/${e}/tenants`)}};var nn=class extends r{async summary(e){return this.get("/platform/admin/revenue/summary",{params:e})}async snapshots(e){return this.get("/platform/admin/revenue/snapshots",{params:e})}async generateSnapshot(e){return this.post("/platform/admin/revenue/snapshot/generate",e)}};var tn=class extends r{async verifyCredentials(e){return this.post("/platform/admin/auth/staff/verify-credentials",e)}async findOrCreate(e){return this.post("/platform/admin/auth/staff/find-or-create",e)}async list(e){return this.get("/platform/admin/auth/staff",{params:e})}async create(e){return this.post("/platform/admin/auth/staff",e)}async update(e,n){return this.patch(`/platform/admin/auth/staff/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/auth/staff/${e}`)}};var rn=class extends r{async stats(e){return this.get("/platform/admin/storage/stats",{params:e})}async events(e){return this.get("/platform/admin/storage/events",{params:e})}async usage(e){return this.get("/platform/admin/storage/usage",{params:e})}};var sn=class extends r{async overview(e){return this.get("/platform/admin/health",{params:e})}};var an=class extends r{async list(e){return this.get("/platform/admin/templates",{params:e})}async create(e){return this.post("/platform/admin/templates",e)}async retrieve(e){return this.get(`/platform/admin/templates/${e}`)}async update(e,n){return this.patch(`/platform/admin/templates/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/templates/${e}`)}async clone(e,n){return this.post(`/platform/admin/templates/${e}/clone`,n)}async versions(e){return this.get(`/platform/admin/templates/${e}/versions`)}async assignPlans(e,n){return this.post(`/platform/admin/templates/${e}/plans`,n)}};var on=class extends r{async deep(e){return this.get(`/platform/admin/tenants/${e}/deep`)}async usage(e){return this.get(`/platform/admin/tenants/${e}/usage`)}async team(e){return this.get(`/platform/admin/tenants/${e}/team`)}async billing(e){return this.get(`/platform/admin/tenants/${e}/billing`)}async whatsapp(e){return this.get(`/platform/admin/tenants/${e}/whatsapp`)}async flows(e){return this.get(`/platform/admin/tenants/${e}/flows`)}async crmStats(e){return this.get(`/platform/admin/tenants/${e}/crm-stats`)}async impersonate(e,n){return this.post(`/platform/admin/tenants/${e}/impersonate`,n)}async suspend(e,n){return this.post(`/platform/admin/tenants/${e}/suspend`,n)}async reactivate(e,n){return this.post(`/platform/admin/tenants/${e}/reactivate`,n)}async updatePlan(e,n){return this.patch(`/platform/admin/tenants/${e}/plan`,n)}async updateLimits(e,n){return this.patch(`/platform/admin/tenants/${e}/limits`,n)}async bulkAssignPlan(e){return this.post("/platform/admin/tenants/bulk-assign-plan",e)}async unassigned(){return this.get("/platform/admin/tenants/unassigned")}};var cn=class extends r{async stats(e){return this.get("/platform/admin/tickets/stats",{params:e})}async list(e){return this.get("/platform/admin/tickets",{params:e})}async create(e){return this.post("/platform/admin/tickets",e)}async retrieve(e){return this.get(`/platform/admin/tickets/${e}`)}async update(e,n){return this.patch(`/platform/admin/tickets/${e}`,n)}async addMessage(e,n){return this.post(`/platform/admin/tickets/${e}/messages`,n)}async resolve(e,n){return this.post(`/platform/admin/tickets/${e}/resolve`,n)}async close(e,n){return this.post(`/platform/admin/tickets/${e}/close`,n)}};var pn=class extends r{async stats(e){return this.get("/platform/admin/waitlist/stats",{params:e})}async list(e){return this.get("/platform/admin/waitlist",{params:e})}async retrieve(e){return this.get(`/platform/admin/waitlist/${e}`)}async update(e,n){return this.patch(`/platform/admin/waitlist/${e}`,n)}async remove(e){return this.deleteRequest(`/platform/admin/waitlist/${e}`)}async bulk(e){return this.post("/platform/admin/waitlist/bulk",e)}};var dn=class extends r{async overview(e){return this.get("/platform/admin/whatsapp/overview",{params:e})}async wabas(e){return this.get("/platform/admin/whatsapp/wabas",{params:e})}async templates(e){return this.get("/platform/admin/whatsapp/templates",{params:e})}async delivery(e){return this.get("/platform/admin/whatsapp/delivery",{params:e})}async webhooks(e){return this.get("/platform/admin/whatsapp/webhooks",{params:e})}};var D=class{constructor(e){s(this,"messages");s(this,"conversations");s(this,"broadcasts");this.messages=new te(e),this.conversations=new ne(e),this.broadcasts=new ee(e)}},q=class{constructor(e){s(this,"leads");s(this,"pipelines");s(this,"automations");s(this,"activities");s(this,"analytics");s(this,"scoring");s(this,"payments");s(this,"sequences");s(this,"automationDashboard");s(this,"chat");s(this,"events");s(this,"eventLog");s(this,"invoices");s(this,"checkout");s(this,"projects");s(this,"campaigns");s(this,"portalInbox");this.leads=new G(e),this.pipelines=new J(e),this.automations=new Q(e),this.activities=new H(e),this.analytics=new K(e),this.scoring=new X(e),this.payments=new Y(e),this.sequences=new Z(e),this.automationDashboard=new z(e),this.chat=new D(e),this.events=new ae(e),this.eventLog=new oe(e),this.invoices=new ie(e),this.checkout=new se(e),this.projects=new pe(e),this.campaigns=new re(e),this.portalInbox=new ce(e)}},I=class{constructor(e){s(this,"erix");this.erix=new q(e)}},N=class{constructor(e){s(this,"config");s(this,"templates");this.config=new ge(e),this.templates=new le(e)}},F=class{constructor(e){s(this,"templates");this.templates=new me(e)}},U=class{constructor(e){s(this,"email");s(this,"whatsapp");s(this,"meet");s(this,"connections");this.email=new N(e),this.whatsapp=new F(e),this.meet=new ue(e),this.connections=new de(e)}},B=class{constructor(e){s(this,"files");s(this,"folders");s(this,"media");this.files=new he(e),this.folders=new fe(e),this.media=new ye(e)}},$=class{constructor(e){s(this,"connect");s(this,"storage");this.connect=new U(e),this.storage=new B(e)}},M=class{constructor(e){s(this,"onboarding");s(this,"persona");this.onboarding=new A(e),this.persona=new C(e)}},_=class{constructor(e){s(this,"me");s(this,"members");s(this,"sessions");s(this,"notifications");this.me=new Ae(e),this.members=new Ce(e),this.sessions=new Ie(e),this.notifications=new xe(e)}},V=class{constructor(e){s(this,"revenue");s(this,"billing");s(this,"payments");s(this,"credits");s(this,"plans");s(this,"agencyInvoices");s(this,"flags");s(this,"activityLogs");s(this,"auditLogs");s(this,"analytics");s(this,"health");s(this,"storage");s(this,"announcements");s(this,"compliance");s(this,"tickets");s(this,"templates");s(this,"agents");s(this,"personaHistory");s(this,"openapi");s(this,"staff");s(this,"tenants");s(this,"whatsapp");s(this,"laie");s(this,"laieRuntime");s(this,"laieVault");s(this,"flow");s(this,"email");s(this,"pipelines");s(this,"integrations");s(this,"erix");s(this,"dashboard");s(this,"partners");s(this,"waitlist");s(this,"blogs");s(this,"leads");s(this,"onboarding");s(this,"cors");s(this,"clients");this.revenue=new nn(e),this.billing=new qe(e),this.payments=new Je(e),this.credits=new Ue(e),this.plans=new en(e),this.agencyInvoices=new Oe(e),this.flags=new Ve(e),this.activityLogs=new $e(e),this.auditLogs=new De(e),this.analytics=new Ee(e),this.health=new sn(e),this.storage=new rn(e),this.announcements=new Le(e),this.compliance=new Fe(e),this.tickets=new cn(e),this.templates=new an(e),this.agents=new Se(e),this.personaHistory=new Xe(e),this.openapi=new Ge(e),this.staff=new tn(e),this.tenants=new on(e),this.whatsapp=new dn(e),this.laie=new He(e),this.laieRuntime=new Ke(e),this.laieVault=new ze(e),this.flow=new je(e),this.email=new Me(e),this.pipelines=new Ze(e),this.integrations=new We(e),this.erix=new _e(e),this.dashboard=new Be(e),this.partners=new Ye(e),this.waitlist=new pn(e),this.blogs=new Ne(e),this.leads=new Qe(e),this.onboarding=new v(e),this.cors=new Te(e),this.clients=new we(e)}},O=class{constructor(e){s(this,"auth");s(this,"users");s(this,"tenants");s(this,"billing");s(this,"support");s(this,"ai");s(this,"admin");s(this,"health");this.auth=new ke(e),this.users=new _(e),this.tenants=new M(e),this.billing=new Pe(e),this.support=new ve(e),this.ai=new Re(e),this.admin=new V(e),this.health=new be(e)}};var S=class extends u{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},ln=class{async constructEvent(e,n,a){if(!n)throw new S("No webhook signature provided");let o=Array.isArray(n)?n[0]:n;o.startsWith("sha256=")&&(o=o.slice(7));try{let c=await import("crypto"),l=c.createHmac("sha256",a).update(e).digest("hex");if(!c.timingSafeEqual(Buffer.from(l),Buffer.from(o)))throw new S("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(c){throw c instanceof S?c:new S(`Webhook payload parsing failed: ${c.message}`)}}};var Cn=typeof process!="undefined"&&"2.1.2"||"2.0.0";var w=class{constructor(e){s(this,"client");s(this,"socket",null);s(this,"socketPromise",null);s(this,"socketQueue",[]);s(this,"clientCode");s(this,"apiVersion");s(this,"platform");s(this,"product");s(this,"infra");s(this,"webhooks");var f,y,b,x,R;if(!e.apiKey)throw new m("API Key is required");this.clientCode=(f=e.clientCode)==null?void 0:f.toUpperCase(),this.apiVersion=(y=e.version)!=null?y:"v1";let n=(b=e.baseUrl)!=null?b:yn,a=Nn(this.apiVersion,n),o=e.socketUrl||n,c=typeof window!="undefined"&&typeof window.document!="undefined",p=c?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",l=c?((x=globalThis.navigator)==null?void 0:x.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",d={"x-api-key":e.apiKey,"x-client-code":((R=e.clientCode)==null?void 0:R.toUpperCase())||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:Cn,runtime:p,os:l})};if(e.coreApiKey&&(d["x-core-api-key"]=e.coreApiKey),this.client=Bn.default.create({baseURL:a,headers:d}),(0,un.default)(this.client,{retries:3,retryDelay:un.default.exponentialDelay,retryCondition:g=>{var j;return un.default.isNetworkOrIdempotentRequestError(g)||((j=g.response)==null?void 0:j.status)===429},onRetry:(g,j,$n)=>{var On,Sn;typeof process!="undefined"&&((On=process.env)==null?void 0:On.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${g}/3): ${(Sn=$n.method)==null?void 0:Sn.toUpperCase()} ${$n.url}. Reason: ${j.message}`)}}),this.platform=new O(this.client),this.product=new I(this.client),this.infra=new $(this.client),this.webhooks=new ln,this.initSocket(o,e.apiKey,e.clientCode),c){let g={version:Cn,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=g,window.ecodrix||(window.ecodrix=this)}}initSocket(e,n,a){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:o})=>{this.socket=o(e,{extraHeaders:{"x-api-key":n,"x-client-code":(a==null?void 0:a.toUpperCase())||""}}),this.setupSocket(a);for(let{type:c,args:p}of this.socketQueue)c==="joinRoom"?this.socket.emit("join-room",p[0]):c==="leaveRoom"?this.socket.emit("leave-room",p[0]):c==="on"?this.socket.on(p[0],p[1]):c==="off"?this.socket.off(p[0],p[1]):c==="disconnect"&&this.socket.disconnect();this.socketQueue=[]}),this.socketPromise)}joinRoom(e){this.socket?this.socket.emit("join-room",e):this.socketQueue.push({type:"joinRoom",args:[e]})}leaveRoom(e){this.socket?this.socket.emit("leave-room",e):this.socketQueue.push({type:"leaveRoom",args:[e]})}setupSocket(e){this.socket&&this.socket.on("connect",()=>{e&&this.socket.emit("join-room",e.toUpperCase())})}on(e,n){return this.socket?this.socket.on(e,n):this.socketQueue.push({type:"on",args:[e,n]}),this}disconnect(){this.socket?this.socket.disconnect():this.socketQueue.push({type:"disconnect",args:[]})}off(e,n){return this.socket?this.socket.off(e,n):this.socketQueue.push({type:"off",args:[e,n]}),this}async request(e,n,a,o){var c,p,l;try{return(await this.client.request({method:e,url:n,data:a,params:o})).data}catch(d){throw d.response?new u(((c=d.response.data)==null?void 0:c.message)||((p=d.response.data)==null?void 0:p.error)||"Raw Execution Failed",d.response.status,(l=d.response.data)==null?void 0:l.code):new u(d.message||"Network Error")}}};var Mn={401:m,403:m,429:h};function Xn(t){var e,n,a;if(t.response){let o=t.response.status,c=((e=t.response.data)==null?void 0:e.message)||((n=t.response.data)==null?void 0:n.error)||"API Request Failed",p=(a=t.response.data)==null?void 0:a.code,l=Mn[o]||u;throw l===m?new m(c):l===h?new h(c):new u(c,o,p)}throw new u(t.message||"Network Error")}function Zn(t,e){return t instanceof e}function et(t){return t instanceof m?{message:t.message,status:t.status,code:t.code,type:"AuthenticationError"}:t instanceof h?{message:t.message,status:t.status,code:t.code,type:"RateLimitError"}:t instanceof u?{message:t.message,status:t.status,code:t.code,type:"APIError"}:{message:t.message||"Unknown error",type:"UnknownError"}}var In={[m.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[h.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[u.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function nt(t){let e=t.constructor.name;return In[e]||In[u.name]}var tt=w;0&&(module.exports={APIError,AdminOnboarding,AuthenticationError,ConnectInfra,ECODrIx,ECODrIxAPI,ERROR_RETRY_CONFIG,EcodrixError,EmailConnect,ErixChat,ErixProduct,HTTP_STATUS_ERROR_MAP,InfraDomain,LEAD_STATUS_VALUES,Onboarding,Persona,PlatformAdmin,PlatformDomain,PlatformTenants,PlatformUsers,ProductDomain,RateLimitError,StorageInfra,WhatsAppConnect,getErrorDetails,getRetryConfig,handleAPIError,isAPIError});
|