@smartbills/sdk 1.1.0-alpha.3 → 1.1.0-alpha.32
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +5789 -2378
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=require("axios");class e{constructor(s){this.http=s}resolveBusinessId(s){return s?.businessId??this.http.defaults.businessId}buildConfig(s){const e={};s?.locale&&(e["Accept-Language"]=s.locale);const t=this.resolveBusinessId(s);return t&&(e["x-tenant-id"]=String(t)),{headers:e,signal:s?.signal}}_list(s,e,t){return this.http.get(s,{...this.buildConfig(t),params:e})}_get(s,e){return this.http.get(s,this.buildConfig(e))}_getWithParams(s,e,t){return this.http.get(s,{...this.buildConfig(t),params:e})}_create(s,e,t){return this.http.post(s,e,this.buildConfig(t))}_update(s,e,t){return this.http.put(s,e,this.buildConfig(t))}_patch(s,e,t){return this.http.patch(s,e,this.buildConfig(t))}_delete(s,e){return this.http.delete(s,this.buildConfig(e))}_upload(s,e,t){return this.http.upload(s,e,this.buildConfig(t))}_download(s,e){return this.http.downloadBlob(s,this.buildConfig(e))}_downloadWithFilename(s,e,t,r){return this.http.downloadBlobWithFilename(s,e,t,this.buildConfig(r))}businessUrl(s,e){const t=this.resolveBusinessId(e);if(!t)throw new Error("businessId is required for this operation");return`/v1/businesses/${t}${s}`}}class t extends e{async list(s){const e=this.businessUrl("/app-installations",s);return this.http.get(e,this.buildConfig(s))}async getById(s,e){const t=this.businessUrl(`/app-installations/${s}`,e);return this._get(t,e)}async getSessionToken(s,e){const t=this.businessUrl(`/app-installations/${s}/session`,e);return this._create(t,{},e)}async delete(s,e){const t=this.businessUrl(`/app-installations/${s}`,e);await this._delete(t,e)}}class r extends e{async listPending(s,e){const t=this.businessUrl("/approbations/pending",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listApproved(s,e){const t=this.businessUrl("/approbations/approved",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listRejected(s,e){const t=this.businessUrl("/approbations/rejected",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listReimbursed(s,e){const t=this.businessUrl("/approbations/reimbursed",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listRequiresChanges(s,e){const t=this.businessUrl("/approbations/requires-changes",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPendingReimbursement(s,e){const t=this.businessUrl("/approbations/pending-reimbursement",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/approbations/${s}`,e);return this._get(t,e)}async approve(s,e,t){const r=this.businessUrl(`/approbations/${s}/approve`,t);return this._create(r,e??{},t)}async reject(s,e,t){const r=this.businessUrl(`/approbations/${s}/reject`,t);return this._create(r,e??{},t)}async requestChanges(s,e,t){const r=this.businessUrl(`/approbations/${s}/request-changes`,t);return this._create(r,e??{},t)}async reimburse(s,e,t){const r=this.businessUrl(`/approbations/${s}/reimburse`,t);return this._create(r,e??{},t)}async planReimbursement(s,e,t){const r=this.businessUrl(`/approbations/${s}/plan-reimbursement`,t);return this._create(r,e,t)}async markReimbursed(s,e,t){const r=this.businessUrl(`/approbations/${s}/mark-reimbursed`,t);return this._create(r,e??{},t)}async revertToReview(s,e,t){const r=this.businessUrl(`/approbations/${s}/revert-to-review`,t);return this._create(r,e??{},t)}async cancelRequiredChanges(s,e,t){const r=this.businessUrl(`/approbations/${s}/cancel-required-changes`,t);return this._create(r,e??{},t)}async getTimeline(s,e){const t=this.businessUrl(`/approbations/${s}/timeline`,e);return this._get(t,e)}async addComment(s,e,t){const r=this.businessUrl(`/approbations/${s}/comments`,t);return this._create(r,e,t)}async getSummary(s){const e=this.businessUrl("/approbations/summary",s);return this._get(e,s)}async exportCsv(s,e,t){const r=this.businessUrl(`/approbations/${s}/export/csv`,t);return this.http.post(r,{},{...this.buildConfig(t),params:{locale:e},responseType:"blob"})}async exportBulkCsv(s,e){const t=this.businessUrl("/approbations/export/csv",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async downloadAttachmentsPdf(s,e){const t=this.businessUrl(`/approbations/${s}/attachments/pdf`,e);return this._download(t,e)}async downloadAttachmentsZip(s,e){const t=this.businessUrl(`/approbations/${s}/attachments/zip`,e);return this._download(t,e)}async updateExpense(s,e,t,r){const n=this.businessUrl(`/approbations/${s}/expenses/${e}`,r);return this._update(n,t,r)}async saveExpenseReview(s,e,t){const r=this.businessUrl(`/approbations/${s}/approve`,t);return this._create(r,{...e,saveExpenseReviewOnly:!0},t)}}class n extends e{async getSubscription(s){return this._get(this.businessUrl("/billing/subscription",s),s)}async upgradeSubscription(s,e){return this._create(this.businessUrl("/billing/subscription/upgrade",e),s,e)}async cancelSubscription(s){return this._create(this.businessUrl("/billing/subscription/cancel",s),{},s)}async getPlans(s){return this._get(this.businessUrl("/billing/subscription/plans",s),s)}async startTrial(s,e){return this._create(this.businessUrl("/billing/subscription/trial",e),s,e)}async activateFreeTier(s){return this._create(this.businessUrl("/billing/subscription/free",s),{},s)}async validateDowngrade(s,e){return this._create(this.businessUrl("/billing/subscription/validate-downgrade",e),s,e)}async listInvoices(s,e){return this._list(this.businessUrl("/billing/invoices",e),s,e)}async getInvoice(s,e){return this._get(this.businessUrl(`/billing/invoices/${s}`,e),e)}async getUpcomingInvoice(s){return this._get(this.businessUrl("/billing/invoices/upcoming",s),s)}async getUsage(s){return this._get(this.businessUrl("/billing/usage",s),s)}async getUsageHistory(s,e){return this._list(this.businessUrl("/billing/usage/history",e),s,e)}async getUsageByKey(s,e){return this._get(this.businessUrl(`/billing/usage/${s}`,e),e)}async createPortalSession(s,e){return this._create(this.businessUrl("/billing/portal",e),s??{},e)}async getPaymentMethods(s){return this._get(this.businessUrl("/billing/payment-methods",s),s)}async createSetupIntent(s){return this._create(this.businessUrl("/billing/payment-methods/setup-intent",s),{},s)}async detachPaymentMethod(s,e){return this._delete(this.businessUrl(`/billing/payment-methods/${s}`,e),e)}async setDefaultPaymentMethod(s,e){return this._create(this.businessUrl(`/billing/payment-methods/${s}/default`,e),{},e)}}class i extends e{async list(s,e){const t=this.businessUrl("/bills",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPersonal(s,e){return this.http.get("/v1/bills",{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/bills/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/bills",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/bills/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/bills/${s}`,e);await this._delete(t,e)}async batchCreate(s,e){const t=this.businessUrl("/bills/batch",e);return this._create(t,s,e)}async batchUpdate(s,e){const t=this.businessUrl("/bills/batch",e);return this._update(t,s,e)}async upload(s,e){const t=this.businessUrl("/bills/upload",e);return this.http.upload(t,s,this.buildConfig(e))}async getStatusSummary(s){const e=this.businessUrl("/bills/status-summary",s);return this._get(e,s)}async getHistory(s,e){const t=this.businessUrl(`/bills/${s}/history`,e);return this._get(t,e)}async getAllowedTransitions(s,e){const t=this.businessUrl(`/bills/${s}/allowed-transitions`,e);return this._get(t,e)}async submitForApproval(s,e,t){const r=this.businessUrl(`/bills/${s}/submit-for-approval`,t);return this._create(r,e??{},t)}async approve(s,e,t){const r=this.businessUrl(`/bills/${s}/approve`,t);return this._create(r,e??{},t)}async schedulePayment(s,e,t){const r=this.businessUrl(`/bills/${s}/schedule-payment`,t);return this._create(r,e,t)}async markPaid(s,e,t){const r=this.businessUrl(`/bills/${s}/mark-paid`,t);return this._create(r,e??{},t)}async cancel(s,e,t){const r=this.businessUrl(`/bills/${s}/cancel`,t);return this._create(r,e??{},t)}async revertToDraft(s,e,t){const r=this.businessUrl(`/bills/${s}/revert-to-draft`,t);return this._create(r,e??{},t)}async reschedulePayment(s,e,t){const r=this.businessUrl(`/bills/${s}/reschedule-payment`,t);return this._create(r,e,t)}async retryPayment(s,e,t){const r=this.businessUrl(`/bills/${s}/retry-payment`,t);return this._create(r,e??{},t)}async bulkApprove(s,e){const t=this.businessUrl("/bills/bulk/approve",e);return this._create(t,s,e)}async bulkMarkPaid(s,e){const t=this.businessUrl("/bills/bulk/mark-paid",e);return this._create(t,s,e)}async bulkSchedulePayment(s,e){const t=this.businessUrl("/bills/bulk/schedule-payment",e);return this._create(t,s,e)}async bulkUnschedule(s,e){const t=this.businessUrl("/bills/bulk/unschedule",e);return this._create(t,s,e)}async bulkCancelPayment(s,e){const t=this.businessUrl("/bills/bulk/cancel-payment",e);return this._create(t,s,e)}async bulkDelete(s,e){const t=this.businessUrl("/bills/bulk/delete",e);return this._create(t,s,e)}async bulkRetryPayment(s,e){const t=this.businessUrl("/bills/bulk/retry-payment",e);return this._create(t,s,e)}async bulkRemind(s,e){const t=this.businessUrl("/bills/bulk/remind",e);return this._create(t,s,e)}async bulkUpdate(s,e){const t=this.businessUrl("/bills/bulk/update",e);return this._create(t,s,e)}async export(s,e){const t=this.businessUrl("/bills/export",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async downloadAttachments(s,e){const t=this.businessUrl("/bills/attachments/download",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async validate(s,e){const t=this.businessUrl("/bills/validate",e);return this.http.upload(t,s,this.buildConfig(e))}}class a extends e{async list(s,e){return this.http.get("/v1/businesses",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/businesses/${s}`,e)}async create(s,e){return this._create("/v1/businesses",s,e)}async update(s,e,t){return this._update(`/v1/businesses/${s}`,e,t)}async delete(s,e){await this._delete(`/v1/businesses/${s}`,e)}async count(s){return this._get("/v1/businesses/count",s)}async createBrand(s,e,t){const r=new FormData;return e.logo&&r.append("logo",e.logo),e.coverImage&&r.append("coverImage",e.coverImage),e.primaryColor&&r.append("primaryColor",e.primaryColor),e.secondaryColor&&r.append("secondaryColor",e.secondaryColor),this._upload(`/v1/businesses/${s}/brand`,r,t)}async batchCreate(s,e){return this._create("/v1/businesses/batch",s,e)}async batchUpdate(s,e){return this._update("/v1/businesses/batch",s,e)}async getPlan(s,e){return this._get(`/v1/businesses/${s}/plan`,e)}}class o extends e{async list(s,e){const t=this.businessUrl("/users",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/users/${s}`,e);return this._get(t,e)}async add(s,e){const t=this.businessUrl("/users",e);return this._create(t,s,e)}async remove(s,e){const t=this.businessUrl(`/users/${s}`,e);return this._delete(t,e)}async updateRole(s,e,t){const r=this.businessUrl(`/users/${s}/role`,t);return this._update(r,e,t)}async invite(s,e){const t=this.businessUrl("/users/invite",e);return this._create(t,s,e)}async reinvite(s,e){const t=this.businessUrl(`/users/${s}/invite`,e);return this._create(t,{},e)}async validateEmail(s,e){const t=this.businessUrl("/users/validate",e);return this.http.get(t,{...this.buildConfig(e),params:{email:s}})}async setInactive(s,e){const t=this.businessUrl(`/users/${s}/status`,e);return this._update(t,{isActive:!1},e)}}class c extends e{async createPaymentIntent(s,e){return this._create("/v1/checkout/pay",s,e)}async getTransaction(s,e){return this._get(`/v1/checkout/SBTransactions/${s}`,e)}async listPayments(s,e){const t=this.businessUrl("/checkout/payments",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getPayment(s,e){const t=this.businessUrl(`/checkout/payments/${s}`,e);return this._get(t,e)}async refund(s,e,t){const r=this.businessUrl(`/checkout/payments/${s}/refund`,t);return this._create(r,e??{},t)}async getLedger(s){const e=this.businessUrl("/checkout/ledger",s);return this._get(e,s)}}class u extends e{async getAccount(s){const e=this.businessUrl("/connect/account",s);return this._get(e,s)}async onboard(s,e){const t=this.businessUrl("/connect/onboard",e);return this._create(t,s,e)}async getDashboardLink(s){const e=this.businessUrl("/connect/dashboard",s);return this._get(e,s)}}class l extends e{async list(s,e){const t=this.businessUrl("/email-accounts",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/email-accounts/${s}`,e);return this._get(t,e)}async authorize(s,e){const t=this.businessUrl("/email-accounts/authorize",e);return this._create(t,s,e)}async callback(s,e){const t=this.businessUrl("/email-accounts/callback",e);return this._create(t,s,e)}async createImap(s,e){const t=this.businessUrl("/email-accounts/imap",e);return this._create(t,s,e)}async delete(s,e){const t=this.businessUrl(`/email-accounts/${s}`,e);await this._delete(t,e)}async update(s,e,t){const r=this.businessUrl(`/email-accounts/${s}`,t);return this._update(r,e,t)}async sync(s,e){const t=this.businessUrl(`/email-accounts/${s}/sync`,e);await this._create(t,{},e)}async reconnect(s,e,t){const r=this.businessUrl(`/email-accounts/${s}/reconnect`,t);return this._create(r,e??{},t)}async enable(s,e){const t=this.businessUrl(`/email-accounts/${s}/enable`,e);return this._create(t,{},e)}async disable(s,e){const t=this.businessUrl(`/email-accounts/${s}/disable`,e);return this._create(t,{},e)}async historicalSync(s,e,t){const r=this.businessUrl(`/email-accounts/${s}/historical-sync`,t);await this._create(r,e,t)}async getMailboxes(s,e){const t=this.businessUrl(`/email-accounts/${s}/mailboxes`,e);return this._get(t,e)}async updateMailbox(s,e,t,r){const n=this.businessUrl(`/email-accounts/${s}/mailboxes/${e}`,r);return this._update(n,t,r)}async getSyncSessions(s,e,t){const r=this.businessUrl(`/email-accounts/${s}/sync-sessions`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}async authorizeWithParams(s,e){const t=this.businessUrl("/email-accounts/authorize",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async validateSharedMailbox(s,e,t){const r=this.businessUrl(`/email-accounts/${s}/shared-mailboxes/validate`,t);return this._create(r,{email:e},t)}async addSharedMailbox(s,e,t){const r=this.businessUrl(`/email-accounts/${s}/shared-mailboxes`,t);return this._create(r,{email:e},t)}async removeSharedMailbox(s,e,t){const r=this.businessUrl(`/email-accounts/${s}/shared-mailboxes/${encodeURIComponent(e)}`,t);await this._delete(r,t)}}class h extends e{async list(s,e){const t=this.businessUrl("/expenses/processing",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPersonal(s,e){return this.http.get("/v1/expenses/processing",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/expenses/processing/${s}`,e)}async listForEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/processing`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}async getEmployeeJobById(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/processing/${e}`,t);return this._get(r,t)}async retryEmployeeJob(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/processing/${e}/retry`,t);await this._create(r,{},t)}}class p extends e{async add(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/expenses`,t);return this._create(r,e,t)}async addBatch(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/expenses/batch`,t);return this._create(r,e,t)}async remove(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/expenses/${e}`,t);await this._delete(r,t)}async edit(s,e,t,r){const n=this.businessUrl(`/expense-reports/${s}/expenses/${e}`,r);return this._update(n,t,r)}async bulkAssignCategory(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/expenses/bulk/category`,t);return this._update(r,e,t)}async bulkRemove(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/expenses/bulk`,t);return this.http.delete(r,{...this.buildConfig(t),data:e})}async addForEmployee(s,e,t,r){const n=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses`,r);return this._create(n,t,r)}async addBatchForEmployee(s,e,t,r){const n=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses/batch`,r);return this._create(n,t,r)}async removeForEmployee(s,e,t,r){const n=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses/${t}`,r);await this._delete(n,r)}async editForEmployee(s,e,t,r,n){const i=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses/${t}`,n);return this._update(i,r,n)}async replace(s,e,t,r){const n=this.businessUrl(`/expense-reports/${s}/expenses/${e}/replace`,r);return this._create(n,t,r)}}class E extends e{async reimburse(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/payments/reimburse`,t);return this._create(r,e??{},t)}async partialReimburse(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/payments/partial-reimburse`,t);return this._create(r,e,t)}async planReimbursement(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/payments/plan-reimbursement`,t);return this._create(r,e,t)}}class d extends e{async list(s,e){const t=this.businessUrl("/expense-reports",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listForEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expense-reports`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}async getByIdForEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expense-reports/${e}`,t);return this._get(r,t)}async getById(s,e){const t=this.businessUrl(`/expense-reports/${s}`,e);return this._get(t,e)}async getMine(s,e){const t=this.businessUrl("/expense-reports/me",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async create(s,e){const t=this.businessUrl("/expense-reports",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/expense-reports/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/expense-reports/${s}`,e);await this._delete(t,e)}async submit(s,e){const t=this.businessUrl(`/expense-reports/${s}/submit`,e);return this._create(t,{},e)}async recall(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/recall`,t);return this._create(r,e??{},t)}async approve(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/approve`,t);return this._create(r,e??{},t)}async reject(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/reject`,t);return this._create(r,e??{},t)}async requestChanges(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/request-changes`,t);return this._create(r,e??{},t)}async reimburse(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/reimburse`,t);return this._create(r,e??{},t)}async planReimbursement(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/plan-reimbursement`,t);return this._create(r,e,t)}async addComment(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/comments`,t);return this._create(r,e,t)}async getTimeline(s,e){const t=this.businessUrl(`/expense-reports/${s}/timeline`,e);return this._get(t,e)}async getAuditLog(s,e){const t=this.businessUrl(`/expense-reports/${s}/audit-log`,e);return this._get(t,e)}async assignLedgerAccount(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/ledger-account`,t);return this._update(r,e,t)}async assignExpenseLedgerAccount(s,e,t,r){const n=this.businessUrl(`/expense-reports/${s}/expenses/${e}/ledger-account`,r);return this._update(n,t,r)}async getSummary(s){const e=this.businessUrl("/expense-reports/summary",s);return this._get(e,s)}async getPendingApprovals(s){const e=this.businessUrl("/expense-reports/pending-approvals",s);return this._get(e,s)}async bulkDelete(s,e){const t=this.businessUrl("/expense-reports/bulk",e);return this.http.delete(t,{...this.buildConfig(e),data:s})}async export(s,e){const t=this.businessUrl("/expense-reports/export",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}}class b extends e{async listBusiness(s,e){const t=this.businessUrl("/expenses",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}async listMy(s,e){return this.http.get("/v1/me/expenses",{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/expenses/${s}`,e);return this._get(t,e)}async update(s,e,t){const r=this.businessUrl(`/expenses/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/expenses/${s}`,e);await this._delete(t,e)}async deleteEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/${e}`,t);await this._delete(r,t)}async updateCategory(s,e,t){const r=this.businessUrl(`/expenses/${s}/category`,t);return this._update(r,e,t)}async updateNote(s,e,t){const r=this.businessUrl(`/expenses/${s}/note`,t);return this._update(r,e,t)}async updateReport(s,e,t){const r=this.businessUrl(`/expenses/${s}/report`,t);return this._update(r,e,t)}async setReport(s,e,t){const r=this.businessUrl(`/expenses/${s}/expense-report`,t);return this._create(r,e,t)}async uploadBusiness(s,e){const t=this.businessUrl("/expenses/upload",e);return this.http.upload(t,s,this.buildConfig(e))}async uploadEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/upload`,t);return this.http.upload(r,e,this.buildConfig(t))}async uploadMy(s,e){return this.http.upload("/v1/me/expenses/upload",s,this.buildConfig(e))}async validateBusiness(s,e){const t=this.businessUrl("/expenses/validate",e);return this.http.upload(t,s,this.buildConfig(e))}async validateEmployee(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/validate`,t);return this.http.upload(r,e,this.buildConfig(t))}async bulkAssignCategory(s,e){const t=this.businessUrl("/expenses/bulk/category",e);return this._update(t,s,e)}async bulkAssignReport(s,e){const t=this.businessUrl("/expenses/bulk/expense-report",e);return this._update(t,s,e)}async bulkAssignVendor(s,e){const t=this.businessUrl("/expenses/bulk/vendor",e);return this._update(t,s,e)}async bulkSetNote(s,e){const t=this.businessUrl("/expenses/bulk/note",e);return this._update(t,s,e)}async updateReview(s,e,t){const r=this.businessUrl(`/expenses/${s}/review`,t);return this._update(r,e,t)}async bulkDelete(s,e){const t=this.businessUrl("/expenses/bulk",e);return this.http.delete(t,{...this.buildConfig(e),data:s})}async export(s,e){const t=this.businessUrl("/expenses/export",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async exportWithFilename(s,e){const t=this.businessUrl("/expenses/export",e);return this._downloadWithFilename("POST",t,s,e)}async downloadAttachments(s,e){const t=this.businessUrl("/expenses/attachments/download",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async downloadAttachmentsWithFilename(s,e){const t=this.businessUrl("/expenses/attachments/download",e);return this._downloadWithFilename("POST",t,s,e)}async downloadSingleAttachment(s,e){const t=this.businessUrl(`/expenses/${s}/attachments/download`,e);return this._download(t,e)}async downloadSingleAttachmentWithFilename(s,e){const t=this.businessUrl(`/expenses/${s}/attachments/download`,e);return this._downloadWithFilename("GET",t,void 0,e)}async split(s,e,t){const r=this.businessUrl(`/expenses/${s}/split`,t);return this._create(r,e,t)}async batchUpdate(s,e){const t=this.businessUrl("/expenses",e);return this._update(t,s,e)}}class y extends e{async listInstalled(s,e){const t=this.businessUrl("/integrations",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/integrations/${s}`,e);return this._get(t,e)}async authorize(s,e){const t=this.businessUrl(`/integrations/${s}/authorize`,e);return this._get(t,e)}async callback(s,e,t){const r=this.businessUrl(`/integrations/${s}/callback`,t);return this._create(r,e,t)}async delete(s,e){const t=this.businessUrl(`/integrations/${s}`,e);await this._delete(t,e)}async revoke(s,e){const t=this.businessUrl(`/integrations/${s}/revoke`,e);await this._delete(t,e)}async listMarketplaceApps(s){return this._get("/v1/app-marketplace/apps",s)}async getMarketplaceApp(s,e){return this._get(`/v1/app-marketplace/apps/${s}`,e)}async getInstallationById(s,e){const t=this.businessUrl(`/apps/installations/${s}`,e);return this._get(t,e)}async getInstallation(s,e,t){const r=this.businessUrl(`/apps/${s}/installations/${e}`,t);return this._get(r,t)}async getSessionToken(s,e){const t=this.businessUrl(`/apps/installations/${s}/session-token`,e);return this._create(t,{},e)}async retryInstallation(s,e,t){const r=this.businessUrl(`/apps/${s}/installations/${e}/retry`,t);return this._create(r,{},t)}async abortInstallation(s,e,t){const r=this.businessUrl(`/apps/${s}/installations/${e}/abort`,t);return this._create(r,{},t)}async updateInstallationStatus(s,e,t,r){const n=this.businessUrl(`/apps/${s}/installations/${e}/status`,r);return this._patch(n,t,r)}}class _ extends e{async list(s,e){const t=this.businessUrl("/invitations",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/invitations/${s}`,e);return this._get(t,e)}async send(s,e){const t=this.businessUrl("/invitations",e);return this._create(t,s,e)}async accept(s,e){const t=this.businessUrl(`/invitations/${s}/accept`,e);return this._create(t,{},e)}async refuse(s,e){const t=this.businessUrl(`/invitations/${s}/refuse`,e);return this._create(t,{},e)}async delete(s,e){const t=this.businessUrl(`/invitations/${s}`,e);return this._delete(t,e)}}class R extends e{async list(s,e){const t=this.businessUrl("/locations",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/locations/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/locations",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/locations/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/locations/${s}`,e);await this._delete(t,e)}async batchCreate(s,e){const t=this.businessUrl("/locations/batch",e);return this._create(t,s,e)}async batchUpdate(s,e){const t=this.businessUrl("/locations/batch",e);return this._update(t,s,e)}async uploadImage(s,e,t){const r=new FormData;r.append("file",e);const n=this.businessUrl(`/locations/${s}/images`,t);return this._upload(n,r,t)}async addImageFromUrl(s,e,t){const r=this.businessUrl(`/locations/${s}/images/url`,t);return this._create(r,e,t)}async deleteImage(s,e,t){const r=this.businessUrl(`/locations/${s}/images/${e}`,t);await this._delete(r,t)}}class U extends e{async list(s){return this._get("/v1/user/memberships",s)}async getById(s,e){return this._get(`/v1/user/memberships/${s}`,e)}async leave(s,e){await this._delete(`/v1/user/memberships/${s}`,e)}}class g extends e{async list(s,e){const t=this.businessUrl("/notifications",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPersonal(s,e){return this.http.get("/v1/notifications",{...this.buildConfig(e),params:s})}async markRead(s,e){const t=this.businessUrl(`/notifications/${s}/read`,e);await this._update(t,{},e)}async markAllRead(s){const e=this.businessUrl("/notifications/read",s);await this._update(e,{},s)}async markReadPersonal(s,e){await this._update(`/v1/notifications/${s}/read`,{},e)}async markAllReadPersonal(s){await this._update("/v1/notifications/read",{},s)}}class m extends e{async list(s,e){return this.http.get("/v1/payment-methods",{...this.buildConfig(e),params:s})}async create(s,e){return this._create("/v1/payment-methods/create",s,e)}async createSetupIntent(s){return this._create("/v1/payment-methods/setup",{},s)}async delete(s,e){await this._delete(`/v1/payment-methods/${s}`,e)}}class I extends e{async list(s,e){return this.http.get("/v1/receipts",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/receipts/${s}`,e)}async create(s,e){return this._create("/v1/receipts",s,e)}async update(s,e,t){return this._update(`/v1/receipts/${s}`,e,t)}async delete(s,e){await this._delete(`/v1/receipts/${s}`,e)}async createFromOCR(s,e){const t=new FormData;return t.append("file",s),this._upload("/v1/receipts/ocr",t,e)}}class A extends e{async monthlySummary(s,e){const t=this.businessUrl("/reports/expenses",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async byCategory(s,e){const t=this.businessUrl("/reports/expenses/categories",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async byVendor(s,e){const t=this.businessUrl("/reports/expenses/vendor",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async daily(s,e){const t=this.businessUrl("/reports/expenses/daily",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxSummary(s,e){const t=this.businessUrl("/reports/expenses/taxes",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxByType(s,e){const t=this.businessUrl("/reports/expenses/taxes/by-type",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxByVendor(s,e){const t=this.businessUrl("/reports/expenses/taxes/by-vendor",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxByCategory(s,e){const t=this.businessUrl("/reports/expenses/taxes/by-category",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async byEmployee(s,e){const t=this.businessUrl("/reports/expenses/employees",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async employeeCategoryBreakdown(s,e){const t=this.businessUrl("/reports/expenses/employees/categories",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async overTime(s,e){const t=this.businessUrl("/reports/expenses/over-time",e);return this.http.get(t,{...this.buildConfig(e),params:s})}}class T extends e{async list(s,e){const t=this.businessUrl("/tables",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/tables/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/tables",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/tables/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/tables/${s}`,e);await this._delete(t,e)}}class x extends e{async list(s,e){return this.http.get("/v1/transactions",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/transactions/${s}`,e)}async update(s,e,t){return this._update(`/v1/transactions/${s}`,e,t)}async batchUpdate(s,e){return this._update("/v1/transactions/batch",s,e)}async upload(s,e){return this.http.upload("/v1/transactions/upload",s,this.buildConfig(e))}async delete(s,e){return this._delete(`/v1/transactions/${s}`,e)}}class N extends e{async me(s){return this._get("/v1/user",s)}async update(s,e){return this._update("/v1/user",s,e)}async delete(s){return this._delete("/v1/user",s)}async getAvatar(s){return this._get("/v1/user/avatar",s)}async getInvitations(s){return this._get("/v1/user/invitations",s)}async getMemberships(s){return this._get("/v1/user/memberships",s)}}class C extends e{async list(s,e){const t=this.businessUrl(`/vendors/${s}/connections`,e);return this._get(t,e)}async getById(s,e,t){const r=this.businessUrl(`/vendors/${s}/connections/${e}`,t);return this._get(r,t)}async getLinkToken(s,e){const t=this.businessUrl(`/vendors/${s}/connections/link`,e);return this._get(t,e)}async getReconnectLinkToken(s,e,t){const r=this.businessUrl(`/vendors/${s}/connections/${e}/link`,t);return this._get(r,t)}async connect(s,e,t){const r=this.businessUrl(`/vendors/${s}/connections`,t);return this._create(r,e,t)}async disconnect(s,e,t){const r=this.businessUrl(`/vendors/${s}/connections/${e}`,t);return this._delete(r,t)}}class D extends e{async list(s,e){return this.http.get("/v1/vendors",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/vendors/${s}`,e)}async create(s,e){return this._create("/v1/vendors",s,e)}async update(s,e,t){return this._update(`/v1/vendors/${s}`,e,t)}async delete(s,e){return this._delete(`/v1/vendors/${s}`,e)}async listBusiness(s,e){const t=this.businessUrl("/vendors",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getBusinessVendor(s,e){const t=this.businessUrl(`/vendors/${s}`,e);return this._get(t,e)}async createBusiness(s,e){const t=this.businessUrl("/vendors",e);return this._create(t,s,e)}async updateBusiness(s,e,t){const r=this.businessUrl(`/vendors/${s}`,t);return this._update(r,e,t)}async deleteBusiness(s,e){const t=this.businessUrl(`/vendors/${s}`,e);return this._delete(t,e)}async refreshBusiness(s,e){const t=this.businessUrl(`/vendors/${s}/refresh`,e);await this._create(t,{},e)}async batchCreate(s,e){const t=this.businessUrl("/vendors/batch",e);return this._create(t,s,e)}async batchUpdate(s,e){const t=this.businessUrl("/vendors/batch",e);return this._update(t,s,e)}async bulkDelete(s,e){const t=this.businessUrl("/vendors/bulk",e);return this.http.delete(t,{...this.buildConfig(e),data:s})}async merge(s,e){const t=this.businessUrl("/vendors/merge",e);return this._create(t,s,e)}async importCsv(s,e){const t=new FormData;t.append("file",s);const r=this.businessUrl("/vendors/import",e);return this._upload(r,t,e)}async downloadImportTemplate(s){const e=this.businessUrl("/vendors/import/template",s);return this._download(e,s)}}class S extends e{async list(s,e){const t=this.businessUrl("/workflows",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/workflows/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/workflows",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/workflows/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/workflows/${s}`,e);await this._delete(t,e)}async test(s,e,t){const r=this.businessUrl(`/workflows/${s}/test`,t);return this._create(r,e??{},t)}async createFromTemplate(s,e){const t=this.businessUrl(`/workflows/templates/${s}`,e);return this._create(t,{},e)}}class v extends e{async list(s,e){const t=this.businessUrl("/customers",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/customers/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/customers",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/customers/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/customers/${s}`,e);return this._delete(t,e)}}class O extends e{async list(s,e){const t=this.businessUrl("/departments",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/departments/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/departments",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/departments/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/departments/${s}`,e);return this._delete(t,e)}}class P extends e{async list(s,e){const t=this.businessUrl("/products",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/products/${s}`,e);return this._get(t,e)}}class $ extends e{async list(s,e){const t=this.businessUrl("/taxes",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/taxes/${s}`,e);return this._get(t,e)}}class f extends e{async getById(s,e){const t=this.businessUrl(`/promo-codes/${s}`,e);return this._get(t,e)}}class w extends e{async list(s){const e=this.businessUrl("/expenses-categories",s);return(await this._get(e,s)).data}async getById(s,e){const t=this.businessUrl(`/expenses-categories/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/expenses-categories",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/expenses-categories/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/expenses-categories/${s}`,e);return this._delete(t,e)}}class L extends e{async list(s,e){const t=this.businessUrl("/employees",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/employees/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/employees",e);return this._create(t,s,e)}async update(s,e,t){const r=this.businessUrl(`/employees/${s}`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/employees/${s}`,e);return this._delete(t,e)}async setManager(s,e,t){const r=this.businessUrl(`/employees/${s}/manager`,t);return this._update(r,e,t)}async bulkAssignManager(s,e){const t=this.businessUrl("/employees/bulk-assign-manager",e);return this._create(t,s,e)}async setActive(s,e){const t=this.businessUrl(`/employees/${s}/active`,e);return this._update(t,{},e)}async setInactive(s,e){const t=this.businessUrl(`/employees/${s}/inactive`,e);return this._update(t,{},e)}}class B extends e{async list(s,e){const t=this.businessUrl("/attachments",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/attachments/${s}`,e);return this._get(t,e)}async rename(s,e,t){const r=this.businessUrl(`/attachments/${s}/rename`,t);return this._update(r,e,t)}async delete(s,e){const t=this.businessUrl(`/attachments/${s}`,e);return this._delete(t,e)}}class M extends e{async listBusiness(s,e){return this._get(`/v1/expenses/forwarding/business/${s}/all`,e)}async getUser(s,e,t){return this._getWithParams(`/v1/expenses/forwarding/users/${s}`,{businessId:e},t)}async configureBusiness(s,e){return this._create("/v1/expenses/forwarding/business",s,e)}async configureUser(s,e){return this._create("/v1/expenses/forwarding/users",s,e)}async disableBusiness(s,e){return this._delete(`/v1/expenses/forwarding/business/${s}`,e)}async disableUser(s,e){return this._delete(`/v1/expenses/forwarding/users/${s}`,e)}}class k extends e{async list(s,e){return this.http.get(`/v1/businesses/${s}/authorized-senders`,this.buildConfig(e))}async create(s,e,t){return this.http.post(`/v1/businesses/${s}/authorized-senders`,e,this.buildConfig(t))}async delete(s,e,t){return this.http.delete(`/v1/businesses/${s}/authorized-senders/${e}`,this.buildConfig(t))}}class F extends e{async list(s,e){return this._list("/v1/loyalty/programs",s,e)}async getById(s,e){return this._get(`/v1/loyalty/programs/${s}`,e)}async create(s,e){return this._create("/v1/loyalty/programs",s,e)}async update(s,e,t){return this._patch(`/v1/loyalty/programs/${s}`,e,t)}async delete(s,e){await this._delete(`/v1/loyalty/programs/${s}`,e)}}class V extends Error{constructor(s,e,t,r){super(s),this.name="SmartbillsError",r?.cause&&(this.cause=r.cause),this.code=e,this.statusCode=t,this.requestId=r?.requestId,this.isRetryable=r?.isRetryable??!1,Object.setPrototypeOf(this,new.target.prototype)}}class G extends V{constructor(s,e,t,r){super(s,e,t,{requestId:r?.requestId,isRetryable:r?.isRetryable,cause:r?.cause}),this.name="SmartbillsApiError",this.errors=r?.errors??[],this.rawResponse=r?.rawResponse,Object.setPrototypeOf(this,new.target.prototype)}}const q={VALIDATION_FAILED:"VALIDATION_FAILED",NOT_FOUND:"NOT_FOUND",FORBIDDEN:"FORBIDDEN",CONFLICT:"CONFLICT",RATE_LIMITED:"RATE_LIMITED",INTEGRATION_NOT_FOUND:"INTEGRATION_NOT_FOUND",APP_INSTALLATION_FAILED:"APP_INSTALLATION_FAILED",CODE_VERIFIER_NOT_FOUND:"CODE_VERIFIER_NOT_FOUND",INTERNAL_SERVER_ERROR:"INTERNAL_SERVER_ERROR",QUOTA_EXCEEDED:"QUOTA_EXCEEDED",UNAUTHORIZED:"UNAUTHORIZED",NETWORK_ERROR:"NETWORK_ERROR",TIMEOUT:"TIMEOUT",REQUEST_CANCELLED:"REQUEST_CANCELLED",UNKNOWN:"UNKNOWN"};class W extends G{constructor(s,e){super(s,q.UNAUTHORIZED,401,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsAuthenticationError",Object.setPrototypeOf(this,new.target.prototype)}}class Q extends G{constructor(s,e){super(s,q.CONFLICT,409,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsConflictError",Object.setPrototypeOf(this,new.target.prototype)}}class H extends V{constructor(s,e){super(s,e?.code??q.NETWORK_ERROR,0,{requestId:e?.requestId,isRetryable:!0,cause:e?.cause}),this.name="SmartbillsNetworkError",Object.setPrototypeOf(this,new.target.prototype)}}class X extends G{constructor(s,e){super(s,q.NOT_FOUND,404,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsNotFoundError",Object.setPrototypeOf(this,new.target.prototype)}}class K extends G{constructor(s,e){super(s,q.FORBIDDEN,403,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsPermissionError",Object.setPrototypeOf(this,new.target.prototype)}}class Y extends G{constructor(s,e){super(s,q.QUOTA_EXCEEDED,402,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsQuotaError",this.quotaKey=e?.quotaKey,Object.setPrototypeOf(this,new.target.prototype)}}class j extends G{constructor(s,e){super(s,q.RATE_LIMITED,429,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!0,cause:e?.cause}),this.name="SmartbillsRateLimitError",this.retryAfter=e?.retryAfter,Object.setPrototypeOf(this,new.target.prototype)}}class z extends G{constructor(s,e){super(s,q.VALIDATION_FAILED,400,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsValidationError",this.fieldErrors=new Map;for(const s of this.errors)if(s.field){const e=this.fieldErrors.get(s.field)??[];e.push(s.message),this.fieldErrors.set(s.field,e)}Object.setPrototypeOf(this,new.target.prototype)}getFieldError(s){return this.fieldErrors.get(s)}hasFieldError(s){return this.fieldErrors.has(s)}get allFieldErrors(){return Object.fromEntries(this.fieldErrors)}}function J(s){return s instanceof V}function Z(s){return J(s)&&s.isRetryable}class ss{constructor(e){this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3,this.instance=s.create({baseURL:e.baseUrl,timeout:e.timeout??3e4,headers:{"Content-Type":"application/json",Accept:"application/json"},paramsSerializer:{indexes:!0}}),this.instance.interceptors.request.use((s=>(this.accessToken&&(s.headers.Authorization=`Bearer ${this.accessToken}`),this.businessId&&(s.headers["x-tenant-id"]=String(this.businessId)),this.locale&&(s.headers["Accept-Language"]=this.locale),s.headers["x-request-id"]=`sb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,s)))}setAccessToken(s){this.accessToken=s}setBusinessId(s){this.businessId=s}setLocale(s){this.locale=s}get defaults(){return{accessToken:this.accessToken,businessId:this.businessId,locale:this.locale}}async get(s,e){return this.requestWithRetry("GET",s,void 0,e)}async post(s,e,t){return this.requestWithRetry("POST",s,e,t)}async put(s,e,t){return this.requestWithRetry("PUT",s,e,t)}async patch(s,e,t){return this.requestWithRetry("PATCH",s,e,t)}async delete(s,e){return this.requestWithRetry("DELETE",s,void 0,e)}async upload(s,e,t){return this.requestWithRetry("POST",s,e,{...t,headers:{...t?.headers,"Content-Type":"multipart/form-data"}})}async downloadBlob(s,e){return(await this.instance.request({method:"GET",url:s,responseType:"blob",...e})).data}async downloadBlobWithFilename(s,e,t,r){const n=await this.instance.request({method:s,url:e,data:t,responseType:"blob",...r}),i=this.parseContentDispositionFilename(n.headers?.["content-disposition"]);return{blob:n.data,filename:i}}parseContentDispositionFilename(s){if(!s)return;const e=s.match(/filename\*=(?:UTF-8''|utf-8'')([^;\s]+)/i);if(e?.[1])return decodeURIComponent(e[1]);const t=s.match(/filename[^;=\n]*=\s*((['"]).*?\2|[^;\n]*)/);return t?.[1]?t[1].replace(/['"]/g,"").trim():void 0}async requestWithRetry(s,e,t,r,n=0){try{return(await this.instance.request({method:s,url:e,data:t,...r})).data}catch(a){const o=this.parseError(a);if(Z(o)&&n<this.maxRetries){const a=this.calculateRetryDelay(o,n);return await(i=a,new Promise((s=>setTimeout(s,i)))),this.requestWithRetry(s,e,t,r,n+1)}throw o}var i}calculateRetryDelay(s,e){return s instanceof j&&s.retryAfter?1e3*s.retryAfter:this.retryDelay*Math.pow(2,e)}parseError(e){if(e instanceof s.AxiosError){const s=e.config?.headers?.["x-request-id"];if(!e.response)return"ECONNABORTED"===e.code||"ETIMEDOUT"===e.code?new H("Request timed out",{code:q.TIMEOUT,requestId:s,cause:e}):"ERR_CANCELED"===e.code?new H("Request was cancelled",{code:q.NETWORK_ERROR,requestId:s,cause:e}):new H(e.message||"Network error occurred",{requestId:s,cause:e});const t=e.response.status,r=e.response.data,n=r?.message??e.message??"An error occurred",i=r?.code??q.UNKNOWN,a=r?.errors??[],o=r;switch(t){case 400:return i===q.VALIDATION_FAILED||a.length>0?new z(n,{errors:a,rawResponse:o,requestId:s,cause:e}):new G(n,i,400,{errors:a,rawResponse:o,requestId:s,cause:e});case 401:return new W(n,{errors:a,rawResponse:o,requestId:s,cause:e});case 402:return new Y(n,{quotaKey:r?.quotaKey,errors:a,rawResponse:o,requestId:s,cause:e});case 403:return r?.quotaKey?new Y(n,{quotaKey:r.quotaKey,errors:a,rawResponse:o,requestId:s,cause:e}):new K(n,{errors:a,rawResponse:o,requestId:s,cause:e});case 404:return new X(n,{errors:a,rawResponse:o,requestId:s,cause:e});case 409:return new Q(n,{errors:a,rawResponse:o,requestId:s,cause:e});case 429:{const t=function(s){if(!s)return;const e=Number(s);if(!Number.isNaN(e))return e;const t=Date.parse(s);return Number.isNaN(t)?void 0:Math.max(0,Math.floor((t-Date.now())/1e3))}(e.response.headers["retry-after"]);return new j(n,{retryAfter:t,errors:a,rawResponse:o,requestId:s,cause:e})}default:return new G(n,i,t,{errors:a,rawResponse:o,requestId:s,isRetryable:t>=500,cause:e})}}return new G(e instanceof Error?e.message:"Unknown error",q.UNKNOWN,0,{cause:e})}}const es="https://api.smartbills.io";var ts,rs,ns,is,as,os,cs,us,ls,hs,ps,Es,ds,bs,ys,_s,Rs,Us,gs,ms,Is,As,Ts,xs,Ns,Cs,Ds,Ss,vs;exports.TransactionType=void 0,(ts=exports.TransactionType||(exports.TransactionType={}))[ts.DOCUMENT=0]="DOCUMENT",ts[ts.BANK_TRANSACTION=1]="BANK_TRANSACTION",ts[ts.OCR_RECEIPT=2]="OCR_RECEIPT",ts[ts.OFFICIAL_RECEIPT=3]="OFFICIAL_RECEIPT",exports.CheckoutStatus=void 0,(rs=exports.CheckoutStatus||(exports.CheckoutStatus={}))[rs.NONE=0]="NONE",rs[rs.AWAITING_PAYMENT=1]="AWAITING_PAYMENT",rs[rs.PROCESSING=2]="PROCESSING",rs[rs.PAID=3]="PAID",rs[rs.FAILED=4]="FAILED",rs[rs.CANCELED=5]="CANCELED",rs[rs.REFUNDED=6]="REFUNDED",rs[rs.PARTIALLY_REFUNDED=7]="PARTIALLY_REFUNDED",rs[rs.DISPUTED=8]="DISPUTED",exports.CheckoutDocumentType=void 0,(ns=exports.CheckoutDocumentType||(exports.CheckoutDocumentType={}))[ns.RECEIPT=0]="RECEIPT",ns[ns.INVOICE=1]="INVOICE",exports.ReceiptPaymentStatus=void 0,(is=exports.ReceiptPaymentStatus||(exports.ReceiptPaymentStatus={}))[is.APPROVED=0]="APPROVED",is[is.PENDING=1]="PENDING",is[is.COMPLETED=2]="COMPLETED",is[is.CANCELLED=3]="CANCELLED",is[is.FAILED=4]="FAILED",is[is.PAID=5]="PAID",is[is.UNPAID=6]="UNPAID",is[is.OVERDUE=7]="OVERDUE",is[is.PROCESSING=8]="PROCESSING",is[is.REQUIRES_ACTION=9]="REQUIRES_ACTION",is[is.REFUNDED=10]="REFUNDED",is[is.PARTIALLY_REFUNDED=11]="PARTIALLY_REFUNDED",is[is.DISPUTED=12]="DISPUTED",exports.ReceiptPaymentType=void 0,(as=exports.ReceiptPaymentType||(exports.ReceiptPaymentType={}))[as.CARD=0]="CARD",as[as.CASH=1]="CASH",as[as.BANK_ACCOUNT=2]="BANK_ACCOUNT",as[as.EXTERNAL=3]="EXTERNAL",as[as.CREDITS=4]="CREDITS",as[as.GIFT_CARD=5]="GIFT_CARD",as[as.OTHER=6]="OTHER",exports.ReceiptType=void 0,(os=exports.ReceiptType||(exports.ReceiptType={}))[os.BANK_TRANSACTION=0]="BANK_TRANSACTION",os[os.OCR=1]="OCR",os[os.SMARTBILLS=2]="SMARTBILLS",exports.ReceiptSource=void 0,(cs=exports.ReceiptSource||(exports.ReceiptSource={}))[cs.MANUAL=0]="MANUAL",cs[cs.API=1]="API",cs[cs.IMPORT=2]="IMPORT",cs[cs.OCR=3]="OCR",cs[cs.EMAIL=4]="EMAIL",cs[cs.INTEGRATION=5]="INTEGRATION",exports.BillApprovalStatus=void 0,(us=exports.BillApprovalStatus||(exports.BillApprovalStatus={}))[us.PENDING=0]="PENDING",us[us.APPROVED=1]="APPROVED",us[us.REJECTED=2]="REJECTED",us[us.SKIPPED=3]="SKIPPED",us[us.NOT_REQUIRED=4]="NOT_REQUIRED",us[us.DELEGATED=5]="DELEGATED",us[us.IN_REVIEW=6]="IN_REVIEW",us[us.REQUESTED_CHANGES=7]="REQUESTED_CHANGES",exports.BillApprovalType=void 0,(ls=exports.BillApprovalType||(exports.BillApprovalType={}))[ls.REQUIRED=0]="REQUIRED",ls[ls.OPTIONAL=1]="OPTIONAL",ls[ls.INFORMATIONAL=2]="INFORMATIONAL",ls[ls.CONDITIONAL=3]="CONDITIONAL",ls[ls.MANAGER=4]="MANAGER",exports.BillStatus=void 0,(hs=exports.BillStatus||(exports.BillStatus={}))[hs.DRAFT=0]="DRAFT",hs[hs.PENDING_APPROVAL=1]="PENDING_APPROVAL",hs[hs.APPROVED=2]="APPROVED",hs[hs.SCHEDULED=3]="SCHEDULED",hs[hs.PAID=4]="PAID",hs[hs.CANCELLED=5]="CANCELLED",hs[hs.OVERDUE=6]="OVERDUE",hs[hs.PAYMENT_FAILED=7]="PAYMENT_FAILED",exports.MembershipRole=void 0,(ps=exports.MembershipRole||(exports.MembershipRole={}))[ps.ADMINISTRATOR=0]="ADMINISTRATOR",ps[ps.FINANCE_MANAGER=1]="FINANCE_MANAGER",ps[ps.ACCOUNTANT=2]="ACCOUNTANT",ps[ps.MANAGER=3]="MANAGER",ps[ps.EMPLOYEE=4]="EMPLOYEE",ps[ps.AUDITOR=5]="AUDITOR",ps[ps.APPROVER=6]="APPROVER",ps[ps.MEMBER=7]="MEMBER",ps[ps.FINANCE_TEAM=8]="FINANCE_TEAM",exports.ExpenseReportStatus=void 0,(Es=exports.ExpenseReportStatus||(exports.ExpenseReportStatus={}))[Es.DRAFT=0]="DRAFT",Es[Es.SUBMITTED=1]="SUBMITTED",Es[Es.APPROVED=2]="APPROVED",Es[Es.REJECTED=3]="REJECTED",Es[Es.REIMBURSED=4]="REIMBURSED",Es[Es.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",Es[Es.REQUIRES_CHANGES=6]="REQUIRES_CHANGES",exports.ExpenseItemStatus=void 0,(ds=exports.ExpenseItemStatus||(exports.ExpenseItemStatus={}))[ds.PENDING=0]="PENDING",ds[ds.APPROVED=1]="APPROVED",ds[ds.REJECTED=2]="REJECTED",ds[ds.PARTIALLY_APPROVED=3]="PARTIALLY_APPROVED",ds[ds.REIMBURSED=4]="REIMBURSED",ds[ds.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",ds[ds.REQUIRES_CHANGES=6]="REQUIRES_CHANGES",exports.ExpenseReportAuditLogAction=void 0,(bs=exports.ExpenseReportAuditLogAction||(exports.ExpenseReportAuditLogAction={}))[bs.CREATED=0]="CREATED",bs[bs.UPDATED=1]="UPDATED",bs[bs.SUBMITTED=2]="SUBMITTED",bs[bs.APPROVED=3]="APPROVED",bs[bs.REJECTED=4]="REJECTED",bs[bs.REQUESTED_CHANGES=5]="REQUESTED_CHANGES",bs[bs.RECALL=6]="RECALL",bs[bs.REIMBURSED=7]="REIMBURSED",bs[bs.PARTIAL_REIMBURSEMENT=8]="PARTIAL_REIMBURSEMENT",bs[bs.PLANNED_REIMBURSEMENT=9]="PLANNED_REIMBURSEMENT",bs[bs.EXPENSE_ADDED=10]="EXPENSE_ADDED",bs[bs.EXPENSE_REMOVED=11]="EXPENSE_REMOVED",bs[bs.EXPENSE_EDITED=12]="EXPENSE_EDITED",bs[bs.COMMENT_ADDED=13]="COMMENT_ADDED",bs[bs.ASSIGNED_LEDGER_ACCOUNT=14]="ASSIGNED_LEDGER_ACCOUNT",bs[bs.ASSIGNED_EXPENSE_LEDGER_ACCOUNT=15]="ASSIGNED_EXPENSE_LEDGER_ACCOUNT",bs[bs.REVERTED_TO_REVIEW=16]="REVERTED_TO_REVIEW",exports.VendorConnectionStatus=void 0,(ys=exports.VendorConnectionStatus||(exports.VendorConnectionStatus={}))[ys.NOT_CONNECTED=0]="NOT_CONNECTED",ys[ys.NEW=1]="NEW",ys[ys.CONNECTING=2]="CONNECTING",ys[ys.CONNECTED=3]="CONNECTED",ys[ys.INVALID_CREDENTIALS=4]="INVALID_CREDENTIALS",ys[ys.ERROR=5]="ERROR",ys[ys.MFA_METHOD_CHOICE=6]="MFA_METHOD_CHOICE",ys[ys.MFA_QUESTION=7]="MFA_QUESTION",ys[ys.MFA_QUESTION_INVALID_ANSWER=8]="MFA_QUESTION_INVALID_ANSWER",ys[ys.MFA_QUESTION_NO_ANSWER=9]="MFA_QUESTION_NO_ANSWER",ys[ys.CAPTCHA=10]="CAPTCHA",ys[ys.SECURITY_QUESTION=11]="SECURITY_QUESTION",ys[ys.ACCOUNT_SELECTION=12]="ACCOUNT_SELECTION",ys[ys.DISCONNECTED=13]="DISCONNECTED",exports.ConnectAccountStatus=void 0,(_s=exports.ConnectAccountStatus||(exports.ConnectAccountStatus={}))[_s.PENDING=0]="PENDING",_s[_s.ONBOARDING=1]="ONBOARDING",_s[_s.ACTIVE=2]="ACTIVE",_s[_s.RESTRICTED=3]="RESTRICTED",_s[_s.DISABLED=4]="DISABLED",exports.CheckoutPaymentStatus=void 0,(Rs=exports.CheckoutPaymentStatus||(exports.CheckoutPaymentStatus={}))[Rs.PENDING=0]="PENDING",Rs[Rs.PROCESSING=1]="PROCESSING",Rs[Rs.SUCCEEDED=2]="SUCCEEDED",Rs[Rs.FAILED=3]="FAILED",Rs[Rs.CANCELED=4]="CANCELED",Rs[Rs.REQUIRES_ACTION=5]="REQUIRES_ACTION",Rs[Rs.REFUNDED=6]="REFUNDED",Rs[Rs.PARTIALLY_REFUNDED=7]="PARTIALLY_REFUNDED",Rs[Rs.DISPUTED=8]="DISPUTED",exports.NotificationType=void 0,(Us=exports.NotificationType||(exports.NotificationType={}))[Us.GENERAL=0]="GENERAL",Us[Us.EXPENSE_REPORT_SUBMITTED=1]="EXPENSE_REPORT_SUBMITTED",Us[Us.EXPENSE_REPORT_APPROVED=2]="EXPENSE_REPORT_APPROVED",Us[Us.EXPENSE_REPORT_REJECTED=3]="EXPENSE_REPORT_REJECTED",Us[Us.EXPENSE_REPORT_REIMBURSED=4]="EXPENSE_REPORT_REIMBURSED",Us[Us.EXPENSE_REPORT_CHANGES_REQUESTED=5]="EXPENSE_REPORT_CHANGES_REQUESTED",Us[Us.EXPENSE_REPORT_COMMENT=6]="EXPENSE_REPORT_COMMENT",Us[Us.INVITATION_RECEIVED=7]="INVITATION_RECEIVED",Us[Us.INVITATION_ACCEPTED=8]="INVITATION_ACCEPTED",Us[Us.BILL_SUBMITTED=9]="BILL_SUBMITTED",Us[Us.BILL_APPROVED=10]="BILL_APPROVED",Us[Us.BILL_PAID=11]="BILL_PAID",Us[Us.BILL_OVERDUE=12]="BILL_OVERDUE",exports.EmailAccountType=void 0,(gs=exports.EmailAccountType||(exports.EmailAccountType={}))[gs.GMAIL=0]="GMAIL",gs[gs.OUTLOOK=1]="OUTLOOK",gs[gs.IMAP=2]="IMAP",exports.EmailAccountStatus=void 0,(ms=exports.EmailAccountStatus||(exports.EmailAccountStatus={}))[ms.ACTIVE=0]="ACTIVE",ms[ms.INACTIVE=1]="INACTIVE",ms[ms.ERROR=2]="ERROR",ms[ms.DISCONNECTED=3]="DISCONNECTED",exports.EmailAccountSyncStatus=void 0,(Is=exports.EmailAccountSyncStatus||(exports.EmailAccountSyncStatus={}))[Is.IDLE=0]="IDLE",Is[Is.SYNCING=1]="SYNCING",Is[Is.ERROR=2]="ERROR",exports.SyncTriggerType=void 0,(As=exports.SyncTriggerType||(exports.SyncTriggerType={}))[As.MANUAL=0]="MANUAL",As[As.SCHEDULED=1]="SCHEDULED",As[As.WEBHOOK=2]="WEBHOOK",exports.MailboxType=void 0,(Ts=exports.MailboxType||(exports.MailboxType={}))[Ts.INBOX=0]="INBOX",Ts[Ts.SENT=1]="SENT",Ts[Ts.DRAFTS=2]="DRAFTS",Ts[Ts.TRASH=3]="TRASH",Ts[Ts.SPAM=4]="SPAM",Ts[Ts.CUSTOM=5]="CUSTOM",exports.InvitationStatus=void 0,(xs=exports.InvitationStatus||(exports.InvitationStatus={}))[xs.PENDING=0]="PENDING",xs[xs.ACCEPTED=1]="ACCEPTED",xs[xs.REFUSED=2]="REFUSED",xs[xs.EXPIRED=3]="EXPIRED",xs[xs.CANCELLED=4]="CANCELLED",exports.IntegrationStatus=void 0,(Ns=exports.IntegrationStatus||(exports.IntegrationStatus={}))[Ns.ACTIVE=0]="ACTIVE",Ns[Ns.INACTIVE=1]="INACTIVE",Ns[Ns.ERROR=2]="ERROR",Ns[Ns.PENDING=3]="PENDING",exports.AppInstallationStatus=void 0,(Cs=exports.AppInstallationStatus||(exports.AppInstallationStatus={}))[Cs.PENDING=0]="PENDING",Cs[Cs.INSTALLING=1]="INSTALLING",Cs[Cs.ACTIVE=2]="ACTIVE",Cs[Cs.FAILED=3]="FAILED",Cs[Cs.UNINSTALLED=4]="UNINSTALLED",exports.WorkflowTriggerType=void 0,(Ds=exports.WorkflowTriggerType||(exports.WorkflowTriggerType={}))[Ds.EXPENSE_REPORT_SUBMITTED=0]="EXPENSE_REPORT_SUBMITTED",Ds[Ds.EXPENSE_REPORT_APPROVED=1]="EXPENSE_REPORT_APPROVED",Ds[Ds.RECEIPT_UPLOADED=2]="RECEIPT_UPLOADED",Ds[Ds.BILL_CREATED=3]="BILL_CREATED",Ds[Ds.BILL_APPROVED=4]="BILL_APPROVED",exports.PayerType=void 0,(Ss=exports.PayerType||(exports.PayerType={}))[Ss.PERSONAL=0]="PERSONAL",Ss[Ss.BUSINESS=1]="BUSINESS",exports.ExpenseSplitType=void 0,(vs=exports.ExpenseSplitType||(exports.ExpenseSplitType={}))[vs.EQUAL=0]="EQUAL",vs[vs.BY_PERCENTAGE=1]="BY_PERCENTAGE",vs[vs.BY_LINE_ITEM=2]="BY_LINE_ITEM",exports.AccessToken=class{constructor(s){this.token=s}getAccessToken(){return this.token}setToken(s){this.token=s}},exports.AppInstallationService=t,exports.ApprobationService=r,exports.AttachmentService=B,exports.AuthorizedSenderService=k,exports.BaseService=e,exports.BillService=i,exports.BillingService=n,exports.BusinessService=a,exports.BusinessUserService=o,exports.CategoryService=w,exports.CheckoutService=c,exports.ConnectService=u,exports.CustomerService=v,exports.DEFAULT_BASE_URL=es,exports.DepartmentService=O,exports.EmailAccountService=l,exports.EmailForwardingService=M,exports.EmployeeService=L,exports.ErrorCode=q,exports.ExpenseJobService=h,exports.ExpenseReportExpenseService=p,exports.ExpenseReportPaymentService=E,exports.ExpenseReportService=d,exports.ExpenseService=b,exports.HttpClient=ss,exports.IntegrationService=y,exports.InvitationService=_,exports.LocationService=R,exports.LoyaltyService=F,exports.MembershipService=U,exports.NotificationService=g,exports.PaymentMethodService=m,exports.ProductService=P,exports.PromoCodeService=f,exports.ReceiptService=I,exports.ReportingService=A,exports.SmartbillsApiError=G,exports.SmartbillsAuthenticationError=W,exports.SmartbillsClient=class{constructor(s){this.http=new ss({baseUrl:s?.baseUrl??es,timeout:s?.timeout,maxRetries:s?.maxRetries,retryDelay:s?.retryDelay}),s?.accessToken&&this.http.setAccessToken(s.accessToken),s?.businessId&&this.http.setBusinessId(s.businessId),s?.locale&&this.http.setLocale(s.locale),this.users=new N(this.http),this.businesses=new a(this.http),this.businessUsers=new o(this.http),this.invitations=new _(this.http),this.memberships=new U(this.http),this.receipts=new I(this.http),this.bills=new i(this.http),this.transactions=new x(this.http),this.expenses=new b(this.http),this.expenseReports=new d(this.http),this.expenseReportExpenses=new p(this.http),this.expenseReportPayments=new E(this.http),this.expenseJobs=new h(this.http),this.approbations=new r(this.http),this.vendors=new D(this.http),this.vendorConnections=new C(this.http),this.notifications=new g(this.http),this.paymentMethods=new m(this.http),this.integrations=new y(this.http),this.appInstallations=new t(this.http),this.emailAccounts=new l(this.http),this.reports=new A(this.http),this.checkout=new c(this.http),this.connect=new u(this.http),this.locations=new R(this.http),this.tables=new T(this.http),this.billing=new n(this.http),this.workflows=new S(this.http),this.customers=new v(this.http),this.departments=new O(this.http),this.products=new P(this.http),this.taxes=new $(this.http),this.promoCodes=new f(this.http),this.categories=new w(this.http),this.employees=new L(this.http),this.attachments=new B(this.http),this.emailForwarding=new M(this.http),this.authorizedSenders=new k(this.http),this.loyalty=new F(this.http)}setAccessToken(s){this.http.setAccessToken(s)}setBusinessId(s){this.http.setBusinessId(s)}setLocale(s){this.http.setLocale(s)}get accessToken(){return this.http.defaults.accessToken}get businessId(){return this.http.defaults.businessId}get locale(){return this.http.defaults.locale}},exports.SmartbillsConflictError=Q,exports.SmartbillsError=V,exports.SmartbillsNetworkError=H,exports.SmartbillsNotFoundError=X,exports.SmartbillsPermissionError=K,exports.SmartbillsQuotaError=Y,exports.SmartbillsRateLimitError=j,exports.SmartbillsValidationError=z,exports.TableService=T,exports.TaxService=$,exports.TransactionService=x,exports.UserService=N,exports.VendorConnectionService=C,exports.VendorService=D,exports.WorkflowService=S,exports.isApiError=function(s){return s instanceof G},exports.isAuthenticationError=function(s){return s instanceof W},exports.isConflictError=function(s){return s instanceof Q},exports.isNetworkError=function(s){return s instanceof H},exports.isNotFoundError=function(s){return s instanceof X},exports.isPermissionError=function(s){return s instanceof K},exports.isQuotaError=function(s){return s instanceof Y},exports.isRateLimitError=function(s){return s instanceof j},exports.isRetryableError=Z,exports.isSmartbillsError=J,exports.isValidationError=function(s){return s instanceof z};
|
|
1
|
+
"use strict";var s=require("axios");class e{constructor(s){this.http=s}resolveBusinessId(s){return s?.businessId??this.http.defaults.businessId}buildConfig(s){const e={};s?.locale&&(e["Accept-Language"]=s.locale);const t=this.resolveBusinessId(s);return t&&(e["x-tenant-id"]=String(t)),{headers:e,signal:s?.signal}}_list(s,e,t){return this.http.get(s,{...this.buildConfig(t),params:e})}_get(s,e){return this.http.get(s,this.buildConfig(e))}_getWithParams(s,e,t){return this.http.get(s,{...this.buildConfig(t),params:e})}_create(s,e,t){return this.http.post(s,e,this.buildConfig(t))}_update(s,e,t){return this.http.put(s,e,this.buildConfig(t))}_patch(s,e,t){return this.http.patch(s,e,this.buildConfig(t))}_delete(s,e){return this.http.delete(s,this.buildConfig(e))}_upload(s,e,t){return this.http.upload(s,e,this.buildConfig(t))}_download(s,e){return this.http.downloadBlob(s,this.buildConfig(e))}_downloadWithFilename(s,e,t,n){return this.http.downloadBlobWithFilename(s,e,t,this.buildConfig(n))}businessUrl(s,e){const t=this.resolveBusinessId(e);if(!t)throw new Error("businessId is required for this operation");return`/v1/businesses/${t}${s}`}}class t extends e{async list(s){const e=this.businessUrl("/app-installations",s);return this.http.get(e,this.buildConfig(s))}async getById(s,e){const t=this.businessUrl(`/app-installations/${s}`,e);return this._get(t,e)}async getSessionToken(s,e){const t=this.businessUrl(`/app-installations/${s}/session`,e);return this._create(t,{},e)}async delete(s,e){const t=this.businessUrl(`/app-installations/${s}`,e);await this._delete(t,e)}}class n extends e{async listPending(s,e){const t=this.businessUrl("/approbations/pending",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listApproved(s,e){const t=this.businessUrl("/approbations/approved",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listRejected(s,e){const t=this.businessUrl("/approbations/rejected",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listReimbursed(s,e){const t=this.businessUrl("/approbations/reimbursed",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listRequiresChanges(s,e){const t=this.businessUrl("/approbations/requires-changes",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPendingReimbursement(s,e){const t=this.businessUrl("/approbations/pending-reimbursement",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e,t){const n=this.businessUrl(`/approbations/${s}`,t);return this._getWithParams(n,e,t)}async approve(s,e,t){const n=this.businessUrl(`/approbations/${s}/approve`,t);return this._create(n,e??{},t)}async reject(s,e,t){const n=this.businessUrl(`/approbations/${s}/reject`,t);return this._create(n,e??{},t)}async requestChanges(s,e,t){const n=this.businessUrl(`/approbations/${s}/request-changes`,t);return this._create(n,e??{},t)}async reimburse(s,e,t){const n=this.businessUrl(`/approbations/${s}/reimburse`,t);return this._create(n,e??{},t)}async planReimbursement(s,e,t){const n=this.businessUrl(`/approbations/${s}/plan-reimbursement`,t);return this._create(n,e,t)}async markReimbursed(s,e,t){const n=this.businessUrl(`/approbations/${s}/mark-reimbursed`,t);return this._create(n,e??{},t)}async revertToReview(s,e,t){const n=this.businessUrl(`/approbations/${s}/revert-to-review`,t);return this._create(n,e??{},t)}async cancelRequiredChanges(s,e,t){const n=this.businessUrl(`/approbations/${s}/cancel-required-changes`,t);return this._create(n,e??{},t)}async getTimeline(s,e){const t=this.businessUrl(`/approbations/${s}/timeline`,e);return this._get(t,e)}async addComment(s,e,t){const n=this.businessUrl(`/approbations/${s}/comments`,t);return this._create(n,e,t)}async getSummary(s){const e=this.businessUrl("/approbations/summary",s);return this._get(e,s)}async exportCsv(s,e,t){const n=this.businessUrl(`/approbations/${s}/export/csv`,t);return this.http.post(n,{},{...this.buildConfig(t),params:{locale:e},responseType:"blob"})}async exportBulkCsv(s,e){const t=this.businessUrl("/approbations/export/csv",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async downloadAttachmentsPdf(s,e){const t=this.businessUrl(`/approbations/${s}/attachments/pdf`,e);return this._download(t,e)}async downloadAttachmentsZip(s,e){const t=this.businessUrl(`/approbations/${s}/attachments/zip`,e);return this._download(t,e)}async updateExpense(s,e,t,n){const r=this.businessUrl(`/approbations/${s}/expenses/${e}`,n);return this._update(r,t,n)}async resetExpenseReview(s,e,t){const n=this.businessUrl(`/approbations/${s}/expenses/${e}/reset-review`,t);return this._create(n,{},t)}async saveExpenseReview(s,e,t){const n=this.businessUrl(`/approbations/${s}/approve`,t);return this._create(n,{...e,saveExpenseReviewOnly:!0},t)}async bulkApprove(s,e){const t=this.businessUrl("/approbations/bulk/approve",e);return this._create(t,s,e)}async bulkReject(s,e){const t=this.businessUrl("/approbations/bulk/reject",e);return this._create(t,s,e)}async bulkRequestChanges(s,e){const t=this.businessUrl("/approbations/bulk/request-changes",e);return this._create(t,s,e)}async bulkMarkReimbursed(s,e){const t=this.businessUrl("/approbations/bulk/mark-reimbursed",e);return this._create(t,s,e)}async bulkPlanReimbursement(s,e){const t=this.businessUrl("/approbations/bulk/plan-reimbursement",e);return this._create(t,s,e)}async bulkRevertToReview(s,e){const t=this.businessUrl("/approbations/bulk/revert-to-review",e);return this._create(t,s,e)}}class r extends e{async getSubscription(s){return this._get(this.businessUrl("/billing/subscription",s),s)}async upgradeSubscription(s,e){return this._create(this.businessUrl("/billing/subscription/upgrade",e),s,e)}async previewPlanChange(s,e){return this._create(this.businessUrl("/billing/subscription/preview-plan-change",e),s,e)}async cancelSubscription(s){return this._create(this.businessUrl("/billing/subscription/cancel",s),{},s)}async getPlans(s){return this._get(this.businessUrl("/billing/subscription/plans",s),s)}async startTrial(s,e){return this._create(this.businessUrl("/billing/subscription/trial",e),s,e)}async activateFreeTier(s){return this._create(this.businessUrl("/billing/subscription/free",s),{},s)}async validateDowngrade(s,e){return this._create(this.businessUrl("/billing/subscription/validate-downgrade",e),s,e)}async listInvoices(s,e){return this._list(this.businessUrl("/billing/invoices",e),s,e)}async getInvoice(s,e){return this._get(this.businessUrl(`/billing/invoices/${s}`,e),e)}async getUpcomingInvoice(s){return this._get(this.businessUrl("/billing/invoices/upcoming",s),s)}async getUsage(s){return this._get(this.businessUrl("/billing/usage",s),s)}async getUsageHistory(s,e){return this._list(this.businessUrl("/billing/usage/history",e),s,e)}async getUsageByKey(s,e){return this._get(this.businessUrl(`/billing/usage/${s}`,e),e)}async createPortalSession(s,e){return this._create(this.businessUrl("/billing/portal",e),s??{},e)}async getPaymentMethods(s){return this._get(this.businessUrl("/billing/payment-methods",s),s)}async createSetupIntent(s){return this._create(this.businessUrl("/billing/payment-methods/setup-intent",s),{},s)}async detachPaymentMethod(s,e){return this._delete(this.businessUrl(`/billing/payment-methods/${s}`,e),e)}async setDefaultPaymentMethod(s,e){return this._create(this.businessUrl(`/billing/payment-methods/${s}/default`,e),{},e)}}class i extends e{async list(s,e){const t=this.businessUrl("/bills",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPersonal(s,e){return this.http.get("/v1/bills",{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/bills/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/bills",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/bills/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/bills/${s}`,e);await this._delete(t,e)}async batchCreate(s,e){const t=this.businessUrl("/bills/batch",e);return this._create(t,s,e)}async batchUpdate(s,e){const t=this.businessUrl("/bills/batch",e);return this._update(t,s,e)}async upload(s,e){const t=this.businessUrl("/bills/upload",e);return this.http.upload(t,s,this.buildConfig(e))}async getStatusSummary(s){const e=this.businessUrl("/bills/status-summary",s);return this._get(e,s)}async getHistory(s,e){const t=this.businessUrl(`/bills/${s}/history`,e);return this._get(t,e)}async getAllowedTransitions(s,e){const t=this.businessUrl(`/bills/${s}/allowed-transitions`,e);return this._get(t,e)}async submitForApproval(s,e,t){const n=this.businessUrl(`/bills/${s}/submit-for-approval`,t);return this._create(n,e??{},t)}async approve(s,e,t){const n=this.businessUrl(`/bills/${s}/approve`,t);return this._create(n,e??{},t)}async schedulePayment(s,e,t){const n=this.businessUrl(`/bills/${s}/schedule-payment`,t);return this._create(n,e,t)}async markPaid(s,e,t){const n=this.businessUrl(`/bills/${s}/mark-paid`,t);return this._create(n,e??{},t)}async cancel(s,e,t){const n=this.businessUrl(`/bills/${s}/cancel`,t);return this._create(n,e??{},t)}async revertToDraft(s,e,t){const n=this.businessUrl(`/bills/${s}/revert-to-draft`,t);return this._create(n,e??{},t)}async reschedulePayment(s,e,t){const n=this.businessUrl(`/bills/${s}/reschedule-payment`,t);return this._create(n,e,t)}async retryPayment(s,e,t){const n=this.businessUrl(`/bills/${s}/retry-payment`,t);return this._create(n,e??{},t)}async bulkApprove(s,e){const t=this.businessUrl("/bills/bulk/approve",e);return this._create(t,s,e)}async bulkMarkPaid(s,e){const t=this.businessUrl("/bills/bulk/mark-paid",e);return this._create(t,s,e)}async bulkSchedulePayment(s,e){const t=this.businessUrl("/bills/bulk/schedule-payment",e);return this._create(t,s,e)}async bulkUnschedule(s,e){const t=this.businessUrl("/bills/bulk/unschedule",e);return this._create(t,s,e)}async bulkCancelPayment(s,e){const t=this.businessUrl("/bills/bulk/cancel-payment",e);return this._create(t,s,e)}async bulkDelete(s,e){const t=this.businessUrl("/bills/bulk/delete",e);return this._create(t,s,e)}async bulkRetryPayment(s,e){const t=this.businessUrl("/bills/bulk/retry-payment",e);return this._create(t,s,e)}async bulkRemind(s,e){const t=this.businessUrl("/bills/bulk/remind",e);return this._create(t,s,e)}async bulkUpdate(s,e){const t=this.businessUrl("/bills/bulk/update",e);return this._create(t,s,e)}async export(s,e){const t=this.businessUrl("/bills/export",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async downloadAttachments(s,e){const t=this.businessUrl("/bills/attachments/download",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async validate(s,e){const t=this.businessUrl("/bills/validate",e);return this.http.upload(t,s,this.buildConfig(e))}}class a extends e{async list(s,e){return this.http.get("/v1/businesses",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/businesses/${s}`,e)}async create(s,e){return this._create("/v1/businesses",s,e)}async update(s,e,t){return this._update(`/v1/businesses/${s}`,e,t)}async delete(s,e){await this._delete(`/v1/businesses/${s}`,e)}async count(s){return this._get("/v1/businesses/count",s)}async createBrand(s,e,t){const n=new FormData;return e.logo&&n.append("logo",e.logo),e.coverImage&&n.append("coverImage",e.coverImage),e.primaryColor&&n.append("primaryColor",e.primaryColor),e.secondaryColor&&n.append("secondaryColor",e.secondaryColor),this._upload(`/v1/businesses/${s}/brand`,n,t)}async uploadLogo(s,e,t){const n=new FormData;return n.append("file",e),this._upload(`/v1/businesses/${s}/logo`,n,t)}async getBrand(s,e){return this._get(`/v1/businesses/${s}/brand`,e)}async updateBrand(s,e,t){return this._update(`/v1/businesses/${s}/brand`,e,t)}async uploadBrandLogo(s,e,t){const n=new FormData;return n.append("file",e),this._upload(`/v1/businesses/${s}/brand/logo`,n,t)}async uploadBrandIcon(s,e,t){const n=new FormData;return n.append("file",e),this._upload(`/v1/businesses/${s}/brand/icon`,n,t)}async uploadBrandCover(s,e,t){const n=new FormData;return n.append("file",e),this._upload(`/v1/businesses/${s}/brand/cover`,n,t)}async batchCreate(s,e){return this._create("/v1/businesses/batch",s,e)}async batchUpdate(s,e){return this._update("/v1/businesses/batch",s,e)}async getPlan(s,e){return this._get(`/v1/businesses/${s}/plan`,e)}}class o extends e{async list(s,e){const t=this.businessUrl("/users",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/users/${s}`,e);return this._get(t,e)}async add(s,e){const t=this.businessUrl("/users",e);return this._create(t,s,e)}async remove(s,e){const t=this.businessUrl(`/users/${s}`,e);return this._delete(t,e)}async updateRole(s,e,t){const n=this.businessUrl(`/users/${s}/role`,t);return this._update(n,e,t)}async invite(s,e){const t=this.businessUrl("/users/invite",e);return this._create(t,s,e)}async reinvite(s,e){const t=this.businessUrl(`/users/${s}/invite`,e);return this._create(t,{},e)}async validateEmail(s,e){const t=this.businessUrl("/users/validate",e);return this.http.get(t,{...this.buildConfig(e),params:{email:s}})}async setInactive(s,e){const t=this.businessUrl(`/users/${s}/status`,e);return this._update(t,{isActive:!1},e)}}class c extends e{async createPaymentIntent(s,e){return this._create("/v1/checkout/pay",s,e)}async getTransaction(s,e){return this._get(`/v1/checkout/SBTransactions/${s}`,e)}async listPayments(s,e){const t=this.businessUrl("/checkout/payments",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getPayment(s,e){const t=this.businessUrl(`/checkout/payments/${s}`,e);return this._get(t,e)}async refund(s,e,t){const n=this.businessUrl(`/checkout/payments/${s}/refund`,t);return this._create(n,e??{},t)}async getLedger(s){const e=this.businessUrl("/checkout/ledger",s);return this._get(e,s)}}class u extends e{async getAccount(s){const e=this.businessUrl("/connect/account",s);return this._get(e,s)}async onboard(s,e){const t=this.businessUrl("/connect/onboard",e);return this._create(t,s,e)}async getDashboardLink(s){const e=this.businessUrl("/connect/dashboard",s);return this._get(e,s)}}class l extends e{async list(s,e){const t=this.businessUrl("/email-accounts",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/email-accounts/${s}`,e);return this._get(t,e)}async authorize(s,e){const t=this.businessUrl("/email-accounts/authorize",e);return this._create(t,s,e)}async callback(s,e){const t=this.businessUrl("/email-accounts/callback",e);return this._create(t,s,e)}async createImap(s,e){const t=this.businessUrl("/email-accounts/imap",e);return this._create(t,s,e)}async delete(s,e){const t=this.businessUrl(`/email-accounts/${s}`,e);await this._delete(t,e)}async update(s,e,t){const n=this.businessUrl(`/email-accounts/${s}`,t);return this._update(n,e,t)}async sync(s,e){const t=this.businessUrl(`/email-accounts/${s}/sync`,e);await this._create(t,{},e)}async reconnect(s,e,t){const n=this.businessUrl(`/email-accounts/${s}/reconnect`,t);return this._create(n,e??{},t)}async enable(s,e){const t=this.businessUrl(`/email-accounts/${s}/enable`,e);return this._create(t,{},e)}async disable(s,e){const t=this.businessUrl(`/email-accounts/${s}/disable`,e);return this._create(t,{},e)}async historicalSync(s,e,t){const n=this.businessUrl(`/email-accounts/${s}/historical-sync`,t);await this._create(n,e,t)}async getMailboxes(s,e){const t=this.businessUrl(`/email-accounts/${s}/mailboxes`,e);return this._get(t,e)}async updateMailbox(s,e,t,n){const r=this.businessUrl(`/email-accounts/${s}/mailboxes/${e}`,n);return this._update(r,t,n)}async getSyncSessions(s,e,t){const n=this.businessUrl(`/email-accounts/${s}/sync-sessions`,t);return this.http.get(n,{...this.buildConfig(t),params:e})}async authorizeWithParams(s,e){const t=this.businessUrl("/email-accounts/authorize",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async validateSharedMailbox(s,e,t){const n=this.businessUrl(`/email-accounts/${s}/shared-mailboxes/validate`,t);return this._create(n,{email:e},t)}async addSharedMailbox(s,e,t){const n=this.businessUrl(`/email-accounts/${s}/shared-mailboxes`,t);return this._create(n,{email:e},t)}async removeSharedMailbox(s,e,t){const n=this.businessUrl(`/email-accounts/${s}/shared-mailboxes/${encodeURIComponent(e)}`,t);await this._delete(n,t)}}class h extends e{async list(s,e){const t=this.businessUrl("/expenses/processing",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPersonal(s,e){return this.http.get("/v1/expenses/processing",{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/expenses/processing/${s}`,e);return this._get(t,e)}async listForEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/processing`,t);return this.http.get(n,{...this.buildConfig(t),params:e})}async getEmployeeJobById(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/processing/${e}`,t);return this._get(n,t)}async retryEmployeeJob(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/processing/${e}/retry`,t);await this._create(n,{},t)}async listByExpenseReport(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/jobs`,t);return this.http.get(n,{...this.buildConfig(t),params:e})}}class p extends e{async add(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/expenses`,t);return this._create(n,e,t)}async addBatch(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/expenses/batch`,t);return this._create(n,e,t)}async remove(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/expenses/${e}`,t);await this._delete(n,t)}async edit(s,e,t,n){const r=this.businessUrl(`/expense-reports/${s}/expenses/${e}`,n);return this._update(r,t,n)}async bulkAssignCategory(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/expenses/bulk/category`,t);return this._update(n,e,t)}async bulkRemove(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/expenses/bulk`,t);return this.http.delete(n,{...this.buildConfig(t),data:e})}async addForEmployee(s,e,t,n){const r=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses`,n);return this._create(r,t,n)}async addBatchForEmployee(s,e,t,n){const r=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses/batch`,n);return this._create(r,t,n)}async removeForEmployee(s,e,t,n){const r=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses/${t}`,n);await this._delete(r,n)}async editForEmployee(s,e,t,n,r){const i=this.businessUrl(`/employees/${s}/expense-reports/${e}/expenses/${t}`,r);return this._update(i,n,r)}async replace(s,e,t,n){const r=this.businessUrl(`/expense-reports/${s}/expenses/${e}/replace`,n);return this._create(r,t,n)}}class d extends e{async reimburse(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/payments/reimburse`,t);return this._create(n,e??{},t)}async partialReimburse(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/payments/partial-reimburse`,t);return this._create(n,e,t)}async planReimbursement(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/payments/plan-reimbursement`,t);return this._create(n,e,t)}}class E extends e{async list(s,e){const t=this.businessUrl("/expense-reports",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listForEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expense-reports`,t);return this.http.get(n,{...this.buildConfig(t),params:e})}async getByIdForEmployee(s,e,t,n){const r=this.businessUrl(`/employees/${s}/expense-reports/${e}`,n);return this._getWithParams(r,t,n)}async getById(s,e,t){const n=this.businessUrl(`/expense-reports/${s}`,t);return this._getWithParams(n,e,t)}async getMine(s,e){const t=this.businessUrl("/expense-reports/me",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async create(s,e){const t=this.businessUrl("/expense-reports",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/expense-reports/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/expense-reports/${s}`,e);await this._delete(t,e)}async submit(s,e){const t=this.businessUrl(`/expense-reports/${s}/submit`,e);return this._create(t,{},e)}async recall(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/recall`,t);return this._create(n,e??{},t)}async approve(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/approve`,t);return this._create(n,e??{},t)}async reject(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/reject`,t);return this._create(n,e??{},t)}async requestChanges(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/request-changes`,t);return this._create(n,e??{},t)}async reimburse(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/reimburse`,t);return this._create(n,e??{},t)}async planReimbursement(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/plan-reimbursement`,t);return this._create(n,e,t)}async addComment(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/comments`,t);return this._create(n,e,t)}async getTimeline(s,e){const t=this.businessUrl(`/expense-reports/${s}/timeline`,e);return this._get(t,e)}async getAuditLog(s,e){const t=this.businessUrl(`/expense-reports/${s}/audit-log`,e);return this._get(t,e)}async assignLedgerAccount(s,e,t){const n=this.businessUrl(`/expense-reports/${s}/ledger-account`,t);return this._update(n,e,t)}async assignExpenseLedgerAccount(s,e,t,n){const r=this.businessUrl(`/expense-reports/${s}/expenses/${e}/ledger-account`,n);return this._update(r,t,n)}async getSummary(s){const e=this.businessUrl("/expense-reports/summary",s);return this._get(e,s)}async getPendingApprovals(s){const e=this.businessUrl("/expense-reports/pending-approvals",s);return this._get(e,s)}async bulkDelete(s,e){const t=this.businessUrl("/expense-reports/bulk",e);return this.http.delete(t,{...this.buildConfig(e),data:s})}async bulkSubmit(s,e){const t=this.businessUrl("/expense-reports/bulk/submit",e);return this._create(t,s,e)}async bulkRecall(s,e){const t=this.businessUrl("/expense-reports/bulk/recall",e);return this._create(t,s,e)}async export(s,e){const t=this.businessUrl("/expense-reports/export",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}}class y extends e{async listBusiness(s,e){const t=this.businessUrl("/expenses",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses`,t);return this.http.get(n,{...this.buildConfig(t),params:e})}async listMy(s,e){return this.http.get("/v1/me/expenses",{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/expenses/${s}`,e);return this._get(t,e)}async createForEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses`,t);return this._create(n,e,t)}async attachReceipt(s,e,t,n){const r=this.businessUrl(`/employees/${s}/expenses/${e}/attachments`,n);return this._create(r,{attachmentId:t},n)}async update(s,e,t){const n=this.businessUrl(`/expenses/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/expenses/${s}`,e);await this._delete(t,e)}async deleteEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/${e}`,t);await this._delete(n,t)}async updateCategory(s,e,t){const n=this.businessUrl(`/expenses/${s}/category`,t);return this._update(n,e,t)}async updateNote(s,e,t){const n=this.businessUrl(`/expenses/${s}/note`,t);return this._update(n,e,t)}async updatePayerType(s,e,t){const n=this.businessUrl(`/expenses/${s}/payer-type`,t);return this._update(n,e,t)}async updateReport(s,e,t){const n=this.businessUrl(`/expenses/${s}/report`,t);return this._update(n,e,t)}async setReport(s,e,t){const n=this.businessUrl(`/expenses/${s}/expense-report`,t);return this._create(n,e,t)}async uploadBusiness(s,e){const t=this.businessUrl("/expenses/upload",e);return this.http.upload(t,s,this.buildConfig(e))}async uploadEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/upload`,t);return this.http.upload(n,e,this.buildConfig(t))}async uploadMy(s,e){return this.http.upload("/v1/me/expenses/upload",s,this.buildConfig(e))}async validateBusiness(s,e){const t=this.businessUrl("/expenses/validate",e);return this.http.upload(t,s,this.buildConfig(e))}async validateEmployee(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/validate`,t);return this.http.upload(n,e,this.buildConfig(t))}async bulkAssignCategory(s,e){const t=this.businessUrl("/expenses/bulk/category",e);return this._update(t,s,e)}async bulkAssignPayerType(s,e){const t=this.businessUrl("/expenses/bulk/payer-type",e);return this._update(t,s,e)}async bulkAssignReport(s,e){const t=this.businessUrl("/expenses/bulk/expense-report",e);return this._update(t,s,e)}async bulkAssignVendor(s,e){const t=this.businessUrl("/expenses/bulk/vendor",e);return this._update(t,s,e)}async bulkSetNote(s,e){const t=this.businessUrl("/expenses/bulk/note",e);return this._update(t,s,e)}async updateReview(s,e,t){const n=this.businessUrl(`/expenses/${s}/review`,t);return this._update(n,e,t)}async bulkDelete(s,e){const t=this.businessUrl("/expenses/bulk",e);return this.http.delete(t,{...this.buildConfig(e),data:s})}async export(s,e){const t=this.businessUrl("/expenses/export",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async exportWithFilename(s,e){const t=this.businessUrl("/expenses/export",e);return this._downloadWithFilename("POST",t,s,e)}async downloadAttachments(s,e){const t=this.businessUrl("/expenses/attachments/download",e);return this.http.post(t,s,{...this.buildConfig(e),responseType:"blob"})}async downloadAttachmentsWithFilename(s,e){const t=this.businessUrl("/expenses/attachments/download",e);return this._downloadWithFilename("POST",t,s,e)}async downloadSingleAttachment(s,e){const t=this.businessUrl(`/expenses/${s}/attachments/download`,e);return this._download(t,e)}async downloadSingleAttachmentWithFilename(s,e){const t=this.businessUrl(`/expenses/${s}/attachments/download`,e);return this._downloadWithFilename("GET",t,void 0,e)}async split(s,e,t){const n=this.businessUrl(`/expenses/${s}/split`,t);return this._create(n,e,t)}async batchUpdate(s,e){const t=this.businessUrl("/expenses",e);return this._update(t,s,e)}async presignUpload(s,e){const t=this.businessUrl("/expenses/upload/presign",e);return this._create(t,s,e)}async confirmUpload(s,e){const t=this.businessUrl("/expenses/upload/confirm",e);return this._create(t,s,e)}async presignEmployeeUpload(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/upload/presign`,t);return this._create(n,e,t)}async confirmEmployeeUpload(s,e,t){const n=this.businessUrl(`/employees/${s}/expenses/upload/confirm`,t);return this._create(n,e,t)}}class b extends e{async listInstalled(s,e){const t=this.businessUrl("/integrations",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/integrations/${s}`,e);return this._get(t,e)}async authorize(s,e){const t=this.businessUrl(`/integrations/${s}/authorize`,e);return this._get(t,e)}async callback(s,e,t){const n=this.businessUrl(`/integrations/${s}/callback`,t);return this._create(n,e,t)}async delete(s,e){const t=this.businessUrl(`/integrations/${s}`,e);await this._delete(t,e)}async revoke(s,e){const t=this.businessUrl(`/integrations/${s}/revoke`,e);await this._delete(t,e)}async listMarketplaceApps(s){return this._get("/v1/app-marketplace/apps",s)}async getMarketplaceApp(s,e){return this._get(`/v1/app-marketplace/apps/${s}`,e)}async getInstallationById(s,e){const t=this.businessUrl(`/apps/installations/${s}`,e);return this._get(t,e)}async getInstallation(s,e,t){const n=this.businessUrl(`/apps/${s}/installations/${e}`,t);return this._get(n,t)}async getSessionToken(s,e){const t=this.businessUrl(`/apps/installations/${s}/session-token`,e);return this._create(t,{},e)}async retryInstallation(s,e,t){const n=this.businessUrl(`/apps/${s}/installations/${e}/retry`,t);return this._create(n,{},t)}async abortInstallation(s,e,t){const n=this.businessUrl(`/apps/${s}/installations/${e}/abort`,t);return this._create(n,{},t)}async updateInstallationStatus(s,e,t,n){const r=this.businessUrl(`/apps/${s}/installations/${e}/status`,n);return this._patch(r,t,n)}}class _ extends e{async list(s,e){const t=this.businessUrl("/invitations",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/invitations/${s}`,e);return this._get(t,e)}async send(s,e){const t=this.businessUrl("/invitations",e);return this._create(t,s,e)}async accept(s,e){const t=this.businessUrl(`/invitations/${s}/accept`,e);return this._create(t,{},e)}async refuse(s,e){const t=this.businessUrl(`/invitations/${s}/refuse`,e);return this._create(t,{},e)}async delete(s,e){const t=this.businessUrl(`/invitations/${s}`,e);return this._delete(t,e)}}class g extends e{async list(s,e){const t=this.businessUrl("/locations",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/locations/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/locations",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/locations/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/locations/${s}`,e);await this._delete(t,e)}async batchCreate(s,e){const t=this.businessUrl("/locations/batch",e);return this._create(t,s,e)}async batchUpdate(s,e){const t=this.businessUrl("/locations/batch",e);return this._update(t,s,e)}async uploadImage(s,e,t){const n=new FormData;n.append("file",e);const r=this.businessUrl(`/locations/${s}/images`,t);return this._upload(r,n,t)}async addImageFromUrl(s,e,t){const n=this.businessUrl(`/locations/${s}/images/url`,t);return this._create(n,e,t)}async deleteImage(s,e,t){const n=this.businessUrl(`/locations/${s}/images/${e}`,t);await this._delete(n,t)}}class U extends e{async list(s){return this._get("/v1/user/memberships",s)}async getById(s,e){return this._get(`/v1/user/memberships/${s}`,e)}async leave(s,e){await this._delete(`/v1/user/memberships/${s}`,e)}}class m extends e{async list(s,e){const t=this.businessUrl("/notifications",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async listPersonal(s,e){return this.http.get("/v1/notifications",{...this.buildConfig(e),params:s})}async markRead(s,e){const t=this.businessUrl(`/notifications/${s}/read`,e);await this._update(t,{},e)}async markAllRead(s){const e=this.businessUrl("/notifications/read",s);await this._update(e,{},s)}async markReadPersonal(s,e){await this._update(`/v1/notifications/${s}/read`,{},e)}async markAllReadPersonal(s){await this._update("/v1/notifications/read",{},s)}}class R extends e{async list(s,e){return this.http.get("/v1/payment-methods",{...this.buildConfig(e),params:s})}async create(s,e){return this._create("/v1/payment-methods/create",s,e)}async createSetupIntent(s){return this._create("/v1/payment-methods/setup",{},s)}async delete(s,e){await this._delete(`/v1/payment-methods/${s}`,e)}}class I extends e{async list(s,e){return this.http.get("/v1/receipts",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/receipts/${s}`,e)}async create(s,e){return this._create("/v1/receipts",s,e)}async update(s,e,t){return this._update(`/v1/receipts/${s}`,e,t)}async delete(s,e){await this._delete(`/v1/receipts/${s}`,e)}async createFromOCR(s,e){const t=new FormData;return t.append("file",s),this._upload("/v1/receipts/ocr",t,e)}}class T extends e{async monthlySummary(s,e){const t=this.businessUrl("/reports/expenses",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async byCategory(s,e){const t=this.businessUrl("/reports/expenses/categories",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async byVendor(s,e){const t=this.businessUrl("/reports/expenses/vendor",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async daily(s,e){const t=this.businessUrl("/reports/expenses/daily",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxSummary(s,e){const t=this.businessUrl("/reports/expenses/taxes",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxByType(s,e){const t=this.businessUrl("/reports/expenses/taxes/by-type",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxByVendor(s,e){const t=this.businessUrl("/reports/expenses/taxes/by-vendor",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async taxByCategory(s,e){const t=this.businessUrl("/reports/expenses/taxes/by-category",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async byEmployee(s,e){const t=this.businessUrl("/reports/expenses/employees",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async employeeCategoryBreakdown(s,e){const t=this.businessUrl("/reports/expenses/employees/categories",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async overTime(s,e){const t=this.businessUrl("/reports/expenses/over-time",e);return this.http.get(t,{...this.buildConfig(e),params:s})}}class x extends e{async list(s,e){const t=this.businessUrl("/tables",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/tables/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/tables",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/tables/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/tables/${s}`,e);await this._delete(t,e)}}class A extends e{async list(s,e){return this.http.get("/v1/transactions",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/transactions/${s}`,e)}async update(s,e,t){return this._update(`/v1/transactions/${s}`,e,t)}async batchUpdate(s,e){return this._update("/v1/transactions/batch",s,e)}async upload(s,e){return this.http.upload("/v1/transactions/upload",s,this.buildConfig(e))}async delete(s,e){return this._delete(`/v1/transactions/${s}`,e)}}class D extends e{async me(s){return this._get("/v1/user",s)}async update(s,e){return this._update("/v1/user",s,e)}async delete(s){return this._delete("/v1/user",s)}async getAvatar(s){return this._get("/v1/user/avatar",s)}async getInvitations(s){return this._get("/v1/user/invitations",s)}async getMemberships(s){return this._get("/v1/user/memberships",s)}}class S extends e{async list(s,e){const t=this.businessUrl(`/vendors/${s}/connections`,e);return this._get(t,e)}async getById(s,e,t){const n=this.businessUrl(`/vendors/${s}/connections/${e}`,t);return this._get(n,t)}async getLinkToken(s,e){const t=this.businessUrl(`/vendors/${s}/connections/link`,e);return this._get(t,e)}async getReconnectLinkToken(s,e,t){const n=this.businessUrl(`/vendors/${s}/connections/${e}/link`,t);return this._get(n,t)}async connect(s,e,t){const n=this.businessUrl(`/vendors/${s}/connections`,t);return this._create(n,e,t)}async disconnect(s,e,t){const n=this.businessUrl(`/vendors/${s}/connections/${e}`,t);return this._delete(n,t)}}class C extends e{async list(s,e){return this.http.get("/v1/vendors",{...this.buildConfig(e),params:s})}async getById(s,e){return this._get(`/v1/vendors/${s}`,e)}async create(s,e){return this._create("/v1/vendors",s,e)}async update(s,e,t){return this._update(`/v1/vendors/${s}`,e,t)}async delete(s,e){return this._delete(`/v1/vendors/${s}`,e)}async listBusiness(s,e){const t=this.businessUrl("/vendors",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getBusinessVendor(s,e){const t=this.businessUrl(`/vendors/${s}`,e);return this._get(t,e)}async createBusiness(s,e){const t=this.businessUrl("/vendors",e);return this._create(t,s,e)}async updateBusiness(s,e,t){const n=this.businessUrl(`/vendors/${s}`,t);return this._update(n,e,t)}async deleteBusiness(s,e){const t=this.businessUrl(`/vendors/${s}`,e);return this._delete(t,e)}async refreshBusiness(s,e){const t=this.businessUrl(`/vendors/${s}/refresh`,e);await this._create(t,{},e)}async batchCreate(s,e){const t=this.businessUrl("/vendors/batch",e);return this._create(t,s,e)}async batchUpdate(s,e){const t=this.businessUrl("/vendors/batch",e);return this._update(t,s,e)}async bulkDelete(s,e){const t=this.businessUrl("/vendors/bulk",e);return this.http.delete(t,{...this.buildConfig(e),data:s})}async merge(s,e){const t=this.businessUrl("/vendors/merge",e);return this._create(t,s,e)}async importCsv(s,e){const t=new FormData;t.append("file",s);const n=this.businessUrl("/vendors/import",e);return this._upload(n,t,e)}async downloadImportTemplate(s){const e=this.businessUrl("/vendors/import/template",s);return this._download(e,s)}async uploadLogo(s,e,t){const n=new FormData;return n.append("file",e),this._upload(`/v1/vendors/${s}/logo`,n,t)}async uploadBusinessLogo(s,e,t){const n=this.businessUrl(`/vendors/${s}/logo`,t),r=new FormData;return r.append("file",e),this._upload(n,r,t)}}class N extends e{async list(s,e){const t=this.businessUrl("/workflows",e);return this.http.get(t,{...this.buildConfig(e),params:s})}async getById(s,e){const t=this.businessUrl(`/workflows/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/workflows",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/workflows/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/workflows/${s}`,e);await this._delete(t,e)}async test(s,e,t){const n=this.businessUrl(`/workflows/${s}/test`,t);return this._create(n,e??{},t)}async createFromTemplate(s,e){const t=this.businessUrl(`/workflows/templates/${s}`,e);return this._create(t,{},e)}}class v extends e{async list(s,e){const t=this.businessUrl("/customers",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/customers/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/customers",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/customers/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/customers/${s}`,e);return this._delete(t,e)}}class P extends e{async list(s,e){const t=this.businessUrl("/departments",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/departments/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/departments",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/departments/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/departments/${s}`,e);return this._delete(t,e)}}class $ extends e{async list(s,e){const t=this.businessUrl("/products",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/products/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/products",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/products/${s}`,t);return this._patch(n,e,t)}async delete(s,e){const t=this.businessUrl(`/products/${s}`,e);return this._delete(t,e)}}class O extends e{async list(s,e){const t=this.businessUrl(`/products/${s}/variants`,e);return this._get(t,e)}async getById(s,e,t){const n=this.businessUrl(`/products/${s}/variants/${e}`,t);return this._get(n,t)}async create(s,e,t){const n=this.businessUrl(`/products/${s}/variants`,t);return this._create(n,e,t)}async update(s,e,t,n){const r=this.businessUrl(`/products/${s}/variants/${e}`,n);return this._update(r,t,n)}async delete(s,e,t){const n=this.businessUrl(`/products/${s}/variants/${e}`,t);return this._delete(n,t)}}class L extends e{async presign(s,e,t){const n=this.businessUrl(`/products/${s}/images/upload/presign`,t);return this._create(n,e,t)}async confirm(s,e,t){const n=this.businessUrl(`/products/${s}/images/upload/confirm`,t);return this._create(n,e,t)}async list(s,e){const t=this.businessUrl(`/products/${s}/images`,e);return this._get(t,e)}async getById(s,e,t){const n=this.businessUrl(`/products/${s}/images/${e}`,t);return this._get(n,t)}async delete(s,e,t){const n=this.businessUrl(`/products/${s}/images/${e}`,t);return this._delete(n,t)}}class f extends e{async list(s,e){const t=this.businessUrl("/taxes",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/taxes/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/taxes",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/taxes/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/taxes/${s}`,e);return this._delete(t,e)}}class w extends e{async list(s,e){const t=this.businessUrl("/promo-codes",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/promo-codes/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/promo-codes",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/promo-codes/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/promo-codes/${s}`,e);return this._delete(t,e)}}class B extends e{async list(s,e){const t=this.businessUrl("/expenses-categories",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/expenses-categories/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/expenses-categories",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/expenses-categories/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/expenses-categories/${s}`,e);return this._delete(t,e)}}class M extends e{async list(s,e){const t=this.businessUrl("/employees",e);return this._list(t,s,e)}async me(s){const e=this.businessUrl("/employees/me",s);return this._get(e,s)}async getById(s,e){const t=this.businessUrl(`/employees/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/employees",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/employees/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/employees/${s}`,e);return this._delete(t,e)}async setManager(s,e,t){const n=this.businessUrl(`/employees/${s}/manager`,t);return this._update(n,e,t)}async bulkAssignManager(s,e){const t=this.businessUrl("/employees/bulk-assign-manager",e);return this._create(t,s,e)}async setActive(s,e){const t=this.businessUrl(`/employees/${s}/active`,e);return this._update(t,{},e)}async setInactive(s,e){const t=this.businessUrl(`/employees/${s}/inactive`,e);return this._update(t,{},e)}}class k extends e{async list(s,e){const t=this.businessUrl("/attachments",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/attachments/${s}`,e);return this._get(t,e)}async rename(s,e,t){const n=this.businessUrl(`/attachments/${s}/rename`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/attachments/${s}`,e);return this._delete(t,e)}async uploadBatch(s,e){const t=this.businessUrl("/attachments/upload",e),n=new FormData;for(const e of s)n.append("files",e,e.name);return this._upload(t,n,e)}}class F extends e{async listBusiness(s,e){return this._get(`/v1/expenses/forwarding/business/${s}/all`,e)}async getUser(s,e,t){return this._getWithParams(`/v1/expenses/forwarding/users/${s}`,{businessId:e},t)}async configureBusiness(s,e){return this._create("/v1/expenses/forwarding/business",s,e)}async configureUser(s,e){return this._create("/v1/expenses/forwarding/users",s,e)}async disableBusiness(s,e){return this._delete(`/v1/expenses/forwarding/business/${s}`,e)}async disableUser(s,e){return this._delete(`/v1/expenses/forwarding/users/${s}`,e)}}class G extends e{async list(s,e){return this.http.get(`/v1/businesses/${s}/authorized-senders`,this.buildConfig(e))}async create(s,e,t){return this.http.post(`/v1/businesses/${s}/authorized-senders`,e,this.buildConfig(t))}async delete(s,e,t){return this.http.delete(`/v1/businesses/${s}/authorized-senders/${e}`,this.buildConfig(t))}}class V extends e{async list(s,e){return this._list("/v1/loyalty/programs",s,e)}async getById(s,e){return this._get(`/v1/loyalty/programs/${s}`,e)}async create(s,e){return this._create("/v1/loyalty/programs",s,e)}async update(s,e,t){return this._patch(`/v1/loyalty/programs/${s}`,e,t)}async delete(s,e){await this._delete(`/v1/loyalty/programs/${s}`,e)}}class q extends e{list(s,e){return this._list(this.businessUrl("/trips",e),s,e)}get(s,e){return this._get(this.businessUrl(`/trips/${s}`,e),e)}create(s,e){return this._create(this.businessUrl("/trips",e),s,e)}update(s,e,t){return this._update(this.businessUrl(`/trips/${s}`,t),e,t)}delete(s,e){return this._delete(this.businessUrl(`/trips/${s}`,e),e)}listExpenses(s,e){return this._get(this.businessUrl(`/trips/${s}/expenses`,e),e)}addExpense(s,e,t){return this._create(this.businessUrl(`/trips/${s}/expenses`,t),{transactionId:e},t)}removeExpense(s,e,t){return this._delete(this.businessUrl(`/trips/${s}/expenses/${e}`,t),t)}getPerDiemSummary(s,e){return this._get(this.businessUrl(`/trips/${s}/per-diem-summary`,e),e)}}class W extends e{list(s){return this._get(this.businessUrl("/travel-policies",s),s)}get(s,e){return this._get(this.businessUrl(`/travel-policies/${s}`,e),e)}create(s,e){return this._create(this.businessUrl("/travel-policies",e),s,e)}update(s,e,t){return this._update(this.businessUrl(`/travel-policies/${s}`,t),e,t)}delete(s,e){return this._delete(this.businessUrl(`/travel-policies/${s}`,e),e)}}class Y extends e{list(s,e){return this._list(this.businessUrl("/mileage-trips",e),s,e)}get(s,e){return this._get(this.businessUrl(`/mileage-trips/${s}`,e),e)}create(s,e){return this._create(this.businessUrl("/mileage-trips",e),s,e)}update(s,e,t){return this._update(this.businessUrl(`/mileage-trips/${s}`,t),e,t)}delete(s,e){return this._delete(this.businessUrl(`/mileage-trips/${s}`,e),e)}calculateRoute(s,e){return this._create(this.businessUrl("/mileage-trips/calculate-route",e),s,e)}}class H extends e{list(s,e){return this._get(this.businessUrl(`/employees/${s}/vehicles`,e),e)}get(s,e,t){return this._get(this.businessUrl(`/employees/${s}/vehicles/${e}`,t),t)}create(s,e,t){return this._create(this.businessUrl(`/employees/${s}/vehicles`,t),e,t)}update(s,e,t,n){return this._update(this.businessUrl(`/employees/${s}/vehicles/${e}`,n),t,n)}delete(s,e,t){return this._delete(this.businessUrl(`/employees/${s}/vehicles/${e}`,t),t)}}class K extends e{list(s){return this._get(this.businessUrl("/saved-trips",s),s)}get(s,e){return this._get(this.businessUrl(`/saved-trips/${s}`,e),e)}create(s,e){return this._create(this.businessUrl("/saved-trips",e),s,e)}update(s,e,t){return this._update(this.businessUrl(`/saved-trips/${s}`,t),e,t)}delete(s,e){return this._delete(this.businessUrl(`/saved-trips/${s}`,e),e)}}class X extends e{listSystemRates(s,e){return this._getWithParams(this.businessUrl("/mileage-rates/system",e),s,e)}listBusinessRates(s){return this._get(this.businessUrl("/mileage-rates",s),s)}get(s,e){return this._get(this.businessUrl(`/mileage-rates/${s}`,e),e)}createCustomRate(s,e){return this._create(this.businessUrl("/mileage-rates",e),s,e)}updateCustomRate(s,e,t){return this._update(this.businessUrl(`/mileage-rates/${s}`,t),e,t)}deleteCustomRate(s,e){return this._delete(this.businessUrl(`/mileage-rates/${s}`,e),e)}resolveRate(s,e){return this._create(this.businessUrl("/mileage-rates/resolve",e),s,e)}}class Q extends e{start(s,e){return this._create(this.businessUrl("/mileage-trips/recordings",e),s,e)}appendWaypoints(s,e,t){return this._update(this.businessUrl(`/mileage-trips/recordings/${s}/waypoints`,t),e,t)}complete(s,e,t){return this._create(this.businessUrl(`/mileage-trips/recordings/${s}/complete`,t),e,t)}cancel(s,e){return this._delete(this.businessUrl(`/mileage-trips/recordings/${s}`,e),e)}get(s,e){return this._get(this.businessUrl(`/mileage-trips/recordings/${s}`,e),e)}}class j extends e{list(s,e){return this._list(this.businessUrl("/budgets",e),s,e)}get(s,e){return this._get(this.businessUrl(`/budgets/${s}`,e),e)}create(s,e){return this._create(this.businessUrl("/budgets",e),s,e)}update(s,e,t){return this._update(this.businessUrl(`/budgets/${s}`,t),e,t)}delete(s,e){return this._delete(this.businessUrl(`/budgets/${s}`,e),e)}createCategory(s,e,t){return this._create(this.businessUrl(`/budgets/${s}/categories`,t),e,t)}updateCategory(s,e,t,n){return this._update(this.businessUrl(`/budgets/${s}/categories/${e}`,n),t,n)}deleteCategory(s,e,t){return this._delete(this.businessUrl(`/budgets/${s}/categories/${e}`,t),t)}createNotification(s,e,t){return this._create(this.businessUrl(`/budgets/${s}/notifications`,t),e,t)}deleteNotification(s,e,t){return this._delete(this.businessUrl(`/budgets/${s}/notifications/${e}`,t),t)}}class z extends e{async list(s,e){const t=this.businessUrl("/invoices",e);return this._list(t,s,e)}async getById(s,e){const t=this.businessUrl(`/invoices/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/invoices",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/invoices/${s}`,t);return this._update(n,e,t)}async delete(s,e){const t=this.businessUrl(`/invoices/${s}`,e);return this._delete(t,e)}async send(s,e){const t=this.businessUrl(`/invoices/${s}/send`,e);return this._create(t,{},e)}async void(s,e){const t=this.businessUrl(`/invoices/${s}/void`,e);return this._create(t,{},e)}async markPaid(s,e,t){const n=this.businessUrl(`/invoices/${s}/mark-paid`,t);return this._create(n,e??{},t)}async duplicate(s,e){const t=this.businessUrl(`/invoices/${s}/duplicate`,e);return this._create(t,{},e)}async bulkSend(s,e){const t=this.businessUrl("/invoices/bulk/send",e);return this._create(t,s,e)}async bulkVoid(s,e){const t=this.businessUrl("/invoices/bulk/void",e);return this._create(t,s,e)}async bulkMarkPaid(s,e){const t=this.businessUrl("/invoices/bulk/mark-paid",e);return this._create(t,s,e)}async bulkDelete(s,e){const t=this.businessUrl("/invoices/bulk/delete",e);return this._create(t,s,e)}async getNextInvoiceNumber(s,e){const t=s?{customerId:s}:{},n=this.businessUrl("/invoices/next-number",e);return this._getWithParams(n,t,e)}async getSummary(s){const e=this.businessUrl("/invoices/summary",s);return this._get(e,s)}async downloadPdf(s,e){const t=this.businessUrl(`/invoices/${s}/pdf`,e);return this._download(t,e)}async getByShortcode(s){return this.http.get(`/v1/invoices/pay/${encodeURIComponent(s)}`)}async getPublicActivity(s){return this.http.get(`/v1/invoices/pay/${encodeURIComponent(s)}/activity`)}async exportPublic(s,e){return this._download(`/v1/invoices/pay/${encodeURIComponent(s)}/export?format=${encodeURIComponent(e)}`)}async getPublicReceiptUrl(s,e){return this.http.get(`/v1/invoices/pay/${encodeURIComponent(s)}/receipts/${e}`)}async attachToWallet(s,e){return this._create(`/v1/invoices/pay/${encodeURIComponent(s)}/attach-to-wallet`,{},e)}async updateReminders(s,e,t){const n=this.businessUrl(`/invoices/${s}/reminders`,t);return this._update(n,{reminders:e},t)}async getReminderDefaults(s){const e=this.businessUrl("/reminder-defaults",s);return this._get(e,s)}async updateReminderDefaults(s,e){const t=this.businessUrl("/reminder-defaults",e);return this._update(t,s,e)}}class J extends e{async get(s){const e=this.businessUrl("/settings/payments",s);return this._get(e,s)}async getStatus(s){const e=this.businessUrl("/settings/payments/status",s);return this._get(e,s)}async createOnboardingLink(s,e){const t=this.businessUrl("/settings/payments/onboard",e);return this._create(t,s,e)}async refreshOnboardingLink(s,e){const t=this.businessUrl("/settings/payments/refresh-link",e);return this._create(t,s,e)}async createLoginLink(s){const e=this.businessUrl("/settings/payments/login-link",s);return this._create(e,{},s)}async updateFees(s,e){const t=this.businessUrl("/settings/payments/fees",e);return this._update(t,s,e)}async updateSettings(s,e){const t=this.businessUrl("/settings/payments/settings",e);return this._update(t,s,e)}async disable(s){const e=this.businessUrl("/settings/payments",s);return this._delete(e,s)}}class Z extends e{async create(s,e){const t=this.businessUrl("/invoice-payments",e);return this._create(t,s,e)}async list(s,e){const t=this.businessUrl("/invoice-payments",e);return this._getWithParams(t,s,e)}async getById(s,e){const t=this.businessUrl(`/invoice-payments/${s}`,e);return this._get(t,e)}async cancel(s,e){const t=this.businessUrl(`/invoice-payments/${s}/cancel`,e);return this._create(t,{},e)}async createRefund(s,e,t){const n=this.businessUrl(`/invoice-payments/${s}/refunds`,t);return this._create(n,e,t)}async listRefunds(s,e){const t=this.businessUrl(`/invoice-payments/${s}/refunds`,e);return this._get(t,e)}async getLedgerSummary(s,e,t){const n=this.businessUrl("/ledger/summary",t);return this._getWithParams(n,{from:s,to:e},t)}async getLedgerEntries(s,e){const t=this.businessUrl("/ledger/entries",e);return this._getWithParams(t,s,e)}async getPayouts(s,e){const t=this.businessUrl("/ledger/payouts",e);return this._getWithParams(t,s,e)}async exportLedgerCsv(s,e,t){const n=this.businessUrl("/ledger/export",t);return this.http.downloadBlob(`${n}?from=${s}&to=${e}`,this.buildConfig(t))}}class ss extends e{async issue(s,e,t){const n=this.businessUrl(`/invoices/${s}/credit-notes`,t);return this._create(n,e,t)}async listByInvoice(s,e){const t=this.businessUrl(`/invoices/${s}/credit-notes`,e);return this._get(t,e)}async getById(s,e){const t=this.businessUrl(`/credit-notes/${s}`,e);return this._get(t,e)}async void(s,e){const t=this.businessUrl(`/credit-notes/${s}/void`,e);return this._create(t,{},e)}async getCustomerCreditBalance(s,e,t){const n=this.businessUrl(`/customers/${s}/credit-balance`,t);return this._getWithParams(n,e?{currency:e}:void 0,t)}async listCustomerCreditBalances(s,e){const t=this.businessUrl(`/customers/${s}/credit-balances`,e);return this._get(t,e)}async applyCreditToInvoice(s,e,t){const n=this.businessUrl(`/invoices/${s}/apply-credit`,t);await this._create(n,e,t)}async adjustCustomerCredit(s,e,t){const n=this.businessUrl(`/customers/${s}/credit-adjustments`,t);return this._create(n,e,t)}}class es extends e{async list(s,e){const t=this.businessUrl("/payments",e);return this._getWithParams(t,s,e)}async getById(s,e){const t=this.businessUrl(`/payments/${s}`,e);return this._get(t,e)}}class ts extends e{async list(s,e){const t=this.businessUrl("/payment-intents",e);return this._getWithParams(t,s,e)}async getSummary(s,e){const t=this.businessUrl("/payment-intents/summary",e);return this._getWithParams(t,s,e)}async getById(s,e){const t=this.businessUrl(`/payment-intents/${s}`,e);return this._get(t,e)}async cancel(s,e){const t=this.businessUrl(`/payment-intents/${s}/cancel`,e);return this._create(t,{},e)}async listCharges(s,e){const t=this.businessUrl(`/payment-intents/${s}/charges`,e);return this._get(t,e)}async createRefund(s,e,t){const n=this.businessUrl(`/payment-intents/${s}/refunds`,t);return this._create(n,e,t)}async listRefunds(s,e){const t=this.businessUrl(`/payment-intents/${s}/refunds`,e);return this._get(t,e)}}class ns extends e{async list(s,e){const t=this.businessUrl("/settings/payments/payouts",e);return this._getWithParams(t,s,e)}async create(s,e){const t=this.businessUrl("/settings/payments/payouts",e);return this._create(t,s,e)}async getSchedule(s){const e=this.businessUrl("/settings/payments/payouts/schedule",s);return this._get(e,s)}async updateSchedule(s,e){const t=this.businessUrl("/settings/payments/payouts/schedule",e);return this._update(t,s,e)}async getBalance(s){const e=this.businessUrl("/settings/payments/payouts/balance",s);return this._get(e,s)}}class rs extends e{async list(s,e){const t=this.businessUrl("/disputes",e);return this._getWithParams(t,s,e)}async getById(s,e){const t=this.businessUrl(`/disputes/${s}`,e);return this._get(t,e)}async submitEvidence(s,e,t){const n=this.businessUrl(`/disputes/${s}/evidence`,t);return this._create(n,e,t)}async accept(s,e){const t=this.businessUrl(`/disputes/${s}/accept`,e);return this._create(t,{},e)}async createEvidenceUploadUrl(s,e,t){const n=this.businessUrl(`/disputes/${s}/evidence/upload-url`,t);return this._create(n,e,t)}async finalizeEvidence(s,e,t){const n=this.businessUrl(`/disputes/${s}/evidence/finalize`,t);return this._create(n,e,t)}async uploadEvidenceFile(s,e,t,n){const r=await this.createEvidenceUploadUrl(s,{slot:e,fileName:t.name,contentType:t.type||"application/octet-stream"},n),i=await fetch(r.uploadUrl,{method:"PUT",headers:{"Content-Type":t.type||"application/octet-stream","x-amz-server-side-encryption":"AES256"},body:t,signal:n?.signal});if(!i.ok)throw new Error(`S3 upload failed: ${i.status} ${i.statusText}`);return this.finalizeEvidence(s,{slot:e,key:r.key,fileName:t.name},n)}}class is extends e{async list(s,e){const t=this.businessUrl("/statements",e);return this._getWithParams(t,s,e)}async getById(s,e){const t=this.businessUrl(`/statements/${s}`,e);return this._get(t,e)}async downloadPdf(s,e){const t=this.businessUrl(`/statements/${s}/pdf`,e);return this._download(t,e)}async resendEmail(s,e){const t=this.businessUrl(`/statements/${s}/resend-email`,e);return this._create(t,{},e)}}class as extends e{async listGrantedByMe(s){const e=this.businessUrl("/delegates/granted-by-me",s);return this._get(e,s)}async listGrantedToMe(s){const e=this.businessUrl("/delegates/granted-to-me",s);return this._get(e,s)}async getById(s,e){const t=this.businessUrl(`/delegates/${s}`,e);return this._get(t,e)}async create(s,e){const t=this.businessUrl("/delegates",e);return this._create(t,s,e)}async update(s,e,t){const n=this.businessUrl(`/delegates/${s}`,t);return this._patch(n,e,t)}async revoke(s,e){const t=this.businessUrl(`/delegates/${s}`,e);return this._delete(t,e)}async decline(s,e){const t=this.businessUrl(`/delegates/${s}/from-me`,e);return this._delete(t,e)}async canActAs(s,e,t){const n=this.businessUrl(`/delegates/can-act-as/${s}`,t),r=e&&e.length>0?e.join(" "):"";return this._getWithParams(n,{scope:r},t)}async createRequest(s,e){const t=this.businessUrl("/delegation-requests",e);return this._create(t,s,e)}async listIncomingRequests(s){const e=this.businessUrl("/delegation-requests/incoming",s);return this._get(e,s)}async listOutgoingRequests(s){const e=this.businessUrl("/delegation-requests/outgoing",s);return this._get(e,s)}async approveRequest(s,e){const t=this.businessUrl(`/delegation-requests/${s}/approve`,e);return this._create(t,{},e)}async declineRequest(s,e){const t=this.businessUrl(`/delegation-requests/${s}/decline`,e);return this._create(t,{},e)}async cancelRequest(s,e){const t=this.businessUrl(`/delegation-requests/${s}`,e);return this._delete(t,e)}async listAuditEvents(s,e){const t=this.businessUrl("/delegates/audit",e);return this._getWithParams(t,s,e)}}class os extends e{async list(s,e){const t=this.businessUrl("/audit-logs",e),{action:n,...r}=s??{},i={...r};return n&&n.length>0&&(i.action=n.join(",")),this._getWithParams(t,i,e)}async verify(s){const e=this.businessUrl("/audit-logs/verify",s);return this._get(e,s)}}const cs="urn:ietf:params:oauth:grant-type:token-exchange",us="urn:ietf:params:oauth:token-type:access_token",ls="urn:smartbills:user:";class hs extends e{constructor(s,e){super(s),this.authBaseUrl=e}async exchangeOnBehalfOf(s){const e={grant_type:cs,subject_token:s.subjectToken,subject_token_type:us,requested_token_type:us,resource:`${ls}${s.delegatorUserId}`,client_id:s.clientId};s.clientSecret&&(e.client_secret=s.clientSecret),s.scope&&(e.scope=s.scope),s.audience&&(e.audience=s.audience);const t=new URLSearchParams(e).toString(),n=`${this.authBaseUrl.replace(/\/$/,"")}/connect/token`;return this.http.post(n,t,{headers:{"Content-Type":"application/x-www-form-urlencoded","x-tenant-id":String(s.businessId)},withCredentials:!0})}}class ps extends Error{constructor(s,e,t,n){super(s),this.name="SmartbillsError",n?.cause&&(this.cause=n.cause),this.code=e,this.statusCode=t,this.requestId=n?.requestId,this.isRetryable=n?.isRetryable??!1,Object.setPrototypeOf(this,new.target.prototype)}}class ds extends ps{constructor(s,e,t,n){super(s,e,t,{requestId:n?.requestId,isRetryable:n?.isRetryable,cause:n?.cause}),this.name="SmartbillsApiError",this.errors=n?.errors??[],this.rawResponse=n?.rawResponse,Object.setPrototypeOf(this,new.target.prototype)}}const Es={VALIDATION_FAILED:"VALIDATION_FAILED",NOT_FOUND:"NOT_FOUND",FORBIDDEN:"FORBIDDEN",CONFLICT:"CONFLICT",RATE_LIMITED:"RATE_LIMITED",INTEGRATION_NOT_FOUND:"INTEGRATION_NOT_FOUND",APP_INSTALLATION_FAILED:"APP_INSTALLATION_FAILED",CODE_VERIFIER_NOT_FOUND:"CODE_VERIFIER_NOT_FOUND",INTERNAL_SERVER_ERROR:"INTERNAL_SERVER_ERROR",QUOTA_EXCEEDED:"QUOTA_EXCEEDED",UNAUTHORIZED:"UNAUTHORIZED",NETWORK_ERROR:"NETWORK_ERROR",TIMEOUT:"TIMEOUT",REQUEST_CANCELLED:"REQUEST_CANCELLED",UNKNOWN:"UNKNOWN"};class ys extends ds{constructor(s,e){super(s,Es.UNAUTHORIZED,401,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsAuthenticationError",Object.setPrototypeOf(this,new.target.prototype)}}class bs extends ds{constructor(s,e){super(s,Es.CONFLICT,409,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsConflictError",Object.setPrototypeOf(this,new.target.prototype)}}class _s extends ps{constructor(s,e){super(s,e?.code??Es.NETWORK_ERROR,0,{requestId:e?.requestId,isRetryable:!0,cause:e?.cause}),this.name="SmartbillsNetworkError",Object.setPrototypeOf(this,new.target.prototype)}}class gs extends ds{constructor(s,e){super(s,Es.NOT_FOUND,404,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsNotFoundError",Object.setPrototypeOf(this,new.target.prototype)}}class Us extends ds{constructor(s,e){super(s,Es.FORBIDDEN,403,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsPermissionError",Object.setPrototypeOf(this,new.target.prototype)}}class ms extends ds{constructor(s,e){super(s,Es.QUOTA_EXCEEDED,402,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsQuotaError",this.quotaKey=e?.quotaKey,Object.setPrototypeOf(this,new.target.prototype)}}class Rs extends ds{constructor(s,e){super(s,Es.RATE_LIMITED,429,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!0,cause:e?.cause}),this.name="SmartbillsRateLimitError",this.retryAfter=e?.retryAfter,Object.setPrototypeOf(this,new.target.prototype)}}class Is extends ds{constructor(s,e){super(s,Es.VALIDATION_FAILED,400,{errors:e?.errors,rawResponse:e?.rawResponse,requestId:e?.requestId,isRetryable:!1,cause:e?.cause}),this.name="SmartbillsValidationError",this.fieldErrors=new Map;for(const s of this.errors)if(s.field){const e=this.fieldErrors.get(s.field)??[];e.push(s.message),this.fieldErrors.set(s.field,e)}Object.setPrototypeOf(this,new.target.prototype)}getFieldError(s){return this.fieldErrors.get(s)}hasFieldError(s){return this.fieldErrors.has(s)}get allFieldErrors(){return Object.fromEntries(this.fieldErrors)}}function Ts(s){return s instanceof ps}function xs(s){return Ts(s)&&s.isRetryable}class As{constructor(e){this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3,this.instance=s.create({baseURL:e.baseUrl,timeout:e.timeout??3e4,headers:{"Content-Type":"application/json",Accept:"application/json"},paramsSerializer:{indexes:!0}}),this.instance.interceptors.request.use((s=>(this.accessToken&&(s.headers.Authorization=`Bearer ${this.accessToken}`),this.businessId&&(s.headers["x-tenant-id"]=String(this.businessId)),this.locale&&(s.headers["Accept-Language"]=this.locale),s.headers["x-request-id"]=`sb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,s)))}setAccessToken(s){this.accessToken=s}setBusinessId(s){this.businessId=s}setLocale(s){this.locale=s}get defaults(){return{accessToken:this.accessToken,businessId:this.businessId,locale:this.locale}}async get(s,e){return this.requestWithRetry("GET",s,void 0,e)}async post(s,e,t){return this.requestWithRetry("POST",s,e,t)}async put(s,e,t){return this.requestWithRetry("PUT",s,e,t)}async patch(s,e,t){return this.requestWithRetry("PATCH",s,e,t)}async delete(s,e){return this.requestWithRetry("DELETE",s,void 0,e)}async upload(s,e,t){return this.requestWithRetry("POST",s,e,{...t,headers:{...t?.headers,"Content-Type":"multipart/form-data"}})}async downloadBlob(s,e){return(await this.instance.request({method:"GET",url:s,responseType:"blob",...e})).data}async downloadBlobWithFilename(s,e,t,n){const r=await this.instance.request({method:s,url:e,data:t,responseType:"blob",...n}),i=this.parseContentDispositionFilename(r.headers?.["content-disposition"]);return{blob:r.data,filename:i}}parseContentDispositionFilename(s){if(!s)return;const e=s.match(/filename\*=(?:UTF-8''|utf-8'')([^;\s]+)/i);if(e?.[1])return decodeURIComponent(e[1]);const t=s.match(/filename[^;=\n]*=\s*((['"]).*?\2|[^;\n]*)/);return t?.[1]?t[1].replace(/['"]/g,"").trim():void 0}async requestWithRetry(s,e,t,n,r=0){try{return(await this.instance.request({method:s,url:e,data:t,...n})).data}catch(a){const o=this.parseError(a);if(xs(o)&&r<this.maxRetries){const a=this.calculateRetryDelay(o,r);return await(i=a,new Promise((s=>setTimeout(s,i)))),this.requestWithRetry(s,e,t,n,r+1)}throw o}var i}calculateRetryDelay(s,e){return s instanceof Rs&&s.retryAfter?1e3*s.retryAfter:this.retryDelay*Math.pow(2,e)}parseError(e){if(e instanceof s.AxiosError){const s=e.config?.headers?.["x-request-id"];if(!e.response)return"ECONNABORTED"===e.code||"ETIMEDOUT"===e.code?new _s("Request timed out",{code:Es.TIMEOUT,requestId:s,cause:e}):"ERR_CANCELED"===e.code?new _s("Request was cancelled",{code:Es.NETWORK_ERROR,requestId:s,cause:e}):new _s(e.message||"Network error occurred",{requestId:s,cause:e});const t=e.response.status,n=e.response.data,r=n?.message??e.message??"An error occurred",i=n?.code??Es.UNKNOWN,a=n?.errors??[],o=n;switch(t){case 400:return i===Es.VALIDATION_FAILED||a.length>0?new Is(r,{errors:a,rawResponse:o,requestId:s,cause:e}):new ds(r,i,400,{errors:a,rawResponse:o,requestId:s,cause:e});case 401:return new ys(r,{errors:a,rawResponse:o,requestId:s,cause:e});case 402:return new ms(r,{quotaKey:n?.quotaKey,errors:a,rawResponse:o,requestId:s,cause:e});case 403:return n?.quotaKey?new ms(r,{quotaKey:n.quotaKey,errors:a,rawResponse:o,requestId:s,cause:e}):new Us(r,{errors:a,rawResponse:o,requestId:s,cause:e});case 404:return new gs(r,{errors:a,rawResponse:o,requestId:s,cause:e});case 409:return new bs(r,{errors:a,rawResponse:o,requestId:s,cause:e});case 429:{const t=function(s){if(!s)return;const e=Number(s);if(!Number.isNaN(e))return e;const t=Date.parse(s);return Number.isNaN(t)?void 0:Math.max(0,Math.floor((t-Date.now())/1e3))}(e.response.headers["retry-after"]);return new Rs(r,{retryAfter:t,errors:a,rawResponse:o,requestId:s,cause:e})}default:return new ds(r,i,t,{errors:a,rawResponse:o,requestId:s,isRetryable:t>=500,cause:e})}}return new ds(e instanceof Error?e.message:"Unknown error",Es.UNKNOWN,0,{cause:e})}}const Ds="https://api.smartbills.io";var Ss,Cs,Ns,vs,Ps,$s,Os,Ls,fs,ws,Bs,Ms,ks,Fs,Gs,Vs,qs,Ws,Ys,Hs,Ks,Xs,Qs,js,zs,Js,Zs,se,ee,te,ne,re,ie,ae,oe,ce,ue,le,he,pe,de,Ee,ye,be,_e,ge,Ue,me,Re,Ie,Te,xe,Ae,De,Se,Ce;exports.SBInvoiceStatus=void 0,(Ss=exports.SBInvoiceStatus||(exports.SBInvoiceStatus={})).DRAFT="DRAFT",Ss.OPEN="OPEN",Ss.PAID="PAID",Ss.VOID="VOID",Ss.UNCOLLECTIBLE="UNCOLLECTIBLE",exports.SBBillStatus=void 0,(Cs=exports.SBBillStatus||(exports.SBBillStatus={})).DRAFT="DRAFT",Cs.PENDING_APPROVAL="PENDING_APPROVAL",Cs.APPROVED="APPROVED",Cs.READY_FOR_PAYMENT="READY_FOR_PAYMENT",Cs.SCHEDULED="SCHEDULED",Cs.PROCESSING="PROCESSING",Cs.PAYMENT_FAILED="PAYMENT_FAILED",Cs.DENIED="DENIED",Cs.PAID="PAID",Cs.VOID="VOID",exports.SBPaymentStatus=void 0,(Ns=exports.SBPaymentStatus||(exports.SBPaymentStatus={})).UNPAID="UNPAID",Ns.PARTIALLY_PAID="PARTIALLY_PAID",Ns.PAID="PAID",Ns.PARTIALLY_REFUNDED="PARTIALLY_REFUNDED",Ns.REFUNDED="REFUNDED",exports.PaymentTerms=void 0,(vs=exports.PaymentTerms||(exports.PaymentTerms={})).UPON_RECEIPT="UPON_RECEIPT",vs.NET_7="NET_7",vs.NET_15="NET_15",vs.NET_30="NET_30",vs.NET_45="NET_45",vs.NET_60="NET_60",vs.NET_90="NET_90",vs.CUSTOM="CUSTOM",exports.SBPaymentMethodType=void 0,(Ps=exports.SBPaymentMethodType||(exports.SBPaymentMethodType={})).CARD="CARD",Ps.INTERAC="INTERAC",Ps.ACH="ACH",Ps.WIRE="WIRE",exports.InvoiceReminderFrequency=void 0,($s=exports.InvoiceReminderFrequency||(exports.InvoiceReminderFrequency={})).ONCE="ONCE",$s.WEEKLY="WEEKLY",$s.BIWEEKLY="BIWEEKLY",$s.MONTHLY="MONTHLY",exports.InvoiceReminderTiming=void 0,(Os=exports.InvoiceReminderTiming||(exports.InvoiceReminderTiming={})).BEFORE_DUE="BEFORE_DUE",Os.ON_DUE="ON_DUE",Os.AFTER_DUE="AFTER_DUE",exports.SBInvoiceActivityKind=void 0,(Ls=exports.SBInvoiceActivityKind||(exports.SBInvoiceActivityKind={})).CREATED="CREATED",Ls.SENT="SENT",Ls.VIEWED="VIEWED",Ls.REMINDER_SENT="REMINDER_SENT",Ls.PARTIAL_PAYMENT="PARTIAL_PAYMENT",Ls.PAID="PAID",Ls.VOIDED="VOIDED",Ls.MARKED_UNCOLLECTIBLE="MARKED_UNCOLLECTIBLE",Ls.MANUAL_REVIEW_FLAGGED="MANUAL_REVIEW_FLAGGED",Ls.MANUAL_REVIEW_CLEARED="MANUAL_REVIEW_CLEARED",Ls.DISPUTE_OPENED="DISPUTE_OPENED",Ls.DISPUTE_RESOLVED="DISPUTE_RESOLVED",Ls.REFUND_ISSUED="REFUND_ISSUED",exports.TransactionType=void 0,(fs=exports.TransactionType||(exports.TransactionType={}))[fs.DOCUMENT=0]="DOCUMENT",fs[fs.BANK_TRANSACTION=1]="BANK_TRANSACTION",fs[fs.OCR_RECEIPT=2]="OCR_RECEIPT",fs[fs.OFFICIAL_RECEIPT=3]="OFFICIAL_RECEIPT",exports.CheckoutStatus=void 0,(ws=exports.CheckoutStatus||(exports.CheckoutStatus={}))[ws.NONE=0]="NONE",ws[ws.AWAITING_PAYMENT=1]="AWAITING_PAYMENT",ws[ws.PROCESSING=2]="PROCESSING",ws[ws.PAID=3]="PAID",ws[ws.FAILED=4]="FAILED",ws[ws.CANCELED=5]="CANCELED",ws[ws.REFUNDED=6]="REFUNDED",ws[ws.PARTIALLY_REFUNDED=7]="PARTIALLY_REFUNDED",ws[ws.DISPUTED=8]="DISPUTED",exports.CheckoutDocumentType=void 0,(Bs=exports.CheckoutDocumentType||(exports.CheckoutDocumentType={}))[Bs.RECEIPT=0]="RECEIPT",Bs[Bs.INVOICE=1]="INVOICE",exports.ReceiptPaymentStatus=void 0,(Ms=exports.ReceiptPaymentStatus||(exports.ReceiptPaymentStatus={})).APPROUVED="APPROUVED",Ms.PENDING="PENDING",Ms.COMPLETED="COMPLETED",Ms.CANCELLED="CANCELLED",Ms.FAILED="FAILED",Ms.PAID="PAID",Ms.UNPAID="UNPAID",Ms.OVERDUE="OVERDUE",exports.ReceiptPaymentType=void 0,(ks=exports.ReceiptPaymentType||(exports.ReceiptPaymentType={})).CARD="CARD",ks.CASH="CASH",ks.BANK_ACCOUNT="BANK_ACCOUNT",ks.CHECK="CHECK",ks.EXTERNAL="EXTERNAL",ks.CREDITS="CREDITS",ks.GIFT_CARD="GIFT_CARD",ks.OTHER="OTHER",ks.SETTLEMENT="SETTLEMENT",exports.ReceiptType=void 0,(Fs=exports.ReceiptType||(exports.ReceiptType={}))[Fs.BANK_TRANSACTION=0]="BANK_TRANSACTION",Fs[Fs.OCR=1]="OCR",Fs[Fs.SMARTBILLS=2]="SMARTBILLS",exports.ReceiptSource=void 0,(Gs=exports.ReceiptSource||(exports.ReceiptSource={}))[Gs.MANUAL=0]="MANUAL",Gs[Gs.API=1]="API",Gs[Gs.IMPORT=2]="IMPORT",Gs[Gs.OCR=3]="OCR",Gs[Gs.EMAIL=4]="EMAIL",Gs[Gs.INTEGRATION=5]="INTEGRATION",exports.BillApprovalStatus=void 0,(Vs=exports.BillApprovalStatus||(exports.BillApprovalStatus={})).PENDING="PENDING",Vs.APPROVED="APPROVED",Vs.REJECTED="REJECTED",Vs.SKIPPED="SKIPPED",Vs[Vs.NOT_REQUIRED=4]="NOT_REQUIRED",Vs.DELEGATED="DELEGATED",Vs.IN_REVIEW="IN_REVIEW",Vs.REQUESTED_CHANGES="REQUESTED_CHANGES",exports.BillApprovalType=void 0,(qs=exports.BillApprovalType||(exports.BillApprovalType={})).REQUIRED="REQUIRED",qs.OPTIONAL="OPTIONAL",qs.INFORMATIONAL="INFORMATIONAL",qs.CONDITIONAL="CONDITIONAL",qs.MANAGER="MANAGER",exports.MembershipRole=void 0,(Ws=exports.MembershipRole||(exports.MembershipRole={})).ADMINISTRATOR="ADMINISTRATOR",Ws.FINANCE_MANAGER="FINANCE_MANAGER",Ws.ACCOUNTANT="ACCOUNTANT",Ws.MANAGER="MANAGER",Ws.EMPLOYEE="EMPLOYEE",Ws.AUDITOR="AUDITOR",Ws.APPROVER="APPROVER",Ws.MEMBER="MEMBER",Ws.FINANCE_TEAM="FINANCE_TEAM",exports.ExpenseReportStatus=void 0,(Ys=exports.ExpenseReportStatus||(exports.ExpenseReportStatus={}))[Ys.DRAFT=0]="DRAFT",Ys[Ys.SUBMITTED=1]="SUBMITTED",Ys[Ys.APPROVED=2]="APPROVED",Ys[Ys.REJECTED=3]="REJECTED",Ys[Ys.REIMBURSED=4]="REIMBURSED",Ys[Ys.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",Ys[Ys.REQUIRES_CHANGES=6]="REQUIRES_CHANGES",exports.ExpenseItemStatus=void 0,(Hs=exports.ExpenseItemStatus||(exports.ExpenseItemStatus={}))[Hs.PENDING=0]="PENDING",Hs[Hs.APPROVED=1]="APPROVED",Hs[Hs.REJECTED=2]="REJECTED",Hs[Hs.PARTIALLY_APPROVED=3]="PARTIALLY_APPROVED",Hs[Hs.REIMBURSED=4]="REIMBURSED",Hs[Hs.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",Hs[Hs.REQUIRES_CHANGES=6]="REQUIRES_CHANGES",exports.ExpenseReportAuditLogAction=void 0,(Ks=exports.ExpenseReportAuditLogAction||(exports.ExpenseReportAuditLogAction={}))[Ks.CREATED=0]="CREATED",Ks[Ks.UPDATED=1]="UPDATED",Ks[Ks.SUBMITTED=2]="SUBMITTED",Ks[Ks.APPROVED=3]="APPROVED",Ks[Ks.REJECTED=4]="REJECTED",Ks[Ks.REQUESTED_CHANGES=5]="REQUESTED_CHANGES",Ks[Ks.RECALL=6]="RECALL",Ks[Ks.REIMBURSED=7]="REIMBURSED",Ks[Ks.PARTIAL_REIMBURSEMENT=8]="PARTIAL_REIMBURSEMENT",Ks[Ks.PLANNED_REIMBURSEMENT=9]="PLANNED_REIMBURSEMENT",Ks[Ks.EXPENSE_ADDED=10]="EXPENSE_ADDED",Ks[Ks.EXPENSE_REMOVED=11]="EXPENSE_REMOVED",Ks[Ks.EXPENSE_EDITED=12]="EXPENSE_EDITED",Ks[Ks.COMMENT_ADDED=13]="COMMENT_ADDED",Ks[Ks.ASSIGNED_LEDGER_ACCOUNT=14]="ASSIGNED_LEDGER_ACCOUNT",Ks[Ks.ASSIGNED_EXPENSE_LEDGER_ACCOUNT=15]="ASSIGNED_EXPENSE_LEDGER_ACCOUNT",Ks[Ks.REVERTED_TO_REVIEW=16]="REVERTED_TO_REVIEW",exports.VendorConnectionStatus=void 0,(Xs=exports.VendorConnectionStatus||(exports.VendorConnectionStatus={}))[Xs.NOT_CONNECTED=0]="NOT_CONNECTED",Xs[Xs.NEW=1]="NEW",Xs[Xs.CONNECTING=2]="CONNECTING",Xs[Xs.CONNECTED=3]="CONNECTED",Xs[Xs.INVALID_CREDENTIALS=4]="INVALID_CREDENTIALS",Xs[Xs.ERROR=5]="ERROR",Xs[Xs.MFA_METHOD_CHOICE=6]="MFA_METHOD_CHOICE",Xs[Xs.MFA_QUESTION=7]="MFA_QUESTION",Xs[Xs.MFA_QUESTION_INVALID_ANSWER=8]="MFA_QUESTION_INVALID_ANSWER",Xs[Xs.MFA_QUESTION_NO_ANSWER=9]="MFA_QUESTION_NO_ANSWER",Xs[Xs.CAPTCHA=10]="CAPTCHA",Xs[Xs.SECURITY_QUESTION=11]="SECURITY_QUESTION",Xs[Xs.ACCOUNT_SELECTION=12]="ACCOUNT_SELECTION",Xs[Xs.DISCONNECTED=13]="DISCONNECTED",exports.ConnectAccountStatus=void 0,(Qs=exports.ConnectAccountStatus||(exports.ConnectAccountStatus={}))[Qs.PENDING=0]="PENDING",Qs[Qs.ONBOARDING=1]="ONBOARDING",Qs[Qs.ACTIVE=2]="ACTIVE",Qs[Qs.RESTRICTED=3]="RESTRICTED",Qs[Qs.DISABLED=4]="DISABLED",exports.CheckoutPaymentStatus=void 0,(js=exports.CheckoutPaymentStatus||(exports.CheckoutPaymentStatus={}))[js.PENDING=0]="PENDING",js[js.PROCESSING=1]="PROCESSING",js[js.SUCCEEDED=2]="SUCCEEDED",js[js.FAILED=3]="FAILED",js[js.CANCELED=4]="CANCELED",js[js.REQUIRES_ACTION=5]="REQUIRES_ACTION",js[js.REFUNDED=6]="REFUNDED",js[js.PARTIALLY_REFUNDED=7]="PARTIALLY_REFUNDED",js[js.DISPUTED=8]="DISPUTED",exports.NotificationType=void 0,(zs=exports.NotificationType||(exports.NotificationType={}))[zs.GENERAL=0]="GENERAL",zs[zs.EXPENSE_REPORT_SUBMITTED=1]="EXPENSE_REPORT_SUBMITTED",zs[zs.EXPENSE_REPORT_APPROVED=2]="EXPENSE_REPORT_APPROVED",zs[zs.EXPENSE_REPORT_REJECTED=3]="EXPENSE_REPORT_REJECTED",zs[zs.EXPENSE_REPORT_REIMBURSED=4]="EXPENSE_REPORT_REIMBURSED",zs[zs.EXPENSE_REPORT_CHANGES_REQUESTED=5]="EXPENSE_REPORT_CHANGES_REQUESTED",zs[zs.EXPENSE_REPORT_COMMENT=6]="EXPENSE_REPORT_COMMENT",zs[zs.INVITATION_RECEIVED=7]="INVITATION_RECEIVED",zs[zs.INVITATION_ACCEPTED=8]="INVITATION_ACCEPTED",zs[zs.BILL_SUBMITTED=9]="BILL_SUBMITTED",zs[zs.BILL_APPROVED=10]="BILL_APPROVED",zs[zs.BILL_PAID=11]="BILL_PAID",zs[zs.BILL_OVERDUE=12]="BILL_OVERDUE",exports.EmailAccountType=void 0,(Js=exports.EmailAccountType||(exports.EmailAccountType={}))[Js.GMAIL=0]="GMAIL",Js[Js.OUTLOOK=1]="OUTLOOK",Js[Js.IMAP=2]="IMAP",exports.EmailAccountStatus=void 0,(Zs=exports.EmailAccountStatus||(exports.EmailAccountStatus={}))[Zs.ACTIVE=0]="ACTIVE",Zs[Zs.INACTIVE=1]="INACTIVE",Zs[Zs.ERROR=2]="ERROR",Zs[Zs.DISCONNECTED=3]="DISCONNECTED",exports.EmailAccountSyncStatus=void 0,(se=exports.EmailAccountSyncStatus||(exports.EmailAccountSyncStatus={}))[se.IDLE=0]="IDLE",se[se.SYNCING=1]="SYNCING",se[se.ERROR=2]="ERROR",exports.SyncTriggerType=void 0,(ee=exports.SyncTriggerType||(exports.SyncTriggerType={}))[ee.MANUAL=0]="MANUAL",ee[ee.SCHEDULED=1]="SCHEDULED",ee[ee.WEBHOOK=2]="WEBHOOK",exports.MailboxType=void 0,(te=exports.MailboxType||(exports.MailboxType={}))[te.INBOX=0]="INBOX",te[te.SENT=1]="SENT",te[te.DRAFTS=2]="DRAFTS",te[te.TRASH=3]="TRASH",te[te.SPAM=4]="SPAM",te[te.CUSTOM=5]="CUSTOM",exports.InvitationStatus=void 0,(ne=exports.InvitationStatus||(exports.InvitationStatus={}))[ne.PENDING=0]="PENDING",ne[ne.ACCEPTED=1]="ACCEPTED",ne[ne.REFUSED=2]="REFUSED",ne[ne.EXPIRED=3]="EXPIRED",ne[ne.CANCELLED=4]="CANCELLED",exports.IntegrationStatus=void 0,(re=exports.IntegrationStatus||(exports.IntegrationStatus={}))[re.ACTIVE=0]="ACTIVE",re[re.INACTIVE=1]="INACTIVE",re[re.ERROR=2]="ERROR",re[re.PENDING=3]="PENDING",exports.AppInstallationStatus=void 0,(ie=exports.AppInstallationStatus||(exports.AppInstallationStatus={}))[ie.PENDING=0]="PENDING",ie[ie.INSTALLING=1]="INSTALLING",ie[ie.ACTIVE=2]="ACTIVE",ie[ie.FAILED=3]="FAILED",ie[ie.UNINSTALLED=4]="UNINSTALLED",exports.WorkflowTriggerType=void 0,(ae=exports.WorkflowTriggerType||(exports.WorkflowTriggerType={}))[ae.EXPENSE_REPORT_SUBMITTED=0]="EXPENSE_REPORT_SUBMITTED",ae[ae.EXPENSE_REPORT_APPROVED=1]="EXPENSE_REPORT_APPROVED",ae[ae.RECEIPT_UPLOADED=2]="RECEIPT_UPLOADED",ae[ae.BILL_CREATED=3]="BILL_CREATED",ae[ae.BILL_APPROVED=4]="BILL_APPROVED",exports.PayerType=void 0,(oe=exports.PayerType||(exports.PayerType={})).EMPLOYEE="EMPLOYEE",oe.COMPANY="COMPANY",exports.TransactionSource=void 0,(ce=exports.TransactionSource||(exports.TransactionSource={})).API="Api",ce.Dashboard="Dashboard",ce.MobileApp="MobileApp",ce.ExpenseForwarding="ExpenseForwarding",ce.ThirdPartyApp="ThirdPartyApp",ce.Manual="Manual",exports.ExpenseSplitType=void 0,(ue=exports.ExpenseSplitType||(exports.ExpenseSplitType={}))[ue.EQUAL=0]="EQUAL",ue[ue.BY_PERCENTAGE=1]="BY_PERCENTAGE",ue[ue.BY_LINE_ITEM=2]="BY_LINE_ITEM",exports.ExpenseJobStatus=void 0,(le=exports.ExpenseJobStatus||(exports.ExpenseJobStatus={})).PENDING="Pending",le.IN_PROGRESS="InProgress",le.SUCCEEDED="Succeeded",le.FAILED="Failed",le.ERROR="Error",le.REJECTED="Rejected",exports.TripStatus=void 0,(he=exports.TripStatus||(exports.TripStatus={})).ACTIVE="ACTIVE",he.UPCOMING="UPCOMING",he.COMPLETED="COMPLETED",he.CANCELLED="CANCELLED",exports.PerDiemAllowanceType=void 0,(pe=exports.PerDiemAllowanceType||(exports.PerDiemAllowanceType={})).DAILY="DAILY",pe.TRIP_WIDE="TRIP_WIDE",exports.GsaRateAdjustment=void 0,(de=exports.GsaRateAdjustment||(exports.GsaRateAdjustment={})).USE_AS_IS="USE_AS_IS",de.STRICT="STRICT",de.RECOMMENDED="RECOMMENDED",de.FLEXIBLE="FLEXIBLE",de.CUSTOM="CUSTOM",exports.DistanceUnit=void 0,(Ee=exports.DistanceUnit||(exports.DistanceUnit={})).KILOMETER="KILOMETER",Ee.MILE="MILE",exports.MileageRateType=void 0,(ye=exports.MileageRateType||(exports.MileageRateType={})).TIERED="TIERED",ye.FLAT="FLAT",exports.MileageRecordingStatus=void 0,(be=exports.MileageRecordingStatus||(exports.MileageRecordingStatus={})).ACTIVE="ACTIVE",be.COMPLETED="COMPLETED",be.CANCELLED="CANCELLED",exports.BudgetStatus=void 0,(_e=exports.BudgetStatus||(exports.BudgetStatus={})).ACTIVE="ACTIVE",_e.CLOSED="CLOSED",exports.ConnectedAccountStatus=void 0,(ge=exports.ConnectedAccountStatus||(exports.ConnectedAccountStatus={})).PENDING="PENDING",ge.RESTRICTED="RESTRICTED",ge.ENABLED="ENABLED",ge.DISABLED="DISABLED",ge.REJECTED="REJECTED",exports.ConnectedAccountType=void 0,(Ue=exports.ConnectedAccountType||(exports.ConnectedAccountType={})).EXPRESS="EXPRESS",Ue.STANDARD="STANDARD",Ue.CUSTOM="CUSTOM",exports.LateFeeType=void 0,(me=exports.LateFeeType||(exports.LateFeeType={})).PERCENTAGE="Percentage",me.FIXED="Fixed",exports.LateFeeFrequency=void 0,(Re=exports.LateFeeFrequency||(exports.LateFeeFrequency={})).ONE_TIME="OneTime",Re.RECURRING="Recurring",exports.InvoicePaymentStatus=void 0,(Ie=exports.InvoicePaymentStatus||(exports.InvoicePaymentStatus={})).PENDING="Pending",Ie.PROCESSING="Processing",Ie.SUCCEEDED="Succeeded",Ie.FAILED="Failed",Ie.CANCELED="Canceled",Ie.REFUNDED="Refunded",Ie.PARTIALLY_REFUNDED="PartiallyRefunded",Ie.DISPUTED="Disputed",Ie.EXPIRED="Expired",exports.DisputeEvidenceSlot=void 0,(Te=exports.DisputeEvidenceSlot||(exports.DisputeEvidenceSlot={})).CustomerCommunication="CustomerCommunication",Te.Receipt="Receipt",Te.ServiceDocumentation="ServiceDocumentation",Te.ShippingDocumentation="ShippingDocumentation",Te.RefundPolicy="RefundPolicy",Te.CancellationPolicy="CancellationPolicy",Te.CustomerSignature="CustomerSignature",Te.DuplicateChargeDocumentation="DuplicateChargeDocumentation",Te.Uncategorized="Uncategorized",exports.PayoutStatus=void 0,(xe=exports.PayoutStatus||(exports.PayoutStatus={})).PAID="paid",xe.PENDING="pending",xe.IN_TRANSIT="in_transit",xe.CANCELED="canceled",xe.FAILED="failed",exports.PayoutInterval=void 0,(Ae=exports.PayoutInterval||(exports.PayoutInterval={})).DAILY="daily",Ae.WEEKLY="weekly",Ae.MONTHLY="monthly",Ae.MANUAL="manual",exports.PaymentIntentStatus=void 0,(De=exports.PaymentIntentStatus||(exports.PaymentIntentStatus={})).REQUIRES_PAYMENT_METHOD="REQUIRES_PAYMENT_METHOD",De.REQUIRES_CONFIRMATION="REQUIRES_CONFIRMATION",De.REQUIRES_ACTION="REQUIRES_ACTION",De.PROCESSING="PROCESSING",De.REQUIRES_CAPTURE="REQUIRES_CAPTURE",De.CANCELED="CANCELED",De.SUCCEEDED="SUCCEEDED",De.FAILED="FAILED",De.PENDING="PENDING",De.REFUNDED="REFUNDED",De.PARTIALLY_REFUNDED="PARTIALLY_REFUNDED",De.DISPUTED="DISPUTED",De.EXPIRED="EXPIRED",exports.ChargeStatus=void 0,(Se=exports.ChargeStatus||(exports.ChargeStatus={})).PENDING="PENDING",Se.SUCCEEDED="SUCCEEDED",Se.FAILED="FAILED",exports.StatementStatus=void 0,(Ce=exports.StatementStatus||(exports.StatementStatus={})).PENDING="PENDING",Ce.GENERATED="GENERATED",Ce.SENT="SENT",Ce.FAILED="FAILED",exports.AccessToken=class{constructor(s){this.token=s}getAccessToken(){return this.token}setToken(s){this.token=s}},exports.AppInstallationService=t,exports.ApprobationService=n,exports.AttachmentService=k,exports.AuditLogService=os,exports.AuthService=hs,exports.AuthorizedSenderService=G,exports.BaseService=e,exports.BillService=i,exports.BillStatus=exports.SBBillStatus,exports.BillingService=r,exports.BudgetService=j,exports.BusinessService=a,exports.BusinessUserService=o,exports.CategoryService=B,exports.CheckoutService=c,exports.ConnectService=u,exports.ConnectedAccountService=J,exports.CreditNoteService=ss,exports.CustomerService=v,exports.DEFAULT_BASE_URL=Ds,exports.DELEGATOR_RESOURCE_PREFIX=ls,exports.DelegateService=as,exports.DepartmentService=P,exports.DisputeService=rs,exports.EmailAccountService=l,exports.EmailForwardingService=F,exports.EmployeeService=M,exports.ErrorCode=Es,exports.ExpenseJobService=h,exports.ExpenseReportExpenseService=p,exports.ExpenseReportPaymentService=d,exports.ExpenseReportService=E,exports.ExpenseService=y,exports.HttpClient=As,exports.IntegrationService=b,exports.InvitationService=_,exports.InvoicePaymentService=Z,exports.InvoiceService=z,exports.LocationService=g,exports.LoyaltyService=V,exports.MembershipService=U,exports.MileageRateService=X,exports.MileageRecordingService=Q,exports.MileageTripService=Y,exports.NotificationService=m,exports.PaymentIntentService=ts,exports.PaymentMethodService=R,exports.PaymentService=es,exports.PayoutService=ns,exports.ProductImageService=L,exports.ProductService=$,exports.ProductVariantService=O,exports.PromoCodeService=w,exports.ReceiptService=I,exports.ReportingService=T,exports.SavedTripService=K,exports.SmartbillsApiError=ds,exports.SmartbillsAuthenticationError=ys,exports.SmartbillsClient=class{constructor(s){this.http=new As({baseUrl:s?.baseUrl??Ds,timeout:s?.timeout,maxRetries:s?.maxRetries,retryDelay:s?.retryDelay}),s?.accessToken&&this.http.setAccessToken(s.accessToken),s?.businessId&&this.http.setBusinessId(s.businessId),s?.locale&&this.http.setLocale(s.locale),this.users=new D(this.http),this.businesses=new a(this.http),this.businessUsers=new o(this.http),this.invitations=new _(this.http),this.memberships=new U(this.http),this.receipts=new I(this.http),this.bills=new i(this.http),this.transactions=new A(this.http),this.expenses=new y(this.http),this.expenseReports=new E(this.http),this.expenseReportExpenses=new p(this.http),this.expenseReportPayments=new d(this.http),this.expenseJobs=new h(this.http),this.approbations=new n(this.http),this.vendors=new C(this.http),this.vendorConnections=new S(this.http),this.notifications=new m(this.http),this.paymentMethods=new R(this.http),this.integrations=new b(this.http),this.appInstallations=new t(this.http),this.emailAccounts=new l(this.http),this.reports=new T(this.http),this.checkout=new c(this.http),this.connect=new u(this.http),this.locations=new g(this.http),this.tables=new x(this.http),this.billing=new r(this.http),this.workflows=new N(this.http),this.customers=new v(this.http),this.departments=new P(this.http),this.products=new $(this.http),this.productVariants=new O(this.http),this.productImages=new L(this.http),this.taxes=new f(this.http),this.promoCodes=new w(this.http),this.categories=new B(this.http),this.employees=new M(this.http),this.attachments=new k(this.http),this.emailForwarding=new F(this.http),this.authorizedSenders=new G(this.http),this.loyalty=new V(this.http),this.trips=new q(this.http),this.travelPolicies=new W(this.http),this.mileageTrips=new Y(this.http),this.vehicles=new H(this.http),this.savedTrips=new K(this.http),this.mileageRates=new X(this.http),this.mileageRecordings=new Q(this.http),this.budgets=new j(this.http),this.invoices=new z(this.http),this.connectedAccounts=new J(this.http),this.invoicePayments=new Z(this.http),this.creditNotes=new ss(this.http),this.payments=new es(this.http),this.paymentIntents=new ts(this.http),this.payouts=new ns(this.http),this.disputes=new rs(this.http),this.statements=new is(this.http),this.delegates=new as(this.http),this.auditLogs=new os(this.http),this.auth=new hs(this.http,s?.authBaseUrl??"https://api.smartbills.io/auth")}setAccessToken(s){this.http.setAccessToken(s)}setBusinessId(s){this.http.setBusinessId(s)}setLocale(s){this.http.setLocale(s)}get accessToken(){return this.http.defaults.accessToken}get businessId(){return this.http.defaults.businessId}get locale(){return this.http.defaults.locale}},exports.SmartbillsConflictError=bs,exports.SmartbillsError=ps,exports.SmartbillsNetworkError=_s,exports.SmartbillsNotFoundError=gs,exports.SmartbillsPermissionError=Us,exports.SmartbillsQuotaError=ms,exports.SmartbillsRateLimitError=Rs,exports.SmartbillsValidationError=Is,exports.StatementService=is,exports.TOKEN_EXCHANGE_GRANT_TYPE=cs,exports.TOKEN_TYPE_ACCESS_TOKEN=us,exports.TableService=x,exports.TaxService=f,exports.TransactionService=A,exports.TravelPolicyService=W,exports.TripService=q,exports.UserService=D,exports.VehicleService=H,exports.VendorConnectionService=S,exports.VendorService=C,exports.WorkflowService=N,exports.isApiError=function(s){return s instanceof ds},exports.isAuthenticationError=function(s){return s instanceof ys},exports.isConflictError=function(s){return s instanceof bs},exports.isNetworkError=function(s){return s instanceof _s},exports.isNotFoundError=function(s){return s instanceof gs},exports.isPermissionError=function(s){return s instanceof Us},exports.isQuotaError=function(s){return s instanceof ms},exports.isRateLimitError=function(s){return s instanceof Rs},exports.isRetryableError=xs,exports.isSmartbillsError=Ts,exports.isValidationError=function(s){return s instanceof Is},exports.uploadFileToS3=async function(e,t,n){await s.put(e,t,{headers:{"Content-Type":n,"x-amz-server-side-encryption":"AES256"}})},exports.uploadFileUriToS3=async function(s,e,t){return new Promise(((n,r)=>{const i=new XMLHttpRequest;i.open("PUT",s),i.setRequestHeader("Content-Type",t),i.setRequestHeader("x-amz-server-side-encryption","AES256"),i.onload=()=>{i.status>=200&&i.status<300?n():r(new Error(`S3 upload failed with status ${i.status}`))},i.onerror=()=>r(new Error("S3 upload network error")),i.send({uri:e,type:t,name:"upload"})}))};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|