@marteye/studiojs 1.1.37 → 1.1.39

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.
@@ -0,0 +1,35 @@
1
+ import { HttpClient } from "../net/http";
2
+ import { ActivityLog } from "../types";
3
+ export interface ActivityListResponse {
4
+ data: ActivityLog[];
5
+ lastId: string | null;
6
+ hasMore: boolean;
7
+ }
8
+ export interface ActivityListParams {
9
+ saleId?: string;
10
+ entityType?: string;
11
+ entityId?: string;
12
+ operation?: string;
13
+ memberId?: string;
14
+ from?: string;
15
+ to?: string;
16
+ limit?: number;
17
+ lastId?: string;
18
+ }
19
+ export default function create(httpClient: HttpClient): {
20
+ /**
21
+ * List activity logs for a market with pagination and filtering
22
+ * @param marketId - ID of the market
23
+ * @param params - Optional filtering and pagination parameters
24
+ * @returns Paginated list of activity logs
25
+ */
26
+ list: (marketId: string, params?: ActivityListParams) => Promise<ActivityListResponse>;
27
+ /**
28
+ * Get a specific activity log by ID
29
+ * @param marketId - ID of the market
30
+ * @param activityId - ID of the activity log entry
31
+ * @returns The activity log details
32
+ */
33
+ get: (marketId: string, activityId: string) => Promise<ActivityLog>;
34
+ };
35
+ export type Activity = ReturnType<typeof create>;
@@ -0,0 +1,35 @@
1
+ import { HttpClient } from "../net/http";
2
+ import { CartItem, Lot } from "../types";
3
+ export interface LotsBySale {
4
+ saleId: string;
5
+ marketId: string;
6
+ lots: Lot[];
7
+ }
8
+ export interface CartResponse {
9
+ customerId: string;
10
+ extras: CartItem[];
11
+ lotsBuyingBySale: LotsBySale[];
12
+ lotsSellingBySale: LotsBySale[];
13
+ }
14
+ export interface AddExtraPayload {
15
+ productId: string;
16
+ clientType: "Seller" | "Buyer";
17
+ quantity: number;
18
+ unitPriceInCents: number;
19
+ passthroughFundsToCustomerId?: string | null;
20
+ }
21
+ export default function create(httpClient: HttpClient): {
22
+ /**
23
+ * Get the full cart for a customer including extras and uninvoiced lots
24
+ */
25
+ get: (marketId: string, customerId: string) => Promise<CartResponse>;
26
+ /**
27
+ * Add an extra product to the customer's cart
28
+ */
29
+ addExtra: (marketId: string, customerId: string, data: AddExtraPayload) => Promise<CartResponse>;
30
+ /**
31
+ * Remove an extra from the customer's cart
32
+ */
33
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
34
+ };
35
+ export type Carts = ReturnType<typeof create>;
@@ -0,0 +1,79 @@
1
+ import { HttpClient } from "../net/http";
2
+ export interface LedgerBalanceResponse {
3
+ balanceInCents: number;
4
+ }
5
+ export interface LedgerTransaction {
6
+ id: string;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ transactionDate: string;
10
+ marketId: string;
11
+ account: string;
12
+ rollUpAccounts: string[];
13
+ accountType: "income" | "expense" | "asset" | "liability" | "equity";
14
+ accountName: string;
15
+ owner: "market" | string;
16
+ isMarketAccount: boolean;
17
+ amountInCents: number;
18
+ batchId: string;
19
+ batchDescription: string;
20
+ referenceId: string;
21
+ referenceType: string;
22
+ referenceTxnCount: number;
23
+ referenceGroupKey: string;
24
+ tags: Record<string, string | number | boolean>;
25
+ parentTransactionId: string | null;
26
+ currentBalanceInCents: number;
27
+ sumOfCreditsInCents: number;
28
+ sumOfDebitsInCents: number;
29
+ index: number;
30
+ }
31
+ export interface TransactionsListResponse {
32
+ transactions: LedgerTransaction[];
33
+ nextCursor: string | null;
34
+ hasMore: boolean;
35
+ }
36
+ export interface ListTransactionsParams {
37
+ account: string;
38
+ dateFrom?: string;
39
+ dateTo?: string;
40
+ limit?: number;
41
+ cursor?: string;
42
+ }
43
+ export default function create(httpClient: HttpClient): {
44
+ /**
45
+ * Get the current balance for a ledger account
46
+ * @param marketId - ID of the market
47
+ * @param account - Full account string (format: owner:accountType:accountName)
48
+ * e.g. "customerId:asset:trade receivable" or "market:liability:trade payable"
49
+ * @returns The current balance in cents
50
+ */
51
+ getBalance: (marketId: string, account: string) => Promise<LedgerBalanceResponse>;
52
+ /**
53
+ * Get a transaction by ID
54
+ * @param marketId - ID of the market
55
+ * @param transactionId - ID of the transaction
56
+ * @returns The transaction details
57
+ */
58
+ getTransaction: (marketId: string, transactionId: string) => Promise<LedgerTransaction>;
59
+ /**
60
+ * Get the latest transaction on an account
61
+ * @param marketId - ID of the market
62
+ * @param account - Full account string (format: owner:accountType:accountName)
63
+ * @returns The latest transaction on the account
64
+ */
65
+ getLatestTransaction: (marketId: string, account: string) => Promise<LedgerTransaction>;
66
+ /**
67
+ * List transactions for an account with optional date range and pagination
68
+ * @param marketId - ID of the market
69
+ * @param params - Query parameters
70
+ * @param params.account - Full account string (format: owner:accountType:accountName)
71
+ * @param params.dateFrom - Optional start date (ISO 8601 format, e.g. "2024-01-01")
72
+ * @param params.dateTo - Optional end date (ISO 8601 format, e.g. "2024-12-31")
73
+ * @param params.limit - Optional max results (default 50, max 100)
74
+ * @param params.cursor - Optional cursor for pagination
75
+ * @returns List of transactions with pagination info
76
+ */
77
+ listTransactions: (marketId: string, params: ListTransactionsParams) => Promise<TransactionsListResponse>;
78
+ };
79
+ export type Ledger = ReturnType<typeof create>;
@@ -5,6 +5,31 @@ export interface PayoutsListResponse {
5
5
  lastId: string | null;
6
6
  hasMore: boolean;
7
7
  }
8
+ export interface PayoutCreateResponse {
9
+ payout: Payout;
10
+ }
11
+ export interface CreatePayoutRequest {
12
+ /** IDs of the seller invoices this payout is for. All must be for the same customer and have status "issued". */
13
+ invoiceIds: string[];
14
+ /** Payout method */
15
+ method: "BACS" | "Cheque" | "Cash";
16
+ /** Payout amount in cents. If not provided, defaults to the sum of amountDueInCents across all invoices. */
17
+ amountInCents?: number;
18
+ /** Transaction date (ISO 8601). Defaults to now. */
19
+ transactionDate?: string;
20
+ /** Cheque number or BACS reference */
21
+ reference?: string | null;
22
+ /** Optional notes */
23
+ notes?: string | null;
24
+ /** Account holder name (BACS only). Falls back to customer bank details or display name. */
25
+ accountName?: string;
26
+ /** 8-digit account number (BACS only). Falls back to customer bank details. */
27
+ accountNumber?: string;
28
+ /** 6-digit sort code (BACS only). Falls back to customer bank details. */
29
+ sortCode?: string;
30
+ /** Name on cheque (Cheque only). Falls back to customer display name. */
31
+ chequeMadePayableTo?: string;
32
+ }
8
33
  export default function create(httpClient: HttpClient): {
9
34
  /**
10
35
  * List all payouts for a market with pagination
@@ -20,5 +45,14 @@ export default function create(httpClient: HttpClient): {
20
45
  * @returns The payout details
21
46
  */
22
47
  get: (marketId: string, payoutId: string) => Promise<Payout>;
48
+ /**
49
+ * Create a payout for one or more seller invoices.
50
+ * Use this to re-create a payout after voiding (e.g., lost cheque).
51
+ * Payment details will fall back to customer defaults if not provided.
52
+ * @param marketId - ID of the market
53
+ * @param data - Payout creation data
54
+ * @returns The created payout
55
+ */
56
+ create: (marketId: string, data: CreatePayoutRequest) => Promise<PayoutCreateResponse>;
23
57
  };
24
58
  export type Payouts = ReturnType<typeof create>;
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from "../net/http";
2
- import { Sale } from "../types";
2
+ import { Sale, SalePublishStatus } from "../types";
3
3
  type SalesListResponse = {
4
4
  start: string;
5
5
  end: string;
@@ -36,6 +36,7 @@ export default function create(httpClient: HttpClient): {
36
36
  recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
37
37
  defaultProductCode?: string;
38
38
  attributeDefaults?: Record<string, any>;
39
+ publishStatus?: SalePublishStatus;
39
40
  marteyeSettings?: {
40
41
  description?: string;
41
42
  image?: string;
@@ -1,5 +1,9 @@
1
1
  import type { HttpClient } from "./net/http";
2
2
  export default function resources(httpClient: HttpClient): {
3
+ activity: {
4
+ list: (marketId: string, params?: import("./resources/activity").ActivityListParams) => Promise<import("./resources/activity").ActivityListResponse>;
5
+ get: (marketId: string, activityId: string) => Promise<import("./types").ActivityLog>;
6
+ };
3
7
  markets: {
4
8
  get: (marketId: string) => Promise<import("./types").Market>;
5
9
  };
@@ -36,6 +40,7 @@ export default function resources(httpClient: HttpClient): {
36
40
  recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
37
41
  defaultProductCode?: string;
38
42
  attributeDefaults?: Record<string, any>;
43
+ publishStatus?: import("./types").SalePublishStatus;
39
44
  marteyeSettings?: {
40
45
  description?: string;
41
46
  image?: string;
@@ -135,6 +140,11 @@ export default function resources(httpClient: HttpClient): {
135
140
  }) => Promise<import("./types").LotItem>;
136
141
  delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
137
142
  };
143
+ carts: {
144
+ get: (marketId: string, customerId: string) => Promise<import("./resources/carts").CartResponse>;
145
+ addExtra: (marketId: string, customerId: string, data: import("./resources/carts").AddExtraPayload) => Promise<import("./resources/carts").CartResponse>;
146
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
147
+ };
138
148
  cph: {
139
149
  lookup: (marketId: string, cph: string) => Promise<import("./types").CphLookupResponse>;
140
150
  };
@@ -221,6 +231,7 @@ export default function resources(httpClient: HttpClient): {
221
231
  payouts: {
222
232
  list: (marketId: string, lastId?: string | null) => Promise<import("./resources/payouts").PayoutsListResponse>;
223
233
  get: (marketId: string, payoutId: string) => Promise<import("./types").Payout>;
234
+ create: (marketId: string, data: import("./resources/payouts").CreatePayoutRequest) => Promise<import("./resources/payouts").PayoutCreateResponse>;
224
235
  };
225
236
  search: {
226
237
  query: (marketId: string, query: string) => Promise<import("./resources/search").SearchResult>;
@@ -249,4 +260,10 @@ export default function resources(httpClient: HttpClient): {
249
260
  update: (marketId: string, customerId: string, contactId: string, payload: import("./resources/contacts").CreateOrUpdateContactPayload) => Promise<import("./types").CustomerContact>;
250
261
  delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
251
262
  };
263
+ ledger: {
264
+ getBalance: (marketId: string, account: string) => Promise<import("./resources/ledger").LedgerBalanceResponse>;
265
+ getTransaction: (marketId: string, transactionId: string) => Promise<import("./resources/ledger").LedgerTransaction>;
266
+ getLatestTransaction: (marketId: string, account: string) => Promise<import("./resources/ledger").LedgerTransaction>;
267
+ listTransactions: (marketId: string, params: import("./resources/ledger").ListTransactionsParams) => Promise<import("./resources/ledger").TransactionsListResponse>;
268
+ };
252
269
  };
package/dist/studio.d.ts CHANGED
@@ -9,6 +9,10 @@ export declare function Studio(info?: {
9
9
  debug?: boolean;
10
10
  }): {
11
11
  isDebugMode: boolean;
12
+ activity: {
13
+ list: (marketId: string, params?: import("./resources/activity").ActivityListParams) => Promise<import("./resources/activity").ActivityListResponse>;
14
+ get: (marketId: string, activityId: string) => Promise<import("./types").ActivityLog>;
15
+ };
12
16
  markets: {
13
17
  get: (marketId: string) => Promise<import("./types").Market>;
14
18
  };
@@ -45,6 +49,7 @@ export declare function Studio(info?: {
45
49
  recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
46
50
  defaultProductCode?: string;
47
51
  attributeDefaults?: Record<string, any>;
52
+ publishStatus?: import("./types").SalePublishStatus;
48
53
  marteyeSettings?: {
49
54
  description?: string;
50
55
  image?: string;
@@ -144,6 +149,11 @@ export declare function Studio(info?: {
144
149
  }) => Promise<import("./types").LotItem>;
145
150
  delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
146
151
  };
152
+ carts: {
153
+ get: (marketId: string, customerId: string) => Promise<import("./resources/carts").CartResponse>;
154
+ addExtra: (marketId: string, customerId: string, data: import("./resources/carts").AddExtraPayload) => Promise<import("./resources/carts").CartResponse>;
155
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
156
+ };
147
157
  cph: {
148
158
  lookup: (marketId: string, cph: string) => Promise<import("./types").CphLookupResponse>;
149
159
  };
@@ -230,6 +240,7 @@ export declare function Studio(info?: {
230
240
  payouts: {
231
241
  list: (marketId: string, lastId?: string | null) => Promise<import("./resources/payouts").PayoutsListResponse>;
232
242
  get: (marketId: string, payoutId: string) => Promise<import("./types").Payout>;
243
+ create: (marketId: string, data: import("./resources/payouts").CreatePayoutRequest) => Promise<import("./resources/payouts").PayoutCreateResponse>;
233
244
  };
234
245
  search: {
235
246
  query: (marketId: string, query: string) => Promise<import("./resources/search").SearchResult>;
@@ -258,4 +269,10 @@ export declare function Studio(info?: {
258
269
  update: (marketId: string, customerId: string, contactId: string, payload: import("./resources/contacts").CreateOrUpdateContactPayload) => Promise<import("./types").CustomerContact>;
259
270
  delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
260
271
  };
272
+ ledger: {
273
+ getBalance: (marketId: string, account: string) => Promise<import("./resources/ledger").LedgerBalanceResponse>;
274
+ getTransaction: (marketId: string, transactionId: string) => Promise<import("./resources/ledger").LedgerTransaction>;
275
+ getLatestTransaction: (marketId: string, account: string) => Promise<import("./resources/ledger").LedgerTransaction>;
276
+ listTransactions: (marketId: string, params: import("./resources/ledger").ListTransactionsParams) => Promise<import("./resources/ledger").TransactionsListResponse>;
277
+ };
261
278
  };
package/dist/types.d.ts CHANGED
@@ -46,6 +46,7 @@ export interface SettingsMarketDefaults {
46
46
  defaultUnitOfSale: UnitOfSale;
47
47
  defaultSuperType?: SuperType | null;
48
48
  defaultSettleDebtsFirst?: boolean;
49
+ liveEmailsEnabled?: boolean;
49
50
  lotDescriptionTemplateMap?: {
50
51
  default: string | undefined;
51
52
  [supertype: string]: string | undefined;
@@ -133,6 +134,7 @@ export type DisplayBoardMode = "off" | "live" | "manual" | {
133
134
  type: "focused";
134
135
  field: string;
135
136
  };
137
+ export type SalePublishStatus = "unpublished" | "sale" | "saleAndCatalog";
136
138
  export interface Sale {
137
139
  id: string;
138
140
  createdAt: Timestamp;
@@ -200,6 +202,13 @@ export interface Sale {
200
202
  };
201
203
  };
202
204
  editedBy?: string[];
205
+ /**
206
+ * Publishing status for external systems
207
+ * - unpublished: Not listed in external system
208
+ * - sale: Sale date is listed externally
209
+ * - saleAndCatalog: Sale and catalog information synced
210
+ */
211
+ publishStatus?: SalePublishStatus;
203
212
  }
204
213
  export interface TemplateSaleData {
205
214
  name?: string;
@@ -644,6 +653,7 @@ export interface Customer {
644
653
  notes?: string;
645
654
  status?: "archived" | "deleted" | null;
646
655
  deleteAfter?: Timestamp;
656
+ casualBuyerLabels?: string[];
647
657
  }
648
658
  export interface CustomerFromSearch extends Omit<Customer, "createdAt" | "updatedAt" | "lastItemPurchaseDate" | "lastItemSaleDate"> {
649
659
  createdAt: number;
@@ -1056,6 +1066,7 @@ export interface AttributeDefinition {
1056
1066
  prefillableFromPreviousLot?: boolean;
1057
1067
  hidden?: boolean;
1058
1068
  showInSellerDetailsPanel?: boolean;
1069
+ showInSellerReviewPanel?: boolean;
1059
1070
  displayTemplate?: string;
1060
1071
  displayTemplateMultiValue?: string;
1061
1072
  type: SupportedAttributeTypes;
@@ -1106,4 +1117,26 @@ export interface CphLookupResponse {
1106
1117
  cphValid?: boolean | null;
1107
1118
  farmName?: string | null;
1108
1119
  }
1120
+ export type ActivityOperation = "created" | "updated" | "deleted" | "voided";
1121
+ export interface ActivityChange {
1122
+ before?: any;
1123
+ after?: any;
1124
+ }
1125
+ export interface ActivityLog {
1126
+ id: string;
1127
+ firstEventAt: Timestamp;
1128
+ lastEventAt: Timestamp;
1129
+ userId: string | null;
1130
+ userName?: string;
1131
+ eventType: WebhookEventName;
1132
+ entityType: ObjectType;
1133
+ entityId: string;
1134
+ entityLabel?: string;
1135
+ saleIds: string[];
1136
+ operation: ActivityOperation;
1137
+ changeCount: number;
1138
+ changes?: {
1139
+ [fieldPath: string]: ActivityChange;
1140
+ };
1141
+ }
1109
1142
  export {};
@@ -5,6 +5,12 @@ export declare function sortByLotNumber<T extends {
5
5
  lotNumber: string;
6
6
  }>(lots: T[]): T[];
7
7
  /***
8
- * Generate the next lot number in a sequence:
8
+ * Generate the next lot number in a sequence.
9
+ * Handles various formats:
10
+ * - Simple: "7" -> "8"
11
+ * - Alphanumeric: "7A" -> "7B"
12
+ * - Range: "1-3" -> "4", "1 - 3" -> "4" (flexible whitespace)
13
+ * - Range with alpha: "1-3A" -> "3B"
14
+ * - Compound: "1-3, 10" -> "11", "1-5, 7-9" -> "10"
9
15
  */
10
16
  export declare function nextLotNumber(previousLotNumber: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marteye/studiojs",
3
- "version": "1.1.37",
3
+ "version": "1.1.39",
4
4
  "description": "MartEye Studio JavaScript SDK",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",