@smartbills/sdk 1.1.0-alpha.13 → 1.1.0-alpha.15
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 +44 -34
- 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,t){const r=this.businessUrl(`/approbations/${s}`,t);return this._getWithParams(r,e,t)}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)}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 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 uploadLogo(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/logo`,r,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 r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/brand/logo`,r,t)}async uploadBrandIcon(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/brand/icon`,r,t)}async uploadBrandCover(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/brand/cover`,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)}async listByExpenseReport(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/jobs`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}}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 d 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 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 r=this.businessUrl(`/employees/${s}/expense-reports`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}async getByIdForEmployee(s,e,t,r){const n=this.businessUrl(`/employees/${s}/expense-reports/${e}`,r);return this._getWithParams(n,t,r)}async getById(s,e,t){const r=this.businessUrl(`/expense-reports/${s}`,t);return this._getWithParams(r,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 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 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 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 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 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)}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 r=this.businessUrl(`/employees/${s}/expenses/upload/presign`,t);return this._create(r,e,t)}async confirmEmployeeUpload(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/upload/confirm`,t);return this._create(r,e,t)}}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 m 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 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 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 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 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 O 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 k 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 M 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,ds,Es,bs,ys,_s,ms,Us,gs,Rs,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,(ds=exports.ExpenseReportStatus||(exports.ExpenseReportStatus={}))[ds.DRAFT=0]="DRAFT",ds[ds.SUBMITTED=1]="SUBMITTED",ds[ds.APPROVED=2]="APPROVED",ds[ds.REJECTED=3]="REJECTED",ds[ds.REIMBURSED=4]="REIMBURSED",ds[ds.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",ds[ds.REQUIRES_CHANGES=6]="REQUIRES_CHANGES",exports.ExpenseItemStatus=void 0,(Es=exports.ExpenseItemStatus||(exports.ExpenseItemStatus={}))[Es.PENDING=0]="PENDING",Es[Es.APPROVED=1]="APPROVED",Es[Es.REJECTED=2]="REJECTED",Es[Es.PARTIALLY_APPROVED=3]="PARTIALLY_APPROVED",Es[Es.REIMBURSED=4]="REIMBURSED",Es[Es.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",Es[Es.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,(ms=exports.CheckoutPaymentStatus||(exports.CheckoutPaymentStatus={}))[ms.PENDING=0]="PENDING",ms[ms.PROCESSING=1]="PROCESSING",ms[ms.SUCCEEDED=2]="SUCCEEDED",ms[ms.FAILED=3]="FAILED",ms[ms.CANCELED=4]="CANCELED",ms[ms.REQUIRES_ACTION=5]="REQUIRES_ACTION",ms[ms.REFUNDED=6]="REFUNDED",ms[ms.PARTIALLY_REFUNDED=7]="PARTIALLY_REFUNDED",ms[ms.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,(Rs=exports.EmailAccountStatus||(exports.EmailAccountStatus={}))[Rs.ACTIVE=0]="ACTIVE",Rs[Rs.INACTIVE=1]="INACTIVE",Rs[Rs.ERROR=2]="ERROR",Rs[Rs.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=M,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=P,exports.EmailAccountService=l,exports.EmailForwardingService=k,exports.EmployeeService=L,exports.ErrorCode=q,exports.ExpenseJobService=h,exports.ExpenseReportExpenseService=p,exports.ExpenseReportPaymentService=d,exports.ExpenseReportService=E,exports.ExpenseService=b,exports.HttpClient=ss,exports.IntegrationService=y,exports.InvitationService=_,exports.LocationService=m,exports.LoyaltyService=F,exports.MembershipService=U,exports.NotificationService=g,exports.PaymentMethodService=R,exports.ProductService=O,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 E(this.http),this.expenseReportExpenses=new p(this.http),this.expenseReportPayments=new d(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 R(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 m(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 P(this.http),this.products=new O(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 k(this.http),this.authorizedSenders=new M(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},exports.uploadFileToS3=async function(s,e,t){const r=await fetch(s,{method:"PUT",headers:{"Content-Type":t},body:e});if(!r.ok)throw new Error(`S3 upload failed: ${r.status} ${r.statusText}`)};
|
|
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,t){const r=this.businessUrl(`/approbations/${s}`,t);return this._getWithParams(r,e,t)}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 resetExpenseReview(s,e,t){const r=this.businessUrl(`/approbations/${s}/expenses/${e}/reset-review`,t);return this._create(r,{},t)}async saveExpenseReview(s,e,t){const r=this.businessUrl(`/approbations/${s}/approve`,t);return this._create(r,{...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 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 uploadLogo(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/logo`,r,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 r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/brand/logo`,r,t)}async uploadBrandIcon(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/brand/icon`,r,t)}async uploadBrandCover(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/businesses/${s}/brand/cover`,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){const t=this.businessUrl(`/expenses/processing/${s}`,e);return this._get(t,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)}async listByExpenseReport(s,e,t){const r=this.businessUrl(`/expense-reports/${s}/jobs`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}}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 d 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 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 r=this.businessUrl(`/employees/${s}/expense-reports`,t);return this.http.get(r,{...this.buildConfig(t),params:e})}async getByIdForEmployee(s,e,t,r){const n=this.businessUrl(`/employees/${s}/expense-reports/${e}`,r);return this._getWithParams(n,t,r)}async getById(s,e,t){const r=this.businessUrl(`/expense-reports/${s}`,t);return this._getWithParams(r,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 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 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 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 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 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)}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 r=this.businessUrl(`/employees/${s}/expenses/upload/presign`,t);return this._create(r,e,t)}async confirmEmployeeUpload(s,e,t){const r=this.businessUrl(`/employees/${s}/expenses/upload/confirm`,t);return this._create(r,e,t)}}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 m 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 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 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)}async uploadLogo(s,e,t){const r=new FormData;return r.append("file",e),this._upload(`/v1/vendors/${s}/logo`,r,t)}async uploadBusinessLogo(s,e,t){const r=this.businessUrl(`/vendors/${s}/logo`,t),n=new FormData;return n.append("file",e),this._upload(r,n,t)}}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 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 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 O 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,e){let t=this.businessUrl("/expenses-categories",e);s?.search&&(t+=`${t.includes("?")?"&":"?"}search=${encodeURIComponent(s.search)}`);return(await this._get(t,e)).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 k 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 M 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,ds,Es,bs,ys,_s,ms,Us,gs,Rs,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={})).PENDING="PENDING",us.APPROVED="APPROVED",us.REJECTED="REJECTED",us.SKIPPED="SKIPPED",us[us.NOT_REQUIRED=4]="NOT_REQUIRED",us.DELEGATED="DELEGATED",us.IN_REVIEW="IN_REVIEW",us.REQUESTED_CHANGES="REQUESTED_CHANGES",exports.BillApprovalType=void 0,(ls=exports.BillApprovalType||(exports.BillApprovalType={})).REQUIRED="REQUIRED",ls.OPTIONAL="OPTIONAL",ls.INFORMATIONAL="INFORMATIONAL",ls.CONDITIONAL="CONDITIONAL",ls.MANAGER="MANAGER",exports.BillStatus=void 0,(hs=exports.BillStatus||(exports.BillStatus={})).DRAFT="DRAFT",hs.PENDING_APPROVAL="PENDING_APPROVAL",hs.APPROVED="APPROVED",hs.SCHEDULED="SCHEDULED",hs.PAID="PAID",hs.CANCELLED="CANCELLED",hs.OVERDUE="OVERDUE",hs.PAYMENT_FAILED="PAYMENT_FAILED",exports.MembershipRole=void 0,(ps=exports.MembershipRole||(exports.MembershipRole={})).ADMINISTRATOR="ADMINISTRATOR",ps.FINANCE_MANAGER="FINANCE_MANAGER",ps.ACCOUNTANT="ACCOUNTANT",ps.MANAGER="MANAGER",ps.EMPLOYEE="EMPLOYEE",ps.AUDITOR="AUDITOR",ps.APPROVER="APPROVER",ps.MEMBER="MEMBER",ps.FINANCE_TEAM="FINANCE_TEAM",exports.ExpenseReportStatus=void 0,(ds=exports.ExpenseReportStatus||(exports.ExpenseReportStatus={}))[ds.DRAFT=0]="DRAFT",ds[ds.SUBMITTED=1]="SUBMITTED",ds[ds.APPROVED=2]="APPROVED",ds[ds.REJECTED=3]="REJECTED",ds[ds.REIMBURSED=4]="REIMBURSED",ds[ds.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",ds[ds.REQUIRES_CHANGES=6]="REQUIRES_CHANGES",exports.ExpenseItemStatus=void 0,(Es=exports.ExpenseItemStatus||(exports.ExpenseItemStatus={}))[Es.PENDING=0]="PENDING",Es[Es.APPROVED=1]="APPROVED",Es[Es.REJECTED=2]="REJECTED",Es[Es.PARTIALLY_APPROVED=3]="PARTIALLY_APPROVED",Es[Es.REIMBURSED=4]="REIMBURSED",Es[Es.PARTIALLY_REIMBURSED=5]="PARTIALLY_REIMBURSED",Es[Es.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,(ms=exports.CheckoutPaymentStatus||(exports.CheckoutPaymentStatus={}))[ms.PENDING=0]="PENDING",ms[ms.PROCESSING=1]="PROCESSING",ms[ms.SUCCEEDED=2]="SUCCEEDED",ms[ms.FAILED=3]="FAILED",ms[ms.CANCELED=4]="CANCELED",ms[ms.REQUIRES_ACTION=5]="REQUIRES_ACTION",ms[ms.REFUNDED=6]="REFUNDED",ms[ms.PARTIALLY_REFUNDED=7]="PARTIALLY_REFUNDED",ms[ms.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,(Rs=exports.EmailAccountStatus||(exports.EmailAccountStatus={}))[Rs.ACTIVE=0]="ACTIVE",Rs[Rs.INACTIVE=1]="INACTIVE",Rs[Rs.ERROR=2]="ERROR",Rs[Rs.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={})).PERSONAL="PERSONAL",Ss.BUSINESS="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=M,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=P,exports.EmailAccountService=l,exports.EmailForwardingService=k,exports.EmployeeService=L,exports.ErrorCode=q,exports.ExpenseJobService=h,exports.ExpenseReportExpenseService=p,exports.ExpenseReportPaymentService=d,exports.ExpenseReportService=E,exports.ExpenseService=b,exports.HttpClient=ss,exports.IntegrationService=y,exports.InvitationService=_,exports.LocationService=m,exports.LoyaltyService=F,exports.MembershipService=U,exports.NotificationService=g,exports.PaymentMethodService=R,exports.ProductService=O,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 E(this.http),this.expenseReportExpenses=new p(this.http),this.expenseReportPayments=new d(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 R(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 m(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 P(this.http),this.products=new O(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 k(this.http),this.authorizedSenders=new M(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},exports.uploadFileToS3=async function(e,t,r){await s.put(e,t,{headers:{"Content-Type":r,"x-amz-server-side-encryption":"AES256"}})};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|