diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fd4335..ca25a33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @code.store/arcxp-sdk-ts +## 5.1.2 + +### Patch Changes + +- Added "site" param to Sales migration method + ## 5.1.1 ### Patch Changes diff --git a/package.json b/package.json index 3e60c7b..25594bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code.store/arcxp-sdk-ts", - "version": "5.1.1", + "version": "5.1.2", "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/sales/index.ts b/src/api/sales/index.ts index 1089c57..9245148 100644 --- a/src/api/sales/index.ts +++ b/src/api/sales/index.ts @@ -1,17 +1,22 @@ import FormData from 'form-data'; import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; -import type { MigrateBatchSubscriptionsPayload, MigrateBatchSubscriptionsResponse } from './types.js'; +import type { + MigrateBatchSubscriptionsParams, + MigrateBatchSubscriptionsPayload, + MigrateBatchSubscriptionsResponse, +} from './types.js'; export class ArcSales extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { super({ ...options, apiPath: 'sales/api/v1' }); } - async migrate(payload: MigrateBatchSubscriptionsPayload) { + async migrate(params: MigrateBatchSubscriptionsParams, payload: MigrateBatchSubscriptionsPayload) { const form = new FormData(); form.append('file', JSON.stringify(payload), { filename: 'subs.json', contentType: 'application/json' }); const { data } = await this.client.post('/migrate', form, { + params, headers: { ...form.getHeaders(), }, diff --git a/src/api/sales/types.ts b/src/api/sales/types.ts index 28dbc69..d76dbeb 100644 --- a/src/api/sales/types.ts +++ b/src/api/sales/types.ts @@ -1,10 +1,15 @@ import type { UserAttribute } from '../identity/types'; +import type { Website } from '../../types/ans-types'; export type MigrateBatchSubscriptionsPayload = { subscriptions: (PaidSubscription | FreeSubscription | SharedSubscription | LinkedSubscription)[]; payments: PaymentInfo[]; }; +export type MigrateBatchSubscriptionsParams = { + site: Website; +}; + export type MigrateBatchSubscriptionsResponse = { subscriptionsInBatch?: number; batchID?: string;