@marteye/studiojs 1.1.37 → 1.1.38

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 { 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,15 @@
1
+ import { HttpClient } from "../net/http";
2
+ export interface LedgerBalanceResponse {
3
+ balanceInCents: number;
4
+ }
5
+ export default function create(httpClient: HttpClient): {
6
+ /**
7
+ * Get the current balance for a ledger account
8
+ * @param marketId - ID of the market
9
+ * @param account - Full account string (format: owner:accountType:accountName)
10
+ * e.g. "customerId:asset:trade receivable" or "market:liability:trade payable"
11
+ * @returns The current balance in cents
12
+ */
13
+ getBalance: (marketId: string, account: string) => Promise<LedgerBalanceResponse>;
14
+ };
15
+ export type Ledger = 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;
@@ -36,6 +36,7 @@ export default function resources(httpClient: HttpClient): {
36
36
  recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
37
37
  defaultProductCode?: string;
38
38
  attributeDefaults?: Record<string, any>;
39
+ publishStatus?: import("./types").SalePublishStatus;
39
40
  marteyeSettings?: {
40
41
  description?: string;
41
42
  image?: string;
@@ -135,6 +136,11 @@ export default function resources(httpClient: HttpClient): {
135
136
  }) => Promise<import("./types").LotItem>;
136
137
  delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
137
138
  };
139
+ carts: {
140
+ get: (marketId: string, customerId: string) => Promise<import("./resources/carts").CartResponse>;
141
+ addExtra: (marketId: string, customerId: string, data: import("./resources/carts").AddExtraPayload) => Promise<import("./resources/carts").CartResponse>;
142
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
143
+ };
138
144
  cph: {
139
145
  lookup: (marketId: string, cph: string) => Promise<import("./types").CphLookupResponse>;
140
146
  };
@@ -249,4 +255,7 @@ export default function resources(httpClient: HttpClient): {
249
255
  update: (marketId: string, customerId: string, contactId: string, payload: import("./resources/contacts").CreateOrUpdateContactPayload) => Promise<import("./types").CustomerContact>;
250
256
  delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
251
257
  };
258
+ ledger: {
259
+ getBalance: (marketId: string, account: string) => Promise<import("./resources/ledger").LedgerBalanceResponse>;
260
+ };
252
261
  };
package/dist/studio.d.ts CHANGED
@@ -45,6 +45,7 @@ export declare function Studio(info?: {
45
45
  recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
46
46
  defaultProductCode?: string;
47
47
  attributeDefaults?: Record<string, any>;
48
+ publishStatus?: import("./types").SalePublishStatus;
48
49
  marteyeSettings?: {
49
50
  description?: string;
50
51
  image?: string;
@@ -144,6 +145,11 @@ export declare function Studio(info?: {
144
145
  }) => Promise<import("./types").LotItem>;
145
146
  delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
146
147
  };
148
+ carts: {
149
+ get: (marketId: string, customerId: string) => Promise<import("./resources/carts").CartResponse>;
150
+ addExtra: (marketId: string, customerId: string, data: import("./resources/carts").AddExtraPayload) => Promise<import("./resources/carts").CartResponse>;
151
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
152
+ };
147
153
  cph: {
148
154
  lookup: (marketId: string, cph: string) => Promise<import("./types").CphLookupResponse>;
149
155
  };
@@ -258,4 +264,7 @@ export declare function Studio(info?: {
258
264
  update: (marketId: string, customerId: string, contactId: string, payload: import("./resources/contacts").CreateOrUpdateContactPayload) => Promise<import("./types").CustomerContact>;
259
265
  delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
260
266
  };
267
+ ledger: {
268
+ getBalance: (marketId: string, account: string) => Promise<import("./resources/ledger").LedgerBalanceResponse>;
269
+ };
261
270
  };
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" | "catalogPublished";
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
+ * - catalogPublished: Sale and catalog information synced
210
+ */
211
+ publishStatus?: SalePublishStatus;
203
212
  }
204
213
  export interface TemplateSaleData {
205
214
  name?: string;
@@ -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.38",
4
4
  "description": "MartEye Studio JavaScript SDK",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",