@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.
- package/dist/index.d.ts +59 -2
- package/dist/index.esm.js +144 -61
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +144 -61
- package/dist/index.js.map +1 -1
- package/dist/resources/carts.d.ts +35 -0
- package/dist/resources/ledger.d.ts +15 -0
- package/dist/resources/sales.d.ts +2 -1
- package/dist/resources.d.ts +9 -0
- package/dist/studio.d.ts +9 -0
- package/dist/types.d.ts +9 -0
- package/dist/utils/lots.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ declare function SimpleHttpClient(baseUrl: string, apiKey: string, fetch: any, d
|
|
|
8
8
|
};
|
|
9
9
|
type HttpClient = ReturnType<typeof SimpleHttpClient>;
|
|
10
10
|
|
|
11
|
+
interface LedgerBalanceResponse {
|
|
12
|
+
balanceInCents: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
type Timestamp = string;
|
|
12
16
|
type ClientType = "Seller" | "Buyer";
|
|
13
17
|
type SuperType = "Sheep" | "Goats" | "Cattle" | "Pigs" | "Horses" | "Deer" | "Poultry" | "Machinery" | "Antiques" | "Other";
|
|
@@ -56,6 +60,7 @@ interface SettingsMarketDefaults {
|
|
|
56
60
|
defaultUnitOfSale: UnitOfSale;
|
|
57
61
|
defaultSuperType?: SuperType | null;
|
|
58
62
|
defaultSettleDebtsFirst?: boolean;
|
|
63
|
+
liveEmailsEnabled?: boolean;
|
|
59
64
|
lotDescriptionTemplateMap?: {
|
|
60
65
|
default: string | undefined;
|
|
61
66
|
[supertype: string]: string | undefined;
|
|
@@ -119,6 +124,7 @@ type DisplayBoardMode = "off" | "live" | "manual" | {
|
|
|
119
124
|
type: "focused";
|
|
120
125
|
field: string;
|
|
121
126
|
};
|
|
127
|
+
type SalePublishStatus = "unpublished" | "sale" | "catalogPublished";
|
|
122
128
|
interface Sale {
|
|
123
129
|
id: string;
|
|
124
130
|
createdAt: Timestamp;
|
|
@@ -186,6 +192,13 @@ interface Sale {
|
|
|
186
192
|
};
|
|
187
193
|
};
|
|
188
194
|
editedBy?: string[];
|
|
195
|
+
/**
|
|
196
|
+
* Publishing status for external systems
|
|
197
|
+
* - unpublished: Not listed in external system
|
|
198
|
+
* - sale: Sale date is listed externally
|
|
199
|
+
* - catalogPublished: Sale and catalog information synced
|
|
200
|
+
*/
|
|
201
|
+
publishStatus?: SalePublishStatus;
|
|
189
202
|
}
|
|
190
203
|
interface TemplateSaleData {
|
|
191
204
|
name?: string;
|
|
@@ -1182,6 +1195,7 @@ type types_ProductCodeConfiguration = ProductCodeConfiguration;
|
|
|
1182
1195
|
type types_ProductConfiguration = ProductConfiguration;
|
|
1183
1196
|
type types_Sale = Sale;
|
|
1184
1197
|
type types_SaleFromSearch = SaleFromSearch;
|
|
1198
|
+
type types_SalePublishStatus = SalePublishStatus;
|
|
1185
1199
|
type types_SaleTemplate = SaleTemplate;
|
|
1186
1200
|
type types_SettingsAccessories = SettingsAccessories;
|
|
1187
1201
|
type types_SettingsAdjustmentsConfiguration = SettingsAdjustmentsConfiguration;
|
|
@@ -1214,7 +1228,7 @@ type types_WebhookEventName = WebhookEventName;
|
|
|
1214
1228
|
declare const types_supportedWebhookEvents: typeof supportedWebhookEvents;
|
|
1215
1229
|
declare namespace types {
|
|
1216
1230
|
export { types_IMAGE_SIZES_VALUES as IMAGE_SIZES_VALUES, types_LivestockSuperTypes as LivestockSuperTypes, types_SupportedCurrencyCodes as SupportedCurrencyCodes, types_SupportedPaymentMethods as SupportedPaymentMethods, types_SupportedSuperTypes as SupportedSuperTypes, types_SupportedUnitsOfSale as SupportedUnitsOfSale, types_VIDEO_TASKS_VALUES as VIDEO_TASKS_VALUES, types_supportedWebhookEvents as supportedWebhookEvents };
|
|
1217
|
-
export type { types_Accessory as Accessory, types_Address as Address, types_AddressWrapper as AddressWrapper, types_AdjustmentTarget as AdjustmentTarget, types_AdjustmentTotalTarget as AdjustmentTotalTarget, types_AdjustmentsConfiguration as AdjustmentsConfiguration, types_AppParameterConfig as AppParameterConfig, types_Application as Application, types_AttributeDefinition as AttributeDefinition, types_AttributeValueType as AttributeValueType, types_BankDetails as BankDetails, types_Cart as Cart, types_CartItem as CartItem, types_ChequeField as ChequeField, types_ClientType as ClientType, types_CphLookupResponse as CphLookupResponse, types_CurrenciesWithGuinea as CurrenciesWithGuinea, types_Currency as Currency, types_Customer as Customer, types_CustomerBankDetails as CustomerBankDetails, types_CustomerContact as CustomerContact, types_CustomerFromSearch as CustomerFromSearch, types_DeviceType as DeviceType, types_DisplayBoardMode as DisplayBoardMode, types_DraftInvoice as DraftInvoice, types_EmailWrapper as EmailWrapper, types_FarmAssurances as FarmAssurances, types_FieldPositions as FieldPositions, types_ImageSizes as ImageSizes, types_IncrementLadder as IncrementLadder, types_IncrementLadderItem as IncrementLadderItem, types_Invoice as Invoice, types_InvoiceDeliveryPreference as InvoiceDeliveryPreference, types_InvoiceField as InvoiceField, types_InvoiceLineItem as InvoiceLineItem, types_InvoiceTotalAdjustmentConfiguration as InvoiceTotalAdjustmentConfiguration, types_InvoiceTotals as InvoiceTotals, types_LineItemAdjustmentConfiguration as LineItemAdjustmentConfiguration, types_Lot as Lot, types_LotGeneratedValues as LotGeneratedValues, types_LotIssue as LotIssue, types_LotItem as LotItem, types_LotSaleStatus as LotSaleStatus, types_LotWithItemsAsArray as LotWithItemsAsArray, types_Market as Market, types_MarketBankDetails as MarketBankDetails, types_MarketReportHeaders as MarketReportHeaders, types_MartEyeLiveSaleSettings as MartEyeLiveSaleSettings, types_MartEyeTimedSaleSettings as MartEyeTimedSaleSettings, types_Media as Media, types_MemberSharingConfiguration as MemberSharingConfiguration, types_ObjectType as ObjectType, types_Payment as Payment, types_PaymentMethod as PaymentMethod, types_Payout as Payout, types_PayoutMethod as PayoutMethod, types_PhoneNumberWrapper as PhoneNumberWrapper, types_Printer as Printer, types_Product as Product, types_ProductCodeConfiguration as ProductCodeConfiguration, types_ProductConfiguration as ProductConfiguration, types_Sale as Sale, types_SaleFromSearch as SaleFromSearch, types_SaleTemplate as SaleTemplate, types_SettingsAccessories as SettingsAccessories, types_SettingsAdjustmentsConfiguration as SettingsAdjustmentsConfiguration, types_SettingsGlobalAttributes as SettingsGlobalAttributes, types_SettingsMarketDefaults as SettingsMarketDefaults, types_SettingsPrinters as SettingsPrinters, types_SettingsProductCodes as SettingsProductCodes, types_SettingsTaxRates as SettingsTaxRates, types_ShortCustomerDetails as ShortCustomerDetails, types_SimplePaymentIn as SimplePaymentIn, types_SimplePaymentOut as SimplePaymentOut, types_StoredDataGridConfig as StoredDataGridConfig, types_StudioAppPartial as StudioAppPartial, types_SubtotalGroups as SubtotalGroups, types_SuperType as SuperType, types_SupportedAttributeTypes as SupportedAttributeTypes, types_SupportedCountryCode as SupportedCountryCode, SupportedFileTypesNames$1 as SupportedFileTypesNames, types_TablePosition as TablePosition, types_TaxRate as TaxRate, types_TemplateSaleData as TemplateSaleData, types_UnitOfSale as UnitOfSale, types_VideoTasks as VideoTasks, types_WebhookEvent as WebhookEvent, types_WebhookEventName as WebhookEventName };
|
|
1231
|
+
export type { types_Accessory as Accessory, types_Address as Address, types_AddressWrapper as AddressWrapper, types_AdjustmentTarget as AdjustmentTarget, types_AdjustmentTotalTarget as AdjustmentTotalTarget, types_AdjustmentsConfiguration as AdjustmentsConfiguration, types_AppParameterConfig as AppParameterConfig, types_Application as Application, types_AttributeDefinition as AttributeDefinition, types_AttributeValueType as AttributeValueType, types_BankDetails as BankDetails, types_Cart as Cart, types_CartItem as CartItem, types_ChequeField as ChequeField, types_ClientType as ClientType, types_CphLookupResponse as CphLookupResponse, types_CurrenciesWithGuinea as CurrenciesWithGuinea, types_Currency as Currency, types_Customer as Customer, types_CustomerBankDetails as CustomerBankDetails, types_CustomerContact as CustomerContact, types_CustomerFromSearch as CustomerFromSearch, types_DeviceType as DeviceType, types_DisplayBoardMode as DisplayBoardMode, types_DraftInvoice as DraftInvoice, types_EmailWrapper as EmailWrapper, types_FarmAssurances as FarmAssurances, types_FieldPositions as FieldPositions, types_ImageSizes as ImageSizes, types_IncrementLadder as IncrementLadder, types_IncrementLadderItem as IncrementLadderItem, types_Invoice as Invoice, types_InvoiceDeliveryPreference as InvoiceDeliveryPreference, types_InvoiceField as InvoiceField, types_InvoiceLineItem as InvoiceLineItem, types_InvoiceTotalAdjustmentConfiguration as InvoiceTotalAdjustmentConfiguration, types_InvoiceTotals as InvoiceTotals, types_LineItemAdjustmentConfiguration as LineItemAdjustmentConfiguration, types_Lot as Lot, types_LotGeneratedValues as LotGeneratedValues, types_LotIssue as LotIssue, types_LotItem as LotItem, types_LotSaleStatus as LotSaleStatus, types_LotWithItemsAsArray as LotWithItemsAsArray, types_Market as Market, types_MarketBankDetails as MarketBankDetails, types_MarketReportHeaders as MarketReportHeaders, types_MartEyeLiveSaleSettings as MartEyeLiveSaleSettings, types_MartEyeTimedSaleSettings as MartEyeTimedSaleSettings, types_Media as Media, types_MemberSharingConfiguration as MemberSharingConfiguration, types_ObjectType as ObjectType, types_Payment as Payment, types_PaymentMethod as PaymentMethod, types_Payout as Payout, types_PayoutMethod as PayoutMethod, types_PhoneNumberWrapper as PhoneNumberWrapper, types_Printer as Printer, types_Product as Product, types_ProductCodeConfiguration as ProductCodeConfiguration, types_ProductConfiguration as ProductConfiguration, types_Sale as Sale, types_SaleFromSearch as SaleFromSearch, types_SalePublishStatus as SalePublishStatus, types_SaleTemplate as SaleTemplate, types_SettingsAccessories as SettingsAccessories, types_SettingsAdjustmentsConfiguration as SettingsAdjustmentsConfiguration, types_SettingsGlobalAttributes as SettingsGlobalAttributes, types_SettingsMarketDefaults as SettingsMarketDefaults, types_SettingsPrinters as SettingsPrinters, types_SettingsProductCodes as SettingsProductCodes, types_SettingsTaxRates as SettingsTaxRates, types_ShortCustomerDetails as ShortCustomerDetails, types_SimplePaymentIn as SimplePaymentIn, types_SimplePaymentOut as SimplePaymentOut, types_StoredDataGridConfig as StoredDataGridConfig, types_StudioAppPartial as StudioAppPartial, types_SubtotalGroups as SubtotalGroups, types_SuperType as SuperType, types_SupportedAttributeTypes as SupportedAttributeTypes, types_SupportedCountryCode as SupportedCountryCode, SupportedFileTypesNames$1 as SupportedFileTypesNames, types_TablePosition as TablePosition, types_TaxRate as TaxRate, types_TemplateSaleData as TemplateSaleData, types_UnitOfSale as UnitOfSale, types_VideoTasks as VideoTasks, types_WebhookEvent as WebhookEvent, types_WebhookEventName as WebhookEventName };
|
|
1218
1232
|
}
|
|
1219
1233
|
|
|
1220
1234
|
interface ListContactsResponse {
|
|
@@ -1501,6 +1515,25 @@ interface ListApplicationsResponse {
|
|
|
1501
1515
|
hasMore: boolean;
|
|
1502
1516
|
}
|
|
1503
1517
|
|
|
1518
|
+
interface LotsBySale {
|
|
1519
|
+
saleId: string;
|
|
1520
|
+
marketId: string;
|
|
1521
|
+
lots: Lot[];
|
|
1522
|
+
}
|
|
1523
|
+
interface CartResponse {
|
|
1524
|
+
customerId: string;
|
|
1525
|
+
extras: CartItem[];
|
|
1526
|
+
lotsBuyingBySale: LotsBySale[];
|
|
1527
|
+
lotsSellingBySale: LotsBySale[];
|
|
1528
|
+
}
|
|
1529
|
+
interface AddExtraPayload {
|
|
1530
|
+
productId: string;
|
|
1531
|
+
clientType: "Seller" | "Buyer";
|
|
1532
|
+
quantity: number;
|
|
1533
|
+
unitPriceInCents: number;
|
|
1534
|
+
passthroughFundsToCustomerId?: string | null;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1504
1537
|
declare function resources(httpClient: HttpClient): {
|
|
1505
1538
|
markets: {
|
|
1506
1539
|
get: (marketId: string) => Promise<Market>;
|
|
@@ -1538,6 +1571,7 @@ declare function resources(httpClient: HttpClient): {
|
|
|
1538
1571
|
recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
|
|
1539
1572
|
defaultProductCode?: string;
|
|
1540
1573
|
attributeDefaults?: Record<string, any>;
|
|
1574
|
+
publishStatus?: SalePublishStatus;
|
|
1541
1575
|
marteyeSettings?: {
|
|
1542
1576
|
description?: string;
|
|
1543
1577
|
image?: string;
|
|
@@ -1637,6 +1671,11 @@ declare function resources(httpClient: HttpClient): {
|
|
|
1637
1671
|
}) => Promise<LotItem>;
|
|
1638
1672
|
delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
|
|
1639
1673
|
};
|
|
1674
|
+
carts: {
|
|
1675
|
+
get: (marketId: string, customerId: string) => Promise<CartResponse>;
|
|
1676
|
+
addExtra: (marketId: string, customerId: string, data: AddExtraPayload) => Promise<CartResponse>;
|
|
1677
|
+
removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
|
|
1678
|
+
};
|
|
1640
1679
|
cph: {
|
|
1641
1680
|
lookup: (marketId: string, cph: string) => Promise<CphLookupResponse>;
|
|
1642
1681
|
};
|
|
@@ -1751,6 +1790,9 @@ declare function resources(httpClient: HttpClient): {
|
|
|
1751
1790
|
update: (marketId: string, customerId: string, contactId: string, payload: CreateOrUpdateContactPayload) => Promise<CustomerContact>;
|
|
1752
1791
|
delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
|
|
1753
1792
|
};
|
|
1793
|
+
ledger: {
|
|
1794
|
+
getBalance: (marketId: string, account: string) => Promise<LedgerBalanceResponse>;
|
|
1795
|
+
};
|
|
1754
1796
|
};
|
|
1755
1797
|
|
|
1756
1798
|
type StudioInstance = ReturnType<typeof resources> & {
|
|
@@ -1799,6 +1841,7 @@ declare function Studio(info?: {
|
|
|
1799
1841
|
recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
|
|
1800
1842
|
defaultProductCode?: string;
|
|
1801
1843
|
attributeDefaults?: Record<string, any>;
|
|
1844
|
+
publishStatus?: SalePublishStatus;
|
|
1802
1845
|
marteyeSettings?: {
|
|
1803
1846
|
description?: string;
|
|
1804
1847
|
image?: string;
|
|
@@ -1898,6 +1941,11 @@ declare function Studio(info?: {
|
|
|
1898
1941
|
}) => Promise<LotItem>;
|
|
1899
1942
|
delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
|
|
1900
1943
|
};
|
|
1944
|
+
carts: {
|
|
1945
|
+
get: (marketId: string, customerId: string) => Promise<CartResponse>;
|
|
1946
|
+
addExtra: (marketId: string, customerId: string, data: AddExtraPayload) => Promise<CartResponse>;
|
|
1947
|
+
removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
|
|
1948
|
+
};
|
|
1901
1949
|
cph: {
|
|
1902
1950
|
lookup: (marketId: string, cph: string) => Promise<CphLookupResponse>;
|
|
1903
1951
|
};
|
|
@@ -2012,6 +2060,9 @@ declare function Studio(info?: {
|
|
|
2012
2060
|
update: (marketId: string, customerId: string, contactId: string, payload: CreateOrUpdateContactPayload) => Promise<CustomerContact>;
|
|
2013
2061
|
delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
|
|
2014
2062
|
};
|
|
2063
|
+
ledger: {
|
|
2064
|
+
getBalance: (marketId: string, account: string) => Promise<LedgerBalanceResponse>;
|
|
2065
|
+
};
|
|
2015
2066
|
};
|
|
2016
2067
|
|
|
2017
2068
|
/**
|
|
@@ -2111,7 +2162,13 @@ declare function sortByLotNumber<T extends {
|
|
|
2111
2162
|
lotNumber: string;
|
|
2112
2163
|
}>(lots: T[]): T[];
|
|
2113
2164
|
/***
|
|
2114
|
-
* Generate the next lot number in a sequence
|
|
2165
|
+
* Generate the next lot number in a sequence.
|
|
2166
|
+
* Handles various formats:
|
|
2167
|
+
* - Simple: "7" -> "8"
|
|
2168
|
+
* - Alphanumeric: "7A" -> "7B"
|
|
2169
|
+
* - Range: "1-3" -> "4", "1 - 3" -> "4" (flexible whitespace)
|
|
2170
|
+
* - Range with alpha: "1-3A" -> "3B"
|
|
2171
|
+
* - Compound: "1-3, 10" -> "11", "1-5, 7-9" -> "10"
|
|
2115
2172
|
*/
|
|
2116
2173
|
declare function nextLotNumber(previousLotNumber: string): string;
|
|
2117
2174
|
|
package/dist/index.esm.js
CHANGED
|
@@ -70,7 +70,7 @@ function SimpleHttpClient(baseUrl, apiKey, fetch, defaultTimeout, debug = false)
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// Path: studiojs/src/resources/markets.ts
|
|
73
|
-
function create$
|
|
73
|
+
function create$m(_) {
|
|
74
74
|
const actions = {
|
|
75
75
|
/***
|
|
76
76
|
* This is used to construct the action from the request body
|
|
@@ -100,7 +100,7 @@ function create$k(_) {
|
|
|
100
100
|
return actions;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
function create$
|
|
103
|
+
function create$l(httpClient) {
|
|
104
104
|
return {
|
|
105
105
|
list: async (marketId) => {
|
|
106
106
|
return httpClient.get(`/${marketId}/adjustments`);
|
|
@@ -117,7 +117,30 @@ function create$j(httpClient) {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
function create$
|
|
120
|
+
function create$k(httpClient) {
|
|
121
|
+
return {
|
|
122
|
+
/**
|
|
123
|
+
* Get the full cart for a customer including extras and uninvoiced lots
|
|
124
|
+
*/
|
|
125
|
+
get: async (marketId, customerId) => {
|
|
126
|
+
return httpClient.get(`/${marketId}/carts/${customerId}`);
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Add an extra product to the customer's cart
|
|
130
|
+
*/
|
|
131
|
+
addExtra: async (marketId, customerId, data) => {
|
|
132
|
+
return httpClient.post(`/${marketId}/carts/${customerId}`, data);
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Remove an extra from the customer's cart
|
|
136
|
+
*/
|
|
137
|
+
removeExtra: async (marketId, customerId, itemId) => {
|
|
138
|
+
return httpClient.delete(`/${marketId}/carts/${customerId}/${itemId}`);
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function create$j(httpClient) {
|
|
121
144
|
return {
|
|
122
145
|
list: async (marketId) => {
|
|
123
146
|
return httpClient.get(`/${marketId}/extras`);
|
|
@@ -137,7 +160,7 @@ function create$i(httpClient) {
|
|
|
137
160
|
/***
|
|
138
161
|
* Bidder applications
|
|
139
162
|
*/
|
|
140
|
-
function create$
|
|
163
|
+
function create$i(httpClient) {
|
|
141
164
|
let applications = {
|
|
142
165
|
/**
|
|
143
166
|
* List applications for a market with optional filtering
|
|
@@ -204,7 +227,7 @@ function create$h(httpClient) {
|
|
|
204
227
|
}
|
|
205
228
|
|
|
206
229
|
// Path: studiojs/src/resources/markets.ts
|
|
207
|
-
function create$
|
|
230
|
+
function create$h(httpClient) {
|
|
208
231
|
let customers = {
|
|
209
232
|
list: async (marketId, lastId) => {
|
|
210
233
|
let params = {};
|
|
@@ -5041,7 +5064,7 @@ const uploadSingleFile = async (input, token) => {
|
|
|
5041
5064
|
};
|
|
5042
5065
|
|
|
5043
5066
|
// Multipart Upload for Media to the MARTEYE Media Service
|
|
5044
|
-
function create$
|
|
5067
|
+
function create$g() {
|
|
5045
5068
|
const files = {
|
|
5046
5069
|
uploadSingleFile: async (input, token) => {
|
|
5047
5070
|
return await uploadSingleFile(input, token);
|
|
@@ -5056,7 +5079,7 @@ function create$f() {
|
|
|
5056
5079
|
return files;
|
|
5057
5080
|
}
|
|
5058
5081
|
|
|
5059
|
-
function create$
|
|
5082
|
+
function create$f(httpClient) {
|
|
5060
5083
|
const invoices = {
|
|
5061
5084
|
/**
|
|
5062
5085
|
* List all invoices for a market with pagination
|
|
@@ -5084,7 +5107,7 @@ function create$e(httpClient) {
|
|
|
5084
5107
|
return invoices;
|
|
5085
5108
|
}
|
|
5086
5109
|
|
|
5087
|
-
function create$
|
|
5110
|
+
function create$e(httpClient) {
|
|
5088
5111
|
return {
|
|
5089
5112
|
create: async (marketId, saleId, lotId, data) => {
|
|
5090
5113
|
return httpClient.post(`/${marketId}/sales/${saleId}/lots/${lotId}/items`, data);
|
|
@@ -5101,7 +5124,7 @@ function create$d(httpClient) {
|
|
|
5101
5124
|
/**
|
|
5102
5125
|
* Defines the possible status values for a lot in a sale
|
|
5103
5126
|
*/
|
|
5104
|
-
function create$
|
|
5127
|
+
function create$d(httpClient) {
|
|
5105
5128
|
return {
|
|
5106
5129
|
get: async (marketId, saleId, lotId) => {
|
|
5107
5130
|
return httpClient.get(`/${marketId}/sales/${saleId}/lots/${lotId}`);
|
|
@@ -5121,7 +5144,7 @@ function create$c(httpClient) {
|
|
|
5121
5144
|
};
|
|
5122
5145
|
}
|
|
5123
5146
|
|
|
5124
|
-
function create$
|
|
5147
|
+
function create$c(httpClient) {
|
|
5125
5148
|
const markets = {
|
|
5126
5149
|
get: async (marketId) => {
|
|
5127
5150
|
return httpClient.get(`/${marketId}`);
|
|
@@ -5143,7 +5166,7 @@ function create$b(httpClient) {
|
|
|
5143
5166
|
return markets;
|
|
5144
5167
|
}
|
|
5145
5168
|
|
|
5146
|
-
function create$
|
|
5169
|
+
function create$b(httpClient) {
|
|
5147
5170
|
const payments = {
|
|
5148
5171
|
/**
|
|
5149
5172
|
* List all payments for a market with pagination
|
|
@@ -5171,7 +5194,7 @@ function create$a(httpClient) {
|
|
|
5171
5194
|
return payments;
|
|
5172
5195
|
}
|
|
5173
5196
|
|
|
5174
|
-
function create$
|
|
5197
|
+
function create$a(httpClient) {
|
|
5175
5198
|
const payouts = {
|
|
5176
5199
|
/**
|
|
5177
5200
|
* List all payouts for a market with pagination
|
|
@@ -5199,24 +5222,24 @@ function create$9(httpClient) {
|
|
|
5199
5222
|
return payouts;
|
|
5200
5223
|
}
|
|
5201
5224
|
|
|
5202
|
-
function create$
|
|
5225
|
+
function create$9(httpClient) {
|
|
5203
5226
|
return {
|
|
5204
5227
|
list: async (marketId) => {
|
|
5205
|
-
return httpClient.get(`/${marketId}/
|
|
5228
|
+
return httpClient.get(`/${marketId}/product-codes`);
|
|
5206
5229
|
},
|
|
5207
5230
|
get: async (marketId, id) => {
|
|
5208
|
-
return httpClient.get(`/${marketId}/
|
|
5231
|
+
return httpClient.get(`/${marketId}/product-codes/${id}`);
|
|
5209
5232
|
},
|
|
5210
5233
|
create: async (marketId, data) => {
|
|
5211
|
-
return httpClient.post(`/${marketId}/
|
|
5234
|
+
return httpClient.post(`/${marketId}/product-codes`, data);
|
|
5212
5235
|
},
|
|
5213
5236
|
update: async (marketId, id, data) => {
|
|
5214
|
-
return httpClient.post(`/${marketId}/
|
|
5237
|
+
return httpClient.post(`/${marketId}/product-codes/${id}`, data);
|
|
5215
5238
|
},
|
|
5216
5239
|
};
|
|
5217
5240
|
}
|
|
5218
5241
|
|
|
5219
|
-
function create$
|
|
5242
|
+
function create$8(httpClient) {
|
|
5220
5243
|
return {
|
|
5221
5244
|
get: async (marketId, saleId) => {
|
|
5222
5245
|
return httpClient.get(`/${marketId}/sales/${saleId}`);
|
|
@@ -5233,7 +5256,7 @@ function create$7(httpClient) {
|
|
|
5233
5256
|
};
|
|
5234
5257
|
}
|
|
5235
5258
|
|
|
5236
|
-
function create$
|
|
5259
|
+
function create$7(httpClient) {
|
|
5237
5260
|
return {
|
|
5238
5261
|
list: async (marketId) => {
|
|
5239
5262
|
return httpClient.get(`/${marketId}/sale-templates`);
|
|
@@ -5253,7 +5276,7 @@ function create$6(httpClient) {
|
|
|
5253
5276
|
};
|
|
5254
5277
|
}
|
|
5255
5278
|
|
|
5256
|
-
function create$
|
|
5279
|
+
function create$6(httpClient) {
|
|
5257
5280
|
let search = {
|
|
5258
5281
|
/**
|
|
5259
5282
|
* Search for documents within a market
|
|
@@ -5268,7 +5291,7 @@ function create$5(httpClient) {
|
|
|
5268
5291
|
return search;
|
|
5269
5292
|
}
|
|
5270
5293
|
|
|
5271
|
-
function create$
|
|
5294
|
+
function create$5(httpClient) {
|
|
5272
5295
|
return {
|
|
5273
5296
|
get: async (marketId) => {
|
|
5274
5297
|
return httpClient.get(`/${marketId}/settings`);
|
|
@@ -5276,7 +5299,7 @@ function create$4(httpClient) {
|
|
|
5276
5299
|
};
|
|
5277
5300
|
}
|
|
5278
5301
|
|
|
5279
|
-
function create$
|
|
5302
|
+
function create$4(httpClient) {
|
|
5280
5303
|
return {
|
|
5281
5304
|
list: async (marketId) => {
|
|
5282
5305
|
return httpClient.get(`/${marketId}/tax_rates`);
|
|
@@ -5288,7 +5311,7 @@ function create$3(httpClient) {
|
|
|
5288
5311
|
}
|
|
5289
5312
|
|
|
5290
5313
|
// Path: studiojs/src/resources/markets.ts
|
|
5291
|
-
function create$
|
|
5314
|
+
function create$3(_) {
|
|
5292
5315
|
const webhooks = {
|
|
5293
5316
|
/***
|
|
5294
5317
|
* This is used to construct the webhook event from the request body
|
|
@@ -5323,13 +5346,13 @@ function create$2(_) {
|
|
|
5323
5346
|
return webhooks;
|
|
5324
5347
|
}
|
|
5325
5348
|
|
|
5326
|
-
function create$
|
|
5349
|
+
function create$2(httpClient) {
|
|
5327
5350
|
return {
|
|
5328
5351
|
lookup: async (marketId, cph) => httpClient.get(`/${marketId}/cph`, { cph }),
|
|
5329
5352
|
};
|
|
5330
5353
|
}
|
|
5331
5354
|
|
|
5332
|
-
function create(httpClient) {
|
|
5355
|
+
function create$1(httpClient) {
|
|
5333
5356
|
return {
|
|
5334
5357
|
list: async (marketId, customerId, params) => {
|
|
5335
5358
|
const query = {};
|
|
@@ -5354,29 +5377,47 @@ function create(httpClient) {
|
|
|
5354
5377
|
};
|
|
5355
5378
|
}
|
|
5356
5379
|
|
|
5380
|
+
function create(httpClient) {
|
|
5381
|
+
let ledger = {
|
|
5382
|
+
/**
|
|
5383
|
+
* Get the current balance for a ledger account
|
|
5384
|
+
* @param marketId - ID of the market
|
|
5385
|
+
* @param account - Full account string (format: owner:accountType:accountName)
|
|
5386
|
+
* e.g. "customerId:asset:trade receivable" or "market:liability:trade payable"
|
|
5387
|
+
* @returns The current balance in cents
|
|
5388
|
+
*/
|
|
5389
|
+
getBalance: async (marketId, account) => {
|
|
5390
|
+
return httpClient.get(`/${marketId}/ledger/balance`, { account });
|
|
5391
|
+
},
|
|
5392
|
+
};
|
|
5393
|
+
return ledger;
|
|
5394
|
+
}
|
|
5395
|
+
|
|
5357
5396
|
function resources(httpClient) {
|
|
5358
5397
|
return {
|
|
5359
|
-
markets: create$
|
|
5360
|
-
sales: create$
|
|
5361
|
-
lots: create$
|
|
5362
|
-
lotitems: create$
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5398
|
+
markets: create$c(httpClient),
|
|
5399
|
+
sales: create$8(httpClient),
|
|
5400
|
+
lots: create$d(httpClient),
|
|
5401
|
+
lotitems: create$e(httpClient),
|
|
5402
|
+
carts: create$k(httpClient),
|
|
5403
|
+
cph: create$2(httpClient),
|
|
5404
|
+
webhooks: create$3(),
|
|
5405
|
+
actions: create$m(),
|
|
5406
|
+
bidderApplications: create$i(httpClient),
|
|
5407
|
+
settings: create$5(httpClient),
|
|
5408
|
+
adjustments: create$l(httpClient),
|
|
5409
|
+
extras: create$j(httpClient),
|
|
5410
|
+
productCodes: create$9(httpClient),
|
|
5411
|
+
saleTemplates: create$7(httpClient),
|
|
5412
|
+
taxRates: create$4(httpClient),
|
|
5413
|
+
customers: create$h(httpClient),
|
|
5414
|
+
invoices: create$f(httpClient),
|
|
5415
|
+
payments: create$b(httpClient),
|
|
5416
|
+
payouts: create$a(httpClient),
|
|
5417
|
+
search: create$6(httpClient),
|
|
5418
|
+
files: create$g(),
|
|
5419
|
+
contacts: create$1(httpClient),
|
|
5420
|
+
ledger: create(httpClient),
|
|
5380
5421
|
};
|
|
5381
5422
|
}
|
|
5382
5423
|
|
|
@@ -5750,28 +5791,70 @@ function sortByLotNumber(lots) {
|
|
|
5750
5791
|
return [...lots].sort(lotComparator);
|
|
5751
5792
|
}
|
|
5752
5793
|
/***
|
|
5753
|
-
* Generate the next lot number in a sequence
|
|
5794
|
+
* Generate the next lot number in a sequence.
|
|
5795
|
+
* Handles various formats:
|
|
5796
|
+
* - Simple: "7" -> "8"
|
|
5797
|
+
* - Alphanumeric: "7A" -> "7B"
|
|
5798
|
+
* - Range: "1-3" -> "4", "1 - 3" -> "4" (flexible whitespace)
|
|
5799
|
+
* - Range with alpha: "1-3A" -> "3B"
|
|
5800
|
+
* - Compound: "1-3, 10" -> "11", "1-5, 7-9" -> "10"
|
|
5754
5801
|
*/
|
|
5755
5802
|
function nextLotNumber(previousLotNumber) {
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5803
|
+
// Helper to compare alpha suffixes (longer = greater, then alphabetically)
|
|
5804
|
+
function isGreaterAlpha(a, b) {
|
|
5805
|
+
let aUpper = a.toUpperCase();
|
|
5806
|
+
let bUpper = b.toUpperCase();
|
|
5807
|
+
if (aUpper.length !== bUpper.length) {
|
|
5808
|
+
return aUpper.length > bUpper.length;
|
|
5809
|
+
}
|
|
5810
|
+
return aUpper > bUpper;
|
|
5811
|
+
}
|
|
5812
|
+
// Split by comma (handles "7-8, 10" format), flexible with whitespace
|
|
5813
|
+
let segments = previousLotNumber.split(/\s*,\s*/);
|
|
5814
|
+
let maxNum = null;
|
|
5815
|
+
let maxAlpha = "";
|
|
5816
|
+
for (let segment of segments) {
|
|
5817
|
+
// Check if segment is a range (contains hyphen with numbers on both sides)
|
|
5818
|
+
// Flexible with whitespace: "1-3", "1 - 3", "1- 3", "1 -3", "1 -3"
|
|
5819
|
+
let rangeMatch = segment.trim().match(/^(\d+)\s*-\s*(\d+)(\D*)$/);
|
|
5820
|
+
if (rangeMatch) {
|
|
5821
|
+
// Range format: take the end number
|
|
5822
|
+
let endNum = parseInt(rangeMatch[2], 10);
|
|
5823
|
+
let alphaPart = rangeMatch[3] || "";
|
|
5824
|
+
if (maxNum === null ||
|
|
5825
|
+
endNum > maxNum ||
|
|
5826
|
+
(endNum === maxNum && isGreaterAlpha(alphaPart, maxAlpha))) {
|
|
5827
|
+
maxNum = endNum;
|
|
5828
|
+
maxAlpha = alphaPart;
|
|
5829
|
+
}
|
|
5764
5830
|
}
|
|
5765
5831
|
else {
|
|
5766
|
-
//
|
|
5767
|
-
|
|
5768
|
-
|
|
5832
|
+
// Single value: "7" or "7A"
|
|
5833
|
+
let singleMatch = segment.trim().match(/^(\d+)(\D*)$/);
|
|
5834
|
+
if (singleMatch) {
|
|
5835
|
+
let num = parseInt(singleMatch[1], 10);
|
|
5836
|
+
let alphaPart = singleMatch[2] || "";
|
|
5837
|
+
if (maxNum === null ||
|
|
5838
|
+
num > maxNum ||
|
|
5839
|
+
(num === maxNum && isGreaterAlpha(alphaPart, maxAlpha))) {
|
|
5840
|
+
maxNum = num;
|
|
5841
|
+
maxAlpha = alphaPart;
|
|
5842
|
+
}
|
|
5843
|
+
}
|
|
5769
5844
|
}
|
|
5770
5845
|
}
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5846
|
+
// If we found numeric parts, increment
|
|
5847
|
+
if (maxNum !== null) {
|
|
5848
|
+
if (maxAlpha === "") {
|
|
5849
|
+
return (maxNum + 1).toString();
|
|
5850
|
+
}
|
|
5851
|
+
else {
|
|
5852
|
+
let nextAlpha = incrementAlphaSequence(maxAlpha);
|
|
5853
|
+
return maxNum + nextAlpha;
|
|
5854
|
+
}
|
|
5774
5855
|
}
|
|
5856
|
+
// Fallback: treat as pure alphabetic (e.g., "A" -> "B")
|
|
5857
|
+
return incrementAlphaSequence(previousLotNumber);
|
|
5775
5858
|
}
|
|
5776
5859
|
function incrementAlphaSequence(alpha) {
|
|
5777
5860
|
if (alpha === "") {
|