@ecodrix/erix-api 2.1.2 → 2.1.3

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import $n from"repl";import{Command as In}from"commander";import Cn from"dotenv";import p from"picocolors";import An from"axios";import Tn from"axios-retry";var Qe="https://api.ecodrix.com";function xn(r="v1",e=Qe){return`${e.replace(/\/+$/,"")}/${r}/api`}var Ye=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},m=class extends Ye{status;code;constructor(e,n,s){super(e),this.name="APIError",this.status=n,this.code=s}},y=class extends m{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},x=class extends m{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var t=class{constructor(e){this.client=e}client;async post(e,n,s){try{let a=this.buildConfig(s);return(await this.client.post(e,n,a)).data}catch(a){this.handleError(a)}}async get(e,n){try{let s=this.buildConfig(n);return(await this.client.get(e,s)).data}catch(s){this.handleError(s)}}async patch(e,n,s){try{let a=this.buildConfig(s);return(await this.client.patch(e,n,a)).data}catch(a){this.handleError(a)}}async put(e,n,s){try{let a=this.buildConfig(s);return(await this.client.put(e,n,a)).data}catch(a){this.handleError(a)}}async deleteRequest(e,n){try{let s=this.buildConfig(n);return(await this.client.delete(e,s)).data}catch(s){this.handleError(s)}}buildConfig(e){if(!e)return;let n={...e};return e.idempotencyKey&&(n.headers={...n.headers,"Idempotency-Key":e.idempotencyKey}),n}handleError(e){if(e.response){let n=e.response.status,s=e.response.data?.message||e.response.data?.error||"API Request Failed",a=e.response.data?.code;switch(n){case 401:throw new y(s);case 403:throw new y(s);case 429:throw new x(s);default:throw new m(s,n,a)}}throw new m(e.message||"Network Error")}};var Ge=class extends t{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}`)}},w=class extends t{notes;constructor(e){super(e),this.notes=new Ge(e)}async timeline(e,n){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:n})}async list(e,n){return this.get(`/product/erix/crm/leads/${e}/activities`,{params:{...n}})}async log(e){return this.post(`/product/erix/crm/leads/${e.leadId}/activities`,e)}async logCall(e,n){return this.post(`/product/erix/crm/leads/${e}/calls`,n)}};var R=class extends t{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 k=class extends t{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 v=class extends t{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,s){return this.post("/product/erix/crm/webhook-event",{ruleId:e,eventName:n,payload:s})}async trigger(e){return this.post("/product/erix/events/trigger",e)}};var P=class extends t{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:[],s=[{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}],a=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:[...s,...a],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 s=[];for(let a=0;a<e.length;a+=n){let l=e.slice(a,a+n).map(d=>this.create(d)),u=await Promise.allSettled(l);for(let d of u)if(d.status==="fulfilled")s.push(d.value);else throw d.reason}return s}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={...e};return Array.isArray(n.tags)&&(n.tags=n.tags.join(",")),this.get("/product/erix/crm/leads",{params:n})}async*listAutoPaging(e){let n=e?.page||1,s=!0;for(;s;){let a=await this.list({...e,page:n}),c=Array.isArray(a.data)?a.data:a||[];if(c.length===0){s=!1;break}for(let l of c)yield l;a.pagination&&n<a.pagination.pages||!a.pagination&&c.length>0?n++:s=!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,s={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${n}/leads`,{params:s})}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,s){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:n,reason:s})}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,s){return this.patch(`/product/erix/crm/notes/${n}`,s)}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 A=class extends t{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var $=class extends t{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){let n=await this.retrieve(e),s=Array.isArray(n.data?.stages)?n.data.stages:[];return{name:`Pipeline: ${n.data?.name||e}`,fields:s.map(a=>({key:a._id,label:a.name,type:"string",required:!0,options:[{label:a.name,value:a._id}],group:"Stages",uiHints:{color:a.color||"#cbd5e1",probability:a.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 I=class extends t{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 C=class extends t{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 S=class extends t{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 O=class extends t{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,s){return this.post(`/product/erix/chat/conversations/${e}/link-lead`,{leadId:n,leadData:s})}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 E=class extends t{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",{...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 L=class extends t{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 D=class extends t{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 N=class extends t{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 q=class extends t{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 M=class extends t{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 U=class extends t{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 _=class extends t{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,s){return this.patch(`/product/erix/commerce/projects/${e}/documents/${n}/signature`,{required:s})}async addSigner(e,n,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/signers`,s)}async sign(e,n,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/sign`,s??{})}async decline(e,n){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/decline`,{})}async stampSign(e,n,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${n}/stamp-sign`,s)}};var V=class extends t{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 F=class extends t{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 B=class extends t{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 j=class extends t{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 K=class extends t{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){let n=await this.retrieve(e),s=Array.isArray(n.data?.components)?n.data.components:[],a=[];for(let c of s)if(c.text){let l=c.text.match(/{{(\d+)}}/g);if(l)for(let u of l){let d=u.replace(/{{|}}/g,"");a.push({key:`var_${d}`,label:`${c.type} Var {{${d}}}`,type:"string",required:!0,group:c.type,description:`Variable placeholder in template ${c.type}`})}}return{name:`Template variables: ${n.data?.name||e}`,fields:a,uiHints:{icon:"Variables",primaryColor:"#059669"}}}async checkUsage(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/usage`)}};import vn from"axios";var W=class extends t{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 s=await this.post("/infra/storage/files/upload-url",n),{uploadUrl:a,key:c}=s.data;await vn.put(a,e,{headers:{"Content-Type":n.contentType}});let l=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:c,sizeBytes:l})}};var H=class extends t{async create(e){return this.post("/infra/storage/files/folders",{name:e})}async delete(e){return this.deleteRequest(`/infra/storage/files/folders/${encodeURIComponent(e)}`)}},z=class extends t{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 Q=class extends t{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/niche-packs",{params:T(e)})}async getNichePack(e,n){let s=n?{version:n}:void 0;return this.get(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,{params:s})}async createNichePack(e){return this.post("/platform/admin/onboarding/niche-packs",e)}async updateNichePack(e,n,s){let a=s?{version:s}:void 0;return this.patch(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,n,{params:a})}async publishNichePack(e,n){let s=n?{version:n}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/publish`,void 0,{params:s})}async unpublishNichePack(e,n){let s=n?{version:n}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/unpublish`,void 0,{params:s})}async forkNichePack(e,n={}){return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/fork`,n)}async smokeTestNichePack(e,n={},s){let a=s?{version:s}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/smoke-test`,n,{params:a})}async listOnboardingConfigs(e={}){return this.get("/platform/admin/onboarding/configs",{params:T(e)})}async createOnboardingConfig(e){return this.post("/platform/admin/onboarding/configs",e)}async updateOnboardingConfig(e,n,s){return this.patch(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(n)}`,s)}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:T(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:T(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/analytics/time-on-step",{params:T(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/analytics/abandonment",{params:T(e)})}};function T(r){let e={};for(let[n,s]of Object.entries(r))s!==void 0&&(e[n]=s);return e}var Y=class extends t{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 G=class extends t{async system(){return(await this.get("/health")).data}};var J=class extends t{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 X=class extends t{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 Z=class extends t{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){return(await super.get(`/platform/tenants/persona/${e}/timeline`,{params:n}))?.data??{entries:[],hasMore:!1}}async followups(e){return(await super.get(`/platform/tenants/persona/${e}/followups`))?.data?.entries??[]}};var Je=class extends t{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,s){return this.post(`/platform/admin/clients/${e}/connections/${n}/connect`,s)}async configureProvider(e,n,s){return this.put(`/platform/admin/clients/${e}/connections/${n}/configure`,s)}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,s){return this.put(`/platform/admin/clients/${e}/connections/${n}/access`,s)}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}`)}},Xe=class extends t{async list(){return this.get("/platform/admin/blogs")}},Ze=class extends t{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},ee=class extends t{clients;blogs;globalLeads;constructor(e){super(e),this.clients=new Je(e),this.blogs=new Xe(e),this.globalLeads=new Ze(e)}};var en=class extends t{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"}},ne=class{copilot;constructor(e){this.copilot=new en(e)}};var te=class extends t{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 nn=class extends t{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},tn=class extends t{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)}},rn=class extends t{async listPublic(){return this.get("/platform/billing/plans/public")}},sn=class extends t{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)}},an=class extends t{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")}},on=class extends t{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)}},re=class{entitlements;subscriptions;plans;checkout;user;credits;constructor(e){this.entitlements=new nn(e),this.subscriptions=new tn(e),this.plans=new rn(e),this.checkout=new sn(e),this.user=new an(e),this.credits=new on(e)}};var se=class extends t{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 t{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",{})}},ie=class extends t{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}`)}},oe=class extends t{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 ce=class extends t{async list(e){return this.get("/platform/admin/logs",{params:e})}async export(e){return this.get("/platform/admin/logs/export",{params:e})}};var pe=class extends t{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 le=class extends t{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 de=class extends t{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 ue=class extends t{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 me=class extends t{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 ge=class extends t{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 ye=class extends t{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 he=class extends t{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 fe=class extends t{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 Te=class extends t{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var be=class extends t{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 xe=class extends t{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 we=class extends t{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 Re=class extends t{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 ke=class extends t{async list(e){return this.get(`/platform/admin/integrations/${e}/integrations`)}async connect(e,n,s){return this.post(`/platform/admin/integrations/${e}/integrations/${n}`,s)}async disconnect(e,n){return this.deleteRequest(`/platform/admin/integrations/${e}/integrations/${n}`)}async test(e,n,s){return this.post(`/platform/admin/integrations/${e}/integrations/${n}/test`,s)}async invite(e,n){return this.post(`/platform/admin/integrations/${e}/invite`,n)}};var ve=class extends t{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 Pe=class extends t{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 Ae=class extends t{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var $e=class extends t{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,s){return this.patch(`/platform/admin/leads/${e}/notes/${n}`,s)}async deleteNote(e,n){return this.deleteRequest(`/platform/admin/leads/${e}/notes/${n}`)}};var Ie=class extends t{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 Ce=class extends t{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,s){return this.patch(`/platform/admin/partners/${e}/referrals/${n}`,s)}};var Se=class extends t{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 Oe=class extends t{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 Ee=class extends t{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 Le=class extends t{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 De=class extends t{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 Ne=class extends t{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 qe=class extends t{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 Me=class extends t{async overview(e){return this.get("/platform/admin/health",{params:e})}};var Ue=class extends t{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 _e=class extends t{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 Ve=class extends t{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 Fe=class extends t{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 Be=class extends t{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 cn=class{messages;conversations;broadcasts;constructor(e){this.messages=new E(e),this.conversations=new O(e),this.broadcasts=new S(e)}},pn=class{leads;pipelines;automations;activities;analytics;scoring;payments;sequences;automationDashboard;chat;events;eventLog;invoices;checkout;projects;campaigns;portalInbox;constructor(e){this.leads=new P(e),this.pipelines=new $(e),this.automations=new v(e),this.activities=new w(e),this.analytics=new R(e),this.scoring=new I(e),this.payments=new A(e),this.sequences=new C(e),this.automationDashboard=new k(e),this.chat=new cn(e),this.events=new N(e),this.eventLog=new M(e),this.invoices=new q(e),this.checkout=new D(e),this.projects=new _(e),this.campaigns=new L(e),this.portalInbox=new U(e)}},je=class{erix;constructor(e){this.erix=new pn(e)}},ln=class{config;templates;constructor(e){this.config=new j(e),this.templates=new F(e)}},dn=class{templates;constructor(e){this.templates=new K(e)}},un=class{email;whatsapp;meet;connections;constructor(e){this.email=new ln(e),this.whatsapp=new dn(e),this.meet=new B(e),this.connections=new V(e)}},mn=class{files;folders;media;constructor(e){this.files=new z(e),this.folders=new H(e),this.media=new W(e)}},Ke=class{connect;storage;constructor(e){this.connect=new un(e),this.storage=new mn(e)}},gn=class{onboarding;persona;constructor(e){this.onboarding=new X(e),this.persona=new Z(e)}},yn=class{me;members;sessions;notifications;constructor(e){this.me=new ae(e),this.members=new ie(e),this.sessions=new oe(e),this.notifications=new J(e)}},hn=class{revenue;billing;payments;credits;plans;agencyInvoices;flags;activityLogs;auditLogs;analytics;health;storage;announcements;compliance;tickets;templates;agents;personaHistory;openapi;staff;tenants;whatsapp;laie;laieRuntime;laieVault;flow;email;pipelines;integrations;erix;dashboard;partners;waitlist;blogs;leads;onboarding;cors;clients;constructor(e){this.revenue=new De(e),this.billing=new ge(e),this.payments=new Se(e),this.credits=new fe(e),this.plans=new Le(e),this.agencyInvoices=new pe(e),this.flags=new we(e),this.activityLogs=new ce(e),this.auditLogs=new me(e),this.analytics=new de(e),this.health=new Me(e),this.storage=new qe(e),this.announcements=new ue(e),this.compliance=new he(e),this.tickets=new Ve(e),this.templates=new Ue(e),this.agents=new le(e),this.personaHistory=new Oe(e),this.openapi=new Ie(e),this.staff=new Ne(e),this.tenants=new _e(e),this.whatsapp=new Be(e),this.laie=new ve(e),this.laieRuntime=new Pe(e),this.laieVault=new Ae(e),this.flow=new Re(e),this.email=new be(e),this.pipelines=new Ee(e),this.integrations=new ke(e),this.erix=new xe(e),this.dashboard=new Te(e),this.partners=new Ce(e),this.waitlist=new Fe(e),this.blogs=new ye(e),this.leads=new $e(e),this.onboarding=new Q(e),this.cors=new Y(e),this.clients=new ee(e)}},We=class{auth;users;tenants;billing;support;ai;admin;health;constructor(e){this.auth=new te(e),this.users=new yn(e),this.tenants=new gn(e),this.billing=new re(e),this.support=new se(e),this.ai=new ne(e),this.admin=new hn(e),this.health=new G(e)}};var b=class extends m{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},He=class{async constructEvent(e,n,s){if(!n)throw new b("No webhook signature provided");let a=Array.isArray(n)?n[0]:n;a.startsWith("sha256=")&&(a=a.slice(7));try{let c=await import("crypto"),u=c.createHmac("sha256",s).update(e).digest("hex");if(!c.timingSafeEqual(Buffer.from(u),Buffer.from(a)))throw new b("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(c){throw c instanceof b?c:new b(`Webhook payload parsing failed: ${c.message}`)}}};var fn=typeof process<"u"&&"2.1.2"||"2.0.0";var ze=class{client;socket=null;socketPromise=null;socketQueue=[];clientCode;apiVersion;platform;product;infra;webhooks;constructor(e){if(!e.apiKey)throw new y("API Key is required");this.clientCode=e.clientCode?.toUpperCase(),this.apiVersion=e.version??"v1";let n=e.baseUrl??Qe,s=xn(this.apiVersion,n),a=e.socketUrl||n,c=typeof window<"u"&&typeof window.document<"u",l=c?"browser":typeof process<"u"?`node ${process.version}`:"unknown",u=c?globalThis.navigator?.userAgent||"browser":typeof process<"u"?process.platform:"unknown",d={"x-api-key":e.apiKey,"x-client-code":e.clientCode?.toUpperCase()||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:fn,runtime:l,os:u})};if(e.coreApiKey&&(d["x-core-api-key"]=e.coreApiKey),this.client=An.create({baseURL:s,headers:d}),Tn(this.client,{retries:3,retryDelay:Tn.exponentialDelay,retryCondition:f=>Tn.isNetworkOrIdempotentRequestError(f)||f.response?.status===429,onRetry:(f,kn,bn)=>{typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${f}/3): ${bn.method?.toUpperCase()} ${bn.url}. Reason: ${kn.message}`)}}),this.platform=new We(this.client),this.product=new je(this.client),this.infra=new Ke(this.client),this.webhooks=new He,this.initSocket(a,e.apiKey,e.clientCode),c){let f={version:fn,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=f,window.ecodrix||(window.ecodrix=this)}}initSocket(e,n,s){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:a})=>{this.socket=a(e,{extraHeaders:{"x-api-key":n,"x-client-code":s?.toUpperCase()||""}}),this.setupSocket(s);for(let{type:c,args:l}of this.socketQueue)c==="joinRoom"?this.socket.emit("join-room",l[0]):c==="leaveRoom"?this.socket.emit("leave-room",l[0]):c==="on"?this.socket.on(l[0],l[1]):c==="off"?this.socket.off(l[0],l[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,s,a){try{return(await this.client.request({method:e,url:n,data:s,params:a})).data}catch(c){throw c.response?new m(c.response.data?.message||c.response.data?.error||"Raw Execution Failed",c.response.status,c.response.data?.code):new m(c.message||"Network Error")}}};Cn.config();var wn="2.1.2";var Sn="Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",g=new In;g.name("erix").description(Sn).version(wn);function h(r){let e=r.key||process.env.ECOD_API_KEY,n=r.client||process.env.ECOD_CLIENT_CODE;return e||(console.error(p.red("Error: API Key is missing.")),console.log(p.yellow("Set ECOD_API_KEY environment variable or use --key <key>")),process.exit(1)),new ze({apiKey:e,clientCode:n,baseUrl:r.baseUrl||process.env.ECOD_BASE_URL})}g.option("-k, --key <key>","ECODrIx API Key").option("-c, --client <code...","Tenant Client Code").option("--base-url <url>","API Base URL override");g.command("whoami").description("Verify current authentication and tenant status").action(async(r,e)=>{let n=e.parent.opts(),s=h(n);console.log(p.cyan("Checking connection to ECODrIx Platform..."));try{let a=await s.request("GET","/api/saas/me/profile");console.log(p.green("\u2714 Authenticated successfully!")),console.log(`${p.bold("User ID:")} ${a.id}`),console.log(`${p.bold("Organisation:")} ${a.organisation?.name||"N/A"}`),n.client&&console.log(`${p.bold("Tenant Code:")} ${p.magenta(n.client)}`)}catch(a){console.error(p.red("\u2716 Authentication failed")),console.error(p.dim(a.message)),process.exit(1)}});var On=g.command("whatsapp").description("WhatsApp Business API operations");On.command("send-template").description("Send a WhatsApp template message").argument("<phone>","Recipient phone number").argument("<template>","Template name").option("-v, --vars <json>","Template variables as JSON string","[]").action(async(r,e,n,s)=>{let a=s.parent.parent.opts(),c=h(a);try{let l=JSON.parse(n.vars);console.log(p.cyan(`Sending template '${e}' to ${r}...`));let u=await c.product.erix.chat.messages.sendTemplate({to:r,templateName:e,language:"en_US",variables:l});console.log(p.green("\u2714 Message sent successfully!")),console.log(p.dim(`ID: ${u?.id||"N/A"}`))}catch(l){console.error(p.red("\u2716 Failed to send message")),console.error(p.dim(l.message))}});var Rn=g.command("crm").description("CRM and Lead management");Rn.command("leads").description("List recent leads").option("-l, --limit <number>","Number of leads to fetch","10").option("-s, --status <status>","Filter by lead status").option("-p, --pipeline <id>","Filter by pipeline ID").option("-q, --search <query>","Search by name or email").action(async(r,e)=>{let n=e.parent.parent.opts(),s=h(n);try{let a=Number.parseInt(r.limit);console.log(p.cyan(`Fetching last ${a} leads...`));let c={limit:a};r.status&&(c.status=r.status),r.pipeline&&(c.pipelineId=r.pipeline),r.search&&(c.search=r.search);let l=await s.product.erix.leads.list(c),u=Array.isArray(l.data)?l.data:Array.isArray(l)?l:[];if(u.length===0){console.log(p.yellow("No leads found."));return}console.table(u.map(d=>({ID:d.id||d._id,Name:`${d.firstName} ${d.lastName||""}`.trim(),Phone:d.phone,Status:d.status,Score:d.score||0,Created:new Date(d.createdAt).toLocaleDateString()})))}catch(a){console.error(p.red("\u2716 Failed to fetch leads")),console.error(p.dim(a.message))}});Rn.command("pipelines").description("List all CRM pipelines").action(async(r,e)=>{let n=e.parent.parent.opts(),s=h(n);try{console.log(p.cyan("Fetching pipelines..."));let a=await s.product.erix.pipelines.list(),c=a.data||a||[];if(c.length===0){console.log(p.yellow("No pipelines found."));return}console.table(c.map(l=>({ID:l.id||l._id,Name:l.name,Default:l.isDefault?"Yes":"No",Stages:l.stages?.length||0})))}catch(a){console.error(p.red("\u2716 Failed to fetch pipelines")),console.error(p.dim(a.message))}});var En=g.command("analytics").description("Business Intelligence Analytics");En.command("overview").description("Get high-level CRM KPIs").option("-r, --range <range>","Date range (e.g., 24h, 7d, 30d, 365d)","30d").action(async(r,e)=>{let n=e.parent.parent.opts(),s=h(n);try{console.log(p.cyan(`Fetching overview metrics for last ${r.range}...`));let a=await s.product.erix.analytics.overview({range:r.range}),c=a.data||a;console.log(`
2
+ import At from"repl";import{Command as $t}from"commander";import It from"dotenv";import p from"picocolors";import Pt from"axios";import ft from"axios-retry";var Qe="https://api.ecodrix.com";function bt(r="v1",e=Qe){return`${e.replace(/\/+$/,"")}/${r}/api`}var Ye=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},m=class extends Ye{status;code;constructor(e,t,s){super(e),this.name="APIError",this.status=t,this.code=s}},y=class extends m{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},x=class extends m{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var n=class{constructor(e){this.client=e}client;async post(e,t,s){try{let a=this.buildConfig(s);return(await this.client.post(e,t,a)).data}catch(a){this.handleError(a)}}async get(e,t){try{let s=this.buildConfig(t);return(await this.client.get(e,s)).data}catch(s){this.handleError(s)}}async patch(e,t,s){try{let a=this.buildConfig(s);return(await this.client.patch(e,t,a)).data}catch(a){this.handleError(a)}}async put(e,t,s){try{let a=this.buildConfig(s);return(await this.client.put(e,t,a)).data}catch(a){this.handleError(a)}}async deleteRequest(e,t){try{let s=this.buildConfig(t);return(await this.client.delete(e,s)).data}catch(s){this.handleError(s)}}buildConfig(e){if(!e)return;let t={...e};return e.idempotencyKey&&(t.headers={...t.headers,"Idempotency-Key":e.idempotencyKey}),t}handleError(e){if(e.response){let t=e.response.status,s=e.response.data?.message||e.response.data?.error||"API Request Failed",a=e.response.data?.code;switch(t){case 401:throw new y(s);case 403:throw new y(s);case 429:throw new x(s);default:throw new m(s,t,a)}}throw new m(e.message||"Network Error")}};var Ge=class extends n{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async update(e,t){return this.patch(`/product/erix/crm/notes/${e}`,{content:t})}async pin(e,t=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:t})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},w=class extends n{notes;constructor(e){super(e),this.notes=new Ge(e)}async timeline(e,t){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:t})}async list(e,t){return this.get(`/product/erix/crm/leads/${e}/activities`,{params:{...t}})}async log(e){return this.post(`/product/erix/crm/leads/${e.leadId}/activities`,e)}async logCall(e,t){return this.post(`/product/erix/crm/leads/${e}/calls`,t)}};var R=class extends n{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 k=class extends n{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 v=class extends n{async list(){return this.get("/product/erix/crm/automations")}async create(e){return this.post("/product/erix/crm/automations",e)}async update(e,t){return this.patch(`/product/erix/crm/automations/${e}`,t)}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,t){return this.post(`/product/erix/crm/automations/${e}/test`,{leadId:t})}async getAvailableEvents(){return this.post("/product/erix/crm/events",{})}async enrollments(e,t){return this.get(`/product/erix/crm/${e}/enrollments`,{params:t})}async getEnrollment(e){return this.get(`/product/erix/crm/enrollments/${e}`)}async pauseEnrollment(e,t){return this.post(`/product/erix/crm/${e}/enrollments/${t}/pause`,{})}async resumeEnrollment(e,t){return this.post(`/product/erix/crm/${e}/enrollments/${t}/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,t,s){return this.post("/product/erix/crm/webhook-event",{ruleId:e,eventName:t,payload:s})}async trigger(e){return this.post("/product/erix/events/trigger",e)}};var P=class extends n{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),t=Array.isArray(e.data)?e.data:[],s=[{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}],a=t.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:[...s,...a],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,t=50){let s=[];for(let a=0;a<e.length;a+=t){let l=e.slice(a,a+t).map(d=>this.create(d)),u=await Promise.allSettled(l);for(let d of u)if(d.status==="fulfilled")s.push(d.value);else throw d.reason}return s}async import(e){return this.post("/product/erix/crm/leads/import",{leads:e})}async bulkUpsert(e){return this.import(e)}async list(e){let t={...e};return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}async*listAutoPaging(e){let t=e?.page||1,s=!0;for(;s;){let a=await this.list({...e,page:t}),c=Array.isArray(a.data)?a.data:a||[];if(c.length===0){s=!1;break}for(let l of c)yield l;a.pagination&&t<a.pagination.pages||!a.pagination&&c.length>0?t++:s=!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,t,s={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:s})}async retrieveByRef(e,t){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async update(e,t){return this.patch(`/product/erix/crm/leads/${e}`,t)}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,s){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:s})}async tags(e,t){return this.patch(`/product/erix/crm/leads/${e}/tags`,t)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,t){return this.patch(`/product/erix/crm/leads/${e}/metadata`,t)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,t){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:t})}async createNote(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async updateNote(e,t,s){return this.patch(`/product/erix/crm/notes/${t}`,s)}async deleteNote(e,t){return this.deleteRequest(`/product/erix/crm/notes/${t}`)}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 A=class extends n{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var $=class extends n{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){let t=await this.retrieve(e),s=Array.isArray(t.data?.stages)?t.data.stages:[];return{name:`Pipeline: ${t.data?.name||e}`,fields:s.map(a=>({key:a._id,label:a.name,type:"string",required:!0,options:[{label:a.name,value:a._id}],group:"Stages",uiHints:{color:a.color||"#cbd5e1",probability:a.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,t){return this.patch(`/product/erix/crm/pipelines/${e}`,t)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,t){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{newName:t})}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,t){return this.post(`/product/erix/crm/pipelines/${e}/stages`,t)}async reorderStages(e,t){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:t})}async updateStage(e,t){return this.patch(`/product/erix/crm/stages/${e}`,t)}async deleteStage(e,t){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:t?{moveLeadsToStageId:t}:void 0})}};var I=class extends n{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`,{})}async preview(e){return this.get(`/product/erix/crm/scoring/preview/${e}`)}};var C=class extends n{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 S=class extends n{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,t){return this.patch(`/product/erix/chat/broadcasts/${e}`,t)}async delete(e){return this.deleteRequest(`/product/erix/chat/broadcasts/${e}`)}};var O=class extends n{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,t){return this.get(`/product/erix/chat/conversations/${e}/messages`,{params:t})}async linkLead(e,t,s){return this.post(`/product/erix/chat/conversations/${e}/link-lead`,{leadId:t,leadData:s})}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 E=class extends n{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",{...e,templateLanguage:e.language||e.templateLanguage||"en_US"})}async star(e,t){return this.post(`/product/erix/chat/messages/${e}/star`,{isStarred:t})}async react(e,t){return this.post(`/product/erix/chat/messages/${e}/react`,{reaction:t})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`)}async upload(e){let t=new FormData;return t.append("file",e),this.post("/product/erix/chat/upload",t,{headers:{"Content-Type":"multipart/form-data"}})}};var L=class extends n{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 D=class extends n{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 N=class extends n{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 q=class extends n{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,t){return this.patch(`/product/erix/commerce/invoices/${e}`,t)}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 M=class extends n{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 U=class extends n{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,t){return this.post(`/product/erix/portal-inbox/conversations/${e}/messages`,t)}};var _=class extends n{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents`,t)}async toggleSignature(e,t,s){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:s})}async addSigner(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,s)}async sign(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/sign`,s??{})}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,s)}};var V=class extends n{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,t){return this.post(`/infra/connect/connections/${e}/connect`,t)}async configure(e,t){return this.put(`/infra/connect/connections/${e}/configure`,t)}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,t){return this.put(`/infra/connect/connections/${e}/access`,t)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var F=class extends n{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,t){return this.put(`/infra/connect/email/templates/${e}`,t)}async deleteTemplate(e,t=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:t}})}async previewTemplate(e,t){return this.post(`/infra/connect/email/templates/${e}/preview`,t)}};var B=class extends n{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,t){return this.patch(`/infra/connect/meet/${e}`,t)}async reschedule(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async delete(e){return this.update(e,{status:"cancelled"})}};var j=class extends n{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 K=class extends n{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,t){return this.put(`/infra/connect/whatsapp/templates/${e}`,t)}async deleteTemplate(e,t){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${t?"?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,t){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,t)}async validate(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`)}async preview(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t})}async getVariableManifest(e){let t=await this.retrieve(e),s=Array.isArray(t.data?.components)?t.data.components:[],a=[];for(let c of s)if(c.text){let l=c.text.match(/{{(\d+)}}/g);if(l)for(let u of l){let d=u.replace(/{{|}}/g,"");a.push({key:`var_${d}`,label:`${c.type} Var {{${d}}}`,type:"string",required:!0,group:c.type,description:`Variable placeholder in template ${c.type}`})}}return{name:`Template variables: ${t.data?.name||e}`,fields:a,uiHints:{icon:"Variables",primaryColor:"#059669"}}}async checkUsage(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/usage`)}};import kt from"axios";var W=class extends n{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}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,t){let s=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:a,key:c}=s.data;await kt.put(a,e,{headers:{"Content-Type":t.contentType}});let l=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:c,sizeBytes:l})}};var H=class extends n{async create(e){return this.post("/infra/storage/files/folders",{name:e})}async delete(e){return this.deleteRequest(`/infra/storage/files/folders/${encodeURIComponent(e)}`)}},z=class extends n{async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}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 Q=class extends n{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/niche-packs",{params:T(e)})}async getNichePack(e,t){let s=t?{version:t}:void 0;return this.get(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,{params:s})}async createNichePack(e){return this.post("/platform/admin/onboarding/niche-packs",e)}async updateNichePack(e,t,s){let a=s?{version:s}:void 0;return this.patch(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,t,{params:a})}async publishNichePack(e,t){let s=t?{version:t}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/publish`,void 0,{params:s})}async unpublishNichePack(e,t){let s=t?{version:t}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/unpublish`,void 0,{params:s})}async forkNichePack(e,t={}){return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/fork`,t)}async smokeTestNichePack(e,t={},s){let a=s?{version:s}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/smoke-test`,t,{params:a})}async listOnboardingConfigs(e={}){return this.get("/platform/admin/onboarding/configs",{params:T(e)})}async createOnboardingConfig(e){return this.post("/platform/admin/onboarding/configs",e)}async updateOnboardingConfig(e,t,s){return this.patch(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,s)}async publishOnboardingConfig(e,t){return this.post(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(t)}/publish`)}async listOnboardingExperiments(e={}){return this.get("/platform/admin/onboarding/experiments",{params:T(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,t){return this.patch(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`,t)}async deleteOnboardingExperiment(e){return this.deleteRequest(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async getOnboardingFunnel(e={}){return this.get("/platform/admin/onboarding/analytics/funnel",{params:T(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/analytics/time-on-step",{params:T(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/analytics/abandonment",{params:T(e)})}};function T(r){let e={};for(let[t,s]of Object.entries(r))s!==void 0&&(e[t]=s);return e}var Y=class extends n{async list(){return this.get("/platform/admin/cors")}async create(e){return this.post("/platform/admin/cors",e)}async update(e,t){return this.patch(`/platform/admin/cors/${e}`,t)}async delete(e){return this.deleteRequest(`/platform/admin/cors/${e}`)}};var G=class extends n{async system(){return(await this.get("/health")).data}};var J=class extends n{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 X=class extends n{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 Z=class extends n{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,t){return(await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t}))?.data??{entries:[],hasMore:!1}}async followups(e){return(await super.get(`/platform/tenants/persona/${e}/followups`))?.data?.entries??[]}};var Je=class extends n{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,t){return this.patch(`/platform/admin/clients/${e}/config`,t)}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,t,s){return this.post(`/platform/admin/clients/${e}/connections/${t}/connect`,s)}async configureProvider(e,t,s){return this.put(`/platform/admin/clients/${e}/connections/${t}/configure`,s)}async disconnectProvider(e,t){return this.post(`/platform/admin/clients/${e}/connections/${t}/disconnect`,{})}async revealConnection(e,t){return this.post(`/platform/admin/clients/${e}/connections/${t}/reveal`,{})}async setConnectionAccess(e,t,s){return this.put(`/platform/admin/clients/${e}/connections/${t}/access`,s)}async getDataSource(e){return this.get(`/api/clients/${e}/datasource`)}async manageDataSource(e,t){return this.post(`/api/clients/${e}/datasource`,t)}async updateIdentity(e,t){return this.patch(`/platform/admin/clients/${e}/identity`,t)}async googleReauth(e,t={}){return this.post(`/platform/admin/clients/${e}/google/reauth`,t)}async delete(e){return this.deleteRequest(`/platform/admin/clients/${e}`)}},Xe=class extends n{async list(){return this.get("/platform/admin/blogs")}},Ze=class extends n{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},ee=class extends n{clients;blogs;globalLeads;constructor(e){super(e),this.clients=new Je(e),this.blogs=new Xe(e),this.globalLeads=new Ze(e)}};var et=class extends n{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"}},te=class{copilot;constructor(e){this.copilot=new et(e)}};var ne=class extends n{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,t){return this.post(`/platform/auth/invitations/${e}/accept`,t)}};var tt=class extends n{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},nt=class extends n{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)}},rt=class extends n{async listPublic(){return this.get("/platform/billing/plans/public")}},st=class extends n{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)}},at=class extends n{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")}},it=class extends n{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)}},re=class{entitlements;subscriptions;plans;checkout;user;credits;constructor(e){this.entitlements=new tt(e),this.subscriptions=new nt(e),this.plans=new rt(e),this.checkout=new st(e),this.user=new at(e),this.credits=new it(e)}};var se=class extends n{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,t){return this.post(`/platform/support/tickets/${e}/reply`,t)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}};var ae=class extends n{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",{})}},ie=class extends n{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}`)}},oe=class extends n{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 ce=class extends n{async list(e){return this.get("/platform/admin/logs",{params:e})}async export(e){return this.get("/platform/admin/logs/export",{params:e})}};var pe=class extends n{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,t){return this.patch(`/platform/admin/invoices/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/invoices/${e}`)}};var le=class extends n{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,t){return this.patch(`/platform/admin/agents/${e}`,t)}async runs(e){return this.get(`/platform/admin/agents/${e}/runs`)}};var de=class extends n{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 ue=class extends n{async list(e){return this.get("/platform/admin/comms",{params:e})}async create(e){return this.post("/platform/admin/comms",e)}async update(e,t){return this.patch(`/platform/admin/comms/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/comms/${e}`)}async publish(e,t){return this.post(`/platform/admin/comms/${e}/publish`,t)}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 me=class extends n{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 ge=class extends n{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 ye=class extends n{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,t){return this.put(`/platform/admin/blogs/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/blogs/${e}`)}};var he=class extends n{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,t){return this.patch(`/platform/admin/compliance/requests/${e}`,t)}async exportOrg(e,t){return this.post(`/platform/admin/compliance/export/${e}`,t)}};var fe=class extends n{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,t){return this.patch(`/platform/admin/credits/packs/${e}`,t)}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,t){return this.post(`/platform/admin/credits/wallet/${e}/adjust`,t)}};var Te=class extends n{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var be=class extends n{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 xe=class extends n{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,t){return this.patch(`/platform/admin/erix/tenants/${e}/plan`,t)}async suspend(e,t){return this.post(`/platform/admin/erix/tenants/${e}/suspend`,t)}async reactivate(e,t){return this.post(`/platform/admin/erix/tenants/${e}/reactivate`,t)}async rotateKey(e,t){return this.post(`/platform/admin/erix/tenants/${e}/rotate-key`,t)}async usage(e){return this.get(`/platform/admin/erix/tenants/${e}/usage`)}};var we=class extends n{async list(e){return this.get("/platform/admin/flags",{params:e})}async create(e){return this.post("/platform/admin/flags",e)}async update(e,t){return this.patch(`/platform/admin/flags/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/flags/${e}`)}async listOverrides(e){return this.get(`/platform/admin/flags/${e}/overrides`)}async addOverride(e,t){return this.post(`/platform/admin/flags/${e}/overrides`,t)}async removeOverride(e,t){return this.deleteRequest(`/platform/admin/flags/${e}/overrides/${t}`)}async forOrg(e){return this.get(`/platform/admin/flags/org/${e}`)}};var Re=class extends n{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,t){return this.post(`/platform/admin/flow/runs/${e}/retry`,t)}};var ke=class extends n{async list(e){return this.get(`/platform/admin/integrations/${e}/integrations`)}async connect(e,t,s){return this.post(`/platform/admin/integrations/${e}/integrations/${t}`,s)}async disconnect(e,t){return this.deleteRequest(`/platform/admin/integrations/${e}/integrations/${t}`)}async test(e,t,s){return this.post(`/platform/admin/integrations/${e}/integrations/${t}/test`,s)}async invite(e,t){return this.post(`/platform/admin/integrations/${e}/invite`,t)}};var ve=class extends n{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,t){return this.post(`/platform/admin/laie/actors/${e}/run`,t)}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 Pe=class extends n{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 Ae=class extends n{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var $e=class extends n{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,t){return this.patch(`/platform/admin/leads/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/leads/${e}`)}async updateStatus(e,t){return this.patch(`/platform/admin/leads/${e}/status`,t)}async qualification(e,t){return this.post(`/platform/admin/leads/${e}/qualification`,t)}async firstContact(e,t){return this.post(`/platform/admin/leads/${e}/first-contact`,t)}async followup(e,t){return this.post(`/platform/admin/leads/${e}/followup`,t)}async notes(e){return this.get(`/platform/admin/leads/${e}/notes`)}async addNote(e,t){return this.post(`/platform/admin/leads/${e}/notes`,t)}async updateNote(e,t,s){return this.patch(`/platform/admin/leads/${e}/notes/${t}`,s)}async deleteNote(e,t){return this.deleteRequest(`/platform/admin/leads/${e}/notes/${t}`)}};var Ie=class extends n{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 Ce=class extends n{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,t){return this.patch(`/platform/admin/partners/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/partners/${e}`)}async referrals(e){return this.get(`/platform/admin/partners/${e}/referrals`)}async updateReferral(e,t,s){return this.patch(`/platform/admin/partners/${e}/referrals/${t}`,s)}};var Se=class extends n{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,t){return this.post(`/platform/admin/payments/retry/${e}`,t)}async timeline(e){return this.get(`/platform/admin/payments/timeline/${e}`)}async risk(e){return this.get(`/platform/admin/payments/risk/${e}`)}};var Oe=class extends n{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,t){return this.get(`/platform/admin/persona-history/${e}/${t}`)}};var Ee=class extends n{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,t){return this.patch(`/platform/admin/pipelines/templates/${e}`,t)}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 Le=class extends n{async list(e){return this.get("/platform/admin/plans",{params:e})}async create(e){return this.post("/platform/admin/plans",e)}async update(e,t){return this.patch(`/platform/admin/plans/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/plans/${e}`)}async tenants(e){return this.get(`/platform/admin/plans/${e}/tenants`)}};var De=class extends n{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 Ne=class extends n{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,t){return this.patch(`/platform/admin/auth/staff/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/auth/staff/${e}`)}};var qe=class extends n{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 Me=class extends n{async overview(e){return this.get("/platform/admin/health",{params:e})}};var Ue=class extends n{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,t){return this.patch(`/platform/admin/templates/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/templates/${e}`)}async clone(e,t){return this.post(`/platform/admin/templates/${e}/clone`,t)}async versions(e){return this.get(`/platform/admin/templates/${e}/versions`)}async assignPlans(e,t){return this.post(`/platform/admin/templates/${e}/plans`,t)}};var _e=class extends n{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,t){return this.post(`/platform/admin/tenants/${e}/impersonate`,t)}async suspend(e,t){return this.post(`/platform/admin/tenants/${e}/suspend`,t)}async reactivate(e,t){return this.post(`/platform/admin/tenants/${e}/reactivate`,t)}async updatePlan(e,t){return this.patch(`/platform/admin/tenants/${e}/plan`,t)}async updateLimits(e,t){return this.patch(`/platform/admin/tenants/${e}/limits`,t)}async bulkAssignPlan(e){return this.post("/platform/admin/tenants/bulk-assign-plan",e)}async unassigned(){return this.get("/platform/admin/tenants/unassigned")}};var Ve=class extends n{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,t){return this.patch(`/platform/admin/tickets/${e}`,t)}async addMessage(e,t){return this.post(`/platform/admin/tickets/${e}/messages`,t)}async resolve(e,t){return this.post(`/platform/admin/tickets/${e}/resolve`,t)}async close(e,t){return this.post(`/platform/admin/tickets/${e}/close`,t)}};var Fe=class extends n{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,t){return this.patch(`/platform/admin/waitlist/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/waitlist/${e}`)}async bulk(e){return this.post("/platform/admin/waitlist/bulk",e)}};var Be=class extends n{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 ot=class{messages;conversations;broadcasts;constructor(e){this.messages=new E(e),this.conversations=new O(e),this.broadcasts=new S(e)}},ct=class{leads;pipelines;automations;activities;analytics;scoring;payments;sequences;automationDashboard;chat;events;eventLog;invoices;checkout;projects;campaigns;portalInbox;constructor(e){this.leads=new P(e),this.pipelines=new $(e),this.automations=new v(e),this.activities=new w(e),this.analytics=new R(e),this.scoring=new I(e),this.payments=new A(e),this.sequences=new C(e),this.automationDashboard=new k(e),this.chat=new ot(e),this.events=new N(e),this.eventLog=new M(e),this.invoices=new q(e),this.checkout=new D(e),this.projects=new _(e),this.campaigns=new L(e),this.portalInbox=new U(e)}},je=class{erix;constructor(e){this.erix=new ct(e)}},pt=class{config;templates;constructor(e){this.config=new j(e),this.templates=new F(e)}},lt=class{templates;constructor(e){this.templates=new K(e)}},dt=class{email;whatsapp;meet;connections;constructor(e){this.email=new pt(e),this.whatsapp=new lt(e),this.meet=new B(e),this.connections=new V(e)}},ut=class{files;folders;media;constructor(e){this.files=new z(e),this.folders=new H(e),this.media=new W(e)}},Ke=class{connect;storage;constructor(e){this.connect=new dt(e),this.storage=new ut(e)}},mt=class{onboarding;persona;constructor(e){this.onboarding=new X(e),this.persona=new Z(e)}},gt=class{me;members;sessions;notifications;constructor(e){this.me=new ae(e),this.members=new ie(e),this.sessions=new oe(e),this.notifications=new J(e)}},yt=class{revenue;billing;payments;credits;plans;agencyInvoices;flags;activityLogs;auditLogs;analytics;health;storage;announcements;compliance;tickets;templates;agents;personaHistory;openapi;staff;tenants;whatsapp;laie;laieRuntime;laieVault;flow;email;pipelines;integrations;erix;dashboard;partners;waitlist;blogs;leads;onboarding;cors;clients;constructor(e){this.revenue=new De(e),this.billing=new ge(e),this.payments=new Se(e),this.credits=new fe(e),this.plans=new Le(e),this.agencyInvoices=new pe(e),this.flags=new we(e),this.activityLogs=new ce(e),this.auditLogs=new me(e),this.analytics=new de(e),this.health=new Me(e),this.storage=new qe(e),this.announcements=new ue(e),this.compliance=new he(e),this.tickets=new Ve(e),this.templates=new Ue(e),this.agents=new le(e),this.personaHistory=new Oe(e),this.openapi=new Ie(e),this.staff=new Ne(e),this.tenants=new _e(e),this.whatsapp=new Be(e),this.laie=new ve(e),this.laieRuntime=new Pe(e),this.laieVault=new Ae(e),this.flow=new Re(e),this.email=new be(e),this.pipelines=new Ee(e),this.integrations=new ke(e),this.erix=new xe(e),this.dashboard=new Te(e),this.partners=new Ce(e),this.waitlist=new Fe(e),this.blogs=new ye(e),this.leads=new $e(e),this.onboarding=new Q(e),this.cors=new Y(e),this.clients=new ee(e)}},We=class{auth;users;tenants;billing;support;ai;admin;health;constructor(e){this.auth=new ne(e),this.users=new gt(e),this.tenants=new mt(e),this.billing=new re(e),this.support=new se(e),this.ai=new te(e),this.admin=new yt(e),this.health=new G(e)}};var b=class extends m{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},He=class{async constructEvent(e,t,s){if(!t)throw new b("No webhook signature provided");let a=Array.isArray(t)?t[0]:t;a.startsWith("sha256=")&&(a=a.slice(7));try{let c=await import("crypto"),u=c.createHmac("sha256",s).update(e).digest("hex");if(!c.timingSafeEqual(Buffer.from(u),Buffer.from(a)))throw new b("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(c){throw c instanceof b?c:new b(`Webhook payload parsing failed: ${c.message}`)}}};var ht=typeof process<"u"&&"2.1.3"||"2.0.0";var ze=class{client;socket=null;socketPromise=null;socketQueue=[];clientCode;apiVersion;platform;product;infra;webhooks;constructor(e){if(!e.apiKey)throw new y("API Key is required");this.clientCode=e.clientCode?.toUpperCase(),this.apiVersion=e.version??"v1";let t=e.baseUrl??Qe,s=bt(this.apiVersion,t),a=e.socketUrl||t,c=typeof window<"u"&&typeof window.document<"u",l=c?"browser":typeof process<"u"?`node ${process.version}`:"unknown",u=c?globalThis.navigator?.userAgent||"browser":typeof process<"u"?process.platform:"unknown",d={"x-api-key":e.apiKey,"x-client-code":e.clientCode?.toUpperCase()||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:ht,runtime:l,os:u})};if(e.coreApiKey&&(d["x-core-api-key"]=e.coreApiKey),this.client=Pt.create({baseURL:s,headers:d,timeout:e.timeout??3e4}),ft(this.client,{retries:3,retryDelay:ft.exponentialDelay,retryCondition:f=>ft.isNetworkOrIdempotentRequestError(f)||f.response?.status===429,onRetry:(f,Rt,Tt)=>{typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${f}/3): ${Tt.method?.toUpperCase()} ${Tt.url}. Reason: ${Rt.message}`)}}),this.platform=new We(this.client),this.product=new je(this.client),this.infra=new Ke(this.client),this.webhooks=new He,this.initSocket(a,e.apiKey,e.clientCode),c){let f={version:ht,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=f,window.ecodrix||(window.ecodrix=this)}}initSocket(e,t,s){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:a})=>{this.socket=a(e,{extraHeaders:{"x-api-key":t,"x-client-code":s?.toUpperCase()||""}}),this.setupSocket(s);for(let{type:c,args:l}of this.socketQueue)c==="joinRoom"?this.socket.emit("join-room",l[0]):c==="leaveRoom"?this.socket.emit("leave-room",l[0]):c==="on"?this.socket.on(l[0],l[1]):c==="off"?this.socket.off(l[0],l[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,t){return this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.socket?this.socket.disconnect():this.socketQueue.push({type:"disconnect",args:[]})}off(e,t){return this.socket?this.socket.off(e,t):this.socketQueue.push({type:"off",args:[e,t]}),this}async request(e,t,s,a){try{return(await this.client.request({method:e,url:t,data:s,params:a})).data}catch(c){throw c.response?new m(c.response.data?.message||c.response.data?.error||"Raw Execution Failed",c.response.status,c.response.data?.code):new m(c.message||"Network Error")}}};It.config();var xt="2.1.3";var Ct="Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",g=new $t;g.name("erix").description(Ct).version(xt);function h(r){let e=r.key||process.env.ECOD_API_KEY,t=r.client||process.env.ECOD_CLIENT_CODE;return e||(console.error(p.red("Error: API Key is missing.")),console.log(p.yellow("Set ECOD_API_KEY environment variable or use --key <key>")),process.exit(1)),new ze({apiKey:e,clientCode:t,baseUrl:r.baseUrl||process.env.ECOD_BASE_URL})}g.option("-k, --key <key>","ECODrIx API Key").option("-c, --client <code...","Tenant Client Code").option("--base-url <url>","API Base URL override");g.command("whoami").description("Verify current authentication and tenant status").action(async(r,e)=>{let t=e.parent.opts(),s=h(t);console.log(p.cyan("Checking connection to ECODrIx Platform..."));try{let a=await s.request("GET","/api/saas/me/profile");console.log(p.green("\u2714 Authenticated successfully!")),console.log(`${p.bold("User ID:")} ${a.id}`),console.log(`${p.bold("Organisation:")} ${a.organisation?.name||"N/A"}`),t.client&&console.log(`${p.bold("Tenant Code:")} ${p.magenta(t.client)}`)}catch(a){console.error(p.red("\u2716 Authentication failed")),console.error(p.dim(a.message)),process.exit(1)}});var St=g.command("whatsapp").description("WhatsApp Business API operations");St.command("send-template").description("Send a WhatsApp template message").argument("<phone>","Recipient phone number").argument("<template>","Template name").option("-v, --vars <json>","Template variables as JSON string","[]").action(async(r,e,t,s)=>{let a=s.parent.parent.opts(),c=h(a);try{let l=JSON.parse(t.vars);console.log(p.cyan(`Sending template '${e}' to ${r}...`));let u=await c.product.erix.chat.messages.sendTemplate({to:r,templateName:e,language:"en_US",variables:l});console.log(p.green("\u2714 Message sent successfully!")),console.log(p.dim(`ID: ${u?.id||"N/A"}`))}catch(l){console.error(p.red("\u2716 Failed to send message")),console.error(p.dim(l.message))}});var wt=g.command("crm").description("CRM and Lead management");wt.command("leads").description("List recent leads").option("-l, --limit <number>","Number of leads to fetch","10").option("-s, --status <status>","Filter by lead status").option("-p, --pipeline <id>","Filter by pipeline ID").option("-q, --search <query>","Search by name or email").action(async(r,e)=>{let t=e.parent.parent.opts(),s=h(t);try{let a=Number.parseInt(r.limit);console.log(p.cyan(`Fetching last ${a} leads...`));let c={limit:a};r.status&&(c.status=r.status),r.pipeline&&(c.pipelineId=r.pipeline),r.search&&(c.search=r.search);let l=await s.product.erix.leads.list(c),u=Array.isArray(l.data)?l.data:Array.isArray(l)?l:[];if(u.length===0){console.log(p.yellow("No leads found."));return}console.table(u.map(d=>({ID:d.id||d._id,Name:`${d.firstName} ${d.lastName||""}`.trim(),Phone:d.phone,Status:d.status,Score:d.score||0,Created:new Date(d.createdAt).toLocaleDateString()})))}catch(a){console.error(p.red("\u2716 Failed to fetch leads")),console.error(p.dim(a.message))}});wt.command("pipelines").description("List all CRM pipelines").action(async(r,e)=>{let t=e.parent.parent.opts(),s=h(t);try{console.log(p.cyan("Fetching pipelines..."));let a=await s.product.erix.pipelines.list(),c=a.data||a||[];if(c.length===0){console.log(p.yellow("No pipelines found."));return}console.table(c.map(l=>({ID:l.id||l._id,Name:l.name,Default:l.isDefault?"Yes":"No",Stages:l.stages?.length||0})))}catch(a){console.error(p.red("\u2716 Failed to fetch pipelines")),console.error(p.dim(a.message))}});var Ot=g.command("analytics").description("Business Intelligence Analytics");Ot.command("overview").description("Get high-level CRM KPIs").option("-r, --range <range>","Date range (e.g., 24h, 7d, 30d, 365d)","30d").action(async(r,e)=>{let t=e.parent.parent.opts(),s=h(t);try{console.log(p.cyan(`Fetching overview metrics for last ${r.range}...`));let a=await s.product.erix.analytics.overview({range:r.range}),c=a.data||a;console.log(`
3
3
  ${p.bold("OVERVIEW KPIs:")}`),console.log(`Total Leads: ${p.green(c.totalLeads||0)}`),console.log(`Open Value: ${p.yellow(`$${(c.openValue||0).toLocaleString()}`)}`),console.log(`Won Revenue: ${p.green(`$${(c.wonRevenue||0).toLocaleString()}`)}`),console.log(`Avg Score: ${p.blue(c.avgScore?.toFixed(1)||0)}`),console.log(`Conversion: ${p.magenta(`${(c.conversionRate||0).toFixed(2)}%`)}
4
- `)}catch(a){console.error(p.red("\u2716 Failed to fetch analytics overview")),console.error(p.dim(a.message))}});var Ln=g.command("webhooks").description("Webhook utility tools");Ln.command("verify").description("Verify a cryptographic webhook signature").argument("<payload>","The raw request body string").argument("<signature>","The 'x-ecodrix-signature' header value").argument("<secret>","Your webhook signing secret").action(async(r,e,n,s,a)=>{let c=a.parent.parent.opts(),l=h(c);try{await l.webhooks.constructEvent(r,e,n),console.log(p.green("\u2714 Signature is VALID"))}catch(u){console.error(p.red("\u2716 Error during verification")),console.error(p.dim(u.message))}});g.command("shell").alias("repl").description("Start an interactive SDK shell").action(async(r,e)=>{let n=e.parent.opts(),s=h(n);console.log(p.magenta(p.bold(`
5
- Welcome to the Erix Interactive Shell`))),console.log(p.dim(`SDK Version: ${wn}`)),console.log(p.dim(`The 'ecod' client is pre-initialized and ready.
6
- `));let a=$n.start({prompt:p.cyan("erix > "),useColors:!0});a.context.ecod=s,a.context.platform=s.platform,a.context.product=s.product,a.context.infra=s.infra,a.on("exit",()=>{console.log(p.yellow(`
4
+ `)}catch(a){console.error(p.red("\u2716 Failed to fetch analytics overview")),console.error(p.dim(a.message))}});var Et=g.command("webhooks").description("Webhook utility tools");Et.command("verify").description("Verify a cryptographic webhook signature").argument("<payload>","The raw request body string").argument("<signature>","The 'x-ecodrix-signature' header value").argument("<secret>","Your webhook signing secret").action(async(r,e,t,s,a)=>{let c=a.parent.parent.opts(),l=h(c);try{await l.webhooks.constructEvent(r,e,t),console.log(p.green("\u2714 Signature is VALID"))}catch(u){console.error(p.red("\u2716 Error during verification")),console.error(p.dim(u.message))}});g.command("shell").alias("repl").description("Start an interactive SDK shell").action(async(r,e)=>{let t=e.parent.opts(),s=h(t);console.log(p.magenta(p.bold(`
5
+ Welcome to the Erix Interactive Shell`))),console.log(p.dim(`SDK Version: ${xt}`)),console.log(p.dim(`The 'ecod' client is pre-initialized and ready.
6
+ `));let a=At.start({prompt:p.cyan("erix > "),useColors:!0});a.context.ecod=s,a.context.platform=s.platform,a.context.product=s.product,a.context.infra=s.infra,a.on("exit",()=>{console.log(p.yellow(`
7
7
  Goodbye!`)),process.exit(0)})});g.command("completion").description("Generate Bash auto-completion script").action(()=>{console.log(`
8
8
  # Erix Bash Completion
9
9
  _erix_completions() {
@@ -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 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});
1
+ "use strict";var Vn=Object.create;var L=Object.defineProperty,jn=Object.defineProperties,Wn=Object.getOwnPropertyDescriptor,Hn=Object.getOwnPropertyDescriptors,Kn=Object.getOwnPropertyNames,Ln=Object.getOwnPropertySymbols,zn=Object.getPrototypeOf,Dn=Object.prototype.hasOwnProperty,Qn=Object.prototype.propertyIsEnumerable;var Gn=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var mn=(t,e,n)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T=(t,e)=>{for(var n in e||(e={}))Dn.call(e,n)&&mn(t,n,e[n]);if(Ln)for(var n of Ln(e))Qn.call(e,n)&&mn(t,n,e[n]);return t},P=(t,e)=>jn(t,Hn(e));var Yn=(t,e)=>{for(var n in e)L(t,n,{get:e[n],enumerable:!0})},qn=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Kn(e))!Dn.call(t,o)&&o!==n&&L(t,o,{get:()=>e[o],enumerable:!(a=Wn(e,o))||a.enumerable});return t};var D=(t,e,n)=>(n=t!=null?Vn(zn(t)):{},qn(e||!t||!t.__esModule?L(n,"default",{value:t,enumerable:!0}):n,t)),Jn=t=>qn(L({},"__esModule",{value:!0}),t);var s=(t,e,n)=>mn(t,typeof e!="symbol"?e+"":e,n);var yn=function(t,e){this[0]=t,this[1]=e},Nn=(t,e,n)=>{var a=(l,d,f,y)=>{try{var b=n[l](d),x=(d=b.value)instanceof yn,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[Gn("asyncIterator")]=()=>p,o("next"),o("throw"),o("return"),p};var st={};Yn(st,{APIError:()=>u,AdminOnboarding:()=>A,AuthenticationError:()=>m,ConnectInfra:()=>B,ECODrIx:()=>w,ECODrIxAPI:()=>w,ERROR_RETRY_CONFIG:()=>$n,EcodrixError:()=>H,EmailConnect:()=>F,ErixChat:()=>q,ErixProduct:()=>N,HTTP_STATUS_ERROR_MAP:()=>_n,InfraDomain:()=>O,LEAD_STATUS_VALUES:()=>Un,Onboarding:()=>C,Persona:()=>I,PlatformAdmin:()=>j,PlatformDomain:()=>S,PlatformTenants:()=>_,PlatformUsers:()=>V,ProductDomain:()=>$,RateLimitError:()=>h,StorageInfra:()=>M,WhatsAppConnect:()=>U,default:()=>rt,getErrorDetails:()=>nt,getRetryConfig:()=>tt,handleAPIError:()=>Zn,isAPIError:()=>et});module.exports=Jn(st);var Mn=D(require("axios"),1),gn=D(require("axios-retry"),1);var fn="https://api.ecodrix.com";function Fn(t="v1",e=fn){return`${e.replace(/\/+$/,"")}/${t}/api`}var H=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},u=class extends H{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=P(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 hn=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}`)}},K=class extends r{constructor(n){super(n);s(this,"notes");this.notes=new hn(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 z=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 Q=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 G=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 Un=["open","won","lost","archived"],Y=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 Nn(this,null,function*(){let n=(e==null?void 0:e.page)||1,a=!0;for(;a;){let o=yield new yn(this.list(P(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 J=class extends r{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var X=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 Z=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`,{})}async preview(e){return this.get(`/product/erix/crm/scoring/preview/${e}`)}};var ee=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 ne=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 te=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 re=class extends r{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",P(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 se=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 ae=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 ie=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 oe=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 ce=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 pe=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 de=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 le=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 ue=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 me=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 ye=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 Bn=D(require("axios"),1);var fe=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 Bn.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 he=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)}`)}},Te=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 A=class extends r{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/niche-packs",{params:v(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:v(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:v(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:v(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/analytics/time-on-step",{params:v(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/analytics/abandonment",{params:v(e)})}};function v(t){let e={};for(let[n,a]of Object.entries(t))a!==void 0&&(e[n]=a);return e}var be=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 xe=class extends r{async system(){return(await this.get("/health")).data}};var we=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 C=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 I=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 Tn=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}`)}},bn=class extends r{async list(){return this.get("/platform/admin/blogs")}},xn=class extends r{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},Re=class extends r{constructor(n){super(n);s(this,"clients");s(this,"blogs");s(this,"globalLeads");this.clients=new Tn(n),this.blogs=new bn(n),this.globalLeads=new xn(n)}};var wn=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"}},ke=class{constructor(e){s(this,"copilot");this.copilot=new wn(e)}};var Pe=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 Rn=class extends r{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},kn=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)}},Pn=class extends r{async listPublic(){return this.get("/platform/billing/plans/public")}},vn=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)}},An=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")}},Cn=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)}},ve=class{constructor(e){s(this,"entitlements");s(this,"subscriptions");s(this,"plans");s(this,"checkout");s(this,"user");s(this,"credits");this.entitlements=new Rn(e),this.subscriptions=new kn(e),this.plans=new Pn(e),this.checkout=new vn(e),this.user=new An(e),this.credits=new Cn(e)}};var Ae=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 Ce=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",{})}},Ie=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}`)}},$e=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 Oe=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 Se=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 Ee=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 Le=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 De=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 qe=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 Ne=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 Fe=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 Ue=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 Be=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 Me=class extends r{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var _e=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 Ve=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 je=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 We=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 He=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 Ke=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 ze=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 Qe=class extends r{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var Ge=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 Ye=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 Je=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 Xe=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 Ze=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 en=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 nn=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 tn=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 rn=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 sn=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 an=class extends r{async overview(e){return this.get("/platform/admin/health",{params:e})}};var on=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 cn=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 pn=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 dn=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 ln=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 q=class{constructor(e){s(this,"messages");s(this,"conversations");s(this,"broadcasts");this.messages=new re(e),this.conversations=new te(e),this.broadcasts=new ne(e)}},N=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 Y(e),this.pipelines=new X(e),this.automations=new G(e),this.activities=new K(e),this.analytics=new z(e),this.scoring=new Z(e),this.payments=new J(e),this.sequences=new ee(e),this.automationDashboard=new Q(e),this.chat=new q(e),this.events=new ie(e),this.eventLog=new ce(e),this.invoices=new oe(e),this.checkout=new ae(e),this.projects=new de(e),this.campaigns=new se(e),this.portalInbox=new pe(e)}},$=class{constructor(e){s(this,"erix");this.erix=new N(e)}},F=class{constructor(e){s(this,"config");s(this,"templates");this.config=new me(e),this.templates=new ue(e)}},U=class{constructor(e){s(this,"templates");this.templates=new ye(e)}},B=class{constructor(e){s(this,"email");s(this,"whatsapp");s(this,"meet");s(this,"connections");this.email=new F(e),this.whatsapp=new U(e),this.meet=new ge(e),this.connections=new le(e)}},M=class{constructor(e){s(this,"files");s(this,"folders");s(this,"media");this.files=new Te(e),this.folders=new he(e),this.media=new fe(e)}},O=class{constructor(e){s(this,"connect");s(this,"storage");this.connect=new B(e),this.storage=new M(e)}},_=class{constructor(e){s(this,"onboarding");s(this,"persona");this.onboarding=new C(e),this.persona=new I(e)}},V=class{constructor(e){s(this,"me");s(this,"members");s(this,"sessions");s(this,"notifications");this.me=new Ce(e),this.members=new Ie(e),this.sessions=new $e(e),this.notifications=new we(e)}},j=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 tn(e),this.billing=new Ne(e),this.payments=new Xe(e),this.credits=new Be(e),this.plans=new nn(e),this.agencyInvoices=new Se(e),this.flags=new je(e),this.activityLogs=new Oe(e),this.auditLogs=new qe(e),this.analytics=new Le(e),this.health=new an(e),this.storage=new sn(e),this.announcements=new De(e),this.compliance=new Ue(e),this.tickets=new pn(e),this.templates=new on(e),this.agents=new Ee(e),this.personaHistory=new Ze(e),this.openapi=new Ye(e),this.staff=new rn(e),this.tenants=new cn(e),this.whatsapp=new ln(e),this.laie=new Ke(e),this.laieRuntime=new ze(e),this.laieVault=new Qe(e),this.flow=new We(e),this.email=new _e(e),this.pipelines=new en(e),this.integrations=new He(e),this.erix=new Ve(e),this.dashboard=new Me(e),this.partners=new Je(e),this.waitlist=new dn(e),this.blogs=new Fe(e),this.leads=new Ge(e),this.onboarding=new A(e),this.cors=new be(e),this.clients=new Re(e)}},S=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 Pe(e),this.users=new V(e),this.tenants=new _(e),this.billing=new ve(e),this.support=new Ae(e),this.ai=new ke(e),this.admin=new j(e),this.health=new xe(e)}};var E=class extends u{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},un=class{async constructEvent(e,n,a){if(!n)throw new E("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 E("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(c){throw c instanceof E?c:new E(`Webhook payload parsing failed: ${c.message}`)}}};var In=typeof process!="undefined"&&"2.1.3"||"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,g;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:fn,a=Fn(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:In,runtime:p,os:l})};if(e.coreApiKey&&(d["x-core-api-key"]=e.coreApiKey),this.client=Mn.default.create({baseURL:a,headers:d,timeout:(g=e.timeout)!=null?g:3e4}),(0,gn.default)(this.client,{retries:3,retryDelay:gn.default.exponentialDelay,retryCondition:k=>{var W;return gn.default.isNetworkOrIdempotentRequestError(k)||((W=k.response)==null?void 0:W.status)===429},onRetry:(k,W,On)=>{var Sn,En;typeof process!="undefined"&&((Sn=process.env)==null?void 0:Sn.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${k}/3): ${(En=On.method)==null?void 0:En.toUpperCase()} ${On.url}. Reason: ${W.message}`)}}),this.platform=new S(this.client),this.product=new $(this.client),this.infra=new O(this.client),this.webhooks=new un,this.initSocket(o,e.apiKey,e.clientCode),c){let k={version:In,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=k,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 _n={401:m,403:m,429:h};function Zn(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=_n[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 et(t,e){return t instanceof e}function nt(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 $n={[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 tt(t){let e=t.constructor.name;return $n[e]||$n[u.name]}var rt=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});
@@ -1073,6 +1073,12 @@ declare class Pipelines extends APIResource {
1073
1073
  deleteStage(stageId: string, moveLeadsToStageId?: string): Promise<unknown>;
1074
1074
  }
1075
1075
 
1076
+ /** Optional time-decay: leads lose points once idle past `afterDays`. */
1077
+ interface ScoreDecay {
1078
+ enabled: boolean;
1079
+ afterDays: number;
1080
+ pointsPerDay: number;
1081
+ }
1076
1082
  interface ScoringConfig {
1077
1083
  /** Scoring rules — each rule adds/subtracts points based on field conditions. */
1078
1084
  rules: any[];
@@ -1091,6 +1097,8 @@ interface ScoringConfig {
1091
1097
  * @example ["lead_created", "appointment_booked"]
1092
1098
  */
1093
1099
  recalculateOnTriggers?: string[];
1100
+ /** Optional time-decay for idle leads. */
1101
+ decay?: ScoreDecay;
1094
1102
  }
1095
1103
  declare class Scoring extends APIResource {
1096
1104
  /**
@@ -1118,6 +1126,13 @@ declare class Scoring extends APIResource {
1118
1126
  * ```
1119
1127
  */
1120
1128
  recalculate<T = any>(leadId: string): Promise<T>;
1129
+ /**
1130
+ * Preview a lead's score + per-rule breakdown WITHOUT persisting it.
1131
+ * Powers the scoring config "why this lead scores X" panel.
1132
+ *
1133
+ * @param leadId - The unique ID of the lead to evaluate.
1134
+ */
1135
+ preview<T = any>(leadId: string): Promise<T>;
1121
1136
  }
1122
1137
 
1123
1138
  declare class Sequences extends APIResource {
@@ -6741,6 +6756,12 @@ interface ECODrIxAPIOptions {
6741
6756
  * never set this and never pass a URL.
6742
6757
  */
6743
6758
  baseUrl?: string;
6759
+ /**
6760
+ * Per-request timeout in milliseconds. A request that gets no response
6761
+ * within this window is aborted and rejected (rather than hanging the
6762
+ * caller forever). Defaults to 30000 (30s). Set 0 to disable.
6763
+ */
6764
+ timeout?: number;
6744
6765
  }
6745
6766
  /**
6746
6767
  * The primary entry point for the ECODrIx SDK.
@@ -1 +1 @@
1
- var St=Object.defineProperty,Et=Object.defineProperties;var Lt=Object.getOwnPropertyDescriptors;var It=Object.getOwnPropertySymbols;var qt=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable;var Dt=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r);var ot=(r,e,t)=>e in r?St(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e)=>{for(var t in e||(e={}))qt.call(e,t)&&ot(r,t,e[t]);if(It)for(var t of It(e))Nt.call(e,t)&&ot(r,t,e[t]);return r},w=(r,e)=>Et(r,Lt(e));var s=(r,e,t)=>ot(r,typeof e!="symbol"?e+"":e,t);var ct=function(r,e){this[0]=r,this[1]=e},$t=(r,e,t)=>{var a=(d,p,y,g)=>{try{var T=t[d](p),b=(p=T.value)instanceof ct,x=T.done;Promise.resolve(b?p[0]:p).then(u=>b?a(d==="return"?d:"next",p[1]?{done:u.done,value:u.value}:u,y,g):y({value:u,done:x})).catch(u=>a("throw",u,y,g))}catch(u){g(u)}},i=(d,p,y,g)=>c[d]=T=>(p=new Promise((b,x,u)=>(u=()=>a(d,T,b,x),o?o.then(u):u())),g=()=>o===y&&(o=0),o=y=p.then(g,g),p),o,c={};return t=t.apply(r,e),c[Dt("asyncIterator")]=()=>c,i("next"),i("throw"),i("return"),c};import Ft from"axios";import kt from"axios-retry";var pt="https://api.ecodrix.com";function Ct(r="v1",e=pt){return`${e.replace(/\/+$/,"")}/${r}/api`}var dt=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},l=class extends dt{constructor(t,a,i){super(t);s(this,"status");s(this,"code");this.name="APIError",this.status=a,this.code=i}},m=class extends l{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},f=class extends l{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var n=class{constructor(e){s(this,"client",e)}async post(e,t,a){try{let i=this.buildConfig(a);return(await this.client.post(e,t,i)).data}catch(i){this.handleError(i)}}async get(e,t){try{let a=this.buildConfig(t);return(await this.client.get(e,a)).data}catch(a){this.handleError(a)}}async patch(e,t,a){try{let i=this.buildConfig(a);return(await this.client.patch(e,t,i)).data}catch(i){this.handleError(i)}}async put(e,t,a){try{let i=this.buildConfig(a);return(await this.client.put(e,t,i)).data}catch(i){this.handleError(i)}}async deleteRequest(e,t){try{let a=this.buildConfig(t);return(await this.client.delete(e,a)).data}catch(a){this.handleError(a)}}buildConfig(e){if(!e)return;let t=h({},e);return e.idempotencyKey&&(t.headers=w(h({},t.headers),{"Idempotency-Key":e.idempotencyKey})),t}handleError(e){var t,a,i;if(e.response){let o=e.response.status,c=((t=e.response.data)==null?void 0:t.message)||((a=e.response.data)==null?void 0:a.error)||"API Request Failed",d=(i=e.response.data)==null?void 0:i.code;switch(o){case 401:throw new m(c);case 403:throw new m(c);case 429:throw new f(c);default:throw new l(c,o,d)}}throw new l(e.message||"Network Error")}};var ut=class extends n{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async update(e,t){return this.patch(`/product/erix/crm/notes/${e}`,{content:t})}async pin(e,t=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:t})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},E=class extends n{constructor(t){super(t);s(this,"notes");this.notes=new ut(t)}async timeline(t,a){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:a})}async list(t,a){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:h({},a)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,a){return this.post(`/product/erix/crm/leads/${t}/calls`,a)}};var L=class extends n{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 q=class extends n{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 N=class extends n{async list(){return this.get("/product/erix/crm/automations")}async create(e){return this.post("/product/erix/crm/automations",e)}async update(e,t){return this.patch(`/product/erix/crm/automations/${e}`,t)}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,t){return this.post(`/product/erix/crm/automations/${e}/test`,{leadId:t})}async getAvailableEvents(){return this.post("/product/erix/crm/events",{})}async enrollments(e,t){return this.get(`/product/erix/crm/${e}/enrollments`,{params:t})}async getEnrollment(e){return this.get(`/product/erix/crm/enrollments/${e}`)}async pauseEnrollment(e,t){return this.post(`/product/erix/crm/${e}/enrollments/${t}/pause`,{})}async resumeEnrollment(e,t){return this.post(`/product/erix/crm/${e}/enrollments/${t}/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,t,a){return this.post("/product/erix/crm/webhook-event",{ruleId:e,eventName:t,payload:a})}async trigger(e){return this.post("/product/erix/events/trigger",e)}};var Ut=["open","won","lost","archived"],D=class extends n{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),t=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}],i=t.map(o=>({key:`metadata.extra.${o.name}`,label:o.label||o.name,type:o.type||"string",required:!!o.required,options:o.options,group:"Custom Fields"}));return{name:"Lead",fields:[...a,...i],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,t=50){let a=[];for(let i=0;i<e.length;i+=t){let c=e.slice(i,i+t).map(p=>this.create(p)),d=await Promise.allSettled(c);for(let p of d)if(p.status==="fulfilled")a.push(p.value);else throw p.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 t=h({},e);return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}listAutoPaging(e){return $t(this,null,function*(){let t=(e==null?void 0:e.page)||1,a=!0;for(;a;){let i=yield new ct(this.list(w(h({},e),{page:t}))),o=Array.isArray(i.data)?i.data:i||[];if(o.length===0){a=!1;break}for(let c of o)yield c;i.pagination&&t<i.pagination.pages||!i.pagination&&o.length>0?t++: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,t,a={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:a})}async retrieveByRef(e,t){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async update(e,t){return this.patch(`/product/erix/crm/leads/${e}`,t)}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,a){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:a})}async tags(e,t){return this.patch(`/product/erix/crm/leads/${e}/tags`,t)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,t){return this.patch(`/product/erix/crm/leads/${e}/metadata`,t)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,t){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:t})}async createNote(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async updateNote(e,t,a){return this.patch(`/product/erix/crm/notes/${t}`,a)}async deleteNote(e,t){return this.deleteRequest(`/product/erix/crm/notes/${t}`)}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 U=class extends n{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var M=class extends n{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var i,o;let t=await this.retrieve(e),a=Array.isArray((i=t.data)==null?void 0:i.stages)?t.data.stages:[];return{name:`Pipeline: ${((o=t.data)==null?void 0:o.name)||e}`,fields:a.map(c=>({key:c._id,label:c.name,type:"string",required:!0,options:[{label:c.name,value:c._id}],group:"Stages",uiHints:{color:c.color||"#cbd5e1",probability:c.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,t){return this.patch(`/product/erix/crm/pipelines/${e}`,t)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,t){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{newName:t})}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,t){return this.post(`/product/erix/crm/pipelines/${e}/stages`,t)}async reorderStages(e,t){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:t})}async updateStage(e,t){return this.patch(`/product/erix/crm/stages/${e}`,t)}async deleteStage(e,t){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:t?{moveLeadsToStageId:t}:void 0})}};var _=class extends n{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 F=class extends n{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 V=class extends n{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,t){return this.patch(`/product/erix/chat/broadcasts/${e}`,t)}async delete(e){return this.deleteRequest(`/product/erix/chat/broadcasts/${e}`)}};var B=class extends n{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,t){return this.get(`/product/erix/chat/conversations/${e}/messages`,{params:t})}async linkLead(e,t,a){return this.post(`/product/erix/chat/conversations/${e}/link-lead`,{leadId:t,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 j=class extends n{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",w(h({},e),{templateLanguage:e.language||e.templateLanguage||"en_US"}))}async star(e,t){return this.post(`/product/erix/chat/messages/${e}/star`,{isStarred:t})}async react(e,t){return this.post(`/product/erix/chat/messages/${e}/react`,{reaction:t})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`)}async upload(e){let t=new FormData;return t.append("file",e),this.post("/product/erix/chat/upload",t,{headers:{"Content-Type":"multipart/form-data"}})}};var H=class extends n{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 K=class extends n{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 W=class extends n{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 z=class extends n{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,t){return this.patch(`/product/erix/commerce/invoices/${e}`,t)}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 Q=class extends n{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 G=class extends n{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,t){return this.post(`/product/erix/portal-inbox/conversations/${e}/messages`,t)}};var Y=class extends n{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents`,t)}async toggleSignature(e,t,a){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:a})}async addSigner(e,t,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,a)}async sign(e,t,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/sign`,a!=null?a:{})}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,a)}};var J=class extends n{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,t){return this.post(`/infra/connect/connections/${e}/connect`,t)}async configure(e,t){return this.put(`/infra/connect/connections/${e}/configure`,t)}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,t){return this.put(`/infra/connect/connections/${e}/access`,t)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var X=class extends n{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,t){return this.put(`/infra/connect/email/templates/${e}`,t)}async deleteTemplate(e,t=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:t}})}async previewTemplate(e,t){return this.post(`/infra/connect/email/templates/${e}/preview`,t)}};var Z=class extends n{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,t){return this.patch(`/infra/connect/meet/${e}`,t)}async reschedule(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async delete(e){return this.update(e,{status:"cancelled"})}};var ee=class extends n{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 te=class extends n{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,t){return this.put(`/infra/connect/whatsapp/templates/${e}`,t)}async deleteTemplate(e,t){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${t?"?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,t){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,t)}async validate(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`)}async preview(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t})}async getVariableManifest(e){var o,c;let t=await this.retrieve(e),a=Array.isArray((o=t.data)==null?void 0:o.components)?t.data.components:[],i=[];for(let d of a)if(d.text){let p=d.text.match(/{{(\d+)}}/g);if(p)for(let y of p){let g=y.replace(/{{|}}/g,"");i.push({key:`var_${g}`,label:`${d.type} Var {{${g}}}`,type:"string",required:!0,group:d.type,description:`Variable placeholder in template ${d.type}`})}}return{name:`Template variables: ${((c=t.data)==null?void 0:c.name)||e}`,fields:i,uiHints:{icon:"Variables",primaryColor:"#059669"}}}async checkUsage(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/usage`)}};import Mt from"axios";var ne=class extends n{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}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,t){let a=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:i,key:o}=a.data;await Mt.put(i,e,{headers:{"Content-Type":t.contentType}});let c=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:o,sizeBytes:c})}};var re=class extends n{async create(e){return this.post("/infra/storage/files/folders",{name:e})}async delete(e){return this.deleteRequest(`/infra/storage/files/folders/${encodeURIComponent(e)}`)}},se=class extends n{async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}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 n{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/niche-packs",{params:R(e)})}async getNichePack(e,t){let a=t?{version:t}: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,t,a){let i=a?{version:a}:void 0;return this.patch(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,t,{params:i})}async publishNichePack(e,t){let a=t?{version:t}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/publish`,void 0,{params:a})}async unpublishNichePack(e,t){let a=t?{version:t}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/unpublish`,void 0,{params:a})}async forkNichePack(e,t={}){return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/fork`,t)}async smokeTestNichePack(e,t={},a){let i=a?{version:a}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/smoke-test`,t,{params:i})}async listOnboardingConfigs(e={}){return this.get("/platform/admin/onboarding/configs",{params:R(e)})}async createOnboardingConfig(e){return this.post("/platform/admin/onboarding/configs",e)}async updateOnboardingConfig(e,t,a){return this.patch(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,a)}async publishOnboardingConfig(e,t){return this.post(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(t)}/publish`)}async listOnboardingExperiments(e={}){return this.get("/platform/admin/onboarding/experiments",{params:R(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,t){return this.patch(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`,t)}async deleteOnboardingExperiment(e){return this.deleteRequest(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async getOnboardingFunnel(e={}){return this.get("/platform/admin/onboarding/analytics/funnel",{params:R(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/analytics/time-on-step",{params:R(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/analytics/abandonment",{params:R(e)})}};function R(r){let e={};for(let[t,a]of Object.entries(r))a!==void 0&&(e[t]=a);return e}var ae=class extends n{async list(){return this.get("/platform/admin/cors")}async create(e){return this.post("/platform/admin/cors",e)}async update(e,t){return this.patch(`/platform/admin/cors/${e}`,t)}async delete(e){return this.deleteRequest(`/platform/admin/cors/${e}`)}};var ie=class extends n{async system(){return(await this.get("/health")).data}};var oe=class extends n{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 n{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 I=class extends n{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,t){var i;let a=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(i=a==null?void 0:a.data)!=null?i:{entries:[],hasMore:!1}}async followups(e){var a,i;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(i=(a=t==null?void 0:t.data)==null?void 0:a.entries)!=null?i:[]}};var lt=class extends n{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,t){return this.patch(`/platform/admin/clients/${e}/config`,t)}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,t,a){return this.post(`/platform/admin/clients/${e}/connections/${t}/connect`,a)}async configureProvider(e,t,a){return this.put(`/platform/admin/clients/${e}/connections/${t}/configure`,a)}async disconnectProvider(e,t){return this.post(`/platform/admin/clients/${e}/connections/${t}/disconnect`,{})}async revealConnection(e,t){return this.post(`/platform/admin/clients/${e}/connections/${t}/reveal`,{})}async setConnectionAccess(e,t,a){return this.put(`/platform/admin/clients/${e}/connections/${t}/access`,a)}async getDataSource(e){return this.get(`/api/clients/${e}/datasource`)}async manageDataSource(e,t){return this.post(`/api/clients/${e}/datasource`,t)}async updateIdentity(e,t){return this.patch(`/platform/admin/clients/${e}/identity`,t)}async googleReauth(e,t={}){return this.post(`/platform/admin/clients/${e}/google/reauth`,t)}async delete(e){return this.deleteRequest(`/platform/admin/clients/${e}`)}},mt=class extends n{async list(){return this.get("/platform/admin/blogs")}},gt=class extends n{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},ce=class extends n{constructor(t){super(t);s(this,"clients");s(this,"blogs");s(this,"globalLeads");this.clients=new lt(t),this.blogs=new mt(t),this.globalLeads=new gt(t)}};var yt=class extends n{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"}},pe=class{constructor(e){s(this,"copilot");this.copilot=new yt(e)}};var de=class extends n{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,t){return this.post(`/platform/auth/invitations/${e}/accept`,t)}};var ht=class extends n{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},ft=class extends n{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)}},Tt=class extends n{async listPublic(){return this.get("/platform/billing/plans/public")}},bt=class extends n{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)}},xt=class extends n{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")}},wt=class extends n{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)}},ue=class{constructor(e){s(this,"entitlements");s(this,"subscriptions");s(this,"plans");s(this,"checkout");s(this,"user");s(this,"credits");this.entitlements=new ht(e),this.subscriptions=new ft(e),this.plans=new Tt(e),this.checkout=new bt(e),this.user=new xt(e),this.credits=new wt(e)}};var le=class extends n{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,t){return this.post(`/platform/support/tickets/${e}/reply`,t)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}};var me=class extends n{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",{})}},ge=class extends n{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}`)}},ye=class extends n{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 he=class extends n{async list(e){return this.get("/platform/admin/logs",{params:e})}async export(e){return this.get("/platform/admin/logs/export",{params:e})}};var fe=class extends n{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,t){return this.patch(`/platform/admin/invoices/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/invoices/${e}`)}};var Te=class extends n{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,t){return this.patch(`/platform/admin/agents/${e}`,t)}async runs(e){return this.get(`/platform/admin/agents/${e}/runs`)}};var be=class extends n{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 xe=class extends n{async list(e){return this.get("/platform/admin/comms",{params:e})}async create(e){return this.post("/platform/admin/comms",e)}async update(e,t){return this.patch(`/platform/admin/comms/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/comms/${e}`)}async publish(e,t){return this.post(`/platform/admin/comms/${e}/publish`,t)}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 we=class extends n{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 Re=class extends n{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 ke=class extends n{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,t){return this.put(`/platform/admin/blogs/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/blogs/${e}`)}};var Pe=class extends n{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,t){return this.patch(`/platform/admin/compliance/requests/${e}`,t)}async exportOrg(e,t){return this.post(`/platform/admin/compliance/export/${e}`,t)}};var ve=class extends n{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,t){return this.patch(`/platform/admin/credits/packs/${e}`,t)}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,t){return this.post(`/platform/admin/credits/wallet/${e}/adjust`,t)}};var Ae=class extends n{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var Ie=class extends n{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 n{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,t){return this.patch(`/platform/admin/erix/tenants/${e}/plan`,t)}async suspend(e,t){return this.post(`/platform/admin/erix/tenants/${e}/suspend`,t)}async reactivate(e,t){return this.post(`/platform/admin/erix/tenants/${e}/reactivate`,t)}async rotateKey(e,t){return this.post(`/platform/admin/erix/tenants/${e}/rotate-key`,t)}async usage(e){return this.get(`/platform/admin/erix/tenants/${e}/usage`)}};var Ce=class extends n{async list(e){return this.get("/platform/admin/flags",{params:e})}async create(e){return this.post("/platform/admin/flags",e)}async update(e,t){return this.patch(`/platform/admin/flags/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/flags/${e}`)}async listOverrides(e){return this.get(`/platform/admin/flags/${e}/overrides`)}async addOverride(e,t){return this.post(`/platform/admin/flags/${e}/overrides`,t)}async removeOverride(e,t){return this.deleteRequest(`/platform/admin/flags/${e}/overrides/${t}`)}async forOrg(e){return this.get(`/platform/admin/flags/org/${e}`)}};var Oe=class extends n{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,t){return this.post(`/platform/admin/flow/runs/${e}/retry`,t)}};var Se=class extends n{async list(e){return this.get(`/platform/admin/integrations/${e}/integrations`)}async connect(e,t,a){return this.post(`/platform/admin/integrations/${e}/integrations/${t}`,a)}async disconnect(e,t){return this.deleteRequest(`/platform/admin/integrations/${e}/integrations/${t}`)}async test(e,t,a){return this.post(`/platform/admin/integrations/${e}/integrations/${t}/test`,a)}async invite(e,t){return this.post(`/platform/admin/integrations/${e}/invite`,t)}};var Ee=class extends n{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,t){return this.post(`/platform/admin/laie/actors/${e}/run`,t)}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 Le=class extends n{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 qe=class extends n{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var Ne=class extends n{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,t){return this.patch(`/platform/admin/leads/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/leads/${e}`)}async updateStatus(e,t){return this.patch(`/platform/admin/leads/${e}/status`,t)}async qualification(e,t){return this.post(`/platform/admin/leads/${e}/qualification`,t)}async firstContact(e,t){return this.post(`/platform/admin/leads/${e}/first-contact`,t)}async followup(e,t){return this.post(`/platform/admin/leads/${e}/followup`,t)}async notes(e){return this.get(`/platform/admin/leads/${e}/notes`)}async addNote(e,t){return this.post(`/platform/admin/leads/${e}/notes`,t)}async updateNote(e,t,a){return this.patch(`/platform/admin/leads/${e}/notes/${t}`,a)}async deleteNote(e,t){return this.deleteRequest(`/platform/admin/leads/${e}/notes/${t}`)}};var De=class extends n{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 Ue=class extends n{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,t){return this.patch(`/platform/admin/partners/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/partners/${e}`)}async referrals(e){return this.get(`/platform/admin/partners/${e}/referrals`)}async updateReferral(e,t,a){return this.patch(`/platform/admin/partners/${e}/referrals/${t}`,a)}};var Me=class extends n{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,t){return this.post(`/platform/admin/payments/retry/${e}`,t)}async timeline(e){return this.get(`/platform/admin/payments/timeline/${e}`)}async risk(e){return this.get(`/platform/admin/payments/risk/${e}`)}};var _e=class extends n{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,t){return this.get(`/platform/admin/persona-history/${e}/${t}`)}};var Fe=class extends n{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,t){return this.patch(`/platform/admin/pipelines/templates/${e}`,t)}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 Ve=class extends n{async list(e){return this.get("/platform/admin/plans",{params:e})}async create(e){return this.post("/platform/admin/plans",e)}async update(e,t){return this.patch(`/platform/admin/plans/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/plans/${e}`)}async tenants(e){return this.get(`/platform/admin/plans/${e}/tenants`)}};var Be=class extends n{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 je=class extends n{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,t){return this.patch(`/platform/admin/auth/staff/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/auth/staff/${e}`)}};var He=class extends n{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 Ke=class extends n{async overview(e){return this.get("/platform/admin/health",{params:e})}};var We=class extends n{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,t){return this.patch(`/platform/admin/templates/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/templates/${e}`)}async clone(e,t){return this.post(`/platform/admin/templates/${e}/clone`,t)}async versions(e){return this.get(`/platform/admin/templates/${e}/versions`)}async assignPlans(e,t){return this.post(`/platform/admin/templates/${e}/plans`,t)}};var ze=class extends n{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,t){return this.post(`/platform/admin/tenants/${e}/impersonate`,t)}async suspend(e,t){return this.post(`/platform/admin/tenants/${e}/suspend`,t)}async reactivate(e,t){return this.post(`/platform/admin/tenants/${e}/reactivate`,t)}async updatePlan(e,t){return this.patch(`/platform/admin/tenants/${e}/plan`,t)}async updateLimits(e,t){return this.patch(`/platform/admin/tenants/${e}/limits`,t)}async bulkAssignPlan(e){return this.post("/platform/admin/tenants/bulk-assign-plan",e)}async unassigned(){return this.get("/platform/admin/tenants/unassigned")}};var Qe=class extends n{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,t){return this.patch(`/platform/admin/tickets/${e}`,t)}async addMessage(e,t){return this.post(`/platform/admin/tickets/${e}/messages`,t)}async resolve(e,t){return this.post(`/platform/admin/tickets/${e}/resolve`,t)}async close(e,t){return this.post(`/platform/admin/tickets/${e}/close`,t)}};var Ge=class extends n{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,t){return this.patch(`/platform/admin/waitlist/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/waitlist/${e}`)}async bulk(e){return this.post("/platform/admin/waitlist/bulk",e)}};var Ye=class extends n{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 Je=class{constructor(e){s(this,"messages");s(this,"conversations");s(this,"broadcasts");this.messages=new j(e),this.conversations=new B(e),this.broadcasts=new V(e)}},Xe=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 D(e),this.pipelines=new M(e),this.automations=new N(e),this.activities=new E(e),this.analytics=new L(e),this.scoring=new _(e),this.payments=new U(e),this.sequences=new F(e),this.automationDashboard=new q(e),this.chat=new Je(e),this.events=new W(e),this.eventLog=new Q(e),this.invoices=new z(e),this.checkout=new K(e),this.projects=new Y(e),this.campaigns=new H(e),this.portalInbox=new G(e)}},$=class{constructor(e){s(this,"erix");this.erix=new Xe(e)}},Ze=class{constructor(e){s(this,"config");s(this,"templates");this.config=new ee(e),this.templates=new X(e)}},et=class{constructor(e){s(this,"templates");this.templates=new te(e)}},tt=class{constructor(e){s(this,"email");s(this,"whatsapp");s(this,"meet");s(this,"connections");this.email=new Ze(e),this.whatsapp=new et(e),this.meet=new Z(e),this.connections=new J(e)}},nt=class{constructor(e){s(this,"files");s(this,"folders");s(this,"media");this.files=new se(e),this.folders=new re(e),this.media=new ne(e)}},C=class{constructor(e){s(this,"connect");s(this,"storage");this.connect=new tt(e),this.storage=new nt(e)}},rt=class{constructor(e){s(this,"onboarding");s(this,"persona");this.onboarding=new A(e),this.persona=new I(e)}},st=class{constructor(e){s(this,"me");s(this,"members");s(this,"sessions");s(this,"notifications");this.me=new me(e),this.members=new ge(e),this.sessions=new ye(e),this.notifications=new oe(e)}},at=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 Be(e),this.billing=new Re(e),this.payments=new Me(e),this.credits=new ve(e),this.plans=new Ve(e),this.agencyInvoices=new fe(e),this.flags=new Ce(e),this.activityLogs=new he(e),this.auditLogs=new we(e),this.analytics=new be(e),this.health=new Ke(e),this.storage=new He(e),this.announcements=new xe(e),this.compliance=new Pe(e),this.tickets=new Qe(e),this.templates=new We(e),this.agents=new Te(e),this.personaHistory=new _e(e),this.openapi=new De(e),this.staff=new je(e),this.tenants=new ze(e),this.whatsapp=new Ye(e),this.laie=new Ee(e),this.laieRuntime=new Le(e),this.laieVault=new qe(e),this.flow=new Oe(e),this.email=new Ie(e),this.pipelines=new Fe(e),this.integrations=new Se(e),this.erix=new $e(e),this.dashboard=new Ae(e),this.partners=new Ue(e),this.waitlist=new Ge(e),this.blogs=new ke(e),this.leads=new Ne(e),this.onboarding=new v(e),this.cors=new ae(e),this.clients=new ce(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 de(e),this.users=new st(e),this.tenants=new rt(e),this.billing=new ue(e),this.support=new le(e),this.ai=new pe(e),this.admin=new at(e),this.health=new ie(e)}};var k=class extends l{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},it=class{async constructEvent(e,t,a){if(!t)throw new k("No webhook signature provided");let i=Array.isArray(t)?t[0]:t;i.startsWith("sha256=")&&(i=i.slice(7));try{let o=await import("crypto"),d=o.createHmac("sha256",a).update(e).digest("hex");if(!o.timingSafeEqual(Buffer.from(d),Buffer.from(i)))throw new k("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(o){throw o instanceof k?o:new k(`Webhook payload parsing failed: ${o.message}`)}}};var Rt=typeof process!="undefined"&&"2.1.2"||"2.0.0";var P=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 y,g,T,b,x;if(!e.apiKey)throw new m("API Key is required");this.clientCode=(y=e.clientCode)==null?void 0:y.toUpperCase(),this.apiVersion=(g=e.version)!=null?g:"v1";let t=(T=e.baseUrl)!=null?T:pt,a=Ct(this.apiVersion,t),i=e.socketUrl||t,o=typeof window!="undefined"&&typeof window.document!="undefined",c=o?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",d=o?((b=globalThis.navigator)==null?void 0:b.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",p={"x-api-key":e.apiKey,"x-client-code":((x=e.clientCode)==null?void 0:x.toUpperCase())||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:Rt,runtime:c,os:d})};if(e.coreApiKey&&(p["x-core-api-key"]=e.coreApiKey),this.client=Ft.create({baseURL:a,headers:p}),kt(this.client,{retries:3,retryDelay:kt.exponentialDelay,retryCondition:u=>{var S;return kt.isNetworkOrIdempotentRequestError(u)||((S=u.response)==null?void 0:S.status)===429},onRetry:(u,S,Pt)=>{var vt,At;typeof process!="undefined"&&((vt=process.env)==null?void 0:vt.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${u}/3): ${(At=Pt.method)==null?void 0:At.toUpperCase()} ${Pt.url}. Reason: ${S.message}`)}}),this.platform=new O(this.client),this.product=new $(this.client),this.infra=new C(this.client),this.webhooks=new it,this.initSocket(i,e.apiKey,e.clientCode),o){let u={version:Rt,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=u,window.ecodrix||(window.ecodrix=this)}}initSocket(e,t,a){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:i})=>{this.socket=i(e,{extraHeaders:{"x-api-key":t,"x-client-code":(a==null?void 0:a.toUpperCase())||""}}),this.setupSocket(a);for(let{type:o,args:c}of this.socketQueue)o==="joinRoom"?this.socket.emit("join-room",c[0]):o==="leaveRoom"?this.socket.emit("leave-room",c[0]):o==="on"?this.socket.on(c[0],c[1]):o==="off"?this.socket.off(c[0],c[1]):o==="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,t){return this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.socket?this.socket.disconnect():this.socketQueue.push({type:"disconnect",args:[]})}off(e,t){return this.socket?this.socket.off(e,t):this.socketQueue.push({type:"off",args:[e,t]}),this}async request(e,t,a,i){var o,c,d;try{return(await this.client.request({method:e,url:t,data:a,params:i})).data}catch(p){throw p.response?new l(((o=p.response.data)==null?void 0:o.message)||((c=p.response.data)==null?void 0:c.error)||"Raw Execution Failed",p.response.status,(d=p.response.data)==null?void 0:d.code):new l(p.message||"Network Error")}}};var Vt={401:m,403:m,429:f};function vi(r){var e,t,a;if(r.response){let i=r.response.status,o=((e=r.response.data)==null?void 0:e.message)||((t=r.response.data)==null?void 0:t.error)||"API Request Failed",c=(a=r.response.data)==null?void 0:a.code,d=Vt[i]||l;throw d===m?new m(o):d===f?new f(o):new l(o,i,c)}throw new l(r.message||"Network Error")}function Ai(r,e){return r instanceof e}function Ii(r){return r instanceof m?{message:r.message,status:r.status,code:r.code,type:"AuthenticationError"}:r instanceof f?{message:r.message,status:r.status,code:r.code,type:"RateLimitError"}:r instanceof l?{message:r.message,status:r.status,code:r.code,type:"APIError"}:{message:r.message||"Unknown error",type:"UnknownError"}}var Ot={[m.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[f.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[l.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function $i(r){let e=r.constructor.name;return Ot[e]||Ot[l.name]}var Si=P;export{l as APIError,v as AdminOnboarding,m as AuthenticationError,tt as ConnectInfra,P as ECODrIx,P as ECODrIxAPI,Ot as ERROR_RETRY_CONFIG,dt as EcodrixError,Ze as EmailConnect,Je as ErixChat,Xe as ErixProduct,Vt as HTTP_STATUS_ERROR_MAP,C as InfraDomain,Ut as LEAD_STATUS_VALUES,A as Onboarding,I as Persona,at as PlatformAdmin,O as PlatformDomain,rt as PlatformTenants,st as PlatformUsers,$ as ProductDomain,f as RateLimitError,nt as StorageInfra,et as WhatsAppConnect,Si as default,Ii as getErrorDetails,$i as getRetryConfig,vi as handleAPIError,Ai as isAPIError};
1
+ var Et=Object.defineProperty,Lt=Object.defineProperties;var qt=Object.getOwnPropertyDescriptors;var It=Object.getOwnPropertySymbols;var Nt=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var Ut=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r);var ct=(r,e,t)=>e in r?Et(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e)=>{for(var t in e||(e={}))Nt.call(e,t)&&ct(r,t,e[t]);if(It)for(var t of It(e))Dt.call(e,t)&&ct(r,t,e[t]);return r},R=(r,e)=>Lt(r,qt(e));var s=(r,e,t)=>ct(r,typeof e!="symbol"?e+"":e,t);var pt=function(r,e){this[0]=r,this[1]=e},Ct=(r,e,t)=>{var a=(u,p,y,g)=>{try{var T=t[u](p),b=(p=T.value)instanceof pt,x=T.done;Promise.resolve(b?p[0]:p).then(l=>b?a(u==="return"?u:"next",p[1]?{done:l.done,value:l.value}:l,y,g):y({value:l,done:x})).catch(l=>a("throw",l,y,g))}catch(l){g(l)}},i=(u,p,y,g)=>c[u]=T=>(p=new Promise((b,x,l)=>(l=()=>a(u,T,b,x),o?o.then(l):l())),g=()=>o===y&&(o=0),o=y=p.then(g,g),p),o,c={};return t=t.apply(r,e),c[Ut("asyncIterator")]=()=>c,i("next"),i("throw"),i("return"),c};import Vt from"axios";import Pt from"axios-retry";var ut="https://api.ecodrix.com";function Ot(r="v1",e=ut){return`${e.replace(/\/+$/,"")}/${r}/api`}var dt=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},d=class extends dt{constructor(t,a,i){super(t);s(this,"status");s(this,"code");this.name="APIError",this.status=a,this.code=i}},m=class extends d{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},f=class extends d{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var n=class{constructor(e){s(this,"client",e)}async post(e,t,a){try{let i=this.buildConfig(a);return(await this.client.post(e,t,i)).data}catch(i){this.handleError(i)}}async get(e,t){try{let a=this.buildConfig(t);return(await this.client.get(e,a)).data}catch(a){this.handleError(a)}}async patch(e,t,a){try{let i=this.buildConfig(a);return(await this.client.patch(e,t,i)).data}catch(i){this.handleError(i)}}async put(e,t,a){try{let i=this.buildConfig(a);return(await this.client.put(e,t,i)).data}catch(i){this.handleError(i)}}async deleteRequest(e,t){try{let a=this.buildConfig(t);return(await this.client.delete(e,a)).data}catch(a){this.handleError(a)}}buildConfig(e){if(!e)return;let t=h({},e);return e.idempotencyKey&&(t.headers=R(h({},t.headers),{"Idempotency-Key":e.idempotencyKey})),t}handleError(e){var t,a,i;if(e.response){let o=e.response.status,c=((t=e.response.data)==null?void 0:t.message)||((a=e.response.data)==null?void 0:a.error)||"API Request Failed",u=(i=e.response.data)==null?void 0:i.code;switch(o){case 401:throw new m(c);case 403:throw new m(c);case 429:throw new f(c);default:throw new d(c,o,u)}}throw new d(e.message||"Network Error")}};var lt=class extends n{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async update(e,t){return this.patch(`/product/erix/crm/notes/${e}`,{content:t})}async pin(e,t=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:t})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},L=class extends n{constructor(t){super(t);s(this,"notes");this.notes=new lt(t)}async timeline(t,a){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:a})}async list(t,a){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:h({},a)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,a){return this.post(`/product/erix/crm/leads/${t}/calls`,a)}};var q=class extends n{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 N=class extends n{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 D=class extends n{async list(){return this.get("/product/erix/crm/automations")}async create(e){return this.post("/product/erix/crm/automations",e)}async update(e,t){return this.patch(`/product/erix/crm/automations/${e}`,t)}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,t){return this.post(`/product/erix/crm/automations/${e}/test`,{leadId:t})}async getAvailableEvents(){return this.post("/product/erix/crm/events",{})}async enrollments(e,t){return this.get(`/product/erix/crm/${e}/enrollments`,{params:t})}async getEnrollment(e){return this.get(`/product/erix/crm/enrollments/${e}`)}async pauseEnrollment(e,t){return this.post(`/product/erix/crm/${e}/enrollments/${t}/pause`,{})}async resumeEnrollment(e,t){return this.post(`/product/erix/crm/${e}/enrollments/${t}/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,t,a){return this.post("/product/erix/crm/webhook-event",{ruleId:e,eventName:t,payload:a})}async trigger(e){return this.post("/product/erix/events/trigger",e)}};var Mt=["open","won","lost","archived"],U=class extends n{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),t=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}],i=t.map(o=>({key:`metadata.extra.${o.name}`,label:o.label||o.name,type:o.type||"string",required:!!o.required,options:o.options,group:"Custom Fields"}));return{name:"Lead",fields:[...a,...i],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,t=50){let a=[];for(let i=0;i<e.length;i+=t){let c=e.slice(i,i+t).map(p=>this.create(p)),u=await Promise.allSettled(c);for(let p of u)if(p.status==="fulfilled")a.push(p.value);else throw p.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 t=h({},e);return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}listAutoPaging(e){return Ct(this,null,function*(){let t=(e==null?void 0:e.page)||1,a=!0;for(;a;){let i=yield new pt(this.list(R(h({},e),{page:t}))),o=Array.isArray(i.data)?i.data:i||[];if(o.length===0){a=!1;break}for(let c of o)yield c;i.pagination&&t<i.pagination.pages||!i.pagination&&o.length>0?t++: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,t,a={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:a})}async retrieveByRef(e,t){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async update(e,t){return this.patch(`/product/erix/crm/leads/${e}`,t)}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,a){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:a})}async tags(e,t){return this.patch(`/product/erix/crm/leads/${e}/tags`,t)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,t){return this.patch(`/product/erix/crm/leads/${e}/metadata`,t)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,t){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:t})}async createNote(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async updateNote(e,t,a){return this.patch(`/product/erix/crm/notes/${t}`,a)}async deleteNote(e,t){return this.deleteRequest(`/product/erix/crm/notes/${t}`)}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 M=class extends n{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var _=class extends n{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var i,o;let t=await this.retrieve(e),a=Array.isArray((i=t.data)==null?void 0:i.stages)?t.data.stages:[];return{name:`Pipeline: ${((o=t.data)==null?void 0:o.name)||e}`,fields:a.map(c=>({key:c._id,label:c.name,type:"string",required:!0,options:[{label:c.name,value:c._id}],group:"Stages",uiHints:{color:c.color||"#cbd5e1",probability:c.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,t){return this.patch(`/product/erix/crm/pipelines/${e}`,t)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,t){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{newName:t})}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,t){return this.post(`/product/erix/crm/pipelines/${e}/stages`,t)}async reorderStages(e,t){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:t})}async updateStage(e,t){return this.patch(`/product/erix/crm/stages/${e}`,t)}async deleteStage(e,t){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:t?{moveLeadsToStageId:t}:void 0})}};var F=class extends n{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`,{})}async preview(e){return this.get(`/product/erix/crm/scoring/preview/${e}`)}};var V=class extends n{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 B=class extends n{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,t){return this.patch(`/product/erix/chat/broadcasts/${e}`,t)}async delete(e){return this.deleteRequest(`/product/erix/chat/broadcasts/${e}`)}};var j=class extends n{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,t){return this.get(`/product/erix/chat/conversations/${e}/messages`,{params:t})}async linkLead(e,t,a){return this.post(`/product/erix/chat/conversations/${e}/link-lead`,{leadId:t,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 H=class extends n{async send(e){return this.post("/product/erix/chat/send",e)}async sendTemplate(e){return this.post("/product/erix/chat/send",R(h({},e),{templateLanguage:e.language||e.templateLanguage||"en_US"}))}async star(e,t){return this.post(`/product/erix/chat/messages/${e}/star`,{isStarred:t})}async react(e,t){return this.post(`/product/erix/chat/messages/${e}/react`,{reaction:t})}async markRead(e){return this.post(`/product/erix/chat/conversations/${e}/read`)}async upload(e){let t=new FormData;return t.append("file",e),this.post("/product/erix/chat/upload",t,{headers:{"Content-Type":"multipart/form-data"}})}};var K=class extends n{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 W=class extends n{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 z=class extends n{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 Q=class extends n{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,t){return this.patch(`/product/erix/commerce/invoices/${e}`,t)}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 G=class extends n{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 Y=class extends n{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,t){return this.post(`/product/erix/portal-inbox/conversations/${e}/messages`,t)}};var J=class extends n{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents`,t)}async toggleSignature(e,t,a){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:a})}async addSigner(e,t,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,a)}async sign(e,t,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/sign`,a!=null?a:{})}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,a){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,a)}};var X=class extends n{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,t){return this.post(`/infra/connect/connections/${e}/connect`,t)}async configure(e,t){return this.put(`/infra/connect/connections/${e}/configure`,t)}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,t){return this.put(`/infra/connect/connections/${e}/access`,t)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var Z=class extends n{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,t){return this.put(`/infra/connect/email/templates/${e}`,t)}async deleteTemplate(e,t=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:t}})}async previewTemplate(e,t){return this.post(`/infra/connect/email/templates/${e}/preview`,t)}};var ee=class extends n{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,t){return this.patch(`/infra/connect/meet/${e}`,t)}async reschedule(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async delete(e){return this.update(e,{status:"cancelled"})}};var te=class extends n{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 ne=class extends n{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,t){return this.put(`/infra/connect/whatsapp/templates/${e}`,t)}async deleteTemplate(e,t){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${t?"?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,t){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,t)}async validate(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`)}async preview(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t})}async getVariableManifest(e){var o,c;let t=await this.retrieve(e),a=Array.isArray((o=t.data)==null?void 0:o.components)?t.data.components:[],i=[];for(let u of a)if(u.text){let p=u.text.match(/{{(\d+)}}/g);if(p)for(let y of p){let g=y.replace(/{{|}}/g,"");i.push({key:`var_${g}`,label:`${u.type} Var {{${g}}}`,type:"string",required:!0,group:u.type,description:`Variable placeholder in template ${u.type}`})}}return{name:`Template variables: ${((c=t.data)==null?void 0:c.name)||e}`,fields:i,uiHints:{icon:"Variables",primaryColor:"#059669"}}}async checkUsage(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/usage`)}};import _t from"axios";var re=class extends n{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}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,t){let a=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:i,key:o}=a.data;await _t.put(i,e,{headers:{"Content-Type":t.contentType}});let c=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:o,sizeBytes:c})}};var se=class extends n{async create(e){return this.post("/infra/storage/files/folders",{name:e})}async delete(e){return this.deleteRequest(`/infra/storage/files/folders/${encodeURIComponent(e)}`)}},ae=class extends n{async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}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 A=class extends n{async listNichePacks(e={}){return this.get("/platform/admin/onboarding/niche-packs",{params:k(e)})}async getNichePack(e,t){let a=t?{version:t}: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,t,a){let i=a?{version:a}:void 0;return this.patch(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}`,t,{params:i})}async publishNichePack(e,t){let a=t?{version:t}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/publish`,void 0,{params:a})}async unpublishNichePack(e,t){let a=t?{version:t}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/unpublish`,void 0,{params:a})}async forkNichePack(e,t={}){return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/fork`,t)}async smokeTestNichePack(e,t={},a){let i=a?{version:a}:void 0;return this.post(`/platform/admin/onboarding/niche-packs/${encodeURIComponent(e)}/smoke-test`,t,{params:i})}async listOnboardingConfigs(e={}){return this.get("/platform/admin/onboarding/configs",{params:k(e)})}async createOnboardingConfig(e){return this.post("/platform/admin/onboarding/configs",e)}async updateOnboardingConfig(e,t,a){return this.patch(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,a)}async publishOnboardingConfig(e,t){return this.post(`/platform/admin/onboarding/configs/${encodeURIComponent(e)}/${encodeURIComponent(t)}/publish`)}async listOnboardingExperiments(e={}){return this.get("/platform/admin/onboarding/experiments",{params:k(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,t){return this.patch(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`,t)}async deleteOnboardingExperiment(e){return this.deleteRequest(`/platform/admin/onboarding/experiments/${encodeURIComponent(e)}`)}async getOnboardingFunnel(e={}){return this.get("/platform/admin/onboarding/analytics/funnel",{params:k(e)})}async getOnboardingTimeOnStep(e={}){return this.get("/platform/admin/onboarding/analytics/time-on-step",{params:k(e)})}async getOnboardingAbandonment(e={}){return this.get("/platform/admin/onboarding/analytics/abandonment",{params:k(e)})}};function k(r){let e={};for(let[t,a]of Object.entries(r))a!==void 0&&(e[t]=a);return e}var ie=class extends n{async list(){return this.get("/platform/admin/cors")}async create(e){return this.post("/platform/admin/cors",e)}async update(e,t){return this.patch(`/platform/admin/cors/${e}`,t)}async delete(e){return this.deleteRequest(`/platform/admin/cors/${e}`)}};var oe=class extends n{async system(){return(await this.get("/health")).data}};var ce=class extends n{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 $=class extends n{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 I=class extends n{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,t){var i;let a=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(i=a==null?void 0:a.data)!=null?i:{entries:[],hasMore:!1}}async followups(e){var a,i;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(i=(a=t==null?void 0:t.data)==null?void 0:a.entries)!=null?i:[]}};var mt=class extends n{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,t){return this.patch(`/platform/admin/clients/${e}/config`,t)}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,t,a){return this.post(`/platform/admin/clients/${e}/connections/${t}/connect`,a)}async configureProvider(e,t,a){return this.put(`/platform/admin/clients/${e}/connections/${t}/configure`,a)}async disconnectProvider(e,t){return this.post(`/platform/admin/clients/${e}/connections/${t}/disconnect`,{})}async revealConnection(e,t){return this.post(`/platform/admin/clients/${e}/connections/${t}/reveal`,{})}async setConnectionAccess(e,t,a){return this.put(`/platform/admin/clients/${e}/connections/${t}/access`,a)}async getDataSource(e){return this.get(`/api/clients/${e}/datasource`)}async manageDataSource(e,t){return this.post(`/api/clients/${e}/datasource`,t)}async updateIdentity(e,t){return this.patch(`/platform/admin/clients/${e}/identity`,t)}async googleReauth(e,t={}){return this.post(`/platform/admin/clients/${e}/google/reauth`,t)}async delete(e){return this.deleteRequest(`/platform/admin/clients/${e}`)}},gt=class extends n{async list(){return this.get("/platform/admin/blogs")}},yt=class extends n{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},pe=class extends n{constructor(t){super(t);s(this,"clients");s(this,"blogs");s(this,"globalLeads");this.clients=new mt(t),this.blogs=new gt(t),this.globalLeads=new yt(t)}};var ht=class extends n{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"}},ue=class{constructor(e){s(this,"copilot");this.copilot=new ht(e)}};var de=class extends n{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,t){return this.post(`/platform/auth/invitations/${e}/accept`,t)}};var ft=class extends n{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},Tt=class extends n{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)}},bt=class extends n{async listPublic(){return this.get("/platform/billing/plans/public")}},xt=class extends n{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)}},wt=class extends n{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")}},Rt=class extends n{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)}},le=class{constructor(e){s(this,"entitlements");s(this,"subscriptions");s(this,"plans");s(this,"checkout");s(this,"user");s(this,"credits");this.entitlements=new ft(e),this.subscriptions=new Tt(e),this.plans=new bt(e),this.checkout=new xt(e),this.user=new wt(e),this.credits=new Rt(e)}};var me=class extends n{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,t){return this.post(`/platform/support/tickets/${e}/reply`,t)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}};var ge=class extends n{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",{})}},ye=class extends n{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}`)}},he=class extends n{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 fe=class extends n{async list(e){return this.get("/platform/admin/logs",{params:e})}async export(e){return this.get("/platform/admin/logs/export",{params:e})}};var Te=class extends n{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,t){return this.patch(`/platform/admin/invoices/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/invoices/${e}`)}};var be=class extends n{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,t){return this.patch(`/platform/admin/agents/${e}`,t)}async runs(e){return this.get(`/platform/admin/agents/${e}/runs`)}};var xe=class extends n{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 we=class extends n{async list(e){return this.get("/platform/admin/comms",{params:e})}async create(e){return this.post("/platform/admin/comms",e)}async update(e,t){return this.patch(`/platform/admin/comms/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/comms/${e}`)}async publish(e,t){return this.post(`/platform/admin/comms/${e}/publish`,t)}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 Re=class extends n{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 ke=class extends n{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 Pe=class extends n{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,t){return this.put(`/platform/admin/blogs/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/blogs/${e}`)}};var ve=class extends n{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,t){return this.patch(`/platform/admin/compliance/requests/${e}`,t)}async exportOrg(e,t){return this.post(`/platform/admin/compliance/export/${e}`,t)}};var Ae=class extends n{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,t){return this.patch(`/platform/admin/credits/packs/${e}`,t)}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,t){return this.post(`/platform/admin/credits/wallet/${e}/adjust`,t)}};var $e=class extends n{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var Ie=class extends n{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 Ce=class extends n{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,t){return this.patch(`/platform/admin/erix/tenants/${e}/plan`,t)}async suspend(e,t){return this.post(`/platform/admin/erix/tenants/${e}/suspend`,t)}async reactivate(e,t){return this.post(`/platform/admin/erix/tenants/${e}/reactivate`,t)}async rotateKey(e,t){return this.post(`/platform/admin/erix/tenants/${e}/rotate-key`,t)}async usage(e){return this.get(`/platform/admin/erix/tenants/${e}/usage`)}};var Oe=class extends n{async list(e){return this.get("/platform/admin/flags",{params:e})}async create(e){return this.post("/platform/admin/flags",e)}async update(e,t){return this.patch(`/platform/admin/flags/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/flags/${e}`)}async listOverrides(e){return this.get(`/platform/admin/flags/${e}/overrides`)}async addOverride(e,t){return this.post(`/platform/admin/flags/${e}/overrides`,t)}async removeOverride(e,t){return this.deleteRequest(`/platform/admin/flags/${e}/overrides/${t}`)}async forOrg(e){return this.get(`/platform/admin/flags/org/${e}`)}};var Se=class extends n{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,t){return this.post(`/platform/admin/flow/runs/${e}/retry`,t)}};var Ee=class extends n{async list(e){return this.get(`/platform/admin/integrations/${e}/integrations`)}async connect(e,t,a){return this.post(`/platform/admin/integrations/${e}/integrations/${t}`,a)}async disconnect(e,t){return this.deleteRequest(`/platform/admin/integrations/${e}/integrations/${t}`)}async test(e,t,a){return this.post(`/platform/admin/integrations/${e}/integrations/${t}/test`,a)}async invite(e,t){return this.post(`/platform/admin/integrations/${e}/invite`,t)}};var Le=class extends n{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,t){return this.post(`/platform/admin/laie/actors/${e}/run`,t)}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 qe=class extends n{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 Ne=class extends n{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var De=class extends n{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,t){return this.patch(`/platform/admin/leads/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/leads/${e}`)}async updateStatus(e,t){return this.patch(`/platform/admin/leads/${e}/status`,t)}async qualification(e,t){return this.post(`/platform/admin/leads/${e}/qualification`,t)}async firstContact(e,t){return this.post(`/platform/admin/leads/${e}/first-contact`,t)}async followup(e,t){return this.post(`/platform/admin/leads/${e}/followup`,t)}async notes(e){return this.get(`/platform/admin/leads/${e}/notes`)}async addNote(e,t){return this.post(`/platform/admin/leads/${e}/notes`,t)}async updateNote(e,t,a){return this.patch(`/platform/admin/leads/${e}/notes/${t}`,a)}async deleteNote(e,t){return this.deleteRequest(`/platform/admin/leads/${e}/notes/${t}`)}};var Ue=class extends n{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 Me=class extends n{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,t){return this.patch(`/platform/admin/partners/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/partners/${e}`)}async referrals(e){return this.get(`/platform/admin/partners/${e}/referrals`)}async updateReferral(e,t,a){return this.patch(`/platform/admin/partners/${e}/referrals/${t}`,a)}};var _e=class extends n{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,t){return this.post(`/platform/admin/payments/retry/${e}`,t)}async timeline(e){return this.get(`/platform/admin/payments/timeline/${e}`)}async risk(e){return this.get(`/platform/admin/payments/risk/${e}`)}};var Fe=class extends n{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,t){return this.get(`/platform/admin/persona-history/${e}/${t}`)}};var Ve=class extends n{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,t){return this.patch(`/platform/admin/pipelines/templates/${e}`,t)}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 Be=class extends n{async list(e){return this.get("/platform/admin/plans",{params:e})}async create(e){return this.post("/platform/admin/plans",e)}async update(e,t){return this.patch(`/platform/admin/plans/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/plans/${e}`)}async tenants(e){return this.get(`/platform/admin/plans/${e}/tenants`)}};var je=class extends n{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 He=class extends n{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,t){return this.patch(`/platform/admin/auth/staff/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/auth/staff/${e}`)}};var Ke=class extends n{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 We=class extends n{async overview(e){return this.get("/platform/admin/health",{params:e})}};var ze=class extends n{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,t){return this.patch(`/platform/admin/templates/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/templates/${e}`)}async clone(e,t){return this.post(`/platform/admin/templates/${e}/clone`,t)}async versions(e){return this.get(`/platform/admin/templates/${e}/versions`)}async assignPlans(e,t){return this.post(`/platform/admin/templates/${e}/plans`,t)}};var Qe=class extends n{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,t){return this.post(`/platform/admin/tenants/${e}/impersonate`,t)}async suspend(e,t){return this.post(`/platform/admin/tenants/${e}/suspend`,t)}async reactivate(e,t){return this.post(`/platform/admin/tenants/${e}/reactivate`,t)}async updatePlan(e,t){return this.patch(`/platform/admin/tenants/${e}/plan`,t)}async updateLimits(e,t){return this.patch(`/platform/admin/tenants/${e}/limits`,t)}async bulkAssignPlan(e){return this.post("/platform/admin/tenants/bulk-assign-plan",e)}async unassigned(){return this.get("/platform/admin/tenants/unassigned")}};var Ge=class extends n{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,t){return this.patch(`/platform/admin/tickets/${e}`,t)}async addMessage(e,t){return this.post(`/platform/admin/tickets/${e}/messages`,t)}async resolve(e,t){return this.post(`/platform/admin/tickets/${e}/resolve`,t)}async close(e,t){return this.post(`/platform/admin/tickets/${e}/close`,t)}};var Ye=class extends n{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,t){return this.patch(`/platform/admin/waitlist/${e}`,t)}async remove(e){return this.deleteRequest(`/platform/admin/waitlist/${e}`)}async bulk(e){return this.post("/platform/admin/waitlist/bulk",e)}};var Je=class extends n{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 Xe=class{constructor(e){s(this,"messages");s(this,"conversations");s(this,"broadcasts");this.messages=new H(e),this.conversations=new j(e),this.broadcasts=new B(e)}},Ze=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 U(e),this.pipelines=new _(e),this.automations=new D(e),this.activities=new L(e),this.analytics=new q(e),this.scoring=new F(e),this.payments=new M(e),this.sequences=new V(e),this.automationDashboard=new N(e),this.chat=new Xe(e),this.events=new z(e),this.eventLog=new G(e),this.invoices=new Q(e),this.checkout=new W(e),this.projects=new J(e),this.campaigns=new K(e),this.portalInbox=new Y(e)}},C=class{constructor(e){s(this,"erix");this.erix=new Ze(e)}},et=class{constructor(e){s(this,"config");s(this,"templates");this.config=new te(e),this.templates=new Z(e)}},tt=class{constructor(e){s(this,"templates");this.templates=new ne(e)}},nt=class{constructor(e){s(this,"email");s(this,"whatsapp");s(this,"meet");s(this,"connections");this.email=new et(e),this.whatsapp=new tt(e),this.meet=new ee(e),this.connections=new X(e)}},rt=class{constructor(e){s(this,"files");s(this,"folders");s(this,"media");this.files=new ae(e),this.folders=new se(e),this.media=new re(e)}},O=class{constructor(e){s(this,"connect");s(this,"storage");this.connect=new nt(e),this.storage=new rt(e)}},st=class{constructor(e){s(this,"onboarding");s(this,"persona");this.onboarding=new $(e),this.persona=new I(e)}},at=class{constructor(e){s(this,"me");s(this,"members");s(this,"sessions");s(this,"notifications");this.me=new ge(e),this.members=new ye(e),this.sessions=new he(e),this.notifications=new ce(e)}},it=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 je(e),this.billing=new ke(e),this.payments=new _e(e),this.credits=new Ae(e),this.plans=new Be(e),this.agencyInvoices=new Te(e),this.flags=new Oe(e),this.activityLogs=new fe(e),this.auditLogs=new Re(e),this.analytics=new xe(e),this.health=new We(e),this.storage=new Ke(e),this.announcements=new we(e),this.compliance=new ve(e),this.tickets=new Ge(e),this.templates=new ze(e),this.agents=new be(e),this.personaHistory=new Fe(e),this.openapi=new Ue(e),this.staff=new He(e),this.tenants=new Qe(e),this.whatsapp=new Je(e),this.laie=new Le(e),this.laieRuntime=new qe(e),this.laieVault=new Ne(e),this.flow=new Se(e),this.email=new Ie(e),this.pipelines=new Ve(e),this.integrations=new Ee(e),this.erix=new Ce(e),this.dashboard=new $e(e),this.partners=new Me(e),this.waitlist=new Ye(e),this.blogs=new Pe(e),this.leads=new De(e),this.onboarding=new A(e),this.cors=new ie(e),this.clients=new pe(e)}},S=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 de(e),this.users=new at(e),this.tenants=new st(e),this.billing=new le(e),this.support=new me(e),this.ai=new ue(e),this.admin=new it(e),this.health=new oe(e)}};var P=class extends d{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},ot=class{async constructEvent(e,t,a){if(!t)throw new P("No webhook signature provided");let i=Array.isArray(t)?t[0]:t;i.startsWith("sha256=")&&(i=i.slice(7));try{let o=await import("crypto"),u=o.createHmac("sha256",a).update(e).digest("hex");if(!o.timingSafeEqual(Buffer.from(u),Buffer.from(i)))throw new P("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(o){throw o instanceof P?o:new P(`Webhook payload parsing failed: ${o.message}`)}}};var kt=typeof process!="undefined"&&"2.1.3"||"2.0.0";var v=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 y,g,T,b,x,l;if(!e.apiKey)throw new m("API Key is required");this.clientCode=(y=e.clientCode)==null?void 0:y.toUpperCase(),this.apiVersion=(g=e.version)!=null?g:"v1";let t=(T=e.baseUrl)!=null?T:ut,a=Ot(this.apiVersion,t),i=e.socketUrl||t,o=typeof window!="undefined"&&typeof window.document!="undefined",c=o?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",u=o?((b=globalThis.navigator)==null?void 0:b.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",p={"x-api-key":e.apiKey,"x-client-code":((x=e.clientCode)==null?void 0:x.toUpperCase())||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:kt,runtime:c,os:u})};if(e.coreApiKey&&(p["x-core-api-key"]=e.coreApiKey),this.client=Vt.create({baseURL:a,headers:p,timeout:(l=e.timeout)!=null?l:3e4}),Pt(this.client,{retries:3,retryDelay:Pt.exponentialDelay,retryCondition:w=>{var E;return Pt.isNetworkOrIdempotentRequestError(w)||((E=w.response)==null?void 0:E.status)===429},onRetry:(w,E,vt)=>{var At,$t;typeof process!="undefined"&&((At=process.env)==null?void 0:At.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${w}/3): ${($t=vt.method)==null?void 0:$t.toUpperCase()} ${vt.url}. Reason: ${E.message}`)}}),this.platform=new S(this.client),this.product=new C(this.client),this.infra=new O(this.client),this.webhooks=new ot,this.initSocket(i,e.apiKey,e.clientCode),o){let w={version:kt,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=w,window.ecodrix||(window.ecodrix=this)}}initSocket(e,t,a){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:i})=>{this.socket=i(e,{extraHeaders:{"x-api-key":t,"x-client-code":(a==null?void 0:a.toUpperCase())||""}}),this.setupSocket(a);for(let{type:o,args:c}of this.socketQueue)o==="joinRoom"?this.socket.emit("join-room",c[0]):o==="leaveRoom"?this.socket.emit("leave-room",c[0]):o==="on"?this.socket.on(c[0],c[1]):o==="off"?this.socket.off(c[0],c[1]):o==="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,t){return this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.socket?this.socket.disconnect():this.socketQueue.push({type:"disconnect",args:[]})}off(e,t){return this.socket?this.socket.off(e,t):this.socketQueue.push({type:"off",args:[e,t]}),this}async request(e,t,a,i){var o,c,u;try{return(await this.client.request({method:e,url:t,data:a,params:i})).data}catch(p){throw p.response?new d(((o=p.response.data)==null?void 0:o.message)||((c=p.response.data)==null?void 0:c.error)||"Raw Execution Failed",p.response.status,(u=p.response.data)==null?void 0:u.code):new d(p.message||"Network Error")}}};var Bt={401:m,403:m,429:f};function Ai(r){var e,t,a;if(r.response){let i=r.response.status,o=((e=r.response.data)==null?void 0:e.message)||((t=r.response.data)==null?void 0:t.error)||"API Request Failed",c=(a=r.response.data)==null?void 0:a.code,u=Bt[i]||d;throw u===m?new m(o):u===f?new f(o):new d(o,i,c)}throw new d(r.message||"Network Error")}function $i(r,e){return r instanceof e}function Ii(r){return r instanceof m?{message:r.message,status:r.status,code:r.code,type:"AuthenticationError"}:r instanceof f?{message:r.message,status:r.status,code:r.code,type:"RateLimitError"}:r instanceof d?{message:r.message,status:r.status,code:r.code,type:"APIError"}:{message:r.message||"Unknown error",type:"UnknownError"}}var St={[m.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[f.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[d.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function Ci(r){let e=r.constructor.name;return St[e]||St[d.name]}var Ei=v;export{d as APIError,A as AdminOnboarding,m as AuthenticationError,nt as ConnectInfra,v as ECODrIx,v as ECODrIxAPI,St as ERROR_RETRY_CONFIG,dt as EcodrixError,et as EmailConnect,Xe as ErixChat,Ze as ErixProduct,Bt as HTTP_STATUS_ERROR_MAP,O as InfraDomain,Mt as LEAD_STATUS_VALUES,$ as Onboarding,I as Persona,it as PlatformAdmin,S as PlatformDomain,st as PlatformTenants,at as PlatformUsers,C as ProductDomain,f as RateLimitError,rt as StorageInfra,tt as WhatsAppConnect,Ei as default,Ii as getErrorDetails,Ci as getRetryConfig,Ai as handleAPIError,$i as isAPIError};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodrix/erix-api",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "author": "ECODrIx Team <contact@ecodrix.com>",
5
5
  "license": "MIT",
6
6
  "description": "Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",