@code.store/arcxp-sdk-ts 5.1.2 → 5.1.6

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/index.js CHANGED
@@ -2,7 +2,6 @@ import axios from 'axios';
2
2
  import * as rateLimit from 'axios-rate-limit';
3
3
  import axiosRetry from 'axios-retry';
4
4
  import * as ws from 'ws';
5
- import FormData from 'form-data';
6
5
  import encode from 'base32-encode';
7
6
  import { v5 } from 'uuid';
8
7
  import assert from 'node:assert';
@@ -67,7 +66,7 @@ class ArcAbstractAPI {
67
66
  // apply retry
68
67
  const retry = typeof axiosRetry === 'function' ? axiosRetry : axiosRetry.default;
69
68
  retry(this.client, {
70
- retries: 5,
69
+ retries: options.maxRetries || 10,
71
70
  retryDelay: axiosRetry.exponentialDelay,
72
71
  retryCondition: (err) => this.retryCondition(err),
73
72
  });
@@ -687,6 +686,7 @@ class ArcSales extends ArcAbstractAPI {
687
686
  super({ ...options, apiPath: 'sales/api/v1' });
688
687
  }
689
688
  async migrate(params, payload) {
689
+ const FormData = await platform.form_data();
690
690
  const form = new FormData();
691
691
  form.append('file', JSON.stringify(payload), { filename: 'subs.json', contentType: 'application/json' });
692
692
  const { data } = await this.client.post('/migrate', form, {
@@ -698,6 +698,33 @@ class ArcSales extends ArcAbstractAPI {
698
698
  return data;
699
699
  }
700
700
  }
701
+ class ArcSalesV2 extends ArcAbstractAPI {
702
+ constructor(options) {
703
+ super({ ...options, apiPath: 'sales/api/v2' });
704
+ }
705
+ async getEnterpriseGroups(params) {
706
+ const { data } = await this.client.get('/subscriptions/enterprise', {
707
+ params: {
708
+ 'arc-site': params.site,
709
+ },
710
+ });
711
+ return data;
712
+ }
713
+ async createEnterpriseGroup(params, payload) {
714
+ const { data } = await this.client.post('/subscriptions/enterprise', payload, {
715
+ params: {
716
+ 'arc-site': params.site,
717
+ },
718
+ });
719
+ return data;
720
+ }
721
+ async createNonce(website, enterpriseGroupId) {
722
+ const { data } = await this.client.get(`/subscriptions/enterprise/${enterpriseGroupId}`, {
723
+ params: { 'arc-site': website },
724
+ });
725
+ return data;
726
+ }
727
+ }
701
728
 
702
729
  class ArcSigningService extends ArcAbstractAPI {
703
730
  constructor(options) {
@@ -830,6 +857,7 @@ const ArcAPI = (options) => {
830
857
  Redirect: new ArcRedirect(options),
831
858
  MigrationCenter: new ArcMigrationCenter(options),
832
859
  Sales: new ArcSales(options),
860
+ SalesV2: new ArcSalesV2(options),
833
861
  Site: new ArcSite(options),
834
862
  Websked: new ArcWebsked(options),
835
863
  Content: new ArcContent(options),