Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
"url": "https://github.com/code-store-platform/arcxp-sdk-ts"
},
"homepage": "https://github.com/code-store-platform/arcxp-sdk-ts",
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "tsc --noEmit && rollup -c",
"format": "npx @biomejs/biome format --write .",
Expand All @@ -33,11 +31,7 @@
"gen:ts": "npx tsx ./src/scripts/json-schema-to-ts.ts",
"cs": "npx changeset && npx changeset version"
},
"keywords": [
"ArcXP",
"SDK",
"Code.Store"
],
"keywords": ["ArcXP", "SDK", "Code.Store"],
"author": "code.store",
"license": "MIT",
"dependencies": {
Expand Down
6 changes: 6 additions & 0 deletions src/api/identity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export class ArcIdentity extends ArcAbstractAPI {
return data;
}

async getUserProfile(id: string): Promise<UserProfile> {
const { data } = await this.client.get(`/profile/${id}`);

return data;
}

async updateUserProfile(id: string, payload: Partial<UserProfile>): Promise<UserProfile> {
const { data } = await this.client.patch(`/profile/${id}`, payload);

Expand Down
5 changes: 5 additions & 0 deletions src/api/identity/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ export interface UserIdentity {
}

export interface UserProfile {
/**
* @description Unique identifier of the user (UUID)
* @example "3eda4538-9ba3-411a-ac33-ecc93ea22abc"
*/
uuid?: string;
/**
* Format: date-time
* @description Date this was created
Expand Down
7 changes: 7 additions & 0 deletions src/api/sales/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import FormData from 'form-data';
import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js';
import type {
GetAllSubscriptionsForUserParams,
MigrateBatchSubscriptionsParams,
MigrateBatchSubscriptionsPayload,
MigrateBatchSubscriptionsResponse,
SubscriptionSummary,
} from './types.js';

export class ArcSales extends ArcAbstractAPI {
Expand All @@ -24,4 +26,9 @@ export class ArcSales extends ArcAbstractAPI {

return data;
}

async getAllSubscriptionsForUser(params?: GetAllSubscriptionsForUserParams): Promise<SubscriptionSummary> {
const { data } = await this.client.get('/subscription/all', { params });
return data;
}
}
25 changes: 25 additions & 0 deletions src/api/sales/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { UserAttribute } from '../identity/types';
import type { Website } from '../../types/ans-types';
export type SubscriptionStatuses = 1 | 2 | 3 | 4 | 5 | 6 | 7;

export type MigrateBatchSubscriptionsPayload = {
subscriptions: (PaidSubscription | FreeSubscription | SharedSubscription | LinkedSubscription)[];
Expand Down Expand Up @@ -92,3 +93,27 @@ export type Refund = {
tax: number;
providerReference?: string;
};

export type GetAllSubscriptionsForUserParams = {
id: string;
site?: string;
};

export interface SubscriptionSummary {
subscriptionID: number;
statusID: number;
paymentMethod?: PaymentMethod | null;
productName?: string | null;
sku?: string | null;
site?: string | null;
}

export interface PaymentMethod {
creditCardType: string | null;
firstSix: string | null;
lastFour: string | null;
expiration: string | null;
cardHolderName: string | null;
paymentPartner: string;
paymentMethodID: number;
}
Loading