diff --git a/CHANGELOG.md b/CHANGELOG.md index ca25a33..eb154e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @code.store/arcxp-sdk-ts +## 5.1.3 + +### Patch Changes + +- Added SalesSDK of v2 + ## 5.1.2 ### Patch Changes diff --git a/package.json b/package.json index 25594bc..9d5109d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code.store/arcxp-sdk-ts", - "version": "5.1.2", + "version": "5.1.3", "description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.", "type": "module", "main": "./dist/index.js", diff --git a/src/api/index.ts b/src/api/index.ts index 7d30f0e..8c92d1a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -12,7 +12,7 @@ import { ArcProtoCenter } from './photo-center/index.js'; import { ArcRedirect } from './redirect/index.js'; import { ArcRetailEvents } from './retail-events/index.js'; import { ArcDeveloperRetail } from './developer-retail/index.js'; -import { ArcSales } from './sales/index.js'; +import { ArcSales, ArcSalesV2 } from './sales/index.js'; import { ArcSigningService } from './signing-service/index.js'; import { ArcSite } from './site/index.js'; import { ArcTags } from './tags/index.js'; @@ -27,6 +27,7 @@ export const ArcAPI = (options: ArcAPIOptions) => { Redirect: new ArcRedirect(options), MigrationCenter: new ArcMigrationCenter(options), Sales: new ArcSales(options), + SalesV2: new ArcSalesV2(options), Site: new ArcSite(options), Websked: new ArcWebsked(options), Content: new ArcContent(options), diff --git a/src/api/sales/index.ts b/src/api/sales/index.ts index 9245148..4fdc78f 100644 --- a/src/api/sales/index.ts +++ b/src/api/sales/index.ts @@ -1,6 +1,8 @@ import FormData from 'form-data'; import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { + CreateEnterpriseGroupPayload, + CreateEnterpriseGroupResponse, MigrateBatchSubscriptionsParams, MigrateBatchSubscriptionsPayload, MigrateBatchSubscriptionsResponse, @@ -25,3 +27,14 @@ export class ArcSales extends ArcAbstractAPI { return data; } } + +export class ArcSalesV2 extends ArcAbstractAPI { + constructor(options: ArcAPIOptions) { + super({ ...options, apiPath: 'sales/api/v2' }); + } + + async createEnterpriseGroup(payload: CreateEnterpriseGroupPayload): Promise { + const { data } = await this.client.post('/subscriptions/enterprise', payload); + return data; + } +} diff --git a/src/api/sales/types.ts b/src/api/sales/types.ts index d76dbeb..371c0aa 100644 --- a/src/api/sales/types.ts +++ b/src/api/sales/types.ts @@ -92,3 +92,15 @@ export type Refund = { tax: number; providerReference?: string; }; + +export type CreateEnterpriseGroupPayload = { + name: string; + sku: string; +}; + +export type CreateEnterpriseGroupResponse = { + name: string; + sku: string; + nonceExpirationInDays: number; + id: number; +};