@ecodrix/erix-api 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/esm/index.d.ts +23 -1
- package/dist/ts/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/ts/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u,b as v,c as w,d as i,e as Bt,f as Kt,g as jt,h as Wt,i as pn,j as f,k as A,l as Gt,m as Ce,n as R}from"./chunk-XPXDFZWU.js";import ln from"axios";import zt from"axios-retry";var r=class{constructor(e){i(this,"client",e)}async post(e,t,s){try{let o=this.buildConfig(s);return(await this.client.post(e,t,o)).data}catch(o){this.handleError(o)}}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 o=this.buildConfig(s);return(await this.client.patch(e,t,o)).data}catch(o){this.handleError(o)}}async put(e,t,s){try{let o=this.buildConfig(s);return(await this.client.put(e,t,o)).data}catch(o){this.handleError(o)}}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=u({},e);return e.idempotencyKey&&(t.headers=v(u({},t.headers),{"Idempotency-Key":e.idempotencyKey})),t}handleError(e){throw R(e)}};var O=class extends r{async settings(){return this.get("/product/erix/ai/settings")}async updateSettings(e){return this.patch("/product/erix/ai/settings",e)}async outcomes(e={}){return this.get("/product/erix/ai/outcomes",{params:e})}async reviews(e){return this.get(`/product/erix/ai/reviews${e?`?status=${e}`:""}`)}async review(e,t,s){return this.post(`/product/erix/ai/reviews/${encodeURIComponent(e)}`,u({verdict:t},s?{note:s}:{}))}async suggestion(e){return this.get(`/product/erix/ai/suggestion/${e}`)}async approveAction(e){return this.post(`/product/erix/ai/suggestion/${e}/approve-action`,{})}async markSent(e,t,s){return this.post(`/product/erix/ai/suggestion/${e}/send`,{text:t,confidence:s})}async dismiss(e){return this.post(`/product/erix/ai/suggestion/${e}/dismiss`,{})}async approvals(){return this.get("/product/flow/approvals")}async agents(){return this.get("/product/flow/agents")}async agent(e){return this.get(`/product/flow/agents/${encodeURIComponent(e)}`)}async tryAgent(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/try`,t)}async proposeAgentChange(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/propose`,t)}async buildAgent(e){return this.post("/product/flow/agents/build",e)}async unansweredQuestions(){return this.get("/product/flow/agents/unanswered")}async markQuestionHandled(e){return this.post("/product/flow/agents/unanswered/handled",{question:e})}async agentTemplates(){return this.get("/product/flow/agents/templates")}async createAgent(e){return this.post("/product/flow/agents",e)}async updateAgent(e,t){return this.patch(`/product/flow/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return this.deleteRequest(`/product/flow/agents/${encodeURIComponent(e)}`)}async agentAutomation(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/automation`,{trigger:t})}async decideRun(e,t,s){return this.post(`/product/flow/runs/${encodeURIComponent(e)}/approve`,u({decision:t},s&&{nodeId:s}))}};var y="/product/erix/commerce/checkout",x="/product/erix/public/checkout",h=encodeURIComponent,xt=class extends r{async getProduct(e,t){return this.get(`${x}/products/${h(t)}`,{params:{c:e}})}async viewSession(e,t){return this.get(`${x}/sessions/view`,{params:{c:e,t}})}async updateItems(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/items`,s)}async startSession(e){return this.post(`${x}/sessions`,e)}async applyCoupon(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/coupon`,s)}async verify(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/verify`,s)}async placeOrder(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/order`,s)}async verifyRazorpay(e){let a=e,{sessionId:t,orderId:s}=a,o=w(a,["sessionId","orderId"]);return this.post(`${x}/sessions/${h(t)}/order/${h(s)}/razorpay`,o)}async orderStatus(e,t){return this.get(`${x}/orders/status`,{params:{c:e,t}})}async confirmCod(e,t){return this.post(`${x}/cod/confirm`,{clientCode:e,token:t})}},kt=class extends r{async create(e){return this.post(`${y}/sessions`,e)}},Ae=class extends r{constructor(t){super(t);i(this,"buyer");i(this,"sessions");this.buyer=new xt(t),this.sessions=new kt(t)}async listProducts(){return this.get(`${y}/products`)}async createProduct(t){return this.post(`${y}/products`,t)}async updateProduct(t,s){return this.patch(`${y}/products/${h(t)}`,s)}async deleteProduct(t){return this.deleteRequest(`${y}/products/${h(t)}`)}async listCoupons(){return this.get(`${y}/coupons`)}async createCoupon(t){return this.post(`${y}/coupons`,t)}async updateCoupon(t,s){return this.patch(`${y}/coupons/${h(t)}`,s)}async deleteCoupon(t){return this.deleteRequest(`${y}/coupons/${h(t)}`)}async listOrders(t){return this.get(`${y}/orders`,{params:t})}async getOrder(t){return this.get(`${y}/orders/${h(t)}`)}async updateOrderStatus(t,s){return this.patch(`${y}/orders/${h(t)}/status`,s)}async getSettings(){return this.get(`${y}/settings`)}async updateSettings(t){return this.put(`${y}/settings`,t)}async createProductLink(t){return this.post(`${y}/links`,t)}};var Re=class extends r{async providers(){return this.get("/infra/connect/providers")}async list(){return this.get("/infra/connect/connections")}async get_(e){return this.get(`/infra/connect/connections/${e}`)}async connect(e,t){return this.post(`/infra/connect/connections/${e}/connect`,t)}async configure(e,t){return this.put(`/infra/connect/connections/${e}/configure`,t)}async configureWebchat(e){return this.configure("webchat",{method:"domain",config:e})}async webchatSettings(){return this.get("/infra/connect/connections/webchat/settings")}async removeWebchatDomain(e){return this.deleteRequest(`/infra/connect/connections/webchat/domains/${encodeURIComponent(e)}`)}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 checkNow(e){return this.post(`/infra/connect/connections/${e}/health/check`,{})}async googleConnectUrl(){return this.post("/infra/connect/google/connect-url",{})}async moveChannel(e,t){return this.post(`/infra/connect/${e}/move`,{ticket:t})}async requestChannelRelease(e,t){return this.post(`/infra/connect/${e}/release-request`,{ticket:t})}async channelReleaseRequest(e){return this.get(`/infra/connect/${e}/release-request`)}async cancelChannelRelease(e){return this.deleteRequest(`/infra/connect/${e}/release-request`)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var D=class extends r{async retrieve(e){return this.get(`/infra/connect/channel-settings/${e}`)}async save(e,t){return this.put(`/infra/connect/channel-settings/${e}`,t)}async resumeEmail(){return this.post("/infra/connect/channel-settings/email/resume",{})}};var U=class extends r{async list(e){return this.get("/infra/connect/accounts",e?{params:{providerId:e}}:void 0)}async retrieve(e){return this.get(`/infra/connect/accounts/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/infra/connect/accounts/${encodeURIComponent(e)}`,t)}async remove(e,t={}){return this.deleteRequest(`/infra/connect/accounts/${encodeURIComponent(e)}`,t.newDefaultId?{params:{newDefaultId:t.newDefaultId}}:void 0)}};var wt=class extends r{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}`)}},Ie=class extends r{constructor(t){super(t);i(this,"notes");this.notes=new wt(t)}async timeline(t,s){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:s})}async list(t,s){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:u({},s)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,s){return this.post(`/product/erix/crm/leads/${t}/calls`,s)}};var Pe=class extends r{async overview(e){return this.get("/product/erix/crm/analytics/overview",{params:e})}async funnel(e){return this.get("/product/erix/crm/analytics/funnel",{params:{pipelineId:e}})}async forecast(e){return this.get("/product/erix/crm/analytics/forecast",{params:{pipelineId:e}})}async sources(e){return this.get("/product/erix/crm/analytics/sources",{params:e})}async team(e){return this.get("/product/erix/crm/analytics/team",{params:e})}async heatmap(e){return this.get("/product/erix/crm/analytics/heatmap",{params:e})}async scores(){return this.get("/product/erix/crm/analytics/scores")}async stageTime(e){return this.get("/product/erix/crm/analytics/stage-time",{params:{pipelineId:e}})}async tiered(e){return this.get("/product/erix/crm/analytics/tiered",{params:e})}async summary(e){return this.get("/product/erix/crm/analytics/summary",{params:e})}async whatsapp(e){return this.get("/product/erix/crm/analytics/whatsapp",{params:e})}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 Le=class extends r{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 Ee=class extends r{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 Ht=["open","won","lost","archived"],$e=class extends r{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:Ht.map(a=>({label:`${a.charAt(0).toUpperCase()}${a.slice(1)}`,value:a}))},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],o=t.map(a=>({key:`metadata.extra.${a.name}`,label:a.label||a.name,type:a.type||"string",required:!!a.required,options:a.options,group:"Custom Fields"}));return{name:"Lead",fields:[...s,...o],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}}async upsert(e){return this.post("/product/erix/crm/leads/upsert",e)}async createMany(e,t=50){let s=[];for(let o=0;o<e.length;o+=t){let l=e.slice(o,o+t).map(g=>this.create(g)),d=await Promise.allSettled(l);for(let g of d)if(g.status==="fulfilled")s.push(g.value);else throw g.reason}return s}async import(e,t={}){return this.post("/product/erix/crm/leads/import",u({leads:e},t))}async bulkUpsert(e){return this.import(e)}async list(e){let t=u({},e);return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}listAutoPaging(e){return Kt(this,null,function*(){let t=(e==null?void 0:e.page)||1,s=!0;for(;s;){let o=yield new Bt(this.list(v(u({},e),{page:t}))),a=Array.isArray(o.data)?o.data:o||[];if(a.length===0){s=!1;break}for(let l of a)yield l;o.pagination&&t<o.pagination.pages||!o.pagination&&a.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 setFollowUp(e,t,s){return this.patch(`/product/erix/crm/leads/${e}`,{nextFollowUpAt:t,nextFollowUpNote:t&&s!=null?s:null})}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 export(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/export`)}async erase(e){return this.post(`/product/erix/crm/leads/${encodeURIComponent(e)}/erase`,{confirm:"ERASE"})}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 flowRuns(e){return this.get(`/product/erix/crm/leads/${e}/flow-runs`)}async merge(e,t){return this.post("/product/erix/crm/leads/merge",{primaryId:e,secondaryId:t})}async duplicates(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/duplicates`)}};var Ve=class extends r{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var Oe=class extends r{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,a;let t=await this.retrieve(e),s=Array.isArray((o=t.data)==null?void 0:o.stages)?t.data.stages:[];return{name:`Pipeline: ${((a=t.data)==null?void 0:a.name)||e}`,fields:s.map(l=>({key:l._id,label:l.name,type:"string",required:!0,options:[{label:l.name,value:l._id}],group:"Stages",uiHints:{color:l.color||"#cbd5e1",probability:l.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`,{name: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 De=class extends r{async getConfig(){return this.get("/product/erix/crm/scoring")}async updateConfig(e){return this.patch("/product/erix/crm/scoring",e)}async recalculate(e){return this.post(`/product/erix/crm/scoring/${e}/recalculate`,{})}async preview(e){return this.get(`/product/erix/crm/scoring/preview/${e}`)}};var Ue=class extends r{async sendTest(e){return this.post("/infra/connect/email/test",{to:e})}async listTemplates(e){return this.get("/infra/connect/email/templates",{params:e})}async getTemplate(e){return this.get(`/infra/connect/email/templates/${e}`)}async createTemplate(e){return this.post("/infra/connect/email/templates",e)}async updateTemplate(e,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 Fe=class extends r{async trigger(e){return this.post("/product/erix/events/trigger",e)}async listCustomEvents(){return this.get("/product/flow/config/triggers")}async createCustomEvent(e){return this.post("/product/flow/config/triggers",e)}async deleteCustomEvent(e){return this.deleteRequest(`/product/flow/config/triggers/${e}`)}};var Me=class extends r{async list(){return this.get("/infra/connect/facebook/lead-forms")}async subscribe(){return this.post("/infra/connect/facebook/lead-forms/subscribe",{})}async setEnabled(e,t){return this.put(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}`,{enabled:t})}async importLast24Hours(e){return this.post(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}/import-last-24h`,{})}};var F=class extends r{path(e,t=""){return`/product/flow/workflows/${encodeURIComponent(e)}${t}`}async versions(e){return this.get(this.path(e,"/versions"))}async version(e,t){return this.get(this.path(e,`/versions/${encodeURIComponent(t)}`))}async restoreVersion(e,t){return this.post(this.path(e,`/versions/${encodeURIComponent(t)}/restore`))}async testData(e){return this.get(this.path(e,"/test-data"))}async pinTestData(e,t){return this.put(this.path(e,"/test-data"),{runId:t})}async unpinTestData(e){return this.deleteRequest(this.path(e,"/test-data"))}async testRun(e,t={}){return this.post(this.path(e,"/test-run"),t)}async testRunProgress(e,t){return this.get(this.path(e,"/test-run"),{params:{runIds:t.join(",")}})}async copilot(e,t){return this.post(this.path(e,"/copilot"),t)}async live(e){return this.get(this.path(e,"/live"))}async week(e){return this.get(this.path(e,"/week"))}async deleteImpact(e){return this.get(this.path(e,"/delete-impact"))}async remove(e,t={}){return this.deleteRequest(this.path(e,t.stop?"?stop=true":""))}async duplicate(e){return this.post(this.path(e,"/duplicate"))}async retryFailed(e,t={}){return this.post(this.path(e,"/retry-failed"),t)}};var S=class extends r{async list(e={}){return this.get("/product/flow/campaigns",{params:e})}async create(e){return this.post("/product/flow/campaigns",e)}async launch(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/launch`,t)}async retrieve(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/product/flow/campaigns/${encodeURIComponent(e)}`,t)}async test(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/test`,{})}async start(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/start`,t)}async pause(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/pause`,{})}async resume(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/resume`,{})}async stop(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/stop`,{})}async remove(e){return this.deleteRequest(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async duplicate(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/duplicate`,{})}async followUp(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/follow-up`,t)}async checks(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/checks`)}async results(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/results`)}async people(e,t={}){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/people`,{params:t})}};var I="/product/flow/conversations",m=(n,e="")=>`${I}/${encodeURIComponent(n)}${e}`,M=class extends r{async list(e={}){return this.get(I,{params:e})}async create(e){return this.post(I,e)}async retrieve(e){return this.get(m(e))}async update(e,t){return this.patch(m(e),t)}async duplicate(e){return this.post(m(e,"/duplicate"),{})}async archive(e){return this.deleteRequest(m(e))}async publish(e,t={}){return this.post(m(e,"/publish"),t)}async versions(e){return this.get(m(e,"/versions"))}async version(e,t){return this.get(m(e,`/versions/${t}`))}async rollback(e,t){return this.post(m(e,"/rollback"),{version:t})}async try(e,t){return this.post(m(e,"/try"),t)}async tests(e){return this.get(m(e,"/tests"))}async addTest(e,t){return this.post(m(e,"/tests"),t)}async deleteTest(e,t){return this.deleteRequest(m(e,`/tests/${encodeURIComponent(t)}`))}async runTests(e,t={}){return this.post(m(e,"/tests/run"),t)}async deployments(e){return this.get(m(e,"/deployments"))}async allDeployments(){return this.get(`${I}/deployments`)}async deploy(e,t){return this.post(m(e,"/deployments"),t)}async updateDeployment(e,t){return this.patch(`${I}/deployments/${encodeURIComponent(e)}`,t)}async removeDeployment(e){return this.deleteRequest(`${I}/deployments/${encodeURIComponent(e)}`)}async checks(e){return this.get(m(e,"/checks"))}async moveToAgent(e){return this.post(m(e,"/move-to-agent"),{})}};var _=class extends r{async get(){return super.get("/product/flow/home")}async nav(){return super.get("/product/flow/home/nav")}},N=class extends r{async create(e){return this.post("/product/flow/drafts",e)}async plan(e){return this.post("/product/flow/drafts/plan",e)}},q=class extends r{async status(){return this.get("/product/flow/first-run")}async installPack(e){return this.post(`/product/flow/first-run/packs/${e}`)}},B=class extends r{async list(){return this.get("/product/flow/audiences")}async byId(e){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}`)}async create(e){return this.post("/product/flow/audiences",e)}async update(e,t){return this.patch(`/product/flow/audiences/${encodeURIComponent(e)}`,t)}async remove(e){return this.deleteRequest(`/product/flow/audiences/${encodeURIComponent(e)}`)}async preview(e,t){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}/preview${t?`?channel=${t}`:""}`)}async previewRules(e){return this.post("/product/flow/audiences/preview",e)}};var _e=class extends r{async system(){return(await this.get("/health")).data}};var Ne=class extends r{async list(e){return this.get("/product/erix/commerce/invoices",{params:e})}async getInvoice(e){return this.get(`/product/erix/commerce/invoices/${e}`)}async create(e){return this.post("/product/erix/commerce/invoices",e)}async update(e,t){return this.patch(`/product/erix/commerce/invoices/${e}`,t)}async void(e){return this.post(`/product/erix/commerce/invoices/${e}/void`,{})}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)}async paymentLink(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payment-link`,{})}async recordPayment(e,t){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payments`,t)}async sendWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-whatsapp`,{})}async sendEmail(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-email`,{})}};var Xt=n=>"queued"in n&&n.queued===!0,Zt={runProgress:"laie:run:progress",importComplete:"laie:import:complete"},p=encodeURIComponent,c="/product/laie",K=class extends r{async list(){return this.get(`${c}/packs`)}async byId(e){return this.get(`${c}/packs/${p(e)}`)}},j=class extends r{async catalog(e={}){return this.get(`${c}/signals/catalog`,{params:e})}async list(e={}){return this.get(`${c}/signals`,{params:e})}},W=class extends r{async find(e){return this.post(`${c}/tools/find`,e)}async collect(e){return this.post(`${c}/tools/collect`,e)}async enrich(e){return this.post(`${c}/tools/enrich`,e)}async verify(e){return this.post(`${c}/tools/verify`,e)}async qualify(e){return this.post(`${c}/tools/qualify`,e)}async store(e){return this.post(`${c}/tools/store`,e)}async use(e){return this.post(`${c}/tools/use`,e)}async verifyEmail(e){return this.post(`${c}/tools/verify-email`,{emails:e})}async websiteLookup(e){return this.post(`${c}/tools/website-lookup`,{url:e})}},G=class extends r{async list(){return this.get(`${c}/campaigns`)}async create(e){return this.post(`${c}/campaigns`,e)}async byId(e){return this.get(`${c}/flows/${p(e)}`)}async settings(e){return this.get(`${c}/campaigns/${p(e)}/settings`)}async updateSettings(e,t){return this.patch(`${c}/campaigns/${p(e)}/settings`,t)}async signals(e){return this.get(`${c}/campaigns/${p(e)}/signals`)}async setSignals(e,t){return this.put(`${c}/campaigns/${p(e)}/signals`,t)}},H=class extends r{async start(e){return this.post(`${c}/campaigns/${p(e)}/runs`)}async list(e,t={}){return this.get(`${c}/campaigns/${p(e)}/runs`,{params:t})}async byId(e,t){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}`)}async changes(e,t,s={}){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}/changes`,{params:s})}async cancel(e,t){return this.post(`${c}/campaigns/${p(e)}/runs/${p(t)}/cancel`)}async quality(e){return this.get(`${c}/jobs/${p(e)}/quality`)}},Q=class extends r{async list(e={}){let o=e,{importedToCrm:t}=o,s=w(o,["importedToCrm"]);return this.get(`${c}/leads`,{params:u(u({},s),t!==void 0&&{importedToCrm:String(t)})})}async byId(e){return this.get(`${c}/leads/${p(e)}`)}async update(e,t){return this.patch(`${c}/leads/${p(e)}`,t)}async notes(e){return this.get(`${c}/leads/${p(e)}/notes`)}async addNote(e,t){return this.post(`${c}/leads/${p(e)}/notes`,t)}async generateKit(e){return this.post(`${c}/leads/${p(e)}/generate-kit`)}async pipelineSummary(){return this.get(`${c}/leads/pipeline-summary`)}async bulkContacted(e,t){return this.post(`${c}/leads/bulk/contacted`,{leadIds:e,channel:t})}async bulkTag(e,t){return this.post(`${c}/leads/bulk/tag`,{leadIds:e,tags:t})}async bulkDelete(e){return this.post(`${c}/leads/bulk/delete`,{leadIds:e})}async bulkExport(e,t="json"){return t==="csv"?this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t},{responseType:"text"}):this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t})}},z=class extends r{async pipelines(){return this.get(`${c}/import/pipelines`)}async crm(e){return this.post(`${c}/import/crm`,e)}},Y=class extends r{async enrich(e){return this.post(`${c}/lists/enrich`,e)}},J=class extends r{async dsr(e){return this.post(`${c}/compliance/dsr`,e)}async report(e={}){return this.get(`${c}/compliance/report`,{params:e})}},X=class extends r{async map(e={}){return this.get(`${c}/market-map`,{params:e})}async forCampaign(e){return this.get(`${c}/campaigns/${p(e)}/market-map`)}async refresh(e={}){return this.post(`${c}/market-map/refresh`,e)}},Z=class extends r{async weights(e={}){return this.get(`${c}/learning/weights`,{params:e})}async outcomes(e={}){return this.get(`${c}/learning/outcomes`,{params:e})}},ee=class extends r{async preview(e){return this.post(`${c}/lookalikes/preview`,e)}async create(e){return this.post(`${c}/lookalikes`,e)}async list(e={}){return this.get(`${c}/lookalikes`,{params:e})}async byId(e){return this.get(`${c}/lookalikes/${p(e)}`)}async rank(e,t={}){return this.get(`${c}/lookalikes/${p(e)}/rank`,{params:t})}},te=class extends r{async status(){return this.get(`${c}/freshness`)}},ne=class extends r{async start(e){return this.post(`${c}/audit`,e)}async byId(e){return this.get(`${c}/audit/${p(e)}`)}};import en from"axios";var qe=class extends r{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,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:o,key:a,headers:l}=s.data;await en.put(o,e,{headers:l!=null?l:{"Content-Type":t.contentType}});let d=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:a,sizeBytes:d})}};var Be=class extends r{async create(e){return this.post("/infra/connect/meet",e)}async list(e){return this.get("/infra/connect/meet",{params:e})}async retrieve(e){return this.get(`/infra/connect/meet/${e}`)}async update(e,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 Ke=class extends r{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 je=class extends r{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")}};var re=class extends r{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}};var se=class extends r{async get(e){return super.get(`/platform/tenants/persona/${e}`)}async reinforce(e){return this.post(`/platform/tenants/persona/${e.productId}/reinforce`,e)}async confidence(e){return super.get(`/platform/tenants/persona/${e}/confidence`,{params:{productId:e}})}async timeline(e,t){var o;let s=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(o=s==null?void 0:s.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var s,o;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(s=t==null?void 0:t.data)==null?void 0:s.entries)!=null?o:[]}};var vt=class extends r{async chatSync(e){return this.post("/platform/ai/copilot/chat/sync",e)}async confirm(e){return this.post("/platform/ai/copilot/confirm",e)}async listSessions(){return this.get("/platform/ai/copilot/sessions")}async getSession(e){return this.get(`/platform/ai/copilot/sessions/${e}`)}async deleteSession(e){return this.deleteRequest(`/platform/ai/copilot/sessions/${e}`)}chatStreamUrl(){return"/platform/ai/copilot/chat"}},We=class{constructor(e){i(this,"copilot");this.copilot=new vt(e)}};var Ge=class extends r{async list(e){return this.get("/platform/tenants/audit",{params:e})}};var He=class extends r{async register(e){return this.post("/platform/auth/register",e)}async login(e){return this.post("/platform/auth/login",e)}async logout(e){return this.post("/platform/auth/logout",e)}async logoutAll(e){return this.post("/platform/auth/logout-all",e)}async validateSession(e){return this.post("/platform/auth/session/validate",e)}async listSessions(){return this.get("/platform/auth/sessions")}async revokeSession(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}async requestPasswordOtp(e){return this.post("/platform/auth/password/request-otp",e)}async setPassword(e){return this.post("/platform/auth/password/set",e)}async changePassword(e){return this.post("/platform/auth/password/change",e)}async forgotPassword(e){return this.post("/platform/auth/forgot",e)}async resetPassword(e){return this.post("/platform/auth/reset",e)}async linkOAuth(e){return this.post("/platform/auth/oauth-link",e)}async getInvitation(e){return this.get(`/platform/auth/invitations/${e}`)}async acceptInvitation(e,t){return this.post(`/platform/auth/invitations/${e}/accept`,t)}};var St=class extends r{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},Tt=class extends r{async upgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/upgrade",e)}async downgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/downgrade",e)}async cancel(e){return this.post("/platform/billing/subscriptions/subscriptions/cancel",e)}},Ct=class extends r{list(){return this.get("/platform/billing/addons")}add(e,t){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/add`,t===void 0?{}:{quantity:t})}remove(e){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/remove`)}overage(){return this.get("/platform/billing/overage")}setOverage(e){return this.put("/platform/billing/overage",e)}},At=class extends r{async listPublic(){return this.get("/platform/billing/plans/public")}},Rt=class extends r{async plans(){return this.get("/platform/billing/checkout/plans")}async proration(e,t){return this.get("/platform/billing/checkout/proration",{params:{planId:e,billingCycle:t}})}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)}},It=class extends r{async transactions(){return this.get("/platform/billing/user/transactions")}async transactionInvoice(e){return this.get(`/platform/billing/user/transactions/${encodeURIComponent(e)}/invoice`)}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")}},Pt=class extends r{async balance(){return this.get("/platform/billing/credits/balance")}async transactions(){return this.get("/platform/billing/credits/transactions")}async packs(){return this.get("/platform/billing/credits/packs")}async topupOrder(e){return this.post("/platform/billing/credits/topup/order",e)}async verifyTopup(e){return this.post("/platform/billing/credits/topup/verify",e)}async setAutoTopup(e){return this.patch("/platform/billing/credits/auto-topup",e)}async setSpendCap(e){return this.patch("/platform/billing/credits/spend-cap",e)}},Qe=class{constructor(e){i(this,"entitlements");i(this,"subscriptions");i(this,"plans");i(this,"checkout");i(this,"user");i(this,"credits");i(this,"addOns");this.entitlements=new St(e),this.subscriptions=new Tt(e),this.plans=new At(e),this.checkout=new Rt(e),this.user=new It(e),this.credits=new Pt(e),this.addOns=new Ct(e)}};var ie=class extends r{async list(){return this.get("/platform/public/catalog",{ignoreClientCode:!0})}};var P=class extends r{async send(e){if(e.conversationId)return this.post(`/platform/inbox/conversations/${e.conversationId}/messages`,{text:e.text,media:e.media});if(!e.to)throw new Error("send: conversationId or to is required");if(e.media)throw new Error("send: media goes to an inbox thread (conversationId)");return this.post("/infra/connect/send/whatsapp",u({phone:e.to,text:e.text},e.accountId?{accountId:e.accountId}:{}))}async sendTemplate(e){return this.post("/infra/connect/send/whatsapp",u({phone:e.to,templateName:e.templateName,language:e.language,variables:e.variables},e.accountId?{accountId:e.accountId}:{}))}async star(e,t){return this.post(`/platform/inbox/messages/${e}/star`,{starred:t})}async translate(e){return this.post(`/platform/inbox/messages/${encodeURIComponent(e)}/translate`,{})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async upload(e,t={}){var k,$,V;let s=($=(k=t.fileName)!=null?k:e.name)!=null?$:"file",o=e.type||"application/octet-stream",a=await this.post("/infra/storage/files/upload-url",{folder:(V=t.folder)!=null?V:"inbox",filename:s,contentType:o}),{uploadUrl:l,key:d,headers:g}=a.data,C=await fetch(l,{method:"PUT",headers:g!=null?g:{"Content-Type":o},body:e});if(!C.ok)throw new Error(`upload failed (${C.status})`);return await this.post("/infra/storage/files/confirm-upload",{key:d,sizeBytes:e.size}),{key:d,mimeType:o,fileName:s}}};var tn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown","text/csv","text/html","image/png","image/jpeg","image/webp"],oe=class extends r{async list(){return this.get("/platform/knowledge/sources")}async addText(e){return this.post("/platform/knowledge/sources",u({kind:"text"},e))}async addUrl(e){return this.post("/platform/knowledge/sources",u({kind:"url"},e))}async addWebsite(e){return this.post("/platform/knowledge/sources",{type:"website",url:e.url})}async addFile(e,t={}){var o,a;let s=await new P(this.client).upload(e,{folder:"knowledge"});return this.post("/platform/knowledge/sources",{kind:"file",key:s.key,mimeType:s.mimeType,title:(a=(o=t.title)!=null?o:s.fileName)!=null?a:"Document"})}async remove(e){return this.deleteRequest(`/platform/knowledge/sources/${e}`)}async reindex(e){return this.post(`/platform/knowledge/sources/${e}/reindex`,{})}async search(e,t){return this.post("/platform/knowledge/search",u({query:e},t?{limit:t}:{}))}};var ze=class extends r{async categories(){return this.get("/platform/support/categories")}async listTickets(e){return this.get("/platform/support/tickets",{params:e})}async createTicket(e){return this.post("/platform/support/tickets",e)}async getTicket(e){return this.get(`/platform/support/tickets/${e}`)}async reply(e,t){return this.post(`/platform/support/tickets/${e}/reply`,t)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}async channelSetup(e){return this.get(`/platform/support/channel-requests/${encodeURIComponent(e)}/setup`)}};var Ye=class extends r{async get(){return super.get("/platform/users/me")}async update(e){return this.patch("/platform/users/me",e)}async updateOrganization(e){return this.patch("/platform/users/me/organization",e)}async toggleModules(e){return this.post("/platform/users/me/modules",e)}async workspaces(){return super.get("/platform/users/me/workspaces")}async setActiveOrg(e){return this.post("/platform/users/me/active-org",e)}async dismissWorkspaceSetup(){return this.post("/platform/users/me/workspace/dismiss-setup",{})}},Je=class extends r{async list(){return this.get("/platform/users/members")}async access(){return this.get("/platform/users/members/access")}async invite(e){return this.post("/platform/users/members/invite",e)}async updateAccess(e,t){return this.patch(`/platform/users/members/${encodeURIComponent(e)}`,t)}async updateRole(e,t){return this.updateAccess(e,{role:t})}async remove(e){return this.deleteRequest(`/platform/users/members/${encodeURIComponent(e)}`)}async invitations(){return this.get("/platform/users/members/invitations")}async resendInvitation(e){return this.post(`/platform/users/members/invitations/${encodeURIComponent(e)}/resend`,{})}async revokeInvitation(e){return this.deleteRequest(`/platform/users/members/invitations/${encodeURIComponent(e)}`)}},Xe=class extends r{async list(){return this.get("/platform/auth/sessions")}async revoke(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}};var Ze=class extends r{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 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 ae=class extends r{async list(){return this.get("/product/seo/projects")}async create(e){return this.post("/product/seo/projects",e)}async byId(e){return this.get(`/product/seo/projects/${e}`)}async update(e,t){return this.patch(`/product/seo/projects/${e}`,t)}async remove(e){return this.deleteRequest(`/product/seo/projects/${e}`)}async crawl(e){return this.post(`/product/seo/projects/${e}/crawl`)}async crawlCompetitor(e,t){return this.post(`/product/seo/projects/${e}/competitors/crawl`,{domain:t})}},ce=class extends r{async start(e){return this.post("/product/seo/audits",e)}async list(e={}){return this.get("/product/seo/audits",{params:e})}async compare(e){return this.post("/product/seo/audits/compare",e)}async byId(e){return this.get(`/product/seo/audits/${e}`)}async resume(e){return this.post(`/product/seo/audits/${e}/resume`)}async pages(e,t={}){return this.get(`/product/seo/audits/${e}/pages`,{params:t})}async issues(e){return this.get(`/product/seo/audits/${e}/issues`)}async links(e){return this.get(`/product/seo/audits/${e}/links`)}async export(e,t="json"){return this.get(`/product/seo/audits/${e}/export`,{params:{format:t},responseType:"text"})}},le=class extends r{async keywords(e,t={}){return this.get(`/product/seo/audits/${e}/keywords`,{params:t})}async contentGap(e){return this.post("/product/seo/audits/content-gap",e)}async search(e){return this.post("/product/seo/audits/search",e)}async backlinks(e){return this.get("/product/seo/audits/backlinks",{params:e})}async domain(e){return this.get(`/product/seo/audits/domains/${encodeURIComponent(e)}`)}},ue=class extends r{async check(e){return this.post(`/product/seo/search-console/${e}/check`)}async importNow(e){return this.post(`/product/seo/search-console/${e}/import`)}async status(e){return this.get(`/product/seo/search-console/${e}/status`)}async queries(e,t={}){return this.get(`/product/seo/search-console/${e}/queries`,{params:t})}async pages(e,t={}){return this.get(`/product/seo/search-console/${e}/pages`,{params:t})}async trend(e,t={}){return this.get(`/product/seo/search-console/${e}/trend`,{params:t})}},pe=class extends r{async keywords(e){return this.get(`/product/seo/ranks/${e}/keywords`)}async add(e,t,s={}){return this.post(`/product/seo/ranks/${e}/keywords`,u({queries:t},s))}async visibility(e,t={}){return this.get(`/product/seo/ranks/${e}/visibility`,{params:t})}async competitors(e){return this.get(`/product/seo/ranks/${e}/competitors`)}async gap(e,t={}){return this.get(`/product/seo/ranks/${e}/gap`,{params:t})}async remove(e,t){return this.deleteRequest(`/product/seo/ranks/${e}/keywords/${t}`)}async checkNow(e,t){return this.post(`/product/seo/ranks/${e}/keywords/${t}/check`)}async history(e,t,s={}){return this.get(`/product/seo/ranks/${e}/keywords/${t}/history`,{params:s})}async changes(e){return this.get(`/product/seo/ranks/${e}/changes`)}},ge=class extends r{async checkNow(e){return this.post(`/product/seo/local/${e}/check`)}async latest(e){return this.get(`/product/seo/local/${e}`)}async history(e,t={}){return this.get(`/product/seo/local/${e}/history`,{params:t})}async startGrid(e,t={}){return this.post(`/product/seo/local/${e}/grid`,t)}async grid(e){return this.get(`/product/seo/local/${e}/grid`)}async grids(e,t={}){return this.get(`/product/seo/local/${e}/grids`,{params:t})}},de=class extends r{async byProject(e){return this.get(`/product/seo/reports/${e}`)}async export(e,t="csv"){return this.get(`/product/seo/reports/${e}/export`,{params:{format:t},responseType:"text"})}async pdf(e,t={}){return this.get(`/product/seo/reports/${e}/pdf`,{params:t,responseType:"arraybuffer"})}async generate(e,t={}){return this.post(`/product/seo/reports/${e}/generate`,t)}async history(e,t={}){return this.get(`/product/seo/reports/${e}/history`,{params:t})}async changes(e){return this.get(`/product/seo/reports/${e}/changes`)}},me=class extends r{async seed(e,t,s="en"){return this.post(`/product/seo/research/${e}/seed`,{seed:t,lang:s})}async fromSearchConsole(e){return this.post(`/product/seo/research/${e}/from-search-console`)}async ideas(e,t={}){return this.get(`/product/seo/research/${e}/ideas`,{params:t})}async analyze(e,t){return this.post(`/product/seo/research/${e}/ideas/${t}/analyze`)}};var ye=class extends r{async releases(){return this.get("/product/seo/backlinks/releases")}async strength(e){return this.get("/product/seo/backlinks/strength",{params:{domains:e.join(",")}})}async overview(e){return this.get(`/product/seo/backlinks/${e}`)}async referring(e,t){return this.get(`/product/seo/backlinks/${e}/referring`,{params:t})}async changes(e,t){return this.get(`/product/seo/backlinks/${e}/changes`,{params:t})}},he=class extends r{async checkNow(e){return this.post(`/product/seo/performance/${e}/check`)}async latest(e){return this.get(`/product/seo/performance/${e}`)}async history(e,t={}){return this.get(`/product/seo/performance/${e}/history`,{params:t})}},be=class extends r{async create(e){return this.post("/product/seo/briefs",e)}async byId(e){return this.get(`/product/seo/briefs/${e}`)}async list(e,t={}){return this.get("/product/seo/briefs",{params:u({projectId:e},t)})}};var nn=35e3,fe=class extends r{async claim(e,t){var o;let s=await this.post("/infra/serp/collector/claim",{collectorId:e,kinds:t},{timeout:nn});return(o=s&&typeof s=="object"?s.data:null)!=null?o:null}async result(e){return this.post("/infra/serp/collector/result",e)}async heartbeat(e,t){return this.post("/infra/serp/collector/heartbeat",u({collectorId:e},t))}};var et=class extends r{async getConfig(){return this.get("/infra/connect/email/config")}async initDomainVerification(e){return this.post("/infra/connect/email/config/ses/domain",{domain:e})}async saveEmailConfig(e){return this.post("/infra/connect/email/config/ses/config",e)}async checkSesVerification(){return this.get("/infra/connect/email/config/ses/verify")}async removeSesIdentity(){return this.deleteRequest("/infra/connect/email/config/ses/domain")}async sendTest(e){return this.post("/infra/connect/email/config/test",{toEmail:e})}async saveAdvancedConfig(e){return this.post("/infra/connect/email/config/advanced",e)}async getHealth(){return this.get("/infra/connect/email/config/health")}async fixDmarc(){return this.post("/infra/connect/email/config/ses/fix-dmarc",{})}async listProviders(){return this.get("/infra/connect/email/config/providers")}};var tt=class extends r{async create(e){return this.post("/infra/storage/files/folders",{name:e})}},nt=class extends r{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/files",{params:{key:e}})}},rt=class extends r{async list(e={}){return this.get("/infra/storage/library",{params:e})}async folders(){return this.get("/infra/storage/library/folders")}async remove(e){return this.deleteRequest(`/infra/storage/library/${encodeURIComponent(e)}`)}};var rn={callChanged:"voice_call_changed"},sn=["NOT_FOUND","VOICE_CALL_REFUSED","VOICE_NOT_SET_UP","VOICE_CAMPAIGN_NOT_APPROVED","VOICE_NOT_ENABLED","VOICE_AGENT_UNAVAILABLE","VOICE_RUNTIME_UNAVAILABLE","VOICE_PREVIEW_FAILED","VOICE_NOT_CONFIGURED","LEAD_NOT_FOUND","INSUFFICIENT_CREDITS"];function on(n){let e=n instanceof f?n.code:void 0;return e&&sn.includes(e)?e:void 0}var Qt={gate:"Voice calling isn't switched on for this workspace.",bad_number:"That phone number isn't a number we can call.",do_not_call:"They asked not to be called again.",dnd:"Their number is on the Do Not Disturb register.",hours:"No calling hours are open for this step.",recently_called:"They were called recently.",promotional:"Promotional calls aren't offered. Calls are for service, reminders, callbacks and demo follow-ups.",no_consent:"No record that they agreed to a phone call, or asked for one. They are not called.",campaign_stopped:"This campaign was stopped.",test_limit:"You can ring your own phone 3 times a day. Try again tomorrow.",not_on_plan:"Voice isn't on your plan. Upgrade your plan to use voice calls.",minutes_used_up:"You've used this month's included voice minutes. Your plan has no extra minutes.",low_balance:"Your balance is below \u20B910. Add credits to place voice calls."};function an(n){var e;return(e=Qt[n])!=null?e:n}var L=encodeURIComponent,st=class extends r{get flow(){return new S(this.client)}list(e={}){return this.flow.list(e)}retrieve(e){return this.flow.retrieve(e)}create(e){return this.flow.create(e)}launch(e,t={}){return this.flow.launch(e,t)}start(e,t={}){return this.flow.start(e,t)}pause(e){return this.flow.pause(e)}resume(e){return this.flow.resume(e)}stop(e){return this.flow.stop(e)}costPreview(e){return this.get(`/product/flow/campaigns/${L(e)}/voice-preview`)}counters(e){return this.get(`/infra/connect/voice/campaigns/${L(e)}/counters`)}approval(e){return this.get(`/infra/connect/voice/campaigns/${L(e)}/approval`)}requestApproval(e){return this.post(`/infra/connect/voice/campaigns/${L(e)}/approval/request`,{})}},xe=class extends r{constructor(t){super(t);i(this,"campaigns");this.campaigns=new st(t)}status(){return this.get("/infra/connect/voice/status")}setup(){return this.get("/infra/connect/voice/setup")}connect(){return this.post("/infra/connect/voice/setup/connect",{})}setupNumbers(t={}){return this.get("/infra/connect/voice/setup/numbers",{params:u(u(u({},t.city?{city:t.city}:{}),t.pattern?{pattern:t.pattern}:{}),t.offset?{offset:String(t.offset)}:{})})}kycRequirements(){return this.get("/infra/connect/voice/setup/kyc/requirements")}kycUploadUrl(t){return this.post("/infra/connect/voice/setup/kyc/upload-url",t)}submitKyc(t){return this.post("/infra/connect/voice/setup/kyc",t)}pickNumber(t){return this.post("/infra/connect/voice/setup/number",{number:t})}releaseNumber(t){return this.deleteRequest(`/infra/connect/voice/setup/numbers/${L(t)}`)}goLive(){return this.post("/infra/connect/voice/setup/go-live",{})}pause(){return this.post("/infra/connect/voice/setup/pause",{})}agent(){return this.get("/infra/connect/voice/agent")}skills(){return this.get("/infra/connect/voice/skills")}voices(t){return this.get(`/infra/connect/voice/voices?language=${encodeURIComponent(t)}`)}saveAgent(t){return this.put("/infra/connect/voice/agent",t)}agents(){return this.get("/infra/connect/voice/agents")}createAgent(t){return this.post("/infra/connect/voice/agents",t)}getAgent(t){return this.get(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}updateAgent(t,s){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}`,s)}setAgentLead(t,s){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}/lead`,{customAgentId:s})}deleteAgent(t){return this.deleteRequest(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}numbers(){return this.get("/infra/connect/voice/numbers")}updateNumber(t,s){return this.patch(`/infra/connect/voice/numbers/${encodeURIComponent(t)}`,s)}async preview(t={}){var s;try{return(await this.client.post("/infra/connect/voice/preview",t,{responseType:"arraybuffer"})).data}catch(o){let a=(s=o==null?void 0:o.response)==null?void 0:s.data;if(a instanceof ArrayBuffer||ArrayBuffer.isView(a))try{o.response.data=JSON.parse(new TextDecoder().decode(a))}catch(l){o.response.data=void 0}throw R(o)}}lines(){return this.get("/infra/connect/voice/lines")}activity(){return this.get("/infra/connect/voice/activity")}calls(t={}){return this.get("/infra/connect/voice/calls",{params:t})}call(t){return this.get(`/infra/connect/voice/calls/${L(t)}`)}callWithAI(t){return this.post("/infra/connect/voice/calls",t)}checkCallWithAI(t){return this.post("/infra/connect/voice/calls/check",t)}callMyPhone(t={}){return this.post("/infra/connect/voice/calls/my-phone",t)}testCall(t={}){return this.post("/infra/connect/voice/test-call",t)}};var it=class extends r{async list(e){return this.get("/platform/inbox/conversations",{params:e})}async create(e){var t;return this.post("/platform/inbox/conversations",{address:e.phone,channel:(t=e.channel)!=null?t:"whatsapp",userName:e.name})}async linkLead(e,t){return this.patch(`/platform/inbox/conversations/${e}/lead`,{leadId:t})}async retrieve(e){return this.get(`/platform/inbox/conversations/${e}`)}async messages(e,t){return this.get(`/platform/inbox/conversations/${e}/messages`,{params:t})}async setStatus(e,t){return this.patch(`/platform/inbox/conversations/${e}/status`,{status:t})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async delete(e){return this.deleteRequest(`/platform/inbox/conversations/${e}`)}async bulkDelete(e){return this.post("/platform/inbox/conversations/bulk-delete",{ids:e})}};var ot=class extends r{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(e={}){return this.post("/infra/connect/whatsapp/templates/sync",e.accountId?{accountId:e.accountId}:{})}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 fix(e){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/fix`,{})}async resubmit(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/resubmit`,t)}async deleteTemplate(e,t,s){let o=new URLSearchParams;t&&o.set("force","true"),s&&o.set("accountId",s);let a=o.toString();return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${a?`?${a}`:""}`)}async mappingConfig(){return this.get("/infra/connect/whatsapp/templates/mapping/config")}async mappingSources(){return this.get("/infra/connect/whatsapp/templates/mapping/sources")}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,t){let s=`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`;return t?this.post(s,t):this.get(s)}async preview(e,t,s,o){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t,mappings:s,onEmptyVariable:o})}async getVariableManifest(e){var a,l;let t=await this.retrieve(e),s=Array.isArray((a=t.data)==null?void 0:a.components)?t.data.components:[],o=[];for(let d of s)if(d.text){let g=d.text.match(/{{(\d+)}}/g);if(g)for(let C of g){let k=C.replace(/{{|}}/g,"");o.push({key:`var_${k}`,label:`${d.type} Var {{${k}}}`,type:"string",required:!0,group:d.type,description:`Variable placeholder in template ${d.type}`})}}return{name:`Template variables: ${((l=t.data)==null?void 0:l.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}};var at=class extends r{async retrieve(e){return this.get("/infra/connect/whatsapp/setup",e?{params:{accountId:e}}:void 0)}async saveProfile(e){return this.put("/infra/connect/whatsapp/setup/profile",e)}async sendTest(e){return this.post("/infra/connect/whatsapp/setup/test",e)}async uploadPhoto(e){return this.post("/infra/connect/whatsapp/setup/profile/photo",e)}async move(e){return this.post("/infra/connect/whatsapp/setup/move",e)}async uploadMedia(e){return this.post("/infra/connect/whatsapp/setup/media",e)}};var ct=class{constructor(e){i(this,"messages");i(this,"conversations");this.messages=new P(e),this.conversations=new it(e)}},lt=class{constructor(e){i(this,"leads");i(this,"pipelines");i(this,"activities");i(this,"analytics");i(this,"scoring");i(this,"payments");i(this,"chat");i(this,"events");i(this,"invoices");i(this,"checkout");i(this,"projects");i(this,"niche");i(this,"documents");i(this,"invoiceExport");i(this,"ai");this.leads=new $e(e),this.pipelines=new Oe(e),this.activities=new Ie(e),this.analytics=new Pe(e),this.scoring=new De(e),this.payments=new Ve(e),this.chat=new ct(e),this.events=new Fe(e),this.invoices=new Ne(e),this.checkout=new Ae(e),this.projects=new Ze(e),this.niche=new Ke(e),this.documents=new Le(e),this.invoiceExport=new Ee(e),this.ai=new O(e)}},ut=class{constructor(e){i(this,"automations");i(this,"campaigns");i(this,"conversations");i(this,"home");i(this,"drafts");i(this,"firstRun");i(this,"audiences");this.automations=new F(e),this.campaigns=new S(e),this.conversations=new M(e),this.home=new _(e),this.drafts=new N(e),this.firstRun=new q(e),this.audiences=new B(e)}},pt=class{constructor(e){i(this,"projects");i(this,"audits");i(this,"insights");i(this,"searchConsole");i(this,"ranks");i(this,"local");i(this,"reports");i(this,"backlinks");i(this,"performance");i(this,"briefs");i(this,"research");this.projects=new ae(e),this.audits=new ce(e),this.insights=new le(e),this.searchConsole=new ue(e),this.ranks=new pe(e),this.local=new ge(e),this.reports=new de(e),this.backlinks=new ye(e),this.performance=new he(e),this.briefs=new be(e),this.research=new me(e)}},gt=class{constructor(e){i(this,"packs");i(this,"signals");i(this,"tools");i(this,"campaigns");i(this,"runs");i(this,"leads");i(this,"import");i(this,"lists");i(this,"compliance");i(this,"market");i(this,"learning");i(this,"lookalikes");i(this,"freshness");i(this,"audit");this.packs=new K(e),this.signals=new j(e),this.tools=new W(e),this.campaigns=new G(e),this.runs=new H(e),this.leads=new Q(e),this.import=new z(e),this.lists=new Y(e),this.compliance=new J(e),this.market=new X(e),this.learning=new Z(e),this.lookalikes=new ee(e),this.freshness=new te(e),this.audit=new ne(e)}},ke=class{constructor(e){i(this,"erix");i(this,"flow");i(this,"seo");i(this,"laie");this.erix=new lt(e),this.flow=new ut(e),this.seo=new pt(e),this.laie=new gt(e)}},dt=class{constructor(e){i(this,"config");i(this,"templates");this.config=new et(e),this.templates=new Ue(e)}},mt=class{constructor(e){i(this,"templates");i(this,"setup");this.templates=new ot(e),this.setup=new at(e)}},Lt=class{constructor(e){i(this,"leadForms");this.leadForms=new Me(e)}},yt=class{constructor(e){i(this,"email");i(this,"whatsapp");i(this,"facebook");i(this,"meet");i(this,"connections");i(this,"accounts");i(this,"channelSettings");i(this,"voice");this.email=new dt(e),this.whatsapp=new mt(e),this.facebook=new Lt(e),this.meet=new Be(e),this.connections=new Re(e),this.accounts=new U(e),this.channelSettings=new D(e),this.voice=new xe(e)}},ht=class{constructor(e){i(this,"files");i(this,"folders");i(this,"media");i(this,"library");this.files=new nt(e),this.folders=new tt(e),this.media=new qe(e),this.library=new rt(e)}},Et=class{constructor(e){i(this,"collector");this.collector=new fe(e)}},we=class{constructor(e){i(this,"connect");i(this,"storage");i(this,"serp");this.connect=new yt(e),this.storage=new ht(e),this.serp=new Et(e)}},bt=class{constructor(e){i(this,"onboarding");i(this,"persona");i(this,"audit");this.onboarding=new re(e),this.persona=new se(e),this.audit=new Ge(e)}},ft=class{constructor(e){i(this,"me");i(this,"members");i(this,"sessions");i(this,"notifications");this.me=new Ye(e),this.members=new Je(e),this.sessions=new Xe(e),this.notifications=new je(e)}},ve=class{constructor(e){i(this,"auth");i(this,"users");i(this,"tenants");i(this,"billing");i(this,"support");i(this,"ai");i(this,"knowledge");i(this,"health");i(this,"catalog");this.auth=new He(e),this.users=new ft(e),this.tenants=new bt(e),this.billing=new Qe(e),this.support=new ze(e),this.ai=new We(e),this.knowledge=new oe(e),this.health=new _e(e),this.catalog=new ie(e)}};var T=class extends f{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},Se=class{async constructEvent(e,t,s){if(!t)throw new T("No webhook signature provided");let o=Array.isArray(t)?t[0]:t;o.startsWith("sha256=")&&(o=o.slice(7));try{let a=await import("crypto"),d=a.createHmac("sha256",s).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(d),Buffer.from(o)))throw new T("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof T?a:new T(`Webhook payload parsing failed: ${a.message}`)}}};var $t=typeof process!="undefined"&&"4.3.0"||"3.1.1";var Yt,Vt=(Yt=zt.default)!=null?Yt:zt,E=class{constructor(e){i(this,"client");i(this,"socket",null);i(this,"startSocket",null);i(this,"socketPromise",null);i(this,"socketQueue",[]);i(this,"clientCode");i(this,"apiVersion");i(this,"platform");i(this,"product");i(this,"infra");i(this,"webhooks");i(this,"lastSeq");i(this,"closed",!1);var k,$,V,Ot,Dt,Ut,Ft,Mt;let t=e.proxy;if(!e.apiKey&&!t)throw new A("API Key is required");this.clientCode=(k=e.clientCode)==null?void 0:k.toUpperCase(),this.apiVersion=($=e.version)!=null?$:"v1";let s=(V=e.baseUrl)!=null?V:jt,o=Wt(this.apiVersion,(Ot=t==null?void 0:t.url)!=null?Ot:s),a=e.socketUrl||s,l=typeof window!="undefined"&&typeof window.document!="undefined",d=l?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",g=l?((Dt=globalThis.navigator)==null?void 0:Dt.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",C=v(u({},t?{}:{"x-api-key":e.apiKey,"x-client-code":((Ut=e.clientCode)==null?void 0:Ut.toUpperCase())||""}),{"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:$t,runtime:d,os:g})});if(this.client=ln.create({baseURL:o,headers:C,timeout:(Ft=e.timeout)!=null?Ft:3e4}),Vt(this.client,{retries:3,retryDelay:Vt.exponentialDelay,retryCondition:b=>{var Te;return Vt.isNetworkOrIdempotentRequestError(b)||((Te=b.response)==null?void 0:Te.status)===429},onRetry:(b,Te,_t)=>{var Nt,qt;typeof process!="undefined"&&((Nt=process.env)==null?void 0:Nt.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${b}/3): ${(qt=_t.method)==null?void 0:qt.toUpperCase()} ${_t.url}. Reason: ${Te.message}`)}}),this.platform=new ve(this.client),this.product=new ke(this.client),this.infra=new we(this.client),this.webhooks=new Se,t){if(t.ticket){let b=t.ticket;this.startSocket=()=>this.initSocket(a,async()=>({ticket:await b()}))}}else{let b={apiKey:e.apiKey,clientCode:((Mt=e.clientCode)==null?void 0:Mt.toUpperCase())||""};this.startSocket=()=>this.initSocket(a,async()=>b,{"x-api-key":b.apiKey,"x-client-code":b.clientCode})}if(l){let b={version:$t,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=b}}initSocket(e,t,s){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:o})=>{this.socket=o(e,{auth:a=>{t().then(l=>a(v(u({},l),{lastSeq:this.lastSeq})),()=>a({lastSeq:this.lastSeq}))},extraHeaders:s,transports:["websocket","polling"],tryAllTransports:!0}),this.setupSocket();for(let{type:a,args:l}of this.socketQueue)a==="joinRoom"?this.socket.emit("join-room",l[0]):a==="leaveRoom"?this.socket.emit("leave-room",l[0]):a==="on"?this.socket.on(l[0],l[1]):a==="off"?this.socket.off(l[0],l[1]):a==="disconnect"&&this.socket.disconnect();this.socketQueue=[]}),this.socketPromise)}joinRoom(e){var t;this.closed||(t=this.startSocket)==null||t.call(this),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(){this.socket&&(this.socket.on("connect_error",()=>{var e;(e=this.socket)!=null&&e.active||setTimeout(()=>{var t;this.closed||(t=this.socket)==null||t.connect()},5e3)}),this.socket.onAny((...e)=>{var s,o;let t=(s=e.at(-1))==null?void 0:s.seq;typeof t=="number"&&t>((o=this.lastSeq)!=null?o:0)&&(this.lastSeq=t)}))}on(e,t){var s;return this.closed||(s=this.startSocket)==null||s.call(this),this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.closed=!0,this.socket?this.socket.disconnect():this.socketPromise&&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,o){var a,l,d;try{return(await this.client.request({method:e,url:t,data:s,params:o})).data}catch(g){throw g.response?new f(((a=g.response.data)==null?void 0:a.message)||((l=g.response.data)==null?void 0:l.error)||"Raw Execution Failed",g.response.status,(d=g.response.data)==null?void 0:d.code):new f(g.message||"Network Error")}}};var $i={401:A,403:Gt,429:Ce};function Vi(n){throw R(n)}function Oi(n,e){return n instanceof e}function Di(n){return n instanceof A?{message:n.message,status:n.status,code:n.code,type:"AuthenticationError"}:n instanceof Ce?{message:n.message,status:n.status,code:n.code,type:"RateLimitError"}:n instanceof f?{message:n.message,status:n.status,code:n.code,type:"APIError"}:{message:n.message||"Unknown error",type:"UnknownError"}}var Jt={[A.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[Ce.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[f.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function Ui(n){let e=n.constructor.name;return Jt[e]||Jt[f.name]}var _i=E;export{f as APIError,r as APIResource,O as AiAgent,A as AuthenticationError,S as Campaigns,ie as Catalog,D as ChannelSettingsResource,fe as Collector,U as ConnectAccounts,yt as ConnectInfra,E as ECODrIx,E as ECODrIxAPI,Jt as ERROR_RETRY_CONFIG,pn as EcodrixError,dt as EmailConnect,ct as ErixChat,lt as ErixProduct,B as FlowAudiences,F as FlowAutomations,M as FlowConversations,N as FlowDrafts,q as FlowFirstRunResource,_ as FlowHome,ut as FlowProduct,$i as HTTP_STATUS_ERROR_MAP,we as InfraDomain,tn as KNOWLEDGE_FILE_TYPES,oe as Knowledge,Zt as LAIE_EVENTS,Ht as LEAD_STATUS_VALUES,ne as LaieAudits,G as LaieCampaigns,J as LaieCompliance,te as LaieFreshness,z as LaieImport,Q as LaieLeads,Z as LaieLearning,Y as LaieLists,ee as LaieLookalikes,X as LaieMarket,K as LaiePacks,gt as LaieProduct,H as LaieRuns,j as LaieSignals,W as LaieTools,re as Onboarding,Gt as PermissionError,se as Persona,ve as PlatformDomain,bt as PlatformTenants,ft as PlatformUsers,ke as ProductDomain,Ce as RateLimitError,ce as SeoAudits,ye as SeoBacklinks,be as SeoBriefs,le as SeoInsights,ge as SeoLocal,he as SeoPerformance,pt as SeoProduct,ae as SeoProjects,pe as SeoRanks,de as SeoReports,me as SeoResearch,ue as SeoSearchConsole,ht as StorageInfra,rn as VOICE_EVENTS,Qt as VOICE_REFUSAL_REASONS,xe as Voice,st as VoiceCampaigns,T as WebhookSignatureError,Se as Webhooks,mt as WhatsAppConnect,_i as default,Di as getErrorDetails,Ui as getRetryConfig,Vi as handleAPIError,Oi as isAPIError,Xt as laieStageQueued,R as toAPIError,on as voiceErrorCode,an as voiceRefusalReason};
|
|
1
|
+
import{a as u,b as v,c as w,d as i,e as Bt,f as Kt,g as jt,h as Wt,i as pn,j as f,k as A,l as Gt,m as Te,n as R}from"./chunk-XPXDFZWU.js";import ln from"axios";import zt from"axios-retry";var s=class{constructor(e){i(this,"client",e)}async post(e,t,r){try{let o=this.buildConfig(r);return(await this.client.post(e,t,o)).data}catch(o){this.handleError(o)}}async get(e,t){try{let r=this.buildConfig(t);return(await this.client.get(e,r)).data}catch(r){this.handleError(r)}}async patch(e,t,r){try{let o=this.buildConfig(r);return(await this.client.patch(e,t,o)).data}catch(o){this.handleError(o)}}async put(e,t,r){try{let o=this.buildConfig(r);return(await this.client.put(e,t,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,t){try{let r=this.buildConfig(t);return(await this.client.delete(e,r)).data}catch(r){this.handleError(r)}}buildConfig(e){if(!e)return;let t=u({},e);return e.idempotencyKey&&(t.headers=v(u({},t.headers),{"Idempotency-Key":e.idempotencyKey})),t}handleError(e){throw R(e)}};var O=class extends s{async settings(){return this.get("/product/erix/ai/settings")}async updateSettings(e){return this.patch("/product/erix/ai/settings",e)}async outcomes(e={}){return this.get("/product/erix/ai/outcomes",{params:e})}async reviews(e){return this.get(`/product/erix/ai/reviews${e?`?status=${e}`:""}`)}async review(e,t,r){return this.post(`/product/erix/ai/reviews/${encodeURIComponent(e)}`,u({verdict:t},r?{note:r}:{}))}async suggestion(e){return this.get(`/product/erix/ai/suggestion/${e}`)}async approveAction(e){return this.post(`/product/erix/ai/suggestion/${e}/approve-action`,{})}async markSent(e,t,r){return this.post(`/product/erix/ai/suggestion/${e}/send`,{text:t,confidence:r})}async dismiss(e){return this.post(`/product/erix/ai/suggestion/${e}/dismiss`,{})}async approvals(){return this.get("/product/flow/approvals")}async agents(){return this.get("/product/flow/agents")}async agent(e){return this.get(`/product/flow/agents/${encodeURIComponent(e)}`)}async tryAgent(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/try`,t)}async proposeAgentChange(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/propose`,t)}async buildAgent(e){return this.post("/product/flow/agents/build",e)}async unansweredQuestions(){return this.get("/product/flow/agents/unanswered")}async markQuestionHandled(e){return this.post("/product/flow/agents/unanswered/handled",{question:e})}async agentTemplates(){return this.get("/product/flow/agents/templates")}async createAgent(e){return this.post("/product/flow/agents",e)}async updateAgent(e,t){return this.patch(`/product/flow/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return this.deleteRequest(`/product/flow/agents/${encodeURIComponent(e)}`)}async agentAutomation(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/automation`,{trigger:t})}async decideRun(e,t,r){return this.post(`/product/flow/runs/${encodeURIComponent(e)}/approve`,u({decision:t},r&&{nodeId:r}))}};var y="/product/erix/commerce/checkout",x="/product/erix/public/checkout",h=encodeURIComponent,xt=class extends s{async getProduct(e,t){return this.get(`${x}/products/${h(t)}`,{params:{c:e}})}async viewSession(e,t){return this.get(`${x}/sessions/view`,{params:{c:e,t}})}async updateItems(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/items`,r)}async startSession(e){return this.post(`${x}/sessions`,e)}async applyCoupon(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/coupon`,r)}async verify(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/verify`,r)}async placeOrder(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/order`,r)}async verifyRazorpay(e){let a=e,{sessionId:t,orderId:r}=a,o=w(a,["sessionId","orderId"]);return this.post(`${x}/sessions/${h(t)}/order/${h(r)}/razorpay`,o)}async orderStatus(e,t){return this.get(`${x}/orders/status`,{params:{c:e,t}})}async confirmCod(e,t){return this.post(`${x}/cod/confirm`,{clientCode:e,token:t})}},kt=class extends s{async create(e){return this.post(`${y}/sessions`,e)}},Ae=class extends s{constructor(t){super(t);i(this,"buyer");i(this,"sessions");this.buyer=new xt(t),this.sessions=new kt(t)}async listProducts(){return this.get(`${y}/products`)}async createProduct(t){return this.post(`${y}/products`,t)}async updateProduct(t,r){return this.patch(`${y}/products/${h(t)}`,r)}async deleteProduct(t){return this.deleteRequest(`${y}/products/${h(t)}`)}async listCoupons(){return this.get(`${y}/coupons`)}async createCoupon(t){return this.post(`${y}/coupons`,t)}async updateCoupon(t,r){return this.patch(`${y}/coupons/${h(t)}`,r)}async deleteCoupon(t){return this.deleteRequest(`${y}/coupons/${h(t)}`)}async listOrders(t){return this.get(`${y}/orders`,{params:t})}async getOrder(t){return this.get(`${y}/orders/${h(t)}`)}async updateOrderStatus(t,r){return this.patch(`${y}/orders/${h(t)}/status`,r)}async getSettings(){return this.get(`${y}/settings`)}async updateSettings(t){return this.put(`${y}/settings`,t)}async createProductLink(t){return this.post(`${y}/links`,t)}};var Re=class extends s{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 configureWebchat(e){return this.configure("webchat",{method:"domain",config:e})}async webchatSettings(){return this.get("/infra/connect/connections/webchat/settings")}async removeWebchatDomain(e){return this.deleteRequest(`/infra/connect/connections/webchat/domains/${encodeURIComponent(e)}`)}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 checkNow(e){return this.post(`/infra/connect/connections/${e}/health/check`,{})}async googleConnectUrl(){return this.post("/infra/connect/google/connect-url",{})}async moveChannel(e,t){return this.post(`/infra/connect/${e}/move`,{ticket:t})}async requestChannelRelease(e,t){return this.post(`/infra/connect/${e}/release-request`,{ticket:t})}async channelReleaseRequest(e){return this.get(`/infra/connect/${e}/release-request`)}async cancelChannelRelease(e){return this.deleteRequest(`/infra/connect/${e}/release-request`)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var D=class extends s{async retrieve(e){return this.get(`/infra/connect/channel-settings/${e}`)}async save(e,t){return this.put(`/infra/connect/channel-settings/${e}`,t)}async resumeEmail(){return this.post("/infra/connect/channel-settings/email/resume",{})}};var U=class extends s{async list(e){return this.get("/infra/connect/accounts",e?{params:{providerId:e}}:void 0)}async retrieve(e){return this.get(`/infra/connect/accounts/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/infra/connect/accounts/${encodeURIComponent(e)}`,t)}async remove(e,t={}){return this.deleteRequest(`/infra/connect/accounts/${encodeURIComponent(e)}`,t.newDefaultId?{params:{newDefaultId:t.newDefaultId}}:void 0)}};var wt=class extends s{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}`)}},Ie=class extends s{constructor(t){super(t);i(this,"notes");this.notes=new wt(t)}async timeline(t,r){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:r})}async list(t,r){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:u({},r)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,r){return this.post(`/product/erix/crm/leads/${t}/calls`,r)}};var Pe=class extends s{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 Le=class extends s{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,r){return this.patch(`/product/erix/crm/documents/checklist/${e}/${t}`,r?{fileUrl:r}:{})}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 Ee=class extends s{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 Ht=["open","won","lost","archived"],$e=class extends s{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:[],r=[{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:Ht.map(a=>({label:`${a.charAt(0).toUpperCase()}${a.slice(1)}`,value:a}))},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],o=t.map(a=>({key:`metadata.extra.${a.name}`,label:a.label||a.name,type:a.type||"string",required:!!a.required,options:a.options,group:"Custom Fields"}));return{name:"Lead",fields:[...r,...o],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}}async upsert(e){return this.post("/product/erix/crm/leads/upsert",e)}async createMany(e,t=50){let r=[];for(let o=0;o<e.length;o+=t){let l=e.slice(o,o+t).map(g=>this.create(g)),d=await Promise.allSettled(l);for(let g of d)if(g.status==="fulfilled")r.push(g.value);else throw g.reason}return r}async import(e,t={}){return this.post("/product/erix/crm/leads/import",u({leads:e},t))}async bulkUpsert(e){return this.import(e)}async list(e){let t=u({},e);return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}listAutoPaging(e){return Kt(this,null,function*(){let t=(e==null?void 0:e.page)||1,r=!0;for(;r;){let o=yield new Bt(this.list(v(u({},e),{page:t}))),a=Array.isArray(o.data)?o.data:o||[];if(a.length===0){r=!1;break}for(let l of a)yield l;o.pagination&&t<o.pagination.pages||!o.pagination&&a.length>0?t++:r=!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,r={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:r})}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 setFollowUp(e,t,r){return this.patch(`/product/erix/crm/leads/${e}`,{nextFollowUpAt:t,nextFollowUpNote:t&&r!=null?r:null})}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,r){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:r})}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,r){return this.patch(`/product/erix/crm/notes/${t}`,r)}async deleteNote(e,t){return this.deleteRequest(`/product/erix/crm/notes/${t}`)}async delete(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async export(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/export`)}async erase(e){return this.post(`/product/erix/crm/leads/${encodeURIComponent(e)}/erase`,{confirm:"ERASE"})}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 flowRuns(e){return this.get(`/product/erix/crm/leads/${e}/flow-runs`)}async merge(e,t){return this.post("/product/erix/crm/leads/merge",{primaryId:e,secondaryId:t})}async duplicates(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/duplicates`)}};var Ve=class extends s{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var Oe=class extends s{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,a;let t=await this.retrieve(e),r=Array.isArray((o=t.data)==null?void 0:o.stages)?t.data.stages:[];return{name:`Pipeline: ${((a=t.data)==null?void 0:a.name)||e}`,fields:r.map(l=>({key:l._id,label:l.name,type:"string",required:!0,options:[{label:l.name,value:l._id}],group:"Stages",uiHints:{color:l.color||"#cbd5e1",probability:l.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`,{name: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 De=class extends s{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 Ue=class extends s{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 Fe=class extends s{async trigger(e){return this.post("/product/erix/events/trigger",e)}async listCustomEvents(){return this.get("/product/flow/config/triggers")}async createCustomEvent(e){return this.post("/product/flow/config/triggers",e)}async deleteCustomEvent(e){return this.deleteRequest(`/product/flow/config/triggers/${e}`)}};var Me=class extends s{async list(){return this.get("/infra/connect/facebook/lead-forms")}async subscribe(){return this.post("/infra/connect/facebook/lead-forms/subscribe",{})}async setEnabled(e,t){return this.put(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}`,{enabled:t})}async importLast24Hours(e){return this.post(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}/import-last-24h`,{})}};var F=class extends s{path(e,t=""){return`/product/flow/workflows/${encodeURIComponent(e)}${t}`}async versions(e){return this.get(this.path(e,"/versions"))}async version(e,t){return this.get(this.path(e,`/versions/${encodeURIComponent(t)}`))}async restoreVersion(e,t){return this.post(this.path(e,`/versions/${encodeURIComponent(t)}/restore`))}async testData(e){return this.get(this.path(e,"/test-data"))}async pinTestData(e,t){return this.put(this.path(e,"/test-data"),{runId:t})}async unpinTestData(e){return this.deleteRequest(this.path(e,"/test-data"))}async testRun(e,t={}){return this.post(this.path(e,"/test-run"),t)}async testRunProgress(e,t){return this.get(this.path(e,"/test-run"),{params:{runIds:t.join(",")}})}async copilot(e,t){return this.post(this.path(e,"/copilot"),t)}async live(e){return this.get(this.path(e,"/live"))}async week(e){return this.get(this.path(e,"/week"))}async deleteImpact(e){return this.get(this.path(e,"/delete-impact"))}async remove(e,t={}){return this.deleteRequest(this.path(e,t.stop?"?stop=true":""))}async duplicate(e){return this.post(this.path(e,"/duplicate"))}async retryFailed(e,t={}){return this.post(this.path(e,"/retry-failed"),t)}};var S=class extends s{async list(e={}){return this.get("/product/flow/campaigns",{params:e})}async create(e){return this.post("/product/flow/campaigns",e)}async launch(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/launch`,t)}async retrieve(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/product/flow/campaigns/${encodeURIComponent(e)}`,t)}async test(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/test`,{})}async start(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/start`,t)}async pause(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/pause`,{})}async resume(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/resume`,{})}async stop(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/stop`,{})}async remove(e){return this.deleteRequest(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async duplicate(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/duplicate`,{})}async followUp(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/follow-up`,t)}async checks(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/checks`)}async results(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/results`)}async people(e,t={}){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/people`,{params:t})}};var I="/product/flow/conversations",m=(n,e="")=>`${I}/${encodeURIComponent(n)}${e}`,M=class extends s{async list(e={}){return this.get(I,{params:e})}async create(e){return this.post(I,e)}async retrieve(e){return this.get(m(e))}async update(e,t){return this.patch(m(e),t)}async duplicate(e){return this.post(m(e,"/duplicate"),{})}async archive(e){return this.deleteRequest(m(e))}async publish(e,t={}){return this.post(m(e,"/publish"),t)}async versions(e){return this.get(m(e,"/versions"))}async version(e,t){return this.get(m(e,`/versions/${t}`))}async rollback(e,t){return this.post(m(e,"/rollback"),{version:t})}async try(e,t){return this.post(m(e,"/try"),t)}async tests(e){return this.get(m(e,"/tests"))}async addTest(e,t){return this.post(m(e,"/tests"),t)}async deleteTest(e,t){return this.deleteRequest(m(e,`/tests/${encodeURIComponent(t)}`))}async runTests(e,t={}){return this.post(m(e,"/tests/run"),t)}async deployments(e){return this.get(m(e,"/deployments"))}async allDeployments(){return this.get(`${I}/deployments`)}async deploy(e,t){return this.post(m(e,"/deployments"),t)}async updateDeployment(e,t){return this.patch(`${I}/deployments/${encodeURIComponent(e)}`,t)}async removeDeployment(e){return this.deleteRequest(`${I}/deployments/${encodeURIComponent(e)}`)}async checks(e){return this.get(m(e,"/checks"))}async moveToAgent(e){return this.post(m(e,"/move-to-agent"),{})}};var _=class extends s{async get(){return super.get("/product/flow/home")}async nav(){return super.get("/product/flow/home/nav")}},N=class extends s{async create(e){return this.post("/product/flow/drafts",e)}async plan(e){return this.post("/product/flow/drafts/plan",e)}},q=class extends s{async status(){return this.get("/product/flow/first-run")}async installPack(e){return this.post(`/product/flow/first-run/packs/${e}`)}},B=class extends s{async list(){return this.get("/product/flow/audiences")}async byId(e){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}`)}async create(e){return this.post("/product/flow/audiences",e)}async update(e,t){return this.patch(`/product/flow/audiences/${encodeURIComponent(e)}`,t)}async remove(e){return this.deleteRequest(`/product/flow/audiences/${encodeURIComponent(e)}`)}async preview(e,t){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}/preview${t?`?channel=${t}`:""}`)}async previewRules(e){return this.post("/product/flow/audiences/preview",e)}};var _e=class extends s{async system(){return(await this.get("/health")).data}};var Ne=class extends s{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 void(e){return this.post(`/product/erix/commerce/invoices/${e}/void`,{})}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)}async paymentLink(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payment-link`,{})}async recordPayment(e,t){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payments`,t)}async sendWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-whatsapp`,{})}async sendEmail(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-email`,{})}};var Xt=n=>"queued"in n&&n.queued===!0,Zt={runProgress:"laie:run:progress",importComplete:"laie:import:complete"},p=encodeURIComponent,c="/product/laie",K=class extends s{async list(){return this.get(`${c}/packs`)}async byId(e){return this.get(`${c}/packs/${p(e)}`)}},j=class extends s{async catalog(e={}){return this.get(`${c}/signals/catalog`,{params:e})}async list(e={}){return this.get(`${c}/signals`,{params:e})}},W=class extends s{async find(e){return this.post(`${c}/tools/find`,e)}async collect(e){return this.post(`${c}/tools/collect`,e)}async enrich(e){return this.post(`${c}/tools/enrich`,e)}async verify(e){return this.post(`${c}/tools/verify`,e)}async qualify(e){return this.post(`${c}/tools/qualify`,e)}async store(e){return this.post(`${c}/tools/store`,e)}async use(e){return this.post(`${c}/tools/use`,e)}async verifyEmail(e){return this.post(`${c}/tools/verify-email`,{emails:e})}async websiteLookup(e){return this.post(`${c}/tools/website-lookup`,{url:e})}},G=class extends s{async list(){return this.get(`${c}/campaigns`)}async create(e){return this.post(`${c}/campaigns`,e)}async byId(e){return this.get(`${c}/flows/${p(e)}`)}async settings(e){return this.get(`${c}/campaigns/${p(e)}/settings`)}async updateSettings(e,t){return this.patch(`${c}/campaigns/${p(e)}/settings`,t)}async signals(e){return this.get(`${c}/campaigns/${p(e)}/signals`)}async setSignals(e,t){return this.put(`${c}/campaigns/${p(e)}/signals`,t)}},H=class extends s{async start(e){return this.post(`${c}/campaigns/${p(e)}/runs`)}async list(e,t={}){return this.get(`${c}/campaigns/${p(e)}/runs`,{params:t})}async byId(e,t){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}`)}async changes(e,t,r={}){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}/changes`,{params:r})}async cancel(e,t){return this.post(`${c}/campaigns/${p(e)}/runs/${p(t)}/cancel`)}async quality(e){return this.get(`${c}/jobs/${p(e)}/quality`)}},Q=class extends s{async list(e={}){let o=e,{importedToCrm:t}=o,r=w(o,["importedToCrm"]);return this.get(`${c}/leads`,{params:u(u({},r),t!==void 0&&{importedToCrm:String(t)})})}async byId(e){return this.get(`${c}/leads/${p(e)}`)}async update(e,t){return this.patch(`${c}/leads/${p(e)}`,t)}async notes(e){return this.get(`${c}/leads/${p(e)}/notes`)}async addNote(e,t){return this.post(`${c}/leads/${p(e)}/notes`,t)}async generateKit(e){return this.post(`${c}/leads/${p(e)}/generate-kit`)}async pipelineSummary(){return this.get(`${c}/leads/pipeline-summary`)}async bulkContacted(e,t){return this.post(`${c}/leads/bulk/contacted`,{leadIds:e,channel:t})}async bulkTag(e,t){return this.post(`${c}/leads/bulk/tag`,{leadIds:e,tags:t})}async bulkDelete(e){return this.post(`${c}/leads/bulk/delete`,{leadIds:e})}async bulkExport(e,t="json"){return t==="csv"?this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t},{responseType:"text"}):this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t})}},z=class extends s{async pipelines(){return this.get(`${c}/import/pipelines`)}async crm(e){return this.post(`${c}/import/crm`,e)}},Y=class extends s{async enrich(e){return this.post(`${c}/lists/enrich`,e)}},J=class extends s{async dsr(e){return this.post(`${c}/compliance/dsr`,e)}async report(e={}){return this.get(`${c}/compliance/report`,{params:e})}},X=class extends s{async map(e={}){return this.get(`${c}/market-map`,{params:e})}async forCampaign(e){return this.get(`${c}/campaigns/${p(e)}/market-map`)}async refresh(e={}){return this.post(`${c}/market-map/refresh`,e)}},Z=class extends s{async weights(e={}){return this.get(`${c}/learning/weights`,{params:e})}async outcomes(e={}){return this.get(`${c}/learning/outcomes`,{params:e})}},ee=class extends s{async preview(e){return this.post(`${c}/lookalikes/preview`,e)}async create(e){return this.post(`${c}/lookalikes`,e)}async list(e={}){return this.get(`${c}/lookalikes`,{params:e})}async byId(e){return this.get(`${c}/lookalikes/${p(e)}`)}async rank(e,t={}){return this.get(`${c}/lookalikes/${p(e)}/rank`,{params:t})}},te=class extends s{async status(){return this.get(`${c}/freshness`)}},ne=class extends s{async start(e){return this.post(`${c}/audit`,e)}async byId(e){return this.get(`${c}/audit/${p(e)}`)}};import en from"axios";var qe=class extends s{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 r=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:o,key:a,headers:l}=r.data;await en.put(o,e,{headers:l!=null?l:{"Content-Type":t.contentType}});let d=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:a,sizeBytes:d})}};var Be=class extends s{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 Ke=class extends s{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 je=class extends s{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")}};var re=class extends s{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}};var se=class extends s{async get(e){return super.get(`/platform/tenants/persona/${e}`)}async reinforce(e){return this.post(`/platform/tenants/persona/${e.productId}/reinforce`,e)}async confidence(e){return super.get(`/platform/tenants/persona/${e}/confidence`,{params:{productId:e}})}async timeline(e,t){var o;let r=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(o=r==null?void 0:r.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var r,o;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(r=t==null?void 0:t.data)==null?void 0:r.entries)!=null?o:[]}};var vt=class extends s{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"}},We=class{constructor(e){i(this,"copilot");this.copilot=new vt(e)}};var Ge=class extends s{async list(e){return this.get("/platform/tenants/audit",{params:e})}};var He=class extends s{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 St=class extends s{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},Ct=class extends s{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)}},Tt=class extends s{list(){return this.get("/platform/billing/addons")}add(e,t){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/add`,t===void 0?{}:{quantity:t})}remove(e){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/remove`)}overage(){return this.get("/platform/billing/overage")}setOverage(e){return this.put("/platform/billing/overage",e)}},At=class extends s{async listPublic(){return this.get("/platform/billing/plans/public")}},Rt=class extends s{async plans(){return this.get("/platform/billing/checkout/plans")}async proration(e,t){return this.get("/platform/billing/checkout/proration",{params:{planId:e,billingCycle:t}})}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)}},It=class extends s{async transactions(){return this.get("/platform/billing/user/transactions")}async transactionInvoice(e){return this.get(`/platform/billing/user/transactions/${encodeURIComponent(e)}/invoice`)}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")}},Pt=class extends s{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)}},Qe=class{constructor(e){i(this,"entitlements");i(this,"subscriptions");i(this,"plans");i(this,"checkout");i(this,"user");i(this,"credits");i(this,"addOns");this.entitlements=new St(e),this.subscriptions=new Ct(e),this.plans=new At(e),this.checkout=new Rt(e),this.user=new It(e),this.credits=new Pt(e),this.addOns=new Tt(e)}};var ie=class extends s{async list(){return this.get("/platform/public/catalog",{ignoreClientCode:!0})}};var P=class extends s{async send(e){if(e.conversationId)return this.post(`/platform/inbox/conversations/${e.conversationId}/messages`,{text:e.text,media:e.media});if(!e.to)throw new Error("send: conversationId or to is required");if(e.media)throw new Error("send: media goes to an inbox thread (conversationId)");return this.post("/infra/connect/send/whatsapp",u({phone:e.to,text:e.text},e.accountId?{accountId:e.accountId}:{}))}async sendTemplate(e){return this.post("/infra/connect/send/whatsapp",u({phone:e.to,templateName:e.templateName,language:e.language,variables:e.variables},e.accountId?{accountId:e.accountId}:{}))}async star(e,t){return this.post(`/platform/inbox/messages/${e}/star`,{starred:t})}async translate(e){return this.post(`/platform/inbox/messages/${encodeURIComponent(e)}/translate`,{})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async upload(e,t={}){var k,$,V;let r=($=(k=t.fileName)!=null?k:e.name)!=null?$:"file",o=e.type||"application/octet-stream",a=await this.post("/infra/storage/files/upload-url",{folder:(V=t.folder)!=null?V:"inbox",filename:r,contentType:o}),{uploadUrl:l,key:d,headers:g}=a.data,T=await fetch(l,{method:"PUT",headers:g!=null?g:{"Content-Type":o},body:e});if(!T.ok)throw new Error(`upload failed (${T.status})`);return await this.post("/infra/storage/files/confirm-upload",{key:d,sizeBytes:e.size}),{key:d,mimeType:o,fileName:r}}};var tn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown","text/csv","text/html","image/png","image/jpeg","image/webp"],oe=class extends s{async list(){return this.get("/platform/knowledge/sources")}async addText(e){return this.post("/platform/knowledge/sources",u({kind:"text"},e))}async addUrl(e){return this.post("/platform/knowledge/sources",u({kind:"url"},e))}async addWebsite(e){return this.post("/platform/knowledge/sources",{type:"website",url:e.url})}async addFile(e,t={}){var o,a;let r=await new P(this.client).upload(e,{folder:"knowledge"});return this.post("/platform/knowledge/sources",{kind:"file",key:r.key,mimeType:r.mimeType,title:(a=(o=t.title)!=null?o:r.fileName)!=null?a:"Document"})}async remove(e){return this.deleteRequest(`/platform/knowledge/sources/${e}`)}async reindex(e){return this.post(`/platform/knowledge/sources/${e}/reindex`,{})}async search(e,t){return this.post("/platform/knowledge/search",u({query:e},t?{limit:t}:{}))}};var ze=class extends s{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`,{})}async channelSetup(e){return this.get(`/platform/support/channel-requests/${encodeURIComponent(e)}/setup`)}};var Ye=class extends s{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",{})}},Je=class extends s{async list(){return this.get("/platform/users/members")}async access(){return this.get("/platform/users/members/access")}async invite(e){return this.post("/platform/users/members/invite",e)}async updateAccess(e,t){return this.patch(`/platform/users/members/${encodeURIComponent(e)}`,t)}async updateRole(e,t){return this.updateAccess(e,{role:t})}async remove(e){return this.deleteRequest(`/platform/users/members/${encodeURIComponent(e)}`)}async invitations(){return this.get("/platform/users/members/invitations")}async resendInvitation(e){return this.post(`/platform/users/members/invitations/${encodeURIComponent(e)}/resend`,{})}async revokeInvitation(e){return this.deleteRequest(`/platform/users/members/invitations/${encodeURIComponent(e)}`)}},Xe=class extends s{async list(){return this.get("/platform/auth/sessions")}async revoke(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}};var Ze=class extends s{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,r){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:r})}async addSigner(e,t,r){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,r)}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,r){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,r)}};var ae=class extends s{async list(){return this.get("/product/seo/projects")}async create(e){return this.post("/product/seo/projects",e)}async byId(e){return this.get(`/product/seo/projects/${e}`)}async update(e,t){return this.patch(`/product/seo/projects/${e}`,t)}async remove(e){return this.deleteRequest(`/product/seo/projects/${e}`)}async crawl(e){return this.post(`/product/seo/projects/${e}/crawl`)}async crawlCompetitor(e,t){return this.post(`/product/seo/projects/${e}/competitors/crawl`,{domain:t})}},ce=class extends s{async start(e){return this.post("/product/seo/audits",e)}async list(e={}){return this.get("/product/seo/audits",{params:e})}async compare(e){return this.post("/product/seo/audits/compare",e)}async byId(e){return this.get(`/product/seo/audits/${e}`)}async resume(e){return this.post(`/product/seo/audits/${e}/resume`)}async pages(e,t={}){return this.get(`/product/seo/audits/${e}/pages`,{params:t})}async issues(e){return this.get(`/product/seo/audits/${e}/issues`)}async links(e){return this.get(`/product/seo/audits/${e}/links`)}async export(e,t="json"){return this.get(`/product/seo/audits/${e}/export`,{params:{format:t},responseType:"text"})}},le=class extends s{async keywords(e,t={}){return this.get(`/product/seo/audits/${e}/keywords`,{params:t})}async contentGap(e){return this.post("/product/seo/audits/content-gap",e)}async search(e){return this.post("/product/seo/audits/search",e)}async backlinks(e){return this.get("/product/seo/audits/backlinks",{params:e})}async domain(e){return this.get(`/product/seo/audits/domains/${encodeURIComponent(e)}`)}},ue=class extends s{async check(e){return this.post(`/product/seo/search-console/${e}/check`)}async importNow(e){return this.post(`/product/seo/search-console/${e}/import`)}async status(e){return this.get(`/product/seo/search-console/${e}/status`)}async queries(e,t={}){return this.get(`/product/seo/search-console/${e}/queries`,{params:t})}async pages(e,t={}){return this.get(`/product/seo/search-console/${e}/pages`,{params:t})}async trend(e,t={}){return this.get(`/product/seo/search-console/${e}/trend`,{params:t})}},pe=class extends s{async keywords(e){return this.get(`/product/seo/ranks/${e}/keywords`)}async add(e,t,r={}){return this.post(`/product/seo/ranks/${e}/keywords`,u({queries:t},r))}async visibility(e,t={}){return this.get(`/product/seo/ranks/${e}/visibility`,{params:t})}async competitors(e){return this.get(`/product/seo/ranks/${e}/competitors`)}async gap(e,t={}){return this.get(`/product/seo/ranks/${e}/gap`,{params:t})}async remove(e,t){return this.deleteRequest(`/product/seo/ranks/${e}/keywords/${t}`)}async checkNow(e,t){return this.post(`/product/seo/ranks/${e}/keywords/${t}/check`)}async history(e,t,r={}){return this.get(`/product/seo/ranks/${e}/keywords/${t}/history`,{params:r})}async changes(e){return this.get(`/product/seo/ranks/${e}/changes`)}},ge=class extends s{async checkNow(e){return this.post(`/product/seo/local/${e}/check`)}async latest(e){return this.get(`/product/seo/local/${e}`)}async history(e,t={}){return this.get(`/product/seo/local/${e}/history`,{params:t})}async startGrid(e,t={}){return this.post(`/product/seo/local/${e}/grid`,t)}async grid(e){return this.get(`/product/seo/local/${e}/grid`)}async grids(e,t={}){return this.get(`/product/seo/local/${e}/grids`,{params:t})}},de=class extends s{async byProject(e){return this.get(`/product/seo/reports/${e}`)}async export(e,t="csv"){return this.get(`/product/seo/reports/${e}/export`,{params:{format:t},responseType:"text"})}async pdf(e,t={}){return this.get(`/product/seo/reports/${e}/pdf`,{params:t,responseType:"arraybuffer"})}async generate(e,t={}){return this.post(`/product/seo/reports/${e}/generate`,t)}async history(e,t={}){return this.get(`/product/seo/reports/${e}/history`,{params:t})}async changes(e){return this.get(`/product/seo/reports/${e}/changes`)}},me=class extends s{async seed(e,t,r="en"){return this.post(`/product/seo/research/${e}/seed`,{seed:t,lang:r})}async fromSearchConsole(e){return this.post(`/product/seo/research/${e}/from-search-console`)}async ideas(e,t={}){return this.get(`/product/seo/research/${e}/ideas`,{params:t})}async analyze(e,t){return this.post(`/product/seo/research/${e}/ideas/${t}/analyze`)}};var ye=class extends s{async releases(){return this.get("/product/seo/backlinks/releases")}async strength(e){return this.get("/product/seo/backlinks/strength",{params:{domains:e.join(",")}})}async overview(e){return this.get(`/product/seo/backlinks/${e}`)}async referring(e,t){return this.get(`/product/seo/backlinks/${e}/referring`,{params:t})}async changes(e,t){return this.get(`/product/seo/backlinks/${e}/changes`,{params:t})}},he=class extends s{async checkNow(e){return this.post(`/product/seo/performance/${e}/check`)}async latest(e){return this.get(`/product/seo/performance/${e}`)}async history(e,t={}){return this.get(`/product/seo/performance/${e}/history`,{params:t})}},be=class extends s{async create(e){return this.post("/product/seo/briefs",e)}async byId(e){return this.get(`/product/seo/briefs/${e}`)}async list(e,t={}){return this.get("/product/seo/briefs",{params:u({projectId:e},t)})}};var nn=35e3,fe=class extends s{async claim(e,t){var o;let r=await this.post("/infra/serp/collector/claim",{collectorId:e,kinds:t},{timeout:nn});return(o=r&&typeof r=="object"?r.data:null)!=null?o:null}async result(e){return this.post("/infra/serp/collector/result",e)}async heartbeat(e,t){return this.post("/infra/serp/collector/heartbeat",u({collectorId:e},t))}};var et=class extends s{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 tt=class extends s{async create(e){return this.post("/infra/storage/files/folders",{name:e})}},nt=class extends s{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/files",{params:{key:e}})}},rt=class extends s{async list(e={}){return this.get("/infra/storage/library",{params:e})}async folders(){return this.get("/infra/storage/library/folders")}async remove(e){return this.deleteRequest(`/infra/storage/library/${encodeURIComponent(e)}`)}};var rn={callChanged:"voice_call_changed"},sn=["NOT_FOUND","VOICE_CALL_REFUSED","VOICE_NOT_SET_UP","VOICE_CAMPAIGN_NOT_APPROVED","VOICE_NOT_ENABLED","VOICE_AGENT_UNAVAILABLE","VOICE_RUNTIME_UNAVAILABLE","VOICE_PREVIEW_FAILED","VOICE_NOT_CONFIGURED","LEAD_NOT_FOUND","INSUFFICIENT_CREDITS"];function on(n){let e=n instanceof f?n.code:void 0;return e&&sn.includes(e)?e:void 0}var Qt={gate:"Voice calling isn't switched on for this workspace.",bad_number:"That phone number isn't a number we can call.",do_not_call:"They asked not to be called again.",dnd:"Their number is on the Do Not Disturb register.",hours:"No calling hours are open for this step.",recently_called:"They were called recently.",promotional:"Promotional calls aren't offered. Calls are for service, reminders, callbacks and demo follow-ups.",no_consent:"No record that they agreed to a phone call, or asked for one. They are not called.",campaign_stopped:"This campaign was stopped.",test_limit:"You can ring your own phone 3 times a day. Try again tomorrow.",not_on_plan:"Voice isn't on your plan. Upgrade your plan to use voice calls.",minutes_used_up:"You've used this month's included voice minutes. Your plan has no extra minutes.",low_balance:"Your balance is below \u20B910. Add credits to place voice calls."};function an(n){var e;return(e=Qt[n])!=null?e:n}var L=encodeURIComponent,st=class extends s{get flow(){return new S(this.client)}list(e={}){return this.flow.list(e)}retrieve(e){return this.flow.retrieve(e)}create(e){return this.flow.create(e)}launch(e,t={}){return this.flow.launch(e,t)}start(e,t={}){return this.flow.start(e,t)}pause(e){return this.flow.pause(e)}resume(e){return this.flow.resume(e)}stop(e){return this.flow.stop(e)}costPreview(e){return this.get(`/product/flow/campaigns/${L(e)}/voice-preview`)}counters(e){return this.get(`/infra/connect/voice/campaigns/${L(e)}/counters`)}approval(e){return this.get(`/infra/connect/voice/campaigns/${L(e)}/approval`)}requestApproval(e){return this.post(`/infra/connect/voice/campaigns/${L(e)}/approval/request`,{})}},xe=class extends s{constructor(t){super(t);i(this,"campaigns");this.campaigns=new st(t)}status(){return this.get("/infra/connect/voice/status")}setup(){return this.get("/infra/connect/voice/setup")}connect(){return this.post("/infra/connect/voice/setup/connect",{})}setupNumbers(t={}){return this.get("/infra/connect/voice/setup/numbers",{params:u(u(u({},t.city?{city:t.city}:{}),t.pattern?{pattern:t.pattern}:{}),t.offset?{offset:String(t.offset)}:{})})}kycRequirements(){return this.get("/infra/connect/voice/setup/kyc/requirements")}kycUploadUrl(t){return this.post("/infra/connect/voice/setup/kyc/upload-url",t)}submitKyc(t){return this.post("/infra/connect/voice/setup/kyc",t)}pickNumber(t){return this.post("/infra/connect/voice/setup/number",{number:t})}releaseNumber(t){return this.deleteRequest(`/infra/connect/voice/setup/numbers/${L(t)}`)}goLive(){return this.post("/infra/connect/voice/setup/go-live",{})}pause(){return this.post("/infra/connect/voice/setup/pause",{})}disconnect(){return this.post("/infra/connect/voice/setup/disconnect",{})}agent(){return this.get("/infra/connect/voice/agent")}skills(){return this.get("/infra/connect/voice/skills")}voices(t){return this.get(`/infra/connect/voice/voices?language=${encodeURIComponent(t)}`)}saveAgent(t){return this.put("/infra/connect/voice/agent",t)}agents(){return this.get("/infra/connect/voice/agents")}createAgent(t){return this.post("/infra/connect/voice/agents",t)}getAgent(t){return this.get(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}updateAgent(t,r){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}`,r)}setAgentLead(t,r){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}/lead`,{customAgentId:r})}deleteAgent(t){return this.deleteRequest(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}numbers(){return this.get("/infra/connect/voice/numbers")}updateNumber(t,r){return this.patch(`/infra/connect/voice/numbers/${encodeURIComponent(t)}`,r)}async preview(t={}){var r;try{return(await this.client.post("/infra/connect/voice/preview",t,{responseType:"arraybuffer"})).data}catch(o){let a=(r=o==null?void 0:o.response)==null?void 0:r.data;if(a instanceof ArrayBuffer||ArrayBuffer.isView(a))try{o.response.data=JSON.parse(new TextDecoder().decode(a))}catch(l){o.response.data=void 0}throw R(o)}}lines(){return this.get("/infra/connect/voice/lines")}activity(){return this.get("/infra/connect/voice/activity")}calls(t={}){return this.get("/infra/connect/voice/calls",{params:t})}call(t){return this.get(`/infra/connect/voice/calls/${L(t)}`)}callWithAI(t){return this.post("/infra/connect/voice/calls",t)}checkCallWithAI(t){return this.post("/infra/connect/voice/calls/check",t)}callMyPhone(t={}){return this.post("/infra/connect/voice/calls/my-phone",t)}testCall(t={}){return this.post("/infra/connect/voice/test-call",t)}};var it=class extends s{async list(e){return this.get("/platform/inbox/conversations",{params:e})}async create(e){var t;return this.post("/platform/inbox/conversations",{address:e.phone,channel:(t=e.channel)!=null?t:"whatsapp",userName:e.name})}async linkLead(e,t){return this.patch(`/platform/inbox/conversations/${e}/lead`,{leadId:t})}async retrieve(e){return this.get(`/platform/inbox/conversations/${e}`)}async messages(e,t){return this.get(`/platform/inbox/conversations/${e}/messages`,{params:t})}async setStatus(e,t){return this.patch(`/platform/inbox/conversations/${e}/status`,{status:t})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async delete(e){return this.deleteRequest(`/platform/inbox/conversations/${e}`)}async bulkDelete(e){return this.post("/platform/inbox/conversations/bulk-delete",{ids:e})}};var ot=class extends s{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(e={}){return this.post("/infra/connect/whatsapp/templates/sync",e.accountId?{accountId:e.accountId}:{})}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 fix(e){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/fix`,{})}async resubmit(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/resubmit`,t)}async deleteTemplate(e,t,r){let o=new URLSearchParams;t&&o.set("force","true"),r&&o.set("accountId",r);let a=o.toString();return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${a?`?${a}`:""}`)}async mappingConfig(){return this.get("/infra/connect/whatsapp/templates/mapping/config")}async mappingSources(){return this.get("/infra/connect/whatsapp/templates/mapping/sources")}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,t){let r=`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`;return t?this.post(r,t):this.get(r)}async preview(e,t,r,o){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t,mappings:r,onEmptyVariable:o})}async getVariableManifest(e){var a,l;let t=await this.retrieve(e),r=Array.isArray((a=t.data)==null?void 0:a.components)?t.data.components:[],o=[];for(let d of r)if(d.text){let g=d.text.match(/{{(\d+)}}/g);if(g)for(let T of g){let k=T.replace(/{{|}}/g,"");o.push({key:`var_${k}`,label:`${d.type} Var {{${k}}}`,type:"string",required:!0,group:d.type,description:`Variable placeholder in template ${d.type}`})}}return{name:`Template variables: ${((l=t.data)==null?void 0:l.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}};var at=class extends s{async retrieve(e){return this.get("/infra/connect/whatsapp/setup",e?{params:{accountId:e}}:void 0)}async saveProfile(e){return this.put("/infra/connect/whatsapp/setup/profile",e)}async sendTest(e){return this.post("/infra/connect/whatsapp/setup/test",e)}async uploadPhoto(e){return this.post("/infra/connect/whatsapp/setup/profile/photo",e)}async move(e){return this.post("/infra/connect/whatsapp/setup/move",e)}async uploadMedia(e){return this.post("/infra/connect/whatsapp/setup/media",e)}};var ct=class{constructor(e){i(this,"messages");i(this,"conversations");this.messages=new P(e),this.conversations=new it(e)}},lt=class{constructor(e){i(this,"leads");i(this,"pipelines");i(this,"activities");i(this,"analytics");i(this,"scoring");i(this,"payments");i(this,"chat");i(this,"events");i(this,"invoices");i(this,"checkout");i(this,"projects");i(this,"niche");i(this,"documents");i(this,"invoiceExport");i(this,"ai");this.leads=new $e(e),this.pipelines=new Oe(e),this.activities=new Ie(e),this.analytics=new Pe(e),this.scoring=new De(e),this.payments=new Ve(e),this.chat=new ct(e),this.events=new Fe(e),this.invoices=new Ne(e),this.checkout=new Ae(e),this.projects=new Ze(e),this.niche=new Ke(e),this.documents=new Le(e),this.invoiceExport=new Ee(e),this.ai=new O(e)}},ut=class{constructor(e){i(this,"automations");i(this,"campaigns");i(this,"conversations");i(this,"home");i(this,"drafts");i(this,"firstRun");i(this,"audiences");this.automations=new F(e),this.campaigns=new S(e),this.conversations=new M(e),this.home=new _(e),this.drafts=new N(e),this.firstRun=new q(e),this.audiences=new B(e)}},pt=class{constructor(e){i(this,"projects");i(this,"audits");i(this,"insights");i(this,"searchConsole");i(this,"ranks");i(this,"local");i(this,"reports");i(this,"backlinks");i(this,"performance");i(this,"briefs");i(this,"research");this.projects=new ae(e),this.audits=new ce(e),this.insights=new le(e),this.searchConsole=new ue(e),this.ranks=new pe(e),this.local=new ge(e),this.reports=new de(e),this.backlinks=new ye(e),this.performance=new he(e),this.briefs=new be(e),this.research=new me(e)}},gt=class{constructor(e){i(this,"packs");i(this,"signals");i(this,"tools");i(this,"campaigns");i(this,"runs");i(this,"leads");i(this,"import");i(this,"lists");i(this,"compliance");i(this,"market");i(this,"learning");i(this,"lookalikes");i(this,"freshness");i(this,"audit");this.packs=new K(e),this.signals=new j(e),this.tools=new W(e),this.campaigns=new G(e),this.runs=new H(e),this.leads=new Q(e),this.import=new z(e),this.lists=new Y(e),this.compliance=new J(e),this.market=new X(e),this.learning=new Z(e),this.lookalikes=new ee(e),this.freshness=new te(e),this.audit=new ne(e)}},ke=class{constructor(e){i(this,"erix");i(this,"flow");i(this,"seo");i(this,"laie");this.erix=new lt(e),this.flow=new ut(e),this.seo=new pt(e),this.laie=new gt(e)}},dt=class{constructor(e){i(this,"config");i(this,"templates");this.config=new et(e),this.templates=new Ue(e)}},mt=class{constructor(e){i(this,"templates");i(this,"setup");this.templates=new ot(e),this.setup=new at(e)}},Lt=class{constructor(e){i(this,"leadForms");this.leadForms=new Me(e)}},yt=class{constructor(e){i(this,"email");i(this,"whatsapp");i(this,"facebook");i(this,"meet");i(this,"connections");i(this,"accounts");i(this,"channelSettings");i(this,"voice");this.email=new dt(e),this.whatsapp=new mt(e),this.facebook=new Lt(e),this.meet=new Be(e),this.connections=new Re(e),this.accounts=new U(e),this.channelSettings=new D(e),this.voice=new xe(e)}},ht=class{constructor(e){i(this,"files");i(this,"folders");i(this,"media");i(this,"library");this.files=new nt(e),this.folders=new tt(e),this.media=new qe(e),this.library=new rt(e)}},Et=class{constructor(e){i(this,"collector");this.collector=new fe(e)}},we=class{constructor(e){i(this,"connect");i(this,"storage");i(this,"serp");this.connect=new yt(e),this.storage=new ht(e),this.serp=new Et(e)}},bt=class{constructor(e){i(this,"onboarding");i(this,"persona");i(this,"audit");this.onboarding=new re(e),this.persona=new se(e),this.audit=new Ge(e)}},ft=class{constructor(e){i(this,"me");i(this,"members");i(this,"sessions");i(this,"notifications");this.me=new Ye(e),this.members=new Je(e),this.sessions=new Xe(e),this.notifications=new je(e)}},ve=class{constructor(e){i(this,"auth");i(this,"users");i(this,"tenants");i(this,"billing");i(this,"support");i(this,"ai");i(this,"knowledge");i(this,"health");i(this,"catalog");this.auth=new He(e),this.users=new ft(e),this.tenants=new bt(e),this.billing=new Qe(e),this.support=new ze(e),this.ai=new We(e),this.knowledge=new oe(e),this.health=new _e(e),this.catalog=new ie(e)}};var C=class extends f{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},Se=class{async constructEvent(e,t,r){if(!t)throw new C("No webhook signature provided");let o=Array.isArray(t)?t[0]:t;o.startsWith("sha256=")&&(o=o.slice(7));try{let a=await import("crypto"),d=a.createHmac("sha256",r).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(d),Buffer.from(o)))throw new C("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof C?a:new C(`Webhook payload parsing failed: ${a.message}`)}}};var $t=typeof process!="undefined"&&"4.3.1"||"3.1.1";var Yt,Vt=(Yt=zt.default)!=null?Yt:zt,E=class{constructor(e){i(this,"client");i(this,"socket",null);i(this,"startSocket",null);i(this,"socketPromise",null);i(this,"socketQueue",[]);i(this,"clientCode");i(this,"apiVersion");i(this,"platform");i(this,"product");i(this,"infra");i(this,"webhooks");i(this,"lastSeq");i(this,"closed",!1);var k,$,V,Ot,Dt,Ut,Ft,Mt;let t=e.proxy;if(!e.apiKey&&!t)throw new A("API Key is required");this.clientCode=(k=e.clientCode)==null?void 0:k.toUpperCase(),this.apiVersion=($=e.version)!=null?$:"v1";let r=(V=e.baseUrl)!=null?V:jt,o=Wt(this.apiVersion,(Ot=t==null?void 0:t.url)!=null?Ot:r),a=e.socketUrl||r,l=typeof window!="undefined"&&typeof window.document!="undefined",d=l?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",g=l?((Dt=globalThis.navigator)==null?void 0:Dt.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",T=v(u({},t?{}:{"x-api-key":e.apiKey,"x-client-code":((Ut=e.clientCode)==null?void 0:Ut.toUpperCase())||""}),{"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:$t,runtime:d,os:g})});if(this.client=ln.create({baseURL:o,headers:T,timeout:(Ft=e.timeout)!=null?Ft:3e4}),Vt(this.client,{retries:3,retryDelay:Vt.exponentialDelay,retryCondition:b=>{var Ce;return Vt.isNetworkOrIdempotentRequestError(b)||((Ce=b.response)==null?void 0:Ce.status)===429},onRetry:(b,Ce,_t)=>{var Nt,qt;typeof process!="undefined"&&((Nt=process.env)==null?void 0:Nt.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${b}/3): ${(qt=_t.method)==null?void 0:qt.toUpperCase()} ${_t.url}. Reason: ${Ce.message}`)}}),this.platform=new ve(this.client),this.product=new ke(this.client),this.infra=new we(this.client),this.webhooks=new Se,t){if(t.ticket){let b=t.ticket;this.startSocket=()=>this.initSocket(a,async()=>({ticket:await b()}))}}else{let b={apiKey:e.apiKey,clientCode:((Mt=e.clientCode)==null?void 0:Mt.toUpperCase())||""};this.startSocket=()=>this.initSocket(a,async()=>b,{"x-api-key":b.apiKey,"x-client-code":b.clientCode})}if(l){let b={version:$t,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=b}}initSocket(e,t,r){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:o})=>{this.socket=o(e,{auth:a=>{t().then(l=>a(v(u({},l),{lastSeq:this.lastSeq})),()=>a({lastSeq:this.lastSeq}))},extraHeaders:r,transports:["websocket","polling"],tryAllTransports:!0}),this.setupSocket();for(let{type:a,args:l}of this.socketQueue)a==="joinRoom"?this.socket.emit("join-room",l[0]):a==="leaveRoom"?this.socket.emit("leave-room",l[0]):a==="on"?this.socket.on(l[0],l[1]):a==="off"?this.socket.off(l[0],l[1]):a==="disconnect"&&this.socket.disconnect();this.socketQueue=[]}),this.socketPromise)}joinRoom(e){var t;this.closed||(t=this.startSocket)==null||t.call(this),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(){this.socket&&(this.socket.on("connect_error",()=>{var e;(e=this.socket)!=null&&e.active||setTimeout(()=>{var t;this.closed||(t=this.socket)==null||t.connect()},5e3)}),this.socket.onAny((...e)=>{var r,o;let t=(r=e.at(-1))==null?void 0:r.seq;typeof t=="number"&&t>((o=this.lastSeq)!=null?o:0)&&(this.lastSeq=t)}))}on(e,t){var r;return this.closed||(r=this.startSocket)==null||r.call(this),this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.closed=!0,this.socket?this.socket.disconnect():this.socketPromise&&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,r,o){var a,l,d;try{return(await this.client.request(u({method:e,url:t,data:r,params:o},typeof FormData!="undefined"&&r instanceof FormData?{headers:{"Content-Type":!1}}:{}))).data}catch(g){throw g.response?new f(((a=g.response.data)==null?void 0:a.message)||((l=g.response.data)==null?void 0:l.error)||"Raw Execution Failed",g.response.status,(d=g.response.data)==null?void 0:d.code):new f(g.message||"Network Error")}}};var $i={401:A,403:Gt,429:Te};function Vi(n){throw R(n)}function Oi(n,e){return n instanceof e}function Di(n){return n instanceof A?{message:n.message,status:n.status,code:n.code,type:"AuthenticationError"}:n instanceof Te?{message:n.message,status:n.status,code:n.code,type:"RateLimitError"}:n instanceof f?{message:n.message,status:n.status,code:n.code,type:"APIError"}:{message:n.message||"Unknown error",type:"UnknownError"}}var Jt={[A.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[Te.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[f.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function Ui(n){let e=n.constructor.name;return Jt[e]||Jt[f.name]}var _i=E;export{f as APIError,s as APIResource,O as AiAgent,A as AuthenticationError,S as Campaigns,ie as Catalog,D as ChannelSettingsResource,fe as Collector,U as ConnectAccounts,yt as ConnectInfra,E as ECODrIx,E as ECODrIxAPI,Jt as ERROR_RETRY_CONFIG,pn as EcodrixError,dt as EmailConnect,ct as ErixChat,lt as ErixProduct,B as FlowAudiences,F as FlowAutomations,M as FlowConversations,N as FlowDrafts,q as FlowFirstRunResource,_ as FlowHome,ut as FlowProduct,$i as HTTP_STATUS_ERROR_MAP,we as InfraDomain,tn as KNOWLEDGE_FILE_TYPES,oe as Knowledge,Zt as LAIE_EVENTS,Ht as LEAD_STATUS_VALUES,ne as LaieAudits,G as LaieCampaigns,J as LaieCompliance,te as LaieFreshness,z as LaieImport,Q as LaieLeads,Z as LaieLearning,Y as LaieLists,ee as LaieLookalikes,X as LaieMarket,K as LaiePacks,gt as LaieProduct,H as LaieRuns,j as LaieSignals,W as LaieTools,re as Onboarding,Gt as PermissionError,se as Persona,ve as PlatformDomain,bt as PlatformTenants,ft as PlatformUsers,ke as ProductDomain,Te as RateLimitError,ce as SeoAudits,ye as SeoBacklinks,be as SeoBriefs,le as SeoInsights,ge as SeoLocal,he as SeoPerformance,pt as SeoProduct,ae as SeoProjects,pe as SeoRanks,de as SeoReports,me as SeoResearch,ue as SeoSearchConsole,ht as StorageInfra,rn as VOICE_EVENTS,Qt as VOICE_REFUSAL_REASONS,xe as Voice,st as VoiceCampaigns,C as WebhookSignatureError,Se as Webhooks,mt as WhatsAppConnect,_i as default,Di as getErrorDetails,Ui as getRetryConfig,Vi as handleAPIError,Oi as isAPIError,Xt as laieStageQueued,R as toAPIError,on as voiceErrorCode,an as voiceRefusalReason};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecodrix/erix-api",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"author": "ECODrIx Team <contact@ecodrix.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Official TypeScript SDK for the ERIX API by ECODrIx: CRM, Flow automations, one inbox across WhatsApp, Instagram and email, GST invoices and payments. Node and browser (proxy mode).",
|