@ecodrix/erix-api 2.1.3 → 2.1.4
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 +4 -4
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/esm/index.d.ts +200 -0
- package/dist/ts/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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(`
|
|
2
|
+
import St from"repl";import{Command as Ot}from"commander";import Et from"dotenv";import p from"picocolors";import Ct from"axios";import wt from"axios-retry";var Xe="https://api.ecodrix.com";function kt(r="v1",e=Xe){return`${e.replace(/\/+$/,"")}/${r}/api`}var Ze=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},m=class extends Ze{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 et=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 et(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})}async revenue(){return this.get("/product/erix/crm/analytics/revenue")}async health(){return this.get("/product/erix/crm/analytics/health")}async payments(){return this.get("/product/erix/crm/analytics/payments")}async reviews(){return this.get("/product/erix/crm/analytics/reviews")}async retention(){return this.get("/product/erix/crm/analytics/retention")}};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 list(e){return this.get("/product/erix/crm/campaigns",{params:e})}async analytics(e){return this.get(`/product/erix/crm/campaigns/${e}/analytics`)}async create(e){return this.post("/product/erix/crm/campaigns",e)}async createAB(e){return this.post("/product/erix/crm/campaigns/ab",e)}};var A=class extends n{async getChecklist(e){return this.get(`/product/erix/crm/documents/checklist/${e}`)}async createChecklist(e,t){return this.post(`/product/erix/crm/documents/checklist/${e}`,{templateNiche:t})}async markReceived(e,t,s){return this.patch(`/product/erix/crm/documents/checklist/${e}/${t}`,s?{fileUrl:s}:{})}async sendReminder(e){return this.post(`/product/erix/crm/documents/checklist/${e}/remind`)}async listIncomplete(){return this.get("/product/erix/crm/documents/checklist/incomplete")}async listTemplates(){return this.get("/product/erix/crm/documents/templates")}};var $=class extends n{async csv(e){return this.get("/product/erix/commerce/invoices/export/csv",{params:e})}async tally(e){return this.get("/product/erix/commerce/invoices/export/tally",{params:e})}async zoho(e){return this.get("/product/erix/commerce/invoices/export/zoho",{params:e})}};var I=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(u=>this.create(u)),d=await Promise.allSettled(l);for(let u of d)if(u.status==="fulfilled")s.push(u.value);else throw u.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`)}async merge(e,t){return this.post("/product/erix/crm/leads/merge",{primaryId:e,secondaryId:t})}};var C=class extends n{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var S=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 O=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 E=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 L=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 D=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 N=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 q=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 M=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 U=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 _=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 V=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 F=class extends n{async workflowPacks(){return this.get("/product/erix/crm/niche/workflow-packs")}async workflowPackDetail(e){return this.get(`/product/erix/crm/niche/workflow-packs/${e}`)}async installWorkflowPack(e){return this.post(`/product/erix/crm/niche/workflow-packs/${e}/install`)}async templateSuggestions(){return this.get("/product/erix/crm/niche/template-suggestions")}};var B=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,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 W=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 K=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 H=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 z=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 Q=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 d of l){let u=d.replace(/{{|}}/g,"");a.push({key:`var_${u}`,label:`${c.type} Var {{${u}}}`,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 $t from"axios";var Y=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 $t.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 G=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)}`)}},J=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 X=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 Z=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 ee=class extends n{async system(){return(await this.get("/health")).data}};var te=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 ne=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 re=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 tt=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}`)}},nt=class extends n{async list(){return this.get("/platform/admin/blogs")}},rt=class extends n{async add(e){return this.post("/platform/admin/leads/add-lead",e)}},se=class extends n{clients;blogs;globalLeads;constructor(e){super(e),this.clients=new tt(e),this.blogs=new nt(e),this.globalLeads=new rt(e)}};var st=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"}},ae=class{copilot;constructor(e){this.copilot=new st(e)}};var ie=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 at=class extends n{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},it=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)}},ot=class extends n{async listPublic(){return this.get("/platform/billing/plans/public")}},ct=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)}},pt=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")}},lt=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)}},oe=class{entitlements;subscriptions;plans;checkout;user;credits;constructor(e){this.entitlements=new at(e),this.subscriptions=new it(e),this.plans=new ot(e),this.checkout=new ct(e),this.user=new pt(e),this.credits=new lt(e)}};var ce=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 pe=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",{})}},le=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}`)}},ue=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 de=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 me=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 ge=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 ye=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 he=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 fe=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 Te=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 be=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 xe=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 we=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 Re=class extends n{async stats(e){return this.get("/platform/admin/dashboard/stats",{params:e})}};var ke=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 ve=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 Pe=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 Ae=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 $e=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 Ie=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 Ce=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 Se=class extends n{async overview(e){return this.get("/platform/admin/laie-vault",{params:e})}};var Oe=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 Ee=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 Le=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 De=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 Ne=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 qe=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 Me=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 Ue=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 _e=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 Ve=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 Fe=class extends n{async overview(e){return this.get("/platform/admin/health",{params:e})}};var Be=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 je=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 We=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 Ke=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 He=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 ut=class{messages;conversations;broadcasts;constructor(e){this.messages=new N(e),this.conversations=new D(e),this.broadcasts=new L(e)}},dt=class{leads;pipelines;automations;activities;analytics;scoring;payments;sequences;automationDashboard;chat;events;eventLog;invoices;checkout;projects;campaigns;portalInbox;niche;documents;invoiceExport;crmCampaigns;constructor(e){this.leads=new I(e),this.pipelines=new S(e),this.automations=new v(e),this.activities=new w(e),this.analytics=new R(e),this.scoring=new O(e),this.payments=new C(e),this.sequences=new E(e),this.automationDashboard=new k(e),this.chat=new ut(e),this.events=new U(e),this.eventLog=new V(e),this.invoices=new _(e),this.checkout=new M(e),this.projects=new j(e),this.campaigns=new q(e),this.portalInbox=new B(e),this.niche=new F(e),this.documents=new A(e),this.invoiceExport=new $(e),this.crmCampaigns=new P(e)}},ze=class{erix;constructor(e){this.erix=new dt(e)}},mt=class{config;templates;constructor(e){this.config=new z(e),this.templates=new K(e)}},gt=class{templates;constructor(e){this.templates=new Q(e)}},yt=class{email;whatsapp;meet;connections;constructor(e){this.email=new mt(e),this.whatsapp=new gt(e),this.meet=new H(e),this.connections=new W(e)}},ht=class{files;folders;media;constructor(e){this.files=new J(e),this.folders=new G(e),this.media=new Y(e)}},Qe=class{connect;storage;constructor(e){this.connect=new yt(e),this.storage=new ht(e)}},ft=class{onboarding;persona;constructor(e){this.onboarding=new ne(e),this.persona=new re(e)}},Tt=class{me;members;sessions;notifications;constructor(e){this.me=new pe(e),this.members=new le(e),this.sessions=new ue(e),this.notifications=new te(e)}},bt=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 Ue(e),this.billing=new Te(e),this.payments=new De(e),this.credits=new we(e),this.plans=new Me(e),this.agencyInvoices=new me(e),this.flags=new Pe(e),this.activityLogs=new de(e),this.auditLogs=new fe(e),this.analytics=new ye(e),this.health=new Fe(e),this.storage=new Ve(e),this.announcements=new he(e),this.compliance=new xe(e),this.tickets=new We(e),this.templates=new Be(e),this.agents=new ge(e),this.personaHistory=new Ne(e),this.openapi=new Ee(e),this.staff=new _e(e),this.tenants=new je(e),this.whatsapp=new He(e),this.laie=new Ie(e),this.laieRuntime=new Ce(e),this.laieVault=new Se(e),this.flow=new Ae(e),this.email=new ke(e),this.pipelines=new qe(e),this.integrations=new $e(e),this.erix=new ve(e),this.dashboard=new Re(e),this.partners=new Le(e),this.waitlist=new Ke(e),this.blogs=new be(e),this.leads=new Oe(e),this.onboarding=new X(e),this.cors=new Z(e),this.clients=new se(e)}},Ye=class{auth;users;tenants;billing;support;ai;admin;health;constructor(e){this.auth=new ie(e),this.users=new Tt(e),this.tenants=new ft(e),this.billing=new oe(e),this.support=new ce(e),this.ai=new ae(e),this.admin=new bt(e),this.health=new ee(e)}};var b=class extends m{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},Ge=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"),d=c.createHmac("sha256",s).update(e).digest("hex");if(!c.timingSafeEqual(Buffer.from(d),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 xt=typeof process<"u"&&"2.1.4"||"2.0.0";var Je=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??Xe,s=kt(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",d=c?globalThis.navigator?.userAgent||"browser":typeof process<"u"?process.platform:"unknown",u={"x-api-key":e.apiKey,"x-client-code":e.clientCode?.toUpperCase()||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:xt,runtime:l,os:d})};if(e.coreApiKey&&(u["x-core-api-key"]=e.coreApiKey),this.client=Ct.create({baseURL:s,headers:u,timeout:e.timeout??3e4}),wt(this.client,{retries:3,retryDelay:wt.exponentialDelay,retryCondition:f=>wt.isNetworkOrIdempotentRequestError(f)||f.response?.status===429,onRetry:(f,At,Rt)=>{typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${f}/3): ${Rt.method?.toUpperCase()} ${Rt.url}. Reason: ${At.message}`)}}),this.platform=new Ye(this.client),this.product=new ze(this.client),this.infra=new Qe(this.client),this.webhooks=new Ge,this.initSocket(a,e.apiKey,e.clientCode),c){let f={version:xt,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")}}};Et.config();var vt="2.1.4";var Lt="Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",g=new Ot;g.name("erix").description(Lt).version(vt);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 Je({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 Dt=g.command("whatsapp").description("WhatsApp Business API operations");Dt.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 d=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: ${d?.id||"N/A"}`))}catch(l){console.error(p.red("\u2716 Failed to send message")),console.error(p.dim(l.message))}});var Pt=g.command("crm").description("CRM and Lead management");Pt.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),d=Array.isArray(l.data)?l.data:Array.isArray(l)?l:[];if(d.length===0){console.log(p.yellow("No leads found."));return}console.table(d.map(u=>({ID:u.id||u._id,Name:`${u.firstName} ${u.lastName||""}`.trim(),Phone:u.phone,Status:u.status,Score:u.score||0,Created:new Date(u.createdAt).toLocaleDateString()})))}catch(a){console.error(p.red("\u2716 Failed to fetch leads")),console.error(p.dim(a.message))}});Pt.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 Nt=g.command("analytics").description("Business Intelligence Analytics");Nt.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
|
|
5
|
-
Welcome to the Erix Interactive Shell`))),console.log(p.dim(`SDK Version: ${
|
|
6
|
-
`));let a=
|
|
4
|
+
`)}catch(a){console.error(p.red("\u2716 Failed to fetch analytics overview")),console.error(p.dim(a.message))}});var qt=g.command("webhooks").description("Webhook utility tools");qt.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(d){console.error(p.red("\u2716 Error during verification")),console.error(p.dim(d.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: ${vt}`)),console.log(p.dim(`The 'ecod' client is pre-initialized and ready.
|
|
6
|
+
`));let a=St.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() {
|