Skip to content

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬

1.2 KB
Raw Blame
/* global axios */
import ApiClient from '../ApiClient';

class EnterpriseAccountAPI extends ApiClient {
  constructor() {
    super('', { accountScoped: true, enterprise: true });
  }

  checkout() {
    return axios.post(`${this.url}checkout`);
  }

  reconnectShopify(pendingInstallToken) {
    return axios.post(`${this.url}reconnect_shopify`, {
      pending_install_token: pendingInstallToken,
    });
  }

  subscription() {
    return axios.post(`${this.url}subscription`);
  }

  billingSummary({ refresh = false } = {}) {
    return axios.get(`${this.url}billing_summary`, {
      params: { refresh },
    });
  }

  selectBillingCurrency(currency) {
    return axios.post(`${this.url}select_billing_currency`, { currency });
  }

  getLimits() {
    return axios.get(`${this.url}limits`);
  }

  toggleDeletion(action) {
    return axios.post(`${this.url}toggle_deletion`, {
      action_type: action,
    });
  }

  createTopupCheckout(credits) {
    return axios.post(`${this.url}topup_checkout`, { credits });
  }

  // Topup packages for the account's billing currency.
  getTopupOptions() {
    return axios.get(`${this.url}topup_options`);
  }
}

export default new EnterpriseAccountAPI();