@marteye/studiojs 1.1.48-beta.1 → 1.1.49-beta.0

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 CHANGED
@@ -1,13 +1,3188 @@
1
- import { Studio } from "./studio";
2
- export * from "./createApp";
3
- export { Studio };
4
- export default Studio;
5
- import * as StudioTypes from "./types";
6
- export { StudioTypes };
7
- export type { StudioInstance } from "./studio";
8
- export type { ChunkedFile } from "./utils/multipart-upload";
9
- export { default as EarTag } from "./utils/eartag";
10
- export { default as CattlePassport } from "./utils/cattlePassport";
11
- export { lotComparator, nextLotNumber, sortByLotNumber } from "./utils/lots";
12
- export type { CreateCustomerPayload, UpdateCustomerPayload, KeeperDetailsUpdate, FarmAssuranceUpdate, } from "./resources/customers";
13
- export type { CustomerList, CustomerListQuery, RollingDateConfig, CustomerListMember, CustomerListFilters, CustomerListReportRow, CustomerListReportSummary, CustomerListViewResult, CustomerListType, CustomerListRole, CustomerListFilterGroup, CustomerListsListOptions, CustomerListMembersOptions, CustomerListViewOptions, CustomerListsListResponse, CustomerListMembersResponse, CustomerListPreviewResponse, CustomerListProductCodesResponse, CustomerListAddMembersResponse, CustomerListRemoveMemberResponse, CustomerListDeleteResponse, CustomerListRefreshResponse, CreateCustomerListPayload, UpdateCustomerListPayload, } from "./resources/customerLists";
1
+ import { z } from 'zod';
2
+
3
+ declare function SimpleHttpClient(baseUrl: string, apiKey: string, fetch: any, defaultTimeout: number, debug?: boolean): {
4
+ get: <T>(path: string, queryParams?: any) => Promise<T>;
5
+ post: <T>(path: string, body: any) => Promise<T>;
6
+ patch: <T>(path: string, body: any) => Promise<T>;
7
+ delete: <T>(path: string) => Promise<T>;
8
+ };
9
+ type HttpClient = ReturnType<typeof SimpleHttpClient>;
10
+
11
+ interface LedgerBalanceResponse {
12
+ balanceInCents: number;
13
+ }
14
+ interface LedgerTransaction {
15
+ id: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ transactionDate: string;
19
+ marketId: string;
20
+ account: string;
21
+ rollUpAccounts: string[];
22
+ accountType: "income" | "expense" | "asset" | "liability" | "equity";
23
+ accountName: string;
24
+ owner: "market" | string;
25
+ isMarketAccount: boolean;
26
+ amountInCents: number;
27
+ batchId: string;
28
+ batchDescription: string;
29
+ referenceId: string;
30
+ referenceType: string;
31
+ referenceTxnCount: number;
32
+ referenceGroupKey: string;
33
+ tags: Record<string, string | number | boolean>;
34
+ parentTransactionId: string | null;
35
+ currentBalanceInCents: number;
36
+ sumOfCreditsInCents: number;
37
+ sumOfDebitsInCents: number;
38
+ index: number;
39
+ }
40
+ interface TransactionsListResponse {
41
+ transactions: LedgerTransaction[];
42
+ nextCursor: string | null;
43
+ hasMore: boolean;
44
+ }
45
+ interface ListTransactionsParams {
46
+ account?: string;
47
+ referenceGroupKey?: string;
48
+ dateFrom?: string;
49
+ dateTo?: string;
50
+ limit?: number;
51
+ cursor?: string;
52
+ }
53
+
54
+ type Timestamp = string;
55
+ type ClientType = "Seller" | "Buyer";
56
+ type SuperType = "Sheep" | "Goats" | "Cattle" | "Pigs" | "Horses" | "Dogs" | "Deer" | "Poultry" | "Machinery" | "Antiques" | "Other";
57
+ declare const SupportedSuperTypes: SuperType[];
58
+ declare const LivestockSuperTypes: SuperType[];
59
+ type Currency = "GBP" | "EUR" | "USD";
60
+ declare const SupportedCurrencyCodes: Currency[];
61
+ declare const AccountTiers: {
62
+ readonly free: 0;
63
+ readonly basic: 1;
64
+ readonly standard: 2;
65
+ readonly premium: 3;
66
+ };
67
+ type AccountTier = (typeof AccountTiers)[keyof typeof AccountTiers];
68
+ type SupportedCountryCode = "GB-ENG" | "GB-SCT" | "GB-WLS" | "GB-NIR" | "IE";
69
+ type CurrenciesWithGuinea = Currency | "GUINEA-GBP";
70
+ type UnitOfSale = "Per KG" | "Per Item" | "Per Lot" | "Per 1000KG";
71
+ declare const SupportedUnitsOfSale: UnitOfSale[];
72
+ type PaymentMethod = "BACS" | "Cheque" | "BankTransfer" | "Cash" | "Card" | "Credit";
73
+ type InvoiceDeliveryPreference = "email" | "printed" | "both";
74
+ type PayoutMethod = "BACS" | "Cheque" | "Cash";
75
+ declare const SupportedPaymentMethods: PaymentMethod[];
76
+ interface Market {
77
+ id: string;
78
+ createdAt: Timestamp;
79
+ updatedAt: Timestamp;
80
+ name: string;
81
+ description: string;
82
+ logo: string;
83
+ primaryColour: string;
84
+ secondaryColour: string;
85
+ countryCode: SupportedCountryCode;
86
+ address: Address;
87
+ telephone?: string;
88
+ vatNumber?: string;
89
+ email?: string;
90
+ movementLocationNumbers?: {
91
+ number: string;
92
+ type: "CPH" | "Herd Number" | "Flock Number" | "Other";
93
+ createdAt: Timestamp;
94
+ }[];
95
+ paymentInstructions?: string;
96
+ accountTier?: AccountTier;
97
+ }
98
+ interface SettingsMarketDefaults {
99
+ updatedAt: Timestamp;
100
+ updatedBy: string | null;
101
+ marketId: string;
102
+ name: string;
103
+ description: string;
104
+ address: Address;
105
+ defaultCurrency: Currency;
106
+ defaultPayoutPreference: PayoutMethod;
107
+ defaultUnitOfSale: UnitOfSale;
108
+ defaultSuperType?: SuperType | null;
109
+ defaultSettleDebtsFirst?: boolean;
110
+ showInvoiceAveragesAndStats?: boolean;
111
+ liveEmailsEnabled?: boolean;
112
+ lotDescriptionTemplateMap?: {
113
+ default: string | undefined;
114
+ [supertype: string]: string | undefined;
115
+ };
116
+ rostrumAttributesMap?: {
117
+ default: string[] | undefined;
118
+ [supertype: string]: string[] | undefined;
119
+ };
120
+ selectDocumentIdsMap: {
121
+ [supertype: string]: string[];
122
+ };
123
+ priceEntrySheetColumnOrder?: string[];
124
+ enableLuckMoney?: boolean;
125
+ }
126
+ interface SettingsProductCodes {
127
+ [code: string]: ProductCodeConfiguration;
128
+ }
129
+ interface SettingsTaxRates {
130
+ [id: string]: TaxRate;
131
+ }
132
+ interface SettingsAdjustmentsConfiguration {
133
+ [id: string]: AdjustmentsConfiguration;
134
+ }
135
+ interface SettingsAccessories {
136
+ [id: string]: Accessory;
137
+ }
138
+ interface SettingsPrinters {
139
+ [id: string]: Printer;
140
+ }
141
+ type DeviceType = "globeWeigh" | "allflexRaceReader";
142
+ interface Accessory {
143
+ deviceId: string;
144
+ deviceType: DeviceType;
145
+ friendlyName: string;
146
+ endOfMessagePattern: string;
147
+ host: string;
148
+ isEnabled: boolean;
149
+ port: number;
150
+ regex: string;
151
+ saleProfileId: string;
152
+ timeoutMs: number;
153
+ updatedAt: Timestamp;
154
+ createdAt: Timestamp;
155
+ }
156
+ interface SettingsGlobalAttributes {
157
+ [id: string]: AttributeDefinition;
158
+ }
159
+ type AttributeValueType = string | number | boolean | Timestamp | Media | Media[];
160
+ /****
161
+ * Used to grant a user access to a market.
162
+ * Each member of staff should have their own.
163
+ */
164
+ interface MemberSharingConfiguration {
165
+ uid: string;
166
+ createdAt: Timestamp;
167
+ updatedAt: Timestamp;
168
+ displayName?: string;
169
+ photoURL?: string;
170
+ marketId: string;
171
+ role: "Owner" | "Admin" | "Editor";
172
+ }
173
+ type DisplayBoardMode = "off" | "live" | "manual" | {
174
+ type: "focused";
175
+ field: string;
176
+ };
177
+ type SalePublishStatus = "unpublished" | "sale" | "saleAndCatalog";
178
+ interface Sale {
179
+ id: string;
180
+ createdAt: Timestamp;
181
+ updatedAt: Timestamp;
182
+ updatedBy?: string | null;
183
+ startsAt: Timestamp;
184
+ closedAt?: Timestamp | null;
185
+ marketId: string;
186
+ name: string;
187
+ recurring?: null | "Weekly" | "Bi-weekly" | "Monthly";
188
+ defaultProductCode: string;
189
+ /**
190
+ * Default attributes values for any new lot item
191
+ */
192
+ attributeDefaults?: {
193
+ [attributekey: string]: AttributeValueType;
194
+ };
195
+ /**
196
+ * the codes that are allowed for the sale
197
+ */
198
+ availableProductCodes: string[];
199
+ /**
200
+ * the supertypes from the product codes. e..g Cattle, Sheep, Pigs etc
201
+ */
202
+ superTypes: SuperType[];
203
+ attributeSet: AttributeDefinition[];
204
+ attributeSetByProductCode: {
205
+ [code: string]: string[];
206
+ };
207
+ currentLotGroup?: string | null;
208
+ displayBoardLotGroup?: string | null | "BLANK";
209
+ nextLotGroup?: string | null;
210
+ /**
211
+ * Auto queue the next lot when the current lot is sold in rostrum
212
+ */
213
+ autoQueue?: boolean;
214
+ /**
215
+ * The sale profile ID to use for this sale. Which is used to find settings specific devices and printers etc.
216
+ */
217
+ saleProfileId?: string | null;
218
+ /**
219
+ * Show the display board
220
+ */
221
+ displayBoard?: boolean;
222
+ /**
223
+ * The display board mode (off, live, manual, or focused on a field)
224
+ */
225
+ displayBoardMode?: DisplayBoardMode;
226
+ martEyeId?: string | null;
227
+ marteyeSettings?: MartEyeTimedSaleSettings | MartEyeLiveSaleSettings | null;
228
+ stats?: {
229
+ lots: {
230
+ count: number;
231
+ sold: number;
232
+ invoiced: number;
233
+ invoicedBuyer?: number;
234
+ invoicedSeller?: number;
235
+ valueInCents: number;
236
+ };
237
+ lotItems: {
238
+ count: number;
239
+ };
240
+ customers: {
241
+ count: number;
242
+ buyers: number;
243
+ sellers: number;
244
+ };
245
+ };
246
+ editedBy?: string[];
247
+ /**
248
+ * Publishing status for external systems
249
+ * - unpublished: Not listed in external system
250
+ * - sale: Sale date is listed externally
251
+ * - saleAndCatalog: Sale and catalog information synced
252
+ */
253
+ publishStatus?: SalePublishStatus;
254
+ enableLuckMoney?: boolean;
255
+ enableLotGrouping?: boolean;
256
+ }
257
+ interface TemplateSaleData {
258
+ name?: string;
259
+ description?: string | null;
260
+ image?: string | null;
261
+ location?: string | null;
262
+ martEyeSaleType?: "LIVE" | "TIMED" | null;
263
+ cover?: string | null;
264
+ availableProductCodes: string[];
265
+ attributeDefaults?: {
266
+ [attributekey: string]: AttributeValueType;
267
+ };
268
+ marteyeSettings?: MartEyeTimedSaleSettings | MartEyeLiveSaleSettings | null;
269
+ enableLuckMoney?: boolean;
270
+ enableLotGrouping?: boolean;
271
+ customAttributes?: AttributeDefinition[];
272
+ }
273
+ interface SaleTemplate {
274
+ id: string;
275
+ marketId: string;
276
+ name: string;
277
+ description?: string | null;
278
+ sourceSaleId?: string;
279
+ createdAt: Timestamp;
280
+ updatedAt: Timestamp;
281
+ createdBy: string;
282
+ saleData: TemplateSaleData;
283
+ lotGridConfigs?: {
284
+ [configId: string]: StoredDataGridConfig;
285
+ };
286
+ }
287
+ interface StoredDataGridConfig {
288
+ widths?: {
289
+ [key: string]: number;
290
+ };
291
+ hiddenColumnIds: string[];
292
+ columnOrder: string[];
293
+ }
294
+ interface MartEyeLiveSaleSettings {
295
+ description?: string;
296
+ image?: string;
297
+ logo?: string;
298
+ type: "LIVE";
299
+ location?: string | null;
300
+ descriptionLines?: string[];
301
+ descriptionLink?: string;
302
+ deposit?: number;
303
+ hidePrices?: boolean;
304
+ hideReplay?: boolean;
305
+ labels?: string[];
306
+ tags?: string[];
307
+ queueLots?: boolean;
308
+ markSubjectLotsAsSold?: boolean;
309
+ }
310
+ interface MartEyeTimedSaleSettings {
311
+ description?: string;
312
+ image?: string;
313
+ logo?: string;
314
+ type: "TIMED";
315
+ /**
316
+ * The moment the staggered closing sequence should begin.
317
+ * The first lot will close at this time, with subsequent lots
318
+ * offset by `staggerSeconds` each.
319
+ */
320
+ closingStartsAt: Timestamp;
321
+ /**
322
+ * The number of seconds to offset each subsequent lot’s closing time
323
+ * from the previous one.
324
+ * Example: 30 → lot #1 closes at `closingStartsAt`, lot #2 at +30 s, lot #3 at +60 s …
325
+ */
326
+ staggerSeconds: number;
327
+ /**
328
+ * The location of the sale. This could be a physical location Ring 1 / Ring 2 / Farm Address etc
329
+ */
330
+ location?: string | null;
331
+ details?: {
332
+ markdownBase64: string;
333
+ title: string;
334
+ }[];
335
+ cover?: string;
336
+ primaryColour?: string;
337
+ secondaryColour?: string;
338
+ foregroundColour?: string;
339
+ extensionTime: number;
340
+ incrementLadder: IncrementLadder;
341
+ hideNav?: boolean;
342
+ signInOverrideLink?: string;
343
+ published?: boolean;
344
+ pin?: boolean;
345
+ labels?: string[];
346
+ deposit?: number;
347
+ cascade?: boolean;
348
+ reportEmail?: string;
349
+ }
350
+ type IncrementLadder = IncrementLadderItem[];
351
+ interface IncrementLadderItem {
352
+ max: number;
353
+ increment: number;
354
+ }
355
+ interface SaleFromSearch extends Omit<Omit<Omit<Sale, "createdAt">, "updatedAt">, "startsAt"> {
356
+ createdAt: number;
357
+ updatedAt: number;
358
+ startsAt: number;
359
+ }
360
+ type LotSaleStatus = "Sold" | "Unsold" | "Rerun" | "Resold" | null;
361
+ type LotDeleteDecision = "allow" | "confirm" | "block";
362
+ type LotDeleteReason = "local_only" | "not_started" | "started" | "started_with_bids" | "finished" | "studio_locked" | "not_found" | "sync_unavailable" | "link_unresolved";
363
+ type LotDeleteStudioLockReason = "invoice" | "sale_status";
364
+ interface LotDeletePreflightItem {
365
+ lotId: string;
366
+ lotNumber: string | null;
367
+ decision: LotDeleteDecision;
368
+ reason: LotDeleteReason;
369
+ isMartEyeEnabled: boolean;
370
+ saleType: "LIVE" | "TIMED" | null;
371
+ started: boolean;
372
+ finished: boolean;
373
+ hasBids: boolean;
374
+ bidCount: number;
375
+ startAt: string | null;
376
+ endAt: string | null;
377
+ studioLockReason?: LotDeleteStudioLockReason;
378
+ lockedSaleStatus?: string | null;
379
+ }
380
+ interface LotDeletePreflightResponse {
381
+ version: 1;
382
+ saleId: string;
383
+ lotId: string;
384
+ result: LotDeletePreflightItem;
385
+ }
386
+ interface DeleteLotsResponse {
387
+ version: 1;
388
+ saleId: string;
389
+ status: "deleted" | "blocked" | "confirmation_required";
390
+ deletedLotIds: string[];
391
+ results: LotDeletePreflightItem[];
392
+ }
393
+ interface Lot {
394
+ id: string;
395
+ saleId: string;
396
+ marketId: string;
397
+ createdAt: Timestamp;
398
+ updatedAt: Timestamp;
399
+ updatedBy?: string | null;
400
+ productCode: string;
401
+ superType?: SuperType;
402
+ isLivestock?: boolean;
403
+ attributes: {
404
+ [key: string]: AttributeValueType;
405
+ };
406
+ loadingAttributes?: {
407
+ [attributePath: string]: {
408
+ id: string;
409
+ startAt: Timestamp;
410
+ path: string;
411
+ };
412
+ };
413
+ itemMap: {
414
+ [itemId: string]: LotItem;
415
+ };
416
+ sellerCasual?: string | null;
417
+ sellerCustomerId: string | null;
418
+ seller?: ShortCustomerDetails;
419
+ lotNumber?: string | null;
420
+ index: number;
421
+ group?: string;
422
+ remarks?: string;
423
+ notes?: string;
424
+ currency: CurrenciesWithGuinea;
425
+ unitOfSale: UnitOfSale;
426
+ reservePriceInCents?: number | null;
427
+ startingPriceInCents?: number | null;
428
+ luckMoneyInCents?: number | null;
429
+ unitPriceInCents?: number;
430
+ buyerCasual?: string | null;
431
+ buyerCustomerId: string | null;
432
+ buyer?: ShortCustomerDetails | null;
433
+ startAt?: Timestamp;
434
+ endAt?: Timestamp;
435
+ sellerInvoiceId: string | null;
436
+ sellerInvoiceNumber?: number | undefined | null;
437
+ buyerInvoiceId: string | null;
438
+ buyerInvoiceNumber?: number | undefined | null;
439
+ voidedSellerInvoiceIds?: string[];
440
+ voidedBuyerInvoiceIds?: string[];
441
+ saleStatus?: LotSaleStatus;
442
+ void?: boolean;
443
+ originalLot?: string;
444
+ metadata: {
445
+ [key: string]: any;
446
+ };
447
+ generated?: LotGeneratedValues;
448
+ issues?: {
449
+ [issueId: string]: LotIssue;
450
+ };
451
+ resolvedIssues?: {
452
+ [issueId: string]: LotIssue;
453
+ };
454
+ /***
455
+ * Default values for any new lot item
456
+ */
457
+ itemAttributeDefaults?: {
458
+ [attributekey: string]: AttributeValueType;
459
+ };
460
+ }
461
+ type LotIssueCode = "unknown-attribute" | "validation-error" | "staff-flagged";
462
+ interface LotIssue {
463
+ id: string;
464
+ itemId?: string | null;
465
+ path?: string | null;
466
+ code: LotIssueCode;
467
+ description: string;
468
+ severity: "error" | "warning" | "info";
469
+ createdAt: Timestamp;
470
+ createdBy: string;
471
+ blockCheckout: boolean;
472
+ }
473
+ interface LotWithItemsAsArray extends Omit<Lot, "itemMap"> {
474
+ items: LotItem[];
475
+ }
476
+ interface LotGeneratedValues {
477
+ totalValueInCents?: number | null;
478
+ description?: string | null;
479
+ buyerInvoiceDescription?: string | null;
480
+ sellerStatementDescription?: string | null;
481
+ pricePerKiloInCents?: number | null;
482
+ averageWeightKg?: number | null;
483
+ pricePerItemInCents?: number | null;
484
+ countOfItems?: number | null;
485
+ ordinal?: number | null;
486
+ }
487
+ interface ShortCustomerDetails {
488
+ isSet: boolean;
489
+ id?: string;
490
+ copiedInAt?: Timestamp;
491
+ accountNumber?: string;
492
+ bidderNumber?: number | null;
493
+ displayName?: string;
494
+ avatar?: string | null;
495
+ }
496
+ interface LotItem {
497
+ id: string;
498
+ createdAt: Timestamp;
499
+ updatedAt: Timestamp;
500
+ updatedBy?: string | null;
501
+ index: number;
502
+ attributes: {
503
+ [key: string]: AttributeValueType;
504
+ };
505
+ notes: {
506
+ id: string;
507
+ text: string;
508
+ createdAt: Timestamp;
509
+ }[];
510
+ metadata: {
511
+ [key: string]: string | number | boolean | Timestamp | Media;
512
+ };
513
+ }
514
+ /***
515
+ * A market may offer other products and services. This is a way to track those.
516
+ * They simply create a line item on the invoice
517
+ *
518
+ * /settings/products
519
+ */
520
+ interface Product {
521
+ id: string;
522
+ createdAt: Timestamp;
523
+ updatedAt: Timestamp;
524
+ marketId: string;
525
+ name: string;
526
+ taxRateId: string;
527
+ defaultUnitPriceInCents: number;
528
+ unitPriceIncludesVat?: boolean;
529
+ applyToClients: ClientType[];
530
+ subtotalGroup?: SubtotalGroups | null | undefined;
531
+ passThroughFundsToAnotherCustomer?: boolean;
532
+ isEnabled?: boolean;
533
+ relatedTo?: {
534
+ lotId: string;
535
+ saleId: string;
536
+ } | null;
537
+ obfusicate?: boolean;
538
+ metadata: {
539
+ [key: string]: string | number | boolean | Timestamp | Media;
540
+ };
541
+ }
542
+ /***
543
+ * When a product is added to a cart it becomes a CartProductItem
544
+ *
545
+ *
546
+ * markets/ballymena/carts/{userId}
547
+ *
548
+ * {id: CartItem}
549
+ */
550
+ interface CartItem {
551
+ id: string;
552
+ createdAt: Timestamp;
553
+ updatedAt: Timestamp;
554
+ updatedBy?: string | null;
555
+ marketId: string;
556
+ customerId: string;
557
+ productId: string;
558
+ clientType: ClientType;
559
+ quantity: number;
560
+ unitPriceInCents: number;
561
+ passthroughFundsToCustomerId?: string | null;
562
+ generated?: {
563
+ totalInCents: number;
564
+ };
565
+ }
566
+ /***
567
+ * Items have codes. And those codes are used to apply the correct commission rates, report movements etc.
568
+ */
569
+ interface ProductCodeConfiguration {
570
+ code: string;
571
+ createdAt?: Timestamp;
572
+ updatedAt?: Timestamp;
573
+ updatedBy?: string | null;
574
+ archived?: boolean;
575
+ archivedAt?: Timestamp | null;
576
+ archivedBy?: string | null;
577
+ superType: SuperType;
578
+ description: string;
579
+ icon?: string;
580
+ metadata: {
581
+ [key: string]: string | number | boolean | Timestamp | Media;
582
+ };
583
+ taxRateId: string;
584
+ subtotalGroup?: SubtotalGroups | null;
585
+ adjustmentIds: string[];
586
+ unitPriceIncludesVat?: boolean;
587
+ totalExVatRebatePecentage?: number;
588
+ defaultCurrency?: CurrenciesWithGuinea;
589
+ defaultUnitOfSale: UnitOfSale;
590
+ defaultLotRange?: {
591
+ min: number;
592
+ max: number;
593
+ };
594
+ attributeDefaults?: {
595
+ [attributekey: string]: AttributeValueType;
596
+ };
597
+ lotDescriptionTemplate?: string;
598
+ sellerStatementLotDescriptionTemplate?: string;
599
+ buyerInvoiceLotDescriptionTemplate?: string;
600
+ rostrumAttributes?: string[];
601
+ benthamSheepBuilder?: {
602
+ topFieldOrder?: string[];
603
+ topFieldVisibility?: Record<string, boolean>;
604
+ lotFieldOrder?: string[];
605
+ lotFieldVisibility?: Record<string, boolean>;
606
+ createLotOnRowAdd?: boolean;
607
+ sendCreatedLotsToDisplayBoard?: boolean;
608
+ displayBoardTrigger?: "auto" | {
609
+ type: "focused";
610
+ field: string;
611
+ };
612
+ };
613
+ selectDocumentIds?: string[] | null;
614
+ }
615
+ /***
616
+ * How the products are stored in settings
617
+ */
618
+ interface ProductConfiguration {
619
+ [id: string]: Product;
620
+ }
621
+ interface Cart {
622
+ customerId: string;
623
+ updatedAt: Timestamp;
624
+ itemsById: {
625
+ [itemId: string]: CartItem;
626
+ };
627
+ checkoutPrefs?: {
628
+ [key: string]: any;
629
+ };
630
+ }
631
+ interface EmailWrapper {
632
+ email: string;
633
+ isVerified: boolean;
634
+ createdAt: Timestamp;
635
+ }
636
+ interface PhoneNumberWrapper {
637
+ phoneNumber: string;
638
+ isVerified: boolean;
639
+ createdAt: Timestamp;
640
+ }
641
+ interface AddressWrapper {
642
+ address: Address;
643
+ createdAt: Timestamp;
644
+ updatedAt?: Timestamp;
645
+ updatedBy?: string | null;
646
+ }
647
+ interface FarmAssurances {
648
+ createdAt: Timestamp;
649
+ updatedAt?: Timestamp;
650
+ updatedBy?: string | null;
651
+ memberReference: string;
652
+ expiryDate: Timestamp;
653
+ scope?: "Beef" | "Dairy" | "Pork" | "Sheep" | "Other";
654
+ }
655
+ type BankDetails = {
656
+ accountName?: string;
657
+ } & ({
658
+ accountNumber: string;
659
+ sortCode: string;
660
+ IBAN?: never;
661
+ } | {
662
+ IBAN: string;
663
+ accountNumber?: never;
664
+ sortCode?: never;
665
+ });
666
+ type CustomerBankDetails = BankDetails & {
667
+ id?: string;
668
+ createdAt?: Timestamp;
669
+ updatedAt?: Timestamp;
670
+ updatedBy?: string | null;
671
+ };
672
+ interface CustomerContact {
673
+ id: string;
674
+ createdAt: Timestamp;
675
+ updatedAt: Timestamp;
676
+ updatedBy?: string | null;
677
+ marketId: string;
678
+ displayName: string;
679
+ email?: string | null;
680
+ phoneNumber?: string | null;
681
+ /** @deprecated */
682
+ landlineNumber?: string | null;
683
+ /** @deprecated */
684
+ address?: Address;
685
+ isPrimary?: boolean;
686
+ isActive?: boolean;
687
+ isDeleted?: boolean;
688
+ isVerified?: boolean;
689
+ accountEmails?: boolean;
690
+ marketingEmails?: boolean;
691
+ marteyeUid?: string | null;
692
+ notes?: string | null;
693
+ metadata?: {
694
+ [key: string]: string | number | boolean | Timestamp | Media;
695
+ };
696
+ }
697
+ /**
698
+ * Used to store the bank details for a market
699
+ */
700
+ type MarketBankDetails = {
701
+ name: string;
702
+ bankId: string;
703
+ address: Address;
704
+ } & ({
705
+ accountNumber: string;
706
+ sortCode: string;
707
+ IBAN?: never;
708
+ } | {
709
+ IBAN: string;
710
+ accountNumber?: never;
711
+ sortCode?: never;
712
+ });
713
+ interface Customer {
714
+ id: string;
715
+ createdAt: Timestamp;
716
+ updatedAt: Timestamp;
717
+ updatedBy?: string | null;
718
+ marketId: string;
719
+ isMarketAccount?: boolean;
720
+ accountNumber?: string;
721
+ bidderNumber?: number | null;
722
+ displayName?: string | null;
723
+ firstName?: string | null;
724
+ lastName?: string | null;
725
+ tradingName?: string | null;
726
+ email?: EmailWrapper;
727
+ phoneNumber?: PhoneNumberWrapper;
728
+ /** @deprecated */
729
+ otherPhoneNumbers?: PhoneNumberWrapper[];
730
+ address: AddressWrapper;
731
+ /** @deprecated */
732
+ otherAddresses: {
733
+ [addressId: string]: AddressWrapper;
734
+ };
735
+ photoURL?: string | null;
736
+ payoutPreference?: PayoutMethod;
737
+ invoiceDeliveryPreference?: InvoiceDeliveryPreference;
738
+ statementDeliveryPreference?: InvoiceDeliveryPreference;
739
+ bankDetails?: CustomerBankDetails | CustomerBankDetails[] | null;
740
+ contacts?: CustomerContact[];
741
+ attributeDefaultsBuyer?: {
742
+ [attributekey: string]: AttributeValueType[];
743
+ };
744
+ attributeDefaultsSeller?: {
745
+ [attributekey: string]: AttributeValueType[];
746
+ };
747
+ preferSettleDebtsFirst?: boolean;
748
+ vatNumber?: string;
749
+ metadata: {
750
+ [key: string]: string | number | boolean | Timestamp | Media;
751
+ };
752
+ lastItemPurchaseDate?: Timestamp;
753
+ lastItemSaleDate?: Timestamp;
754
+ hasPurchasedItems?: boolean;
755
+ hasSoldItems?: boolean;
756
+ notes?: string;
757
+ status?: "archived" | "deleted" | null;
758
+ deleteAfter?: Timestamp;
759
+ casualBuyerLabels?: string[];
760
+ }
761
+ interface CustomerFromSearch extends Omit<Customer, "createdAt" | "updatedAt" | "lastItemPurchaseDate" | "lastItemSaleDate"> {
762
+ createdAt: number;
763
+ updatedAt: number;
764
+ lastItemPurchaseDate?: number;
765
+ lastItemSaleDate?: number;
766
+ }
767
+ interface Application {
768
+ id: string;
769
+ createdAt: Timestamp;
770
+ updatedAt: Timestamp;
771
+ marketId: string;
772
+ status: "pending" | "approved" | "rejected";
773
+ displayName: string;
774
+ phoneNumber?: string;
775
+ email?: string;
776
+ address: {
777
+ firstLine: string;
778
+ secondLine?: string;
779
+ county?: string;
780
+ postCode: string;
781
+ };
782
+ dateOfMarteyeAccountCreation?: Timestamp;
783
+ hasWonLotsOnMarteye?: boolean;
784
+ isApprovedAtOtherMarkets?: boolean;
785
+ marteyeUid: string;
786
+ notes?: string;
787
+ customerId?: string;
788
+ contactId?: string;
789
+ accountNumber?: string;
790
+ approvedBy?: string;
791
+ rejectedBy?: string;
792
+ approvedAt?: Timestamp;
793
+ rejectedAt?: Timestamp;
794
+ }
795
+ interface Address {
796
+ id: string;
797
+ nickname?: string;
798
+ company?: string;
799
+ firstName?: string;
800
+ lastName?: string;
801
+ address1: string;
802
+ address2?: string;
803
+ city: string;
804
+ province?: string;
805
+ zip: string;
806
+ country: string;
807
+ }
808
+ declare const IMAGE_SIZES_VALUES: readonly ["small", "medium", "large"];
809
+ declare const VIDEO_TASKS_VALUES: readonly ["compressed", "thumbnail"];
810
+ type ImageSizes = (typeof IMAGE_SIZES_VALUES)[number];
811
+ type VideoTasks = (typeof VIDEO_TASKS_VALUES)[number];
812
+ type SupportedFileTypesNames$1 = "image" | "video" | "file";
813
+ interface Media {
814
+ id: string;
815
+ fileName: string;
816
+ path: string;
817
+ url: string;
818
+ fileType: string;
819
+ variants: Partial<Record<ImageSizes | VideoTasks, {
820
+ url: string;
821
+ isLocal?: boolean;
822
+ isProcessing: boolean;
823
+ type: SupportedFileTypesNames$1;
824
+ }>>;
825
+ }
826
+ type MarketReportHeaders = "grossServices" | "vatOnServices" | "grossGoods" | "vatOnGoods" | "netTotal" | "contra";
827
+ /**
828
+ * Content types which will denote the position of the data on the invoice wihth out with a cheque
829
+ */
830
+ type FieldPositions = {
831
+ id: ChequeField | InvoiceField;
832
+ x: number;
833
+ y: number;
834
+ };
835
+ type InvoiceField = "invoiceNumber" | "invoiceDate" | "description" | "lotNumber" | "quantity" | "weight" | "unitPrice" | "grossLineTotal" | "accountRef" | "accountName" | "businessAddress" | "customerAddress" | "lineItemsStartLine" | "footerBoundaryLine" | "vatNumber" | "saleName" | "subTotal" | "subTotalTable" | "tagList" | "tagNumber";
836
+ type ChequeField = "chequeDate" | "chequeNumber" | "payee" | "amount" | "amountInWords" | "hunderdsOfThousands" | "tensOfThousands" | "thousands" | "hundreds" | "tens" | "units";
837
+ type SubtotalGroups = "Commission" | string;
838
+ type AdjustmentTotalTarget = "Per Invoice" | "Total - finalTotalInCents" | "Total - lotTotalLessCommissionInCentsExVat";
839
+ type AdjustmentTarget = UnitOfSale | AdjustmentTotalTarget;
840
+ type LadderCalculationMode = "progressive" | "threshold";
841
+ /***
842
+ * Commission is added as a line item. Can also be used for levies etc
843
+ */
844
+ interface AdjustmentsConfiguration {
845
+ id: string;
846
+ createdAt: Timestamp;
847
+ updatedAt: Timestamp;
848
+ updatedBy?: string | null;
849
+ name?: string | null;
850
+ description?: string | null;
851
+ applyToClients: ClientType[];
852
+ subtotalGroup?: SubtotalGroups | null | undefined;
853
+ type: "commission" | "levy" | "vat-rebate";
854
+ filter?: {
855
+ currency?: CurrenciesWithGuinea | null;
856
+ quantity?: {
857
+ min?: number;
858
+ max?: number;
859
+ } | null;
860
+ unitPrice?: {
861
+ minInCents?: number;
862
+ maxInCents?: number;
863
+ } | null;
864
+ totalPrice?: {
865
+ minInCents?: number;
866
+ maxInCents?: number;
867
+ } | null;
868
+ customerIsVATRegistered?: boolean | null;
869
+ customerWithinTaxRegion?: boolean | null;
870
+ attribute?: {
871
+ key: string;
872
+ value: string | number | boolean | null;
873
+ } | null;
874
+ };
875
+ taxRateId: string;
876
+ adjustment: Adjustment & {
877
+ target: AdjustmentTarget;
878
+ };
879
+ }
880
+ interface Adjustment {
881
+ percentage?: {
882
+ value?: number;
883
+ floorInCents?: number;
884
+ ceilingInCents?: number;
885
+ } | null;
886
+ fixedAmountInCents?: number | null;
887
+ ladder?: {
888
+ mode?: LadderCalculationMode;
889
+ steps: {
890
+ percentageValue?: number;
891
+ upToAmountInCents?: number | null;
892
+ }[];
893
+ floorInCents?: number;
894
+ ceilingInCents?: number;
895
+ };
896
+ }
897
+ interface LineItemAdjustmentConfiguration extends AdjustmentsConfiguration {
898
+ adjustment: Adjustment & {
899
+ target: UnitOfSale;
900
+ };
901
+ }
902
+ interface InvoiceTotalAdjustmentConfiguration extends AdjustmentsConfiguration {
903
+ adjustment: Adjustment & {
904
+ target: AdjustmentTotalTarget;
905
+ };
906
+ }
907
+ /***
908
+ * Tax config is used to generate the invoice but the user can still edit the invoice, overriding the final values.
909
+ */
910
+ interface TaxRate {
911
+ id: string;
912
+ createdAt: Timestamp;
913
+ updatedAt: Timestamp;
914
+ marketId: string;
915
+ description: string;
916
+ taxSubtotalGroup?: string | null;
917
+ percentage: number;
918
+ isExportTaxRate?: boolean;
919
+ }
920
+ interface Payment {
921
+ id: string;
922
+ createdAt: Timestamp;
923
+ updatedAt: Timestamp;
924
+ updatedBy?: string;
925
+ transactionDate: Timestamp;
926
+ marketId: string;
927
+ customerId: string;
928
+ method: PaymentMethod;
929
+ amountInCents: number;
930
+ reference: string | null;
931
+ status: "complete" | "void";
932
+ voidedAt?: Timestamp | null;
933
+ voidedBy?: string | null;
934
+ voidReason?: string | null;
935
+ invoiceIds: string[];
936
+ invoices?: Array<{
937
+ id: string;
938
+ amountAppliedInCents?: number;
939
+ }>;
940
+ transactionIds: string[];
941
+ }
942
+ interface Payout {
943
+ id: string;
944
+ marketId: string;
945
+ createdAt: Timestamp;
946
+ updatedAt: Timestamp;
947
+ updatedBy: string | null;
948
+ customerId: string;
949
+ method: PayoutMethod | "Credit";
950
+ amountInCents: number;
951
+ invoices?: Array<{
952
+ id: string;
953
+ amountAppliedInCents?: number;
954
+ }>;
955
+ accountName?: string;
956
+ accountNumber?: string;
957
+ sortCode?: string;
958
+ chequeMadePayableTo?: string;
959
+ chequeIsPrinted?: boolean;
960
+ chequeIssuedManually?: boolean;
961
+ transactionDate: Timestamp;
962
+ reference: string | null;
963
+ status: "pending" | "complete" | "void";
964
+ notes: string | null;
965
+ completedAt?: Timestamp | null;
966
+ completedBy?: string | null;
967
+ voidedAt?: Timestamp | null;
968
+ voidedBy?: string | null;
969
+ voidReason?: string | null;
970
+ transactionIds: string[];
971
+ invoiceIds: string[];
972
+ }
973
+ interface DraftInvoice extends InvoiceTotals {
974
+ id: string;
975
+ currency: Currency;
976
+ status: "draft";
977
+ issuedAt?: Timestamp;
978
+ lotIdents: {
979
+ lotId: string;
980
+ saleId: string;
981
+ }[];
982
+ clientType: ClientType;
983
+ customerId: string;
984
+ customerAccountNumber: string;
985
+ name: string;
986
+ address: Address;
987
+ email: string | null;
988
+ superTypes?: SuperType[];
989
+ customerIsVATRegistered: boolean;
990
+ customerWithinTaxRegion: boolean;
991
+ lineItems: InvoiceLineItem[];
992
+ adjustmentLineItems: InvoiceLineItem[];
993
+ vatNumber?: string;
994
+ extraProductIds: string[];
995
+ payoutMethod?: PayoutMethod | null;
996
+ payoutParams?: {
997
+ settleDebtsFirst: boolean;
998
+ accountName?: string;
999
+ accountNumber?: string;
1000
+ sortCode?: string;
1001
+ chequeMadePayableTo?: string;
1002
+ };
1003
+ potentialPayoutsById?: {
1004
+ [payoutId: string]: {
1005
+ id: string;
1006
+ amountInCents: number;
1007
+ paymentMethod: PaymentMethod;
1008
+ invoice?: {
1009
+ id: string;
1010
+ invoiceNumber: number;
1011
+ fullyPaid: boolean;
1012
+ };
1013
+ };
1014
+ };
1015
+ attributeValues?: {
1016
+ [attributekey: string]: AttributeValueType;
1017
+ };
1018
+ attributes: AttributeDefinition[];
1019
+ averages?: {
1020
+ label: string;
1021
+ value: number;
1022
+ formattedValue: string;
1023
+ }[];
1024
+ paymentInstructions?: string | null;
1025
+ }
1026
+ interface InvoiceTotals {
1027
+ lotTotalInCentsExVat: number;
1028
+ vatOnLotTotalInCents: number;
1029
+ commissionTotalInCents?: number;
1030
+ vatOnCommissionInCents?: number;
1031
+ nonCommissionAdjustmentsInCents?: number;
1032
+ vatOnAdjustmentsInCents?: number;
1033
+ subtotalGroupTotals: {
1034
+ [key in SubtotalGroups]: number;
1035
+ };
1036
+ taxSubtotalGroupTotals: {
1037
+ [key in string]: number;
1038
+ };
1039
+ finalTotalInCents: number;
1040
+ }
1041
+ interface SimplePaymentIn {
1042
+ paymentId: string;
1043
+ amountInCents: number;
1044
+ paymentMethod: PaymentMethod;
1045
+ reference: string | null;
1046
+ paidAt: Timestamp;
1047
+ }
1048
+ /**
1049
+ * Used on invoice to show the payout. Use payout collection for the source of truth
1050
+ */
1051
+ interface SimplePaymentOut {
1052
+ payoutId: string;
1053
+ amountInCents: number;
1054
+ paymentMethod: PaymentMethod;
1055
+ reference: string | null;
1056
+ paidAt: Timestamp;
1057
+ }
1058
+ interface Invoice extends Omit<Omit<Omit<Omit<DraftInvoice, "ledgerAccountTotals">, "potentialPayoutsById">, "payoutParams">, "status"> {
1059
+ id: string;
1060
+ invoiceNumber: number;
1061
+ createdAt: Timestamp;
1062
+ updatedAt: Timestamp;
1063
+ updatedBy?: string | null;
1064
+ marketId: string;
1065
+ saleIds: string[];
1066
+ sales: {
1067
+ id: string;
1068
+ name?: string;
1069
+ startsAt?: Timestamp;
1070
+ }[];
1071
+ transactionIds?: string[];
1072
+ status: "draft" | "issued" | "void" | "imported" | "paid";
1073
+ paymentsInById: {
1074
+ [paymentId: string]: SimplePaymentIn;
1075
+ };
1076
+ payoutMethod: PayoutMethod | null;
1077
+ payoutsById: {
1078
+ [payoutId: string]: SimplePaymentOut;
1079
+ };
1080
+ voidReason?: string;
1081
+ voidedAt?: Timestamp;
1082
+ voidedBy?: string;
1083
+ description?: string;
1084
+ footnotes?: string[];
1085
+ metadata: {
1086
+ [key: string]: string | number | boolean | Timestamp | Media;
1087
+ };
1088
+ /***
1089
+ * this is important to add when adding an invoice
1090
+ * it creates a lock so we only ever get sequential invoice numbers
1091
+ * The invoice will have this as null until the next invoice is created
1092
+ */
1093
+ internalNextInvoiceId: string | null;
1094
+ emailNotifications?: string[];
1095
+ emailStatus?: {
1096
+ recipient: string;
1097
+ status: "sent" | "delivered" | "opened" | "bounced";
1098
+ timestamp: Timestamp;
1099
+ }[];
1100
+ printHistory?: {
1101
+ printedAt: Timestamp;
1102
+ printedBy: string;
1103
+ deviceId: string;
1104
+ documentIds: string[];
1105
+ }[];
1106
+ pitchPayLink: string | null;
1107
+ }
1108
+ /**
1109
+ * @description Configuration for the printer
1110
+ */
1111
+ interface Printer {
1112
+ id: string;
1113
+ createdAt: Timestamp;
1114
+ updatedAt: Timestamp;
1115
+ /**
1116
+ * @description The name of the printer. Its the same as the id
1117
+ */
1118
+ name: string;
1119
+ friendlyName: string;
1120
+ /**
1121
+ * Optional single IPP URI if linked by IP discovery
1122
+ */
1123
+ uri?: string;
1124
+ chequePrinter?: boolean;
1125
+ /**
1126
+ * The next cheque number to use when printing a cheque
1127
+ */
1128
+ nextChequeNumber?: number;
1129
+ lastPrintedAt?: Timestamp;
1130
+ lastPrinterMessage?: string;
1131
+ }
1132
+ interface Printer {
1133
+ name: string;
1134
+ id: string;
1135
+ }
1136
+ interface InvoiceLineItem {
1137
+ id: string;
1138
+ createdAt: Timestamp;
1139
+ updatedAt: Timestamp;
1140
+ subtotalGroup?: SubtotalGroups | null;
1141
+ clientType: ClientType;
1142
+ description: string;
1143
+ index?: number;
1144
+ quantity: number;
1145
+ impreciseUnitPriceInCents: number;
1146
+ unitOfSale?: UnitOfSale;
1147
+ unitPriceIncludesVat?: boolean;
1148
+ taxRate: TaxRate;
1149
+ taxAmountInCents: number;
1150
+ discountAmountInCents?: number;
1151
+ totalAmountInCentsExVat: number;
1152
+ saleId?: string;
1153
+ lotId?: string;
1154
+ lotProductCode?: string;
1155
+ superType?: SuperType | null;
1156
+ productId?: string;
1157
+ productRelatedTo?: {
1158
+ lotId: string;
1159
+ saleId: string;
1160
+ } | null;
1161
+ productObfusicate?: boolean;
1162
+ passthroughFundsToCustomerId?: string | null;
1163
+ adjustmentConfig?: AdjustmentsConfiguration;
1164
+ isLuckMoney?: boolean;
1165
+ metadata: {
1166
+ [key: string]: string | number | boolean | Timestamp | Media | {
1167
+ [key: string]: string | number | boolean | Timestamp;
1168
+ };
1169
+ };
1170
+ }
1171
+ interface TablePosition {
1172
+ id: InvoiceField | ChequeField | MarketReportHeaders;
1173
+ title: string;
1174
+ cellWidth: number;
1175
+ halign: "left" | "center" | "right";
1176
+ }
1177
+ type WebhookEventName = "market.updated" | "sale.created" | "sale.updated" | "sale.deleted" | "lot.created" | "lot.updated" | "lot.deleted" | "lot.media.created" | "lot.media.deleted" | "invoice.created" | "invoice.updated" | "invoice.deleted" | "payment.created" | "payment.updated" | "payment.deleted" | "payout.created" | "payout.updated" | "payout.deleted" | "customer.created" | "customer.updated" | "customer.deleted" | "member.created" | "member.updated" | "member.deleted" | "sms-task.created" | "sms-task.updated" | "sms-task.deleted";
1178
+ declare const supportedWebhookEvents: readonly ["market.updated", "sale.created", "sale.updated", "sale.deleted", "lot.created", "lot.updated", "lot.deleted", "lot.media.created", "lot.media.deleted", "invoice.created", "invoice.updated", "invoice.deleted", "payment.created", "payment.updated", "payment.deleted", "payout.created", "payout.updated", "payout.deleted", "customer.created", "customer.updated", "customer.deleted", "member.created", "member.updated", "member.deleted", "sms-task.created", "sms-task.updated", "sms-task.deleted"];
1179
+ type ObjectType = "market" | "sale" | "lot" | "invoice" | "payment" | "customer" | "member" | "sms-task";
1180
+ interface WebhookEvent<T> {
1181
+ id: string;
1182
+ createdAt: Timestamp;
1183
+ trigger: WebhookEventName;
1184
+ marketId: string;
1185
+ objectType: ObjectType;
1186
+ data: {
1187
+ object: T;
1188
+ objectBefore?: T;
1189
+ };
1190
+ }
1191
+ type SupportedAttributeTypes = "string" | "number" | "boolean" | "date" | "datetime" | "media" | "mediaset" | "time";
1192
+ interface AttributeDefinition {
1193
+ id: string;
1194
+ name: string;
1195
+ shortName?: string;
1196
+ description?: string;
1197
+ martEyeAttribute?: string;
1198
+ scope?: "global" | "sale";
1199
+ saleScoped?: boolean;
1200
+ archivedAt?: Timestamp | null;
1201
+ archivedBy?: string | null;
1202
+ archivedSyncToMartEye?: boolean | null;
1203
+ applyTo: string[];
1204
+ level: "item" | "lot";
1205
+ readonly?: boolean;
1206
+ lotDetailFlyoutGroup?: string;
1207
+ buyerCheckoutGroup?: string;
1208
+ sellerCheckoutGroup?: string;
1209
+ buyerCustomerAttribute?: boolean;
1210
+ sellerCustomerAttribute?: boolean;
1211
+ defaultHiddenOnSaleSheet?: boolean;
1212
+ prefillableFromPreviousLot?: boolean;
1213
+ hidden?: boolean;
1214
+ showInSellerDetailsPanel?: boolean;
1215
+ showInSellerReviewPanel?: boolean;
1216
+ displayTemplate?: string;
1217
+ displayTemplateMultiValue?: string;
1218
+ type: SupportedAttributeTypes;
1219
+ requiredPreSale: boolean;
1220
+ requiredToCheckout: boolean;
1221
+ minValue?: number;
1222
+ maxValue?: number;
1223
+ minLength?: number;
1224
+ maxLength?: number;
1225
+ regexPattern?: string;
1226
+ minDateExpression?: string;
1227
+ maxDateExpression?: string;
1228
+ allowedValues?: string[];
1229
+ }
1230
+ interface StudioAppPartial {
1231
+ id: string;
1232
+ name: string;
1233
+ version: string;
1234
+ description: string;
1235
+ icon: string;
1236
+ parameterConfig: AppParameterConfig[];
1237
+ parameterValues: {
1238
+ [key: string]: string | number | boolean | string[];
1239
+ };
1240
+ }
1241
+ type AppParameterConfig = {
1242
+ id: string;
1243
+ type: "string" | "number" | "boolean" | "string[]" | "password";
1244
+ label: string;
1245
+ description?: string;
1246
+ required?: boolean;
1247
+ defaultValue?: string | number | boolean | string[];
1248
+ };
1249
+ interface CphLookupResponse {
1250
+ cph: string;
1251
+ county: string;
1252
+ parish: string;
1253
+ holding: string;
1254
+ subLocation?: string;
1255
+ country: string;
1256
+ region: string | null;
1257
+ spatialUnit: string | null;
1258
+ office: string | null;
1259
+ ahdoNumber: string | null;
1260
+ parishName: string;
1261
+ tbTestingInterval: string | null;
1262
+ tbArea: string | null;
1263
+ cphValid?: boolean | null;
1264
+ farmName?: string | null;
1265
+ }
1266
+ type ActivityOperation = "created" | "updated" | "deleted" | "voided";
1267
+ interface ActivityChange {
1268
+ before?: any;
1269
+ after?: any;
1270
+ }
1271
+ type ReadOptions = {
1272
+ at?: string;
1273
+ };
1274
+ interface ActivityLog {
1275
+ id: string;
1276
+ firstEventAt: Timestamp;
1277
+ lastEventAt: Timestamp;
1278
+ userId: string | null;
1279
+ userName?: string;
1280
+ eventType: WebhookEventName;
1281
+ entityType: ObjectType;
1282
+ entityId: string;
1283
+ entityLabel?: string;
1284
+ saleIds: string[];
1285
+ operation: ActivityOperation;
1286
+ changeCount: number;
1287
+ changes?: {
1288
+ [fieldPath: string]: ActivityChange;
1289
+ };
1290
+ }
1291
+ interface SendSMSPayload {
1292
+ to: string[];
1293
+ message: string;
1294
+ customerId?: string;
1295
+ reference?: string;
1296
+ senderName?: string;
1297
+ communicationContext?: string;
1298
+ metadata?: Record<string, any>;
1299
+ }
1300
+ type BroadcastType = "sms" | "email";
1301
+ type BroadcastKind = "broadcast" | "statement";
1302
+ type EmailDeliveryClass = "transactional" | "broadcast";
1303
+ type PostmarkMessageStream = "outbound" | "broadcast";
1304
+ interface BroadcastRecipient {
1305
+ customerId: string;
1306
+ displayName?: string;
1307
+ accountNumber?: string;
1308
+ phoneNumbers?: string[];
1309
+ emails?: string[];
1310
+ }
1311
+ interface SMSBroadcastPayload {
1312
+ type: "sms";
1313
+ kind?: BroadcastKind;
1314
+ communicationContext?: string;
1315
+ message?: string;
1316
+ senderName?: string;
1317
+ recipients: BroadcastRecipient[];
1318
+ }
1319
+ interface EmailBroadcastPayload {
1320
+ type: "email";
1321
+ kind?: BroadcastKind;
1322
+ communicationContext?: string;
1323
+ message?: string;
1324
+ subject?: string;
1325
+ subdomain?: string;
1326
+ recipients: BroadcastRecipient[];
1327
+ }
1328
+ type BroadcastPayload = SMSBroadcastPayload | EmailBroadcastPayload;
1329
+ interface BroadcastSendResultItem {
1330
+ customerId: string;
1331
+ taskId?: string;
1332
+ status: "queued" | "skipped" | "failed";
1333
+ recipientCount: number;
1334
+ reason?: string;
1335
+ }
1336
+ interface BroadcastSendResponse {
1337
+ success: boolean;
1338
+ type: BroadcastType;
1339
+ kind: BroadcastKind;
1340
+ broadcastId: string;
1341
+ sent: number;
1342
+ skipped: number;
1343
+ results: BroadcastSendResultItem[];
1344
+ }
1345
+ interface SMSTask {
1346
+ id: string;
1347
+ marketId: string;
1348
+ broadcastId?: string;
1349
+ to: string[];
1350
+ message: string;
1351
+ customerId?: string;
1352
+ accountNumber?: string;
1353
+ reference?: string;
1354
+ senderName?: string;
1355
+ metadata?: Record<string, any>;
1356
+ status: "pending" | "sent" | "delivered" | "failed" | "partial";
1357
+ errorCode?: string;
1358
+ errorMessage?: string;
1359
+ providerMessageIds?: string[];
1360
+ providerName?: string;
1361
+ createdAt: Timestamp;
1362
+ updatedAt: Timestamp;
1363
+ sentAt?: Timestamp;
1364
+ deliveredAt?: Timestamp;
1365
+ recipientStatus?: {
1366
+ [phoneNumber: string]: {
1367
+ status: "pending" | "sent" | "delivered" | "failed";
1368
+ providerMessageId?: string;
1369
+ errorCode?: string;
1370
+ errorMessage?: string;
1371
+ timestamp: Timestamp;
1372
+ };
1373
+ };
1374
+ }
1375
+ interface EmailTask {
1376
+ id: string;
1377
+ marketId: string;
1378
+ broadcastId?: string;
1379
+ marketName: string;
1380
+ replyTo: string;
1381
+ customerId: string;
1382
+ accountNumber?: string;
1383
+ templateId: string;
1384
+ deliveryClass?: EmailDeliveryClass;
1385
+ postmarkMessageStream?: PostmarkMessageStream;
1386
+ to: string[];
1387
+ documents?: string[];
1388
+ data: Record<string, any>;
1389
+ status: "failed" | "pending" | "sent" | "delivered" | "opened" | "bounced" | "spam-complaint";
1390
+ errorCode?: number;
1391
+ errorMessage?: string;
1392
+ providerMessageId?: string;
1393
+ createdAt: Timestamp;
1394
+ updatedAt: Timestamp;
1395
+ sentAt?: Timestamp;
1396
+ deliveredAt?: Timestamp;
1397
+ openedAt?: Timestamp;
1398
+ bouncedAt?: Timestamp;
1399
+ subject?: string;
1400
+ events?: {
1401
+ id: string;
1402
+ timestamp: Timestamp;
1403
+ type: string;
1404
+ recipient: string;
1405
+ }[];
1406
+ }
1407
+ type BroadcastTask = SMSTask | EmailTask;
1408
+
1409
+ type types_Accessory = Accessory;
1410
+ type types_AccountTier = AccountTier;
1411
+ declare const types_AccountTiers: typeof AccountTiers;
1412
+ type types_ActivityChange = ActivityChange;
1413
+ type types_ActivityLog = ActivityLog;
1414
+ type types_ActivityOperation = ActivityOperation;
1415
+ type types_Address = Address;
1416
+ type types_AddressWrapper = AddressWrapper;
1417
+ type types_AdjustmentTarget = AdjustmentTarget;
1418
+ type types_AdjustmentTotalTarget = AdjustmentTotalTarget;
1419
+ type types_AdjustmentsConfiguration = AdjustmentsConfiguration;
1420
+ type types_AppParameterConfig = AppParameterConfig;
1421
+ type types_Application = Application;
1422
+ type types_AttributeDefinition = AttributeDefinition;
1423
+ type types_AttributeValueType = AttributeValueType;
1424
+ type types_BankDetails = BankDetails;
1425
+ type types_BroadcastKind = BroadcastKind;
1426
+ type types_BroadcastPayload = BroadcastPayload;
1427
+ type types_BroadcastRecipient = BroadcastRecipient;
1428
+ type types_BroadcastSendResponse = BroadcastSendResponse;
1429
+ type types_BroadcastSendResultItem = BroadcastSendResultItem;
1430
+ type types_BroadcastTask = BroadcastTask;
1431
+ type types_BroadcastType = BroadcastType;
1432
+ type types_Cart = Cart;
1433
+ type types_CartItem = CartItem;
1434
+ type types_ChequeField = ChequeField;
1435
+ type types_ClientType = ClientType;
1436
+ type types_CphLookupResponse = CphLookupResponse;
1437
+ type types_CurrenciesWithGuinea = CurrenciesWithGuinea;
1438
+ type types_Currency = Currency;
1439
+ type types_Customer = Customer;
1440
+ type types_CustomerBankDetails = CustomerBankDetails;
1441
+ type types_CustomerContact = CustomerContact;
1442
+ type types_CustomerFromSearch = CustomerFromSearch;
1443
+ type types_DeleteLotsResponse = DeleteLotsResponse;
1444
+ type types_DeviceType = DeviceType;
1445
+ type types_DisplayBoardMode = DisplayBoardMode;
1446
+ type types_DraftInvoice = DraftInvoice;
1447
+ type types_EmailBroadcastPayload = EmailBroadcastPayload;
1448
+ type types_EmailDeliveryClass = EmailDeliveryClass;
1449
+ type types_EmailTask = EmailTask;
1450
+ type types_EmailWrapper = EmailWrapper;
1451
+ type types_FarmAssurances = FarmAssurances;
1452
+ type types_FieldPositions = FieldPositions;
1453
+ declare const types_IMAGE_SIZES_VALUES: typeof IMAGE_SIZES_VALUES;
1454
+ type types_ImageSizes = ImageSizes;
1455
+ type types_IncrementLadder = IncrementLadder;
1456
+ type types_IncrementLadderItem = IncrementLadderItem;
1457
+ type types_Invoice = Invoice;
1458
+ type types_InvoiceDeliveryPreference = InvoiceDeliveryPreference;
1459
+ type types_InvoiceField = InvoiceField;
1460
+ type types_InvoiceLineItem = InvoiceLineItem;
1461
+ type types_InvoiceTotalAdjustmentConfiguration = InvoiceTotalAdjustmentConfiguration;
1462
+ type types_InvoiceTotals = InvoiceTotals;
1463
+ type types_LadderCalculationMode = LadderCalculationMode;
1464
+ type types_LineItemAdjustmentConfiguration = LineItemAdjustmentConfiguration;
1465
+ declare const types_LivestockSuperTypes: typeof LivestockSuperTypes;
1466
+ type types_Lot = Lot;
1467
+ type types_LotDeleteDecision = LotDeleteDecision;
1468
+ type types_LotDeletePreflightItem = LotDeletePreflightItem;
1469
+ type types_LotDeletePreflightResponse = LotDeletePreflightResponse;
1470
+ type types_LotDeleteReason = LotDeleteReason;
1471
+ type types_LotDeleteStudioLockReason = LotDeleteStudioLockReason;
1472
+ type types_LotGeneratedValues = LotGeneratedValues;
1473
+ type types_LotIssue = LotIssue;
1474
+ type types_LotItem = LotItem;
1475
+ type types_LotSaleStatus = LotSaleStatus;
1476
+ type types_LotWithItemsAsArray = LotWithItemsAsArray;
1477
+ type types_Market = Market;
1478
+ type types_MarketBankDetails = MarketBankDetails;
1479
+ type types_MarketReportHeaders = MarketReportHeaders;
1480
+ type types_MartEyeLiveSaleSettings = MartEyeLiveSaleSettings;
1481
+ type types_MartEyeTimedSaleSettings = MartEyeTimedSaleSettings;
1482
+ type types_Media = Media;
1483
+ type types_MemberSharingConfiguration = MemberSharingConfiguration;
1484
+ type types_ObjectType = ObjectType;
1485
+ type types_Payment = Payment;
1486
+ type types_PaymentMethod = PaymentMethod;
1487
+ type types_Payout = Payout;
1488
+ type types_PayoutMethod = PayoutMethod;
1489
+ type types_PhoneNumberWrapper = PhoneNumberWrapper;
1490
+ type types_PostmarkMessageStream = PostmarkMessageStream;
1491
+ type types_Printer = Printer;
1492
+ type types_Product = Product;
1493
+ type types_ProductCodeConfiguration = ProductCodeConfiguration;
1494
+ type types_ProductConfiguration = ProductConfiguration;
1495
+ type types_ReadOptions = ReadOptions;
1496
+ type types_SMSBroadcastPayload = SMSBroadcastPayload;
1497
+ type types_SMSTask = SMSTask;
1498
+ type types_Sale = Sale;
1499
+ type types_SaleFromSearch = SaleFromSearch;
1500
+ type types_SalePublishStatus = SalePublishStatus;
1501
+ type types_SaleTemplate = SaleTemplate;
1502
+ type types_SendSMSPayload = SendSMSPayload;
1503
+ type types_SettingsAccessories = SettingsAccessories;
1504
+ type types_SettingsAdjustmentsConfiguration = SettingsAdjustmentsConfiguration;
1505
+ type types_SettingsGlobalAttributes = SettingsGlobalAttributes;
1506
+ type types_SettingsMarketDefaults = SettingsMarketDefaults;
1507
+ type types_SettingsPrinters = SettingsPrinters;
1508
+ type types_SettingsProductCodes = SettingsProductCodes;
1509
+ type types_SettingsTaxRates = SettingsTaxRates;
1510
+ type types_ShortCustomerDetails = ShortCustomerDetails;
1511
+ type types_SimplePaymentIn = SimplePaymentIn;
1512
+ type types_SimplePaymentOut = SimplePaymentOut;
1513
+ type types_StoredDataGridConfig = StoredDataGridConfig;
1514
+ type types_StudioAppPartial = StudioAppPartial;
1515
+ type types_SubtotalGroups = SubtotalGroups;
1516
+ type types_SuperType = SuperType;
1517
+ type types_SupportedAttributeTypes = SupportedAttributeTypes;
1518
+ type types_SupportedCountryCode = SupportedCountryCode;
1519
+ declare const types_SupportedCurrencyCodes: typeof SupportedCurrencyCodes;
1520
+ declare const types_SupportedPaymentMethods: typeof SupportedPaymentMethods;
1521
+ declare const types_SupportedSuperTypes: typeof SupportedSuperTypes;
1522
+ declare const types_SupportedUnitsOfSale: typeof SupportedUnitsOfSale;
1523
+ type types_TablePosition = TablePosition;
1524
+ type types_TaxRate = TaxRate;
1525
+ type types_TemplateSaleData = TemplateSaleData;
1526
+ type types_UnitOfSale = UnitOfSale;
1527
+ declare const types_VIDEO_TASKS_VALUES: typeof VIDEO_TASKS_VALUES;
1528
+ type types_VideoTasks = VideoTasks;
1529
+ type types_WebhookEvent<T> = WebhookEvent<T>;
1530
+ type types_WebhookEventName = WebhookEventName;
1531
+ declare const types_supportedWebhookEvents: typeof supportedWebhookEvents;
1532
+ declare namespace types {
1533
+ export { types_AccountTiers as AccountTiers, 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 };
1534
+ export type { types_Accessory as Accessory, types_AccountTier as AccountTier, types_ActivityChange as ActivityChange, types_ActivityLog as ActivityLog, types_ActivityOperation as ActivityOperation, 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_BroadcastKind as BroadcastKind, types_BroadcastPayload as BroadcastPayload, types_BroadcastRecipient as BroadcastRecipient, types_BroadcastSendResponse as BroadcastSendResponse, types_BroadcastSendResultItem as BroadcastSendResultItem, types_BroadcastTask as BroadcastTask, types_BroadcastType as BroadcastType, 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_DeleteLotsResponse as DeleteLotsResponse, types_DeviceType as DeviceType, types_DisplayBoardMode as DisplayBoardMode, types_DraftInvoice as DraftInvoice, types_EmailBroadcastPayload as EmailBroadcastPayload, types_EmailDeliveryClass as EmailDeliveryClass, types_EmailTask as EmailTask, 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_LadderCalculationMode as LadderCalculationMode, types_LineItemAdjustmentConfiguration as LineItemAdjustmentConfiguration, types_Lot as Lot, types_LotDeleteDecision as LotDeleteDecision, types_LotDeletePreflightItem as LotDeletePreflightItem, types_LotDeletePreflightResponse as LotDeletePreflightResponse, types_LotDeleteReason as LotDeleteReason, types_LotDeleteStudioLockReason as LotDeleteStudioLockReason, 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_PostmarkMessageStream as PostmarkMessageStream, types_Printer as Printer, types_Product as Product, types_ProductCodeConfiguration as ProductCodeConfiguration, types_ProductConfiguration as ProductConfiguration, types_ReadOptions as ReadOptions, types_SMSBroadcastPayload as SMSBroadcastPayload, types_SMSTask as SMSTask, types_Sale as Sale, types_SaleFromSearch as SaleFromSearch, types_SalePublishStatus as SalePublishStatus, types_SaleTemplate as SaleTemplate, types_SendSMSPayload as SendSMSPayload, 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 };
1535
+ }
1536
+
1537
+ interface ListContactsResponse {
1538
+ contacts: CustomerContact[];
1539
+ lastId: string | null;
1540
+ hasMore: boolean;
1541
+ }
1542
+ interface CreateOrUpdateContactPayload {
1543
+ id?: string;
1544
+ displayName?: string | null;
1545
+ email?: string | null;
1546
+ phoneNumber?: string | null;
1547
+ notes?: string | null;
1548
+ marteyeUid?: string | null;
1549
+ accountEmails?: boolean;
1550
+ marketingEmails?: boolean;
1551
+ }
1552
+
1553
+ declare const videoTaskSchema: z.ZodEnum<["compressed", "thumbnail"]>;
1554
+ declare const imageSizeSchema: z.ZodEnum<["thumbnail", "small", "medium", "large"]>;
1555
+ type ImageSize = z.infer<typeof imageSizeSchema>;
1556
+ type VideoTask = z.infer<typeof videoTaskSchema>;
1557
+ type SupportedFileTypesNames = "image" | "video" | "file";
1558
+ type VariantProcessingState = {
1559
+ fileName: string;
1560
+ thumbHash: string;
1561
+ path: string;
1562
+ url: string;
1563
+ fileType: string;
1564
+ variants: Partial<Record<ImageSize | VideoTask, {
1565
+ url: string;
1566
+ isProcessing: boolean;
1567
+ type: SupportedFileTypesNames;
1568
+ }>>;
1569
+ };
1570
+ /**
1571
+ |--------------------------------------------------
1572
+ | END OF MEDIA CRATE CODE
1573
+ |--------------------------------------------------
1574
+ */
1575
+ type MediaFinishUploadResponse = {
1576
+ message: string;
1577
+ mediaType: string;
1578
+ process: VariantProcessingState;
1579
+ };
1580
+ type MediaUploadOptions = {
1581
+ marketId: string;
1582
+ saleId: string;
1583
+ lotId: string;
1584
+ attributeId: string;
1585
+ options?: {
1586
+ bucket?: "raw";
1587
+ parallelParts?: number;
1588
+ baseUrl?: string;
1589
+ progressCallback?: (progress: {
1590
+ /**
1591
+ * The state of the upload
1592
+ */
1593
+ state: "uploading" | "finished" | "failed" | "starting";
1594
+ /**
1595
+ * The progress of the upload
1596
+ */
1597
+ progress: number;
1598
+ /**
1599
+ * The current part number
1600
+ */
1601
+ currentPart?: number;
1602
+ /**
1603
+ * The total parts
1604
+ */
1605
+ totalParts?: number;
1606
+ }) => void;
1607
+ };
1608
+ };
1609
+ type ChunkedFile = {
1610
+ partNumber: string;
1611
+ chunk: string;
1612
+ fileExtension: string;
1613
+ fileMimeType: string;
1614
+ };
1615
+ type FileInput = {
1616
+ file: File;
1617
+ uploadConfig: MediaUploadOptions;
1618
+ };
1619
+ type ChunkedInput = {
1620
+ fileName: string;
1621
+ chunks: ChunkedFile[];
1622
+ uploadConfig: MediaUploadOptions;
1623
+ };
1624
+ /**
1625
+ * Handles the complete file upload process including chunking and progress tracking -
1626
+ * WEB: Pass in a file and we will chunk it and upload it in parallel
1627
+ * NATIVE: You need to chunk the file yourself.
1628
+ * @param {FileInput | ChunkedInput} input - Either {file, options} or {fileName, chunks, options}
1629
+ * @returns {Promise<MediaFinishUploadResponse>}
1630
+ * @throws {Error} When upload fails
1631
+ */
1632
+ declare const uploadMultipartFile: (input: FileInput | ChunkedInput, token: string) => Promise<MediaFinishUploadResponse>;
1633
+ type SingleFileInput = {
1634
+ file?: File;
1635
+ filePath?: never;
1636
+ uploadConfig: MediaUploadOptions;
1637
+ } | {
1638
+ filePath?: string;
1639
+ file?: never;
1640
+ uploadConfig: MediaUploadOptions;
1641
+ };
1642
+ declare const uploadSingleFile: (input: SingleFileInput, token: string) => Promise<{
1643
+ message: string;
1644
+ data: Media;
1645
+ }>;
1646
+
1647
+ /**
1648
+ * Search result interface based on the API implementation
1649
+ */
1650
+ interface SearchResult {
1651
+ hits: Array<{
1652
+ id: string;
1653
+ marketId: string;
1654
+ title: string;
1655
+ [key: string]: any;
1656
+ }>;
1657
+ processingTimeMs: number;
1658
+ query: string;
1659
+ }
1660
+
1661
+ interface PayoutsListResponse {
1662
+ payouts: Payout[];
1663
+ lastId: string | null;
1664
+ hasMore: boolean;
1665
+ }
1666
+ interface PayoutCreateResponse {
1667
+ payout: Payout;
1668
+ }
1669
+ interface CreatePayoutRequest {
1670
+ /** IDs of the seller invoices this payout is for. All must be for the same customer and have status "issued". */
1671
+ invoiceIds: string[];
1672
+ /** Payout method */
1673
+ method: "BACS" | "Cheque" | "Cash";
1674
+ /** Payout amount in cents. If not provided, defaults to the sum of amountDueInCents across all invoices. */
1675
+ amountInCents?: number;
1676
+ /** Transaction date (ISO 8601). Defaults to now. */
1677
+ transactionDate?: string;
1678
+ /** Cheque number or BACS reference */
1679
+ reference?: string | null;
1680
+ /** Optional notes */
1681
+ notes?: string | null;
1682
+ /** Account holder name (BACS only). Falls back to customer bank details or display name. */
1683
+ accountName?: string;
1684
+ /** 8-digit account number (BACS only). Falls back to customer bank details. */
1685
+ accountNumber?: string;
1686
+ /** 6-digit sort code (BACS only). Falls back to customer bank details. */
1687
+ sortCode?: string;
1688
+ /** Name on cheque (Cheque only). Falls back to customer display name. */
1689
+ chequeMadePayableTo?: string;
1690
+ /** True when the cheque has already been issued and should not be queued for Studio printing. */
1691
+ chequeIsPrinted?: boolean;
1692
+ /** True when the cheque was written or printed outside Studio. */
1693
+ chequeIssuedManually?: boolean;
1694
+ }
1695
+
1696
+ interface PaymentsListResponse {
1697
+ payments: Payment[];
1698
+ lastId: string | null;
1699
+ hasMore: boolean;
1700
+ }
1701
+
1702
+ interface InvoicesListResponse {
1703
+ invoices: Invoice[];
1704
+ lastId: string | null;
1705
+ hasMore: boolean;
1706
+ }
1707
+
1708
+ interface CreateCustomerPayload {
1709
+ displayName: string;
1710
+ email?: string;
1711
+ phone?: string;
1712
+ accountNumberPrefix?: string;
1713
+ accountNumber?: string;
1714
+ cphNumber?: string;
1715
+ farmName?: string;
1716
+ herdNumber?: string;
1717
+ flockNumber?: string;
1718
+ address?: {
1719
+ company?: string;
1720
+ firstName?: string;
1721
+ lastName?: string;
1722
+ address1: string;
1723
+ address2?: string;
1724
+ city: string;
1725
+ province?: string;
1726
+ zip: string;
1727
+ country: string;
1728
+ };
1729
+ marteyeUid?: string;
1730
+ bankDetails?: {
1731
+ sortCode?: string;
1732
+ accountNumber?: string;
1733
+ accountName?: string;
1734
+ };
1735
+ vatNumber?: string;
1736
+ invoiceDeliveryPreference?: string;
1737
+ statementDeliveryPreference?: string;
1738
+ payoutPreference?: string;
1739
+ notes?: string;
1740
+ }
1741
+ interface FarmAssuranceUpdate {
1742
+ number?: string | null;
1743
+ scheme?: string | null;
1744
+ expiry?: string | Date | null;
1745
+ }
1746
+ interface KeeperDetailsUpdate {
1747
+ herdNumber?: string | null;
1748
+ flockNumber?: string | null;
1749
+ cphNumber?: string | null;
1750
+ farmName?: string | null;
1751
+ slapMark?: string | null;
1752
+ farmAssurance?: {
1753
+ cattle?: FarmAssuranceUpdate | null;
1754
+ sheep?: FarmAssuranceUpdate | null;
1755
+ pigs?: FarmAssuranceUpdate | null;
1756
+ };
1757
+ vetAttestation?: {
1758
+ vanNumber?: string | null;
1759
+ expiry?: string | Date | null;
1760
+ } | null;
1761
+ movementReporting?: {
1762
+ fromOrigin?: boolean | null;
1763
+ toDestination?: boolean | null;
1764
+ } | null;
1765
+ }
1766
+ interface UpdateCustomerPayload {
1767
+ displayName?: string | null;
1768
+ email?: {
1769
+ email: string;
1770
+ isVerified?: boolean;
1771
+ createdAt?: string | Date;
1772
+ } | null;
1773
+ phoneNumber?: {
1774
+ phoneNumber: string;
1775
+ isVerified?: boolean;
1776
+ createdAt?: string | Date;
1777
+ } | null;
1778
+ address?: Customer["address"] | null;
1779
+ otherAddresses?: Customer["otherAddresses"] | null;
1780
+ otherPhoneNumbers?: Customer["otherPhoneNumbers"] | null;
1781
+ payoutPreference?: PayoutMethod | "none" | null;
1782
+ invoiceDeliveryPreference?: InvoiceDeliveryPreference | "none" | null;
1783
+ statementDeliveryPreference?: InvoiceDeliveryPreference | "none" | null;
1784
+ bankDetails?: Customer["bankDetails"] | null;
1785
+ preferSettleDebtsFirst?: boolean;
1786
+ vatNumber?: string | null;
1787
+ accountNumber?: string | null;
1788
+ notes?: string | null;
1789
+ attributeDefaultsBuyer?: Customer["attributeDefaultsBuyer"] | null;
1790
+ attributeDefaultsSeller?: Customer["attributeDefaultsSeller"] | null;
1791
+ metadata?: Customer["metadata"] | null;
1792
+ keeperDetails?: KeeperDetailsUpdate;
1793
+ }
1794
+ interface CustomersListResponse {
1795
+ customers: Customer[];
1796
+ lastId: string | null;
1797
+ hasMore: boolean;
1798
+ }
1799
+
1800
+ interface CreateExtraPayload {
1801
+ id: string;
1802
+ name: string;
1803
+ taxRateId: string;
1804
+ defaultUnitPriceInCents?: number;
1805
+ unitPriceIncludesVat?: boolean;
1806
+ applyToClients?: ("Seller" | "Buyer")[];
1807
+ subtotalGroup?: string | null;
1808
+ passThroughFundsToAnotherCustomer?: boolean;
1809
+ isEnabled?: boolean;
1810
+ metadata?: Record<string, any>;
1811
+ }
1812
+ interface UpdateExtraPayload {
1813
+ name?: string;
1814
+ taxRateId?: string;
1815
+ defaultUnitPriceInCents?: number;
1816
+ unitPriceIncludesVat?: boolean;
1817
+ applyToClients?: ("Seller" | "Buyer")[];
1818
+ subtotalGroup?: string | null;
1819
+ passThroughFundsToAnotherCustomer?: boolean;
1820
+ isEnabled?: boolean;
1821
+ metadata?: Record<string, any>;
1822
+ }
1823
+
1824
+ interface CreateApplicationPayload {
1825
+ displayName: string;
1826
+ phoneNumber?: string;
1827
+ email?: string;
1828
+ address: {
1829
+ firstLine: string;
1830
+ secondLine?: string;
1831
+ county?: string;
1832
+ postCode: string;
1833
+ };
1834
+ dateOfMarteyeAccountCreation?: string;
1835
+ hasWonLotsOnMarteye?: boolean;
1836
+ isApprovedAtOtherMarkets?: boolean;
1837
+ marteyeUid: string;
1838
+ notes?: string;
1839
+ }
1840
+ interface UpdateApplicationPayload {
1841
+ displayName?: string;
1842
+ phoneNumber?: string;
1843
+ email?: string;
1844
+ address?: {
1845
+ firstLine?: string;
1846
+ secondLine?: string;
1847
+ county?: string;
1848
+ postCode?: string;
1849
+ };
1850
+ notes?: string;
1851
+ }
1852
+ interface ListApplicationsOptions {
1853
+ lastId?: string;
1854
+ status?: "pending" | "approved" | "rejected";
1855
+ }
1856
+ interface ListApplicationsResponse {
1857
+ applications: Application[];
1858
+ lastId: string | null;
1859
+ hasMore: boolean;
1860
+ }
1861
+
1862
+ interface LotsBySale {
1863
+ saleId: string;
1864
+ marketId: string;
1865
+ lots: Lot[];
1866
+ }
1867
+ interface CartResponse {
1868
+ customerId: string;
1869
+ extras: CartItem[];
1870
+ lotsBuyingBySale: LotsBySale[];
1871
+ lotsSellingBySale: LotsBySale[];
1872
+ }
1873
+ interface AddExtraPayload {
1874
+ productId: string;
1875
+ clientType: "Seller" | "Buyer";
1876
+ quantity: number;
1877
+ unitPriceInCents: number;
1878
+ passthroughFundsToCustomerId?: string | null;
1879
+ }
1880
+
1881
+ interface Member {
1882
+ uid: string;
1883
+ displayName: string | null;
1884
+ role: "Owner" | "Admin" | "Editor";
1885
+ createdAt: string;
1886
+ updatedAt: string;
1887
+ }
1888
+ interface MembersListResponse {
1889
+ data: Member[];
1890
+ lastId: string | null;
1891
+ hasMore: boolean;
1892
+ }
1893
+ interface MembersListParams {
1894
+ limit?: number;
1895
+ lastId?: string;
1896
+ }
1897
+
1898
+ interface ActivityListResponse {
1899
+ data: ActivityLog[];
1900
+ lastId: string | null;
1901
+ hasMore: boolean;
1902
+ }
1903
+ interface ActivityListParams {
1904
+ saleId?: string;
1905
+ entityType?: string;
1906
+ entityId?: string;
1907
+ operation?: string;
1908
+ memberId?: string;
1909
+ from?: string;
1910
+ to?: string;
1911
+ limit?: number;
1912
+ lastId?: string;
1913
+ }
1914
+
1915
+ type CustomerListType = "simple" | "smart";
1916
+ type CustomerListRole = "buyer" | "seller" | "both";
1917
+ type CustomerListSourceCustomerType = Exclude<CustomerListRole, "both">;
1918
+ interface GeoBounds {
1919
+ north: number;
1920
+ south: number;
1921
+ east: number;
1922
+ west: number;
1923
+ }
1924
+ interface RollingDateConfig {
1925
+ windowDays: number;
1926
+ originalStart: string;
1927
+ originalEnd: string;
1928
+ }
1929
+ interface CustomerListQuery {
1930
+ role: CustomerListRole;
1931
+ filter?: string;
1932
+ excludeFilters?: string[];
1933
+ bounds?: GeoBounds;
1934
+ sourceCustomerType?: CustomerListSourceCustomerType | null;
1935
+ sourceSaleId?: string | null;
1936
+ sourceCustomerIds?: string[];
1937
+ rollingDateConfig?: RollingDateConfig;
1938
+ secondaryFilter?: {
1939
+ role: CustomerListRole;
1940
+ filter?: string;
1941
+ bounds?: GeoBounds;
1942
+ sourceCustomerType?: CustomerListSourceCustomerType | null;
1943
+ sourceCustomerIds?: string[];
1944
+ rollingDateConfig?: RollingDateConfig;
1945
+ };
1946
+ }
1947
+ interface CustomerList {
1948
+ id: string;
1949
+ marketId: string;
1950
+ name: string;
1951
+ slug: string;
1952
+ description?: string;
1953
+ type: CustomerListType;
1954
+ query?: CustomerListQuery;
1955
+ rollingDateConfig?: RollingDateConfig;
1956
+ excludedCustomerIds?: string[];
1957
+ memberCount: number;
1958
+ refreshStatus?: "idle" | "refreshing" | "failed";
1959
+ refreshError?: string;
1960
+ lastRefreshedAt?: string;
1961
+ lastRefreshDurationMs?: number;
1962
+ lastRefreshCostEstimate?: number;
1963
+ lastRollingDateRange?: {
1964
+ start: string;
1965
+ end: string;
1966
+ };
1967
+ createdAt: string;
1968
+ createdBy: string;
1969
+ updatedAt: string;
1970
+ updatedBy: string;
1971
+ }
1972
+ interface CustomerListMember {
1973
+ marketId: string;
1974
+ listId: string;
1975
+ customerId: string;
1976
+ dateAdded: string;
1977
+ addedBy: string;
1978
+ customerDisplayName?: string;
1979
+ customerAccountNumber?: string;
1980
+ email?: string;
1981
+ phoneNumber?: string;
1982
+ }
1983
+ interface CustomerListFilterGroup {
1984
+ role?: CustomerListRole | null;
1985
+ dateStart?: string | null;
1986
+ dateEnd?: string | null;
1987
+ productCodes?: string[];
1988
+ sourceCustomerType?: CustomerListSourceCustomerType | null;
1989
+ sourceCustomerIds?: string[];
1990
+ sourceSaleId?: string | null;
1991
+ geoBounds?: GeoBounds | null;
1992
+ rollingDateConfig?: RollingDateConfig;
1993
+ }
1994
+ interface CustomerListFilters {
1995
+ role?: CustomerListRole | null;
1996
+ dateStart?: string | null;
1997
+ dateEnd?: string | null;
1998
+ productCodes?: string[];
1999
+ sourceCustomerType?: CustomerListSourceCustomerType | null;
2000
+ sourceCustomerIds?: string[];
2001
+ sourceSaleId?: string | null;
2002
+ excludeDateStart?: string | null;
2003
+ excludeDateEnd?: string | null;
2004
+ excludedProductCodes?: string[];
2005
+ geoBounds?: GeoBounds | null;
2006
+ boughtOnlineOnly?: boolean;
2007
+ cattleBreeds?: string[];
2008
+ sheepBreeds?: string[];
2009
+ rollingDateConfig?: RollingDateConfig;
2010
+ secondaryFilter?: CustomerListFilterGroup | null;
2011
+ }
2012
+ interface CustomerListReportRow {
2013
+ customerId: string;
2014
+ displayName?: string | null;
2015
+ accountNumber?: string | null;
2016
+ purchasedItemCount: number;
2017
+ totalPurchasedValueInCents: number;
2018
+ soldItemCount: number;
2019
+ totalSoldValueInCents: number;
2020
+ lastSaleDate?: string | null;
2021
+ lastPurchaseDate?: string | null;
2022
+ productCodesSold?: string[] | null;
2023
+ productCodesBought?: string[] | null;
2024
+ latitude?: number | null;
2025
+ longitude?: number | null;
2026
+ address1?: string | null;
2027
+ address2?: string | null;
2028
+ city?: string | null;
2029
+ province?: string | null;
2030
+ zip?: string | null;
2031
+ country?: string | null;
2032
+ email?: string | null;
2033
+ phoneNumber?: string | null;
2034
+ }
2035
+ interface CustomerListReportSummary {
2036
+ totalCustomers: number;
2037
+ totalSoldValueInCents: number;
2038
+ totalPurchasedValueInCents: number;
2039
+ customersWithLocation: number;
2040
+ uniqueProductCodes: string[];
2041
+ }
2042
+ type CustomerListViewResult = {
2043
+ mode: "simple";
2044
+ list: CustomerList;
2045
+ members: CustomerListMember[];
2046
+ total: number;
2047
+ } | {
2048
+ mode: "smart";
2049
+ list: CustomerList;
2050
+ effectiveFilters: CustomerListFilters;
2051
+ rows: CustomerListReportRow[];
2052
+ summary: CustomerListReportSummary;
2053
+ };
2054
+ interface CustomerListsListOptions {
2055
+ type?: CustomerListType;
2056
+ limit?: number;
2057
+ offset?: number;
2058
+ }
2059
+ interface CustomerListMembersOptions {
2060
+ limit?: number;
2061
+ offset?: number;
2062
+ includeArchived?: boolean;
2063
+ }
2064
+ interface CustomerListViewOptions {
2065
+ identifierType?: "auto" | "id" | "slug";
2066
+ limit?: number;
2067
+ offset?: number;
2068
+ allMembers?: boolean;
2069
+ refresh?: boolean;
2070
+ }
2071
+ interface CustomerListsListResponse {
2072
+ lists: CustomerList[];
2073
+ total: number;
2074
+ }
2075
+ interface CustomerListMembersResponse {
2076
+ members: CustomerListMember[];
2077
+ total: number;
2078
+ hasMore: boolean;
2079
+ }
2080
+ interface CustomerListPreviewResponse {
2081
+ rows: CustomerListReportRow[];
2082
+ summary: CustomerListReportSummary;
2083
+ sourceGroups?: Array<{
2084
+ source: CustomerListReportRow;
2085
+ targets: CustomerListReportRow[];
2086
+ }>;
2087
+ }
2088
+ interface CustomerListProductCodesResponse {
2089
+ uniqueProductCodes: string[];
2090
+ }
2091
+ interface CustomerListAddMembersResponse {
2092
+ added: number;
2093
+ alreadyMembers: number;
2094
+ notFound: number;
2095
+ memberCount: number;
2096
+ }
2097
+ interface CustomerListRemoveMemberResponse {
2098
+ removed: boolean;
2099
+ memberCount: number;
2100
+ }
2101
+ interface CustomerListDeleteResponse {
2102
+ deleted: boolean;
2103
+ membersRemoved: number;
2104
+ }
2105
+ interface CustomerListRefreshResponse {
2106
+ refreshStatus: "refreshing";
2107
+ message: string;
2108
+ }
2109
+ type CreateCustomerListPayload = {
2110
+ name: string;
2111
+ description?: string;
2112
+ type: "simple";
2113
+ } | {
2114
+ name: string;
2115
+ description?: string;
2116
+ type: "smart";
2117
+ query?: CustomerListQuery;
2118
+ filters?: CustomerListFilters;
2119
+ };
2120
+ interface UpdateCustomerListPayload {
2121
+ name?: string;
2122
+ description?: string | null;
2123
+ query?: CustomerListQuery;
2124
+ filters?: Partial<CustomerListFilters>;
2125
+ }
2126
+
2127
+ declare function resources(httpClient: HttpClient): {
2128
+ activity: {
2129
+ list: (marketId: string, params?: ActivityListParams) => Promise<ActivityListResponse>;
2130
+ get: (marketId: string, activityId: string) => Promise<ActivityLog>;
2131
+ };
2132
+ broadcast: {
2133
+ send: (marketId: string, data: BroadcastPayload) => Promise<BroadcastSendResponse>;
2134
+ get: (marketId: string, type: BroadcastType, taskId: string) => Promise<BroadcastTask>;
2135
+ };
2136
+ markets: {
2137
+ get: (marketId: string, options?: ReadOptions) => Promise<Market>;
2138
+ };
2139
+ members: {
2140
+ list: (marketId: string, params?: MembersListParams) => Promise<MembersListResponse>;
2141
+ get: (marketId: string, memberId: string) => Promise<Member>;
2142
+ };
2143
+ sales: {
2144
+ get: (marketId: string, saleId: string, options?: ReadOptions) => Promise<Sale>;
2145
+ list: (marketId: string, opts: {
2146
+ start?: string;
2147
+ end?: string;
2148
+ }) => Promise<{
2149
+ start: string;
2150
+ end: string;
2151
+ sales: Sale[];
2152
+ }>;
2153
+ create: (marketId: string, saleData: {
2154
+ name: string;
2155
+ startsAt: string;
2156
+ availableProductCodes: string[];
2157
+ recurring?: null | "Weekly" | "Bi-weekly" | "Monthly";
2158
+ martEyeSaleType?: "LIVE" | "TIMED" | null;
2159
+ location?: string | null;
2160
+ description?: string | null;
2161
+ image?: string | null;
2162
+ cover?: string | null;
2163
+ templateId?: string | null;
2164
+ enableLotGrouping?: boolean;
2165
+ attributeDefaults?: {
2166
+ [attributekey: string]: string | number | boolean;
2167
+ };
2168
+ }) => Promise<{
2169
+ saleId: string;
2170
+ }>;
2171
+ update: (marketId: string, saleId: string, data: {
2172
+ name?: string;
2173
+ startsAt?: string;
2174
+ recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
2175
+ defaultProductCode?: string;
2176
+ attributeDefaults?: Record<string, any>;
2177
+ publishStatus?: SalePublishStatus;
2178
+ enableLotGrouping?: boolean;
2179
+ marteyeSettings?: {
2180
+ description?: string;
2181
+ image?: string;
2182
+ logo?: string;
2183
+ type: "LIVE" | "TIMED";
2184
+ location?: string | null;
2185
+ descriptionLines?: string[];
2186
+ descriptionLink?: string;
2187
+ deposit?: number;
2188
+ hidePrices?: boolean;
2189
+ hideReplay?: boolean;
2190
+ labels?: string[];
2191
+ tags?: string[];
2192
+ details?: Array<{
2193
+ markdownBase64: string;
2194
+ title: string;
2195
+ }>;
2196
+ cover?: string;
2197
+ primaryColour?: string;
2198
+ secondaryColour?: string;
2199
+ foregroundColour?: string;
2200
+ extensionTime?: number;
2201
+ incrementLadder?: Array<{
2202
+ max: number;
2203
+ increment: number;
2204
+ }>;
2205
+ hideNav?: boolean;
2206
+ signInOverrideLink?: string;
2207
+ published?: boolean;
2208
+ pin?: boolean;
2209
+ cascade?: boolean;
2210
+ reportEmail?: string;
2211
+ queueLots?: boolean;
2212
+ markSubjectLotsAsSold?: boolean;
2213
+ } | null;
2214
+ }) => Promise<Sale>;
2215
+ };
2216
+ lots: {
2217
+ get: (marketId: string, saleId: string, lotId: string, options?: ReadOptions) => Promise<Lot>;
2218
+ list: (marketId: string, saleId: string, filters?: {
2219
+ group?: string;
2220
+ productCode?: string;
2221
+ saleStatus?: LotSaleStatus;
2222
+ sellerCustomerId?: string;
2223
+ buyerCustomerId?: string;
2224
+ }) => Promise<Lot[]>;
2225
+ create: (marketId: string, saleId: string, data: {
2226
+ index?: number;
2227
+ lotNumber?: string;
2228
+ group?: string;
2229
+ productCode?: string;
2230
+ sellerCustomerId?: string;
2231
+ attributes?: Record<string, any>;
2232
+ metadata?: Record<string, any>;
2233
+ buyerCustomerId?: string;
2234
+ unitPriceInCents?: number;
2235
+ reservePriceInCents?: number;
2236
+ startingPriceInCents?: number;
2237
+ startAt?: string;
2238
+ endAt?: string;
2239
+ previousLotNumber?: string;
2240
+ saleStatus?: LotSaleStatus;
2241
+ }) => Promise<Lot>;
2242
+ update: (marketId: string, saleId: string, lotId: string, data: {
2243
+ productCode?: string;
2244
+ attributes?: Record<string, any>;
2245
+ sellerCasual?: string | null;
2246
+ sellerCustomerId?: string | null;
2247
+ lotNumber?: string | null;
2248
+ remarks?: string;
2249
+ notes?: string;
2250
+ unitOfSale?: "Per KG" | "Per Item" | "Per Lot" | "Per 1000KG";
2251
+ unitPriceInCents?: number;
2252
+ reservePriceInCents?: number;
2253
+ startingPriceInCents?: number;
2254
+ buyerCasual?: string | null;
2255
+ buyerCustomerId?: string | null;
2256
+ startAt?: string | null;
2257
+ endAt?: string | null;
2258
+ saleStatus?: LotSaleStatus;
2259
+ metadata?: Record<string, any>;
2260
+ inputAccessories?: Record<string, any>;
2261
+ }) => Promise<Lot>;
2262
+ delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
2263
+ deletePreflight: (marketId: string, saleId: string, lotId: string) => Promise<LotDeletePreflightResponse>;
2264
+ deletePreflightBatch: (marketId: string, saleId: string, lotIds: string[]) => Promise<DeleteLotsResponse>;
2265
+ deleteBatch: (marketId: string, saleId: string, lotIds: string[], confirmedLotIds?: string[]) => Promise<DeleteLotsResponse>;
2266
+ };
2267
+ lotitems: {
2268
+ create: (marketId: string, saleId: string, lotId: string, data: {
2269
+ attributes?: Record<string, any>;
2270
+ notes?: Array<{
2271
+ text: string;
2272
+ }>;
2273
+ metadata?: Record<string, any>;
2274
+ }) => Promise<LotItem>;
2275
+ update: (marketId: string, saleId: string, lotId: string, itemId: string, data: {
2276
+ attributes?: Record<string, any>;
2277
+ index?: number;
2278
+ metadata?: Record<string, any>;
2279
+ }) => Promise<LotItem>;
2280
+ delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
2281
+ };
2282
+ carts: {
2283
+ get: (marketId: string, customerId: string) => Promise<CartResponse>;
2284
+ addExtra: (marketId: string, customerId: string, data: AddExtraPayload) => Promise<CartResponse>;
2285
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
2286
+ };
2287
+ cph: {
2288
+ lookup: (marketId: string, cph: string) => Promise<CphLookupResponse>;
2289
+ };
2290
+ webhooks: {
2291
+ constructEvent: <T extends unknown>(bodyAsBuffer: Buffer, signature: string | undefined | null, endpointSecret: string | undefined | null) => Promise<WebhookEvent<T>>;
2292
+ };
2293
+ actions: {
2294
+ constructAction: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
2295
+ };
2296
+ bidderApplications: {
2297
+ list: (marketId: string, options?: ListApplicationsOptions) => Promise<ListApplicationsResponse>;
2298
+ get: (marketId: string, applicationId: string) => Promise<Application>;
2299
+ create: (marketId: string, applicationData: CreateApplicationPayload) => Promise<Application>;
2300
+ update: (marketId: string, applicationId: string, updateData: UpdateApplicationPayload) => Promise<Application>;
2301
+ approve: (marketId: string, applicationId: string, notes?: string) => Promise<Application>;
2302
+ reject: (marketId: string, applicationId: string, notes?: string) => Promise<Application>;
2303
+ unlink: (marketId: string, applicationId: string) => Promise<Application>;
2304
+ delete: (marketId: string, applicationId: string) => Promise<void>;
2305
+ };
2306
+ settings: {
2307
+ get: (marketId: string, options?: ReadOptions) => Promise<SettingsMarketDefaults>;
2308
+ };
2309
+ adjustments: {
2310
+ list: (marketId: string) => Promise<AdjustmentsConfiguration[]>;
2311
+ get: (marketId: string, id: string, options?: ReadOptions) => Promise<AdjustmentsConfiguration>;
2312
+ create: (marketId: string, data: Partial<AdjustmentsConfiguration>) => Promise<AdjustmentsConfiguration>;
2313
+ update: (marketId: string, id: string, data: Partial<AdjustmentsConfiguration>) => Promise<AdjustmentsConfiguration>;
2314
+ };
2315
+ extras: {
2316
+ list: (marketId: string) => Promise<Product[]>;
2317
+ get: (marketId: string, id: string) => Promise<Product>;
2318
+ create: (marketId: string, data: CreateExtraPayload) => Promise<Product>;
2319
+ update: (marketId: string, id: string, data: UpdateExtraPayload) => Promise<Product>;
2320
+ };
2321
+ productCodes: {
2322
+ list: (marketId: string, options?: {
2323
+ includeArchived?: boolean;
2324
+ }) => Promise<ProductCodeConfiguration[]>;
2325
+ get: (marketId: string, id: string, options?: ReadOptions) => Promise<ProductCodeConfiguration>;
2326
+ create: (marketId: string, data: Partial<ProductCodeConfiguration>) => Promise<ProductCodeConfiguration>;
2327
+ update: (marketId: string, id: string, data: Partial<ProductCodeConfiguration>) => Promise<ProductCodeConfiguration>;
2328
+ };
2329
+ saleTemplates: {
2330
+ list: (marketId: string) => Promise<{
2331
+ templates: SaleTemplate[];
2332
+ }>;
2333
+ get: (marketId: string, templateId: string) => Promise<{
2334
+ template: SaleTemplate;
2335
+ }>;
2336
+ create: (marketId: string, body: {
2337
+ saleId: string;
2338
+ name: string;
2339
+ description?: string | null;
2340
+ }) => Promise<{
2341
+ templateId: string;
2342
+ }>;
2343
+ update: (marketId: string, templateId: string, body: {
2344
+ name?: string;
2345
+ description?: string | null;
2346
+ }) => Promise<{
2347
+ template: SaleTemplate;
2348
+ }>;
2349
+ delete: (marketId: string, templateId: string) => Promise<{
2350
+ success: boolean;
2351
+ }>;
2352
+ };
2353
+ taxRates: {
2354
+ list: (marketId: string) => Promise<TaxRate[]>;
2355
+ get: (marketId: string, id: string) => Promise<TaxRate>;
2356
+ };
2357
+ customers: {
2358
+ list: (marketId: string, lastId?: string | null) => Promise<CustomersListResponse>;
2359
+ get: (marketId: string, customerId: string, options?: ReadOptions) => Promise<Customer>;
2360
+ avatar: (marketId: string, customerId: string) => Promise<Customer>;
2361
+ create: (marketId: string, customerData: CreateCustomerPayload) => Promise<Customer>;
2362
+ update: (marketId: string, customerId: string, customerData: UpdateCustomerPayload) => Promise<Customer>;
2363
+ getByAccountNumber: (marketId: string, accountNumber: string) => Promise<Customer | null>;
2364
+ getByMartEyeUid: (marketId: string, marteyeUid: string) => Promise<Customer | null>;
2365
+ };
2366
+ customerLists: {
2367
+ list: (marketId: string, options?: CustomerListsListOptions) => Promise<CustomerListsListResponse>;
2368
+ listAll: (marketId: string, options?: Omit<CustomerListsListOptions, "offset">) => Promise<CustomerList[]>;
2369
+ get: (marketId: string, listId: string) => Promise<CustomerList>;
2370
+ getBySlug: (marketId: string, slug: string) => Promise<CustomerList>;
2371
+ create: (marketId: string, payload: CreateCustomerListPayload) => Promise<CustomerList>;
2372
+ update: (marketId: string, listId: string, payload: UpdateCustomerListPayload) => Promise<CustomerList>;
2373
+ delete: (marketId: string, listId: string) => Promise<CustomerListDeleteResponse>;
2374
+ refresh: (marketId: string, listId: string) => Promise<CustomerListRefreshResponse>;
2375
+ getMembers: (marketId: string, listId: string, options?: CustomerListMembersOptions) => Promise<CustomerListMembersResponse>;
2376
+ getAllMembers: (marketId: string, listId: string, options?: Omit<CustomerListMembersOptions, "offset">) => Promise<CustomerListMember[]>;
2377
+ addMembers: (marketId: string, listId: string, customerIds: string[]) => Promise<CustomerListAddMembersResponse>;
2378
+ removeMember: (marketId: string, listId: string, customerId: string) => Promise<CustomerListRemoveMemberResponse>;
2379
+ preview: (marketId: string, filters: CustomerListFilters) => Promise<CustomerListPreviewResponse>;
2380
+ listProductCodes: (marketId: string) => Promise<CustomerListProductCodesResponse>;
2381
+ view: (marketId: string, listIdOrSlug: string, options?: CustomerListViewOptions) => Promise<CustomerListViewResult>;
2382
+ };
2383
+ invoices: {
2384
+ list: (marketId: string, lastId?: string | null) => Promise<InvoicesListResponse>;
2385
+ get: (marketId: string, invoiceId: string, options?: ReadOptions) => Promise<Invoice>;
2386
+ };
2387
+ payments: {
2388
+ list: (marketId: string, lastId?: string | null) => Promise<PaymentsListResponse>;
2389
+ get: (marketId: string, paymentId: string) => Promise<Payment>;
2390
+ };
2391
+ payouts: {
2392
+ list: (marketId: string, lastId?: string | null) => Promise<PayoutsListResponse>;
2393
+ get: (marketId: string, payoutId: string) => Promise<Payout>;
2394
+ create: (marketId: string, data: CreatePayoutRequest) => Promise<PayoutCreateResponse>;
2395
+ };
2396
+ search: {
2397
+ query: (marketId: string, query: string) => Promise<SearchResult>;
2398
+ };
2399
+ files: {
2400
+ uploadSingleFile: (input: Parameters<typeof uploadSingleFile>[0], token: string) => Promise<{
2401
+ message: string;
2402
+ data: Media;
2403
+ }>;
2404
+ uploadMultipartFile: (input: Parameters<typeof uploadMultipartFile>[0], token: string) => Promise<{
2405
+ message: string;
2406
+ mediaType: string;
2407
+ process: VariantProcessingState;
2408
+ }>;
2409
+ deleteFile: (fileUrl: string, token: string) => Promise<{
2410
+ data: boolean;
2411
+ }>;
2412
+ };
2413
+ contacts: {
2414
+ list: (marketId: string, customerId: string, params?: {
2415
+ lastId?: string;
2416
+ limit?: number;
2417
+ }) => Promise<ListContactsResponse>;
2418
+ get: (marketId: string, customerId: string, contactId: string) => Promise<CustomerContact>;
2419
+ create: (marketId: string, customerId: string, payload: CreateOrUpdateContactPayload) => Promise<CustomerContact>;
2420
+ update: (marketId: string, customerId: string, contactId: string, payload: CreateOrUpdateContactPayload) => Promise<CustomerContact>;
2421
+ delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
2422
+ };
2423
+ ledger: {
2424
+ getBalance: (marketId: string, account: string) => Promise<LedgerBalanceResponse>;
2425
+ getTransaction: (marketId: string, transactionId: string) => Promise<LedgerTransaction>;
2426
+ getLatestTransaction: (marketId: string, account: string) => Promise<LedgerTransaction>;
2427
+ listTransactions: (marketId: string, params: ListTransactionsParams) => Promise<TransactionsListResponse>;
2428
+ };
2429
+ };
2430
+
2431
+ type StudioInstance = ReturnType<typeof resources> & {
2432
+ isDebugMode: boolean;
2433
+ };
2434
+ declare function Studio(info?: {
2435
+ apiKey?: string;
2436
+ baseUrl?: string;
2437
+ defaultTimeout?: number;
2438
+ debug?: boolean;
2439
+ }): {
2440
+ isDebugMode: boolean;
2441
+ activity: {
2442
+ list: (marketId: string, params?: ActivityListParams) => Promise<ActivityListResponse>;
2443
+ get: (marketId: string, activityId: string) => Promise<ActivityLog>;
2444
+ };
2445
+ broadcast: {
2446
+ send: (marketId: string, data: BroadcastPayload) => Promise<BroadcastSendResponse>;
2447
+ get: (marketId: string, type: BroadcastType, taskId: string) => Promise<BroadcastTask>;
2448
+ };
2449
+ markets: {
2450
+ get: (marketId: string, options?: ReadOptions) => Promise<Market>;
2451
+ };
2452
+ members: {
2453
+ list: (marketId: string, params?: MembersListParams) => Promise<MembersListResponse>;
2454
+ get: (marketId: string, memberId: string) => Promise<Member>;
2455
+ };
2456
+ sales: {
2457
+ get: (marketId: string, saleId: string, options?: ReadOptions) => Promise<Sale>;
2458
+ list: (marketId: string, opts: {
2459
+ start?: string;
2460
+ end?: string;
2461
+ }) => Promise<{
2462
+ start: string;
2463
+ end: string;
2464
+ sales: Sale[];
2465
+ }>;
2466
+ create: (marketId: string, saleData: {
2467
+ name: string;
2468
+ startsAt: string;
2469
+ availableProductCodes: string[];
2470
+ recurring?: null | "Weekly" | "Bi-weekly" | "Monthly";
2471
+ martEyeSaleType?: "LIVE" | "TIMED" | null;
2472
+ location?: string | null;
2473
+ description?: string | null;
2474
+ image?: string | null;
2475
+ cover?: string | null;
2476
+ templateId?: string | null;
2477
+ enableLotGrouping?: boolean;
2478
+ attributeDefaults?: {
2479
+ [attributekey: string]: string | number | boolean;
2480
+ };
2481
+ }) => Promise<{
2482
+ saleId: string;
2483
+ }>;
2484
+ update: (marketId: string, saleId: string, data: {
2485
+ name?: string;
2486
+ startsAt?: string;
2487
+ recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
2488
+ defaultProductCode?: string;
2489
+ attributeDefaults?: Record<string, any>;
2490
+ publishStatus?: SalePublishStatus;
2491
+ enableLotGrouping?: boolean;
2492
+ marteyeSettings?: {
2493
+ description?: string;
2494
+ image?: string;
2495
+ logo?: string;
2496
+ type: "LIVE" | "TIMED";
2497
+ location?: string | null;
2498
+ descriptionLines?: string[];
2499
+ descriptionLink?: string;
2500
+ deposit?: number;
2501
+ hidePrices?: boolean;
2502
+ hideReplay?: boolean;
2503
+ labels?: string[];
2504
+ tags?: string[];
2505
+ details?: Array<{
2506
+ markdownBase64: string;
2507
+ title: string;
2508
+ }>;
2509
+ cover?: string;
2510
+ primaryColour?: string;
2511
+ secondaryColour?: string;
2512
+ foregroundColour?: string;
2513
+ extensionTime?: number;
2514
+ incrementLadder?: Array<{
2515
+ max: number;
2516
+ increment: number;
2517
+ }>;
2518
+ hideNav?: boolean;
2519
+ signInOverrideLink?: string;
2520
+ published?: boolean;
2521
+ pin?: boolean;
2522
+ cascade?: boolean;
2523
+ reportEmail?: string;
2524
+ queueLots?: boolean;
2525
+ markSubjectLotsAsSold?: boolean;
2526
+ } | null;
2527
+ }) => Promise<Sale>;
2528
+ };
2529
+ lots: {
2530
+ get: (marketId: string, saleId: string, lotId: string, options?: ReadOptions) => Promise<Lot>;
2531
+ list: (marketId: string, saleId: string, filters?: {
2532
+ group?: string;
2533
+ productCode?: string;
2534
+ saleStatus?: LotSaleStatus;
2535
+ sellerCustomerId?: string;
2536
+ buyerCustomerId?: string;
2537
+ }) => Promise<Lot[]>;
2538
+ create: (marketId: string, saleId: string, data: {
2539
+ index?: number;
2540
+ lotNumber?: string;
2541
+ group?: string;
2542
+ productCode?: string;
2543
+ sellerCustomerId?: string;
2544
+ attributes?: Record<string, any>;
2545
+ metadata?: Record<string, any>;
2546
+ buyerCustomerId?: string;
2547
+ unitPriceInCents?: number;
2548
+ reservePriceInCents?: number;
2549
+ startingPriceInCents?: number;
2550
+ startAt?: string;
2551
+ endAt?: string;
2552
+ previousLotNumber?: string;
2553
+ saleStatus?: LotSaleStatus;
2554
+ }) => Promise<Lot>;
2555
+ update: (marketId: string, saleId: string, lotId: string, data: {
2556
+ productCode?: string;
2557
+ attributes?: Record<string, any>;
2558
+ sellerCasual?: string | null;
2559
+ sellerCustomerId?: string | null;
2560
+ lotNumber?: string | null;
2561
+ remarks?: string;
2562
+ notes?: string;
2563
+ unitOfSale?: "Per KG" | "Per Item" | "Per Lot" | "Per 1000KG";
2564
+ unitPriceInCents?: number;
2565
+ reservePriceInCents?: number;
2566
+ startingPriceInCents?: number;
2567
+ buyerCasual?: string | null;
2568
+ buyerCustomerId?: string | null;
2569
+ startAt?: string | null;
2570
+ endAt?: string | null;
2571
+ saleStatus?: LotSaleStatus;
2572
+ metadata?: Record<string, any>;
2573
+ inputAccessories?: Record<string, any>;
2574
+ }) => Promise<Lot>;
2575
+ delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
2576
+ deletePreflight: (marketId: string, saleId: string, lotId: string) => Promise<LotDeletePreflightResponse>;
2577
+ deletePreflightBatch: (marketId: string, saleId: string, lotIds: string[]) => Promise<DeleteLotsResponse>;
2578
+ deleteBatch: (marketId: string, saleId: string, lotIds: string[], confirmedLotIds?: string[]) => Promise<DeleteLotsResponse>;
2579
+ };
2580
+ lotitems: {
2581
+ create: (marketId: string, saleId: string, lotId: string, data: {
2582
+ attributes?: Record<string, any>;
2583
+ notes?: Array<{
2584
+ text: string;
2585
+ }>;
2586
+ metadata?: Record<string, any>;
2587
+ }) => Promise<LotItem>;
2588
+ update: (marketId: string, saleId: string, lotId: string, itemId: string, data: {
2589
+ attributes?: Record<string, any>;
2590
+ index?: number;
2591
+ metadata?: Record<string, any>;
2592
+ }) => Promise<LotItem>;
2593
+ delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
2594
+ };
2595
+ carts: {
2596
+ get: (marketId: string, customerId: string) => Promise<CartResponse>;
2597
+ addExtra: (marketId: string, customerId: string, data: AddExtraPayload) => Promise<CartResponse>;
2598
+ removeExtra: (marketId: string, customerId: string, itemId: string) => Promise<void>;
2599
+ };
2600
+ cph: {
2601
+ lookup: (marketId: string, cph: string) => Promise<CphLookupResponse>;
2602
+ };
2603
+ webhooks: {
2604
+ constructEvent: <T extends unknown>(bodyAsBuffer: Buffer, signature: string | undefined | null, endpointSecret: string | undefined | null) => Promise<WebhookEvent<T>>;
2605
+ };
2606
+ actions: {
2607
+ constructAction: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
2608
+ };
2609
+ bidderApplications: {
2610
+ list: (marketId: string, options?: ListApplicationsOptions) => Promise<ListApplicationsResponse>;
2611
+ get: (marketId: string, applicationId: string) => Promise<Application>;
2612
+ create: (marketId: string, applicationData: CreateApplicationPayload) => Promise<Application>;
2613
+ update: (marketId: string, applicationId: string, updateData: UpdateApplicationPayload) => Promise<Application>;
2614
+ approve: (marketId: string, applicationId: string, notes?: string) => Promise<Application>;
2615
+ reject: (marketId: string, applicationId: string, notes?: string) => Promise<Application>;
2616
+ unlink: (marketId: string, applicationId: string) => Promise<Application>;
2617
+ delete: (marketId: string, applicationId: string) => Promise<void>;
2618
+ };
2619
+ settings: {
2620
+ get: (marketId: string, options?: ReadOptions) => Promise<SettingsMarketDefaults>;
2621
+ };
2622
+ adjustments: {
2623
+ list: (marketId: string) => Promise<AdjustmentsConfiguration[]>;
2624
+ get: (marketId: string, id: string, options?: ReadOptions) => Promise<AdjustmentsConfiguration>;
2625
+ create: (marketId: string, data: Partial<AdjustmentsConfiguration>) => Promise<AdjustmentsConfiguration>;
2626
+ update: (marketId: string, id: string, data: Partial<AdjustmentsConfiguration>) => Promise<AdjustmentsConfiguration>;
2627
+ };
2628
+ extras: {
2629
+ list: (marketId: string) => Promise<Product[]>;
2630
+ get: (marketId: string, id: string) => Promise<Product>;
2631
+ create: (marketId: string, data: CreateExtraPayload) => Promise<Product>;
2632
+ update: (marketId: string, id: string, data: UpdateExtraPayload) => Promise<Product>;
2633
+ };
2634
+ productCodes: {
2635
+ list: (marketId: string, options?: {
2636
+ includeArchived?: boolean;
2637
+ }) => Promise<ProductCodeConfiguration[]>;
2638
+ get: (marketId: string, id: string, options?: ReadOptions) => Promise<ProductCodeConfiguration>;
2639
+ create: (marketId: string, data: Partial<ProductCodeConfiguration>) => Promise<ProductCodeConfiguration>;
2640
+ update: (marketId: string, id: string, data: Partial<ProductCodeConfiguration>) => Promise<ProductCodeConfiguration>;
2641
+ };
2642
+ saleTemplates: {
2643
+ list: (marketId: string) => Promise<{
2644
+ templates: SaleTemplate[];
2645
+ }>;
2646
+ get: (marketId: string, templateId: string) => Promise<{
2647
+ template: SaleTemplate;
2648
+ }>;
2649
+ create: (marketId: string, body: {
2650
+ saleId: string;
2651
+ name: string;
2652
+ description?: string | null;
2653
+ }) => Promise<{
2654
+ templateId: string;
2655
+ }>;
2656
+ update: (marketId: string, templateId: string, body: {
2657
+ name?: string;
2658
+ description?: string | null;
2659
+ }) => Promise<{
2660
+ template: SaleTemplate;
2661
+ }>;
2662
+ delete: (marketId: string, templateId: string) => Promise<{
2663
+ success: boolean;
2664
+ }>;
2665
+ };
2666
+ taxRates: {
2667
+ list: (marketId: string) => Promise<TaxRate[]>;
2668
+ get: (marketId: string, id: string) => Promise<TaxRate>;
2669
+ };
2670
+ customers: {
2671
+ list: (marketId: string, lastId?: string | null) => Promise<CustomersListResponse>;
2672
+ get: (marketId: string, customerId: string, options?: ReadOptions) => Promise<Customer>;
2673
+ avatar: (marketId: string, customerId: string) => Promise<Customer>;
2674
+ create: (marketId: string, customerData: CreateCustomerPayload) => Promise<Customer>;
2675
+ update: (marketId: string, customerId: string, customerData: UpdateCustomerPayload) => Promise<Customer>;
2676
+ getByAccountNumber: (marketId: string, accountNumber: string) => Promise<Customer | null>;
2677
+ getByMartEyeUid: (marketId: string, marteyeUid: string) => Promise<Customer | null>;
2678
+ };
2679
+ customerLists: {
2680
+ list: (marketId: string, options?: CustomerListsListOptions) => Promise<CustomerListsListResponse>;
2681
+ listAll: (marketId: string, options?: Omit<CustomerListsListOptions, "offset">) => Promise<CustomerList[]>;
2682
+ get: (marketId: string, listId: string) => Promise<CustomerList>;
2683
+ getBySlug: (marketId: string, slug: string) => Promise<CustomerList>;
2684
+ create: (marketId: string, payload: CreateCustomerListPayload) => Promise<CustomerList>;
2685
+ update: (marketId: string, listId: string, payload: UpdateCustomerListPayload) => Promise<CustomerList>;
2686
+ delete: (marketId: string, listId: string) => Promise<CustomerListDeleteResponse>;
2687
+ refresh: (marketId: string, listId: string) => Promise<CustomerListRefreshResponse>;
2688
+ getMembers: (marketId: string, listId: string, options?: CustomerListMembersOptions) => Promise<CustomerListMembersResponse>;
2689
+ getAllMembers: (marketId: string, listId: string, options?: Omit<CustomerListMembersOptions, "offset">) => Promise<CustomerListMember[]>;
2690
+ addMembers: (marketId: string, listId: string, customerIds: string[]) => Promise<CustomerListAddMembersResponse>;
2691
+ removeMember: (marketId: string, listId: string, customerId: string) => Promise<CustomerListRemoveMemberResponse>;
2692
+ preview: (marketId: string, filters: CustomerListFilters) => Promise<CustomerListPreviewResponse>;
2693
+ listProductCodes: (marketId: string) => Promise<CustomerListProductCodesResponse>;
2694
+ view: (marketId: string, listIdOrSlug: string, options?: CustomerListViewOptions) => Promise<CustomerListViewResult>;
2695
+ };
2696
+ invoices: {
2697
+ list: (marketId: string, lastId?: string | null) => Promise<InvoicesListResponse>;
2698
+ get: (marketId: string, invoiceId: string, options?: ReadOptions) => Promise<Invoice>;
2699
+ };
2700
+ payments: {
2701
+ list: (marketId: string, lastId?: string | null) => Promise<PaymentsListResponse>;
2702
+ get: (marketId: string, paymentId: string) => Promise<Payment>;
2703
+ };
2704
+ payouts: {
2705
+ list: (marketId: string, lastId?: string | null) => Promise<PayoutsListResponse>;
2706
+ get: (marketId: string, payoutId: string) => Promise<Payout>;
2707
+ create: (marketId: string, data: CreatePayoutRequest) => Promise<PayoutCreateResponse>;
2708
+ };
2709
+ search: {
2710
+ query: (marketId: string, query: string) => Promise<SearchResult>;
2711
+ };
2712
+ files: {
2713
+ uploadSingleFile: (input: Parameters<typeof uploadSingleFile>[0], token: string) => Promise<{
2714
+ message: string;
2715
+ data: Media;
2716
+ }>;
2717
+ uploadMultipartFile: (input: Parameters<typeof uploadMultipartFile>[0], token: string) => Promise<{
2718
+ message: string;
2719
+ mediaType: string;
2720
+ process: VariantProcessingState;
2721
+ }>;
2722
+ deleteFile: (fileUrl: string, token: string) => Promise<{
2723
+ data: boolean;
2724
+ }>;
2725
+ };
2726
+ contacts: {
2727
+ list: (marketId: string, customerId: string, params?: {
2728
+ lastId?: string;
2729
+ limit?: number;
2730
+ }) => Promise<ListContactsResponse>;
2731
+ get: (marketId: string, customerId: string, contactId: string) => Promise<CustomerContact>;
2732
+ create: (marketId: string, customerId: string, payload: CreateOrUpdateContactPayload) => Promise<CustomerContact>;
2733
+ update: (marketId: string, customerId: string, contactId: string, payload: CreateOrUpdateContactPayload) => Promise<CustomerContact>;
2734
+ delete: (marketId: string, customerId: string, contactId: string) => Promise<void>;
2735
+ };
2736
+ ledger: {
2737
+ getBalance: (marketId: string, account: string) => Promise<LedgerBalanceResponse>;
2738
+ getTransaction: (marketId: string, transactionId: string) => Promise<LedgerTransaction>;
2739
+ getLatestTransaction: (marketId: string, account: string) => Promise<LedgerTransaction>;
2740
+ listTransactions: (marketId: string, params: ListTransactionsParams) => Promise<TransactionsListResponse>;
2741
+ };
2742
+ };
2743
+
2744
+ /**
2745
+ * Headers used by Studio to identify webhook and action requests
2746
+ */
2747
+ declare const StudioHeaders: {
2748
+ marketId: string;
2749
+ webhookId: string;
2750
+ action: string;
2751
+ apiKey: string;
2752
+ signature: string;
2753
+ };
2754
+ interface StudioManifest {
2755
+ id: string;
2756
+ name: string;
2757
+ version: string;
2758
+ description: string;
2759
+ icon: string;
2760
+ author: string;
2761
+ actions: {
2762
+ name: string;
2763
+ url: string;
2764
+ }[];
2765
+ webhooks: {
2766
+ url: string;
2767
+ triggers: WebhookEventName[];
2768
+ }[];
2769
+ parameterConfig: {
2770
+ id: string;
2771
+ type: "string" | "number" | "boolean" | "string[]" | "password";
2772
+ label: string;
2773
+ description?: string;
2774
+ required?: boolean;
2775
+ defaultValue?: string | number | boolean | string[];
2776
+ }[];
2777
+ }
2778
+ /***
2779
+ * Creates an app manifest used to describe the app to Studio
2780
+ *
2781
+ * @param appConfig
2782
+ * @returns
2783
+ */
2784
+ declare function createAppManifest(appConfig: {
2785
+ id: string;
2786
+ name: string;
2787
+ version: string;
2788
+ description: string;
2789
+ icon: string;
2790
+ author: string;
2791
+ }): {
2792
+ addWebhook: (url: string, triggers: WebhookEventName[]) => void;
2793
+ addConfig: (config: {
2794
+ id: string;
2795
+ type: "string" | "number" | "boolean" | "string[]" | "password";
2796
+ label: string;
2797
+ description?: string;
2798
+ required?: boolean;
2799
+ defaultValue?: string | number | boolean | string[];
2800
+ }) => void;
2801
+ addAction: (action: {
2802
+ name: string;
2803
+ url: string;
2804
+ }) => void;
2805
+ readonly manifest: StudioManifest;
2806
+ };
2807
+
2808
+ declare const MEDIA_CRATE_V2_BASE_URL_ENV_VARS: readonly ["MEDIA_CRATE_V2_BASE_URL", "NEXT_PUBLIC_MEDIA_CRATE_BASE_URL"];
2809
+ type MediaCrateProjectEnv = Record<string, string | undefined>;
2810
+ declare const MEDIA_CRATE_SINGLE_UPLOAD_MAX_BYTES: number;
2811
+ declare const MEDIA_CRATE_MULTIPART_MAX_CHUNK_BYTES: number;
2812
+ declare const MEDIA_CRATE_DEFAULT_CHUNK_BYTES: number;
2813
+ declare const MEDIA_CRATE_MEDIA_STATUSES: readonly ["uploading", "processing", "done", "error", "deleted", "partial", "expired", "indeterminate"];
2814
+ /** @deprecated Use MEDIA_CRATE_MEDIA_STATUSES. */
2815
+ declare const MEDIA_CRATE_ASSET_STATUSES: readonly ["uploading", "processing", "done", "error", "deleted", "partial", "expired", "indeterminate"];
2816
+ type MediaCrateUploadMode = "lot" | "transform" | "direct";
2817
+ type MediaCrateMediaMode = Exclude<MediaCrateUploadMode, "lot">;
2818
+ type MediaCrateMediaStatus = (typeof MEDIA_CRATE_MEDIA_STATUSES)[number];
2819
+ /** @deprecated Use MediaCrateUploadMode. */
2820
+ type MediaCrateAssetMode = MediaCrateUploadMode;
2821
+ /** @deprecated Use MediaCrateMediaStatus. */
2822
+ type MediaCrateAssetStatus = MediaCrateMediaStatus;
2823
+ type MediaCrateUploadStrategy = "auto" | "single" | "multipart";
2824
+ type MediaCrateExpectedVariant = {
2825
+ url: string;
2826
+ key: string;
2827
+ ready: boolean;
2828
+ };
2829
+ type MediaCrateExpectedUrls = {
2830
+ original: MediaCrateExpectedVariant;
2831
+ variants?: Record<string, MediaCrateExpectedVariant>;
2832
+ };
2833
+ type MediaCrateStatusUrls = MediaCrateExpectedUrls;
2834
+ type MediaCrateVariantSource = MediaCrateExpectedUrls | MediaCrateStatusUrls | {
2835
+ expected: MediaCrateExpectedUrls;
2836
+ } | {
2837
+ urls: MediaCrateStatusUrls;
2838
+ };
2839
+ type MediaCrateVariantSelectionOptions = {
2840
+ /** Only return the variant if Media Crate marks it as ready. */
2841
+ requireReady?: boolean;
2842
+ /** Fall back to the original URL when the named variant is absent. */
2843
+ fallbackToOriginal?: boolean;
2844
+ };
2845
+ declare function getMediaCrateVariant(source: MediaCrateVariantSource, variantName: string, opts?: MediaCrateVariantSelectionOptions): MediaCrateExpectedVariant | undefined;
2846
+ declare function getMediaCrateVariantUrl(source: MediaCrateVariantSource, variantName: string, opts?: MediaCrateVariantSelectionOptions): string | undefined;
2847
+ declare function requireMediaCrateVariantUrl(source: MediaCrateVariantSource, variantName: string, opts?: MediaCrateVariantSelectionOptions): string;
2848
+ type MediaCrateUploadResult = {
2849
+ message?: string;
2850
+ assetId: string;
2851
+ statusUrl: string;
2852
+ status: MediaCrateMediaStatus;
2853
+ expected: MediaCrateExpectedUrls;
2854
+ retryAfterMs?: number;
2855
+ };
2856
+ type MediaCrateStatusResult = {
2857
+ assetId: string;
2858
+ marketId: string;
2859
+ mode: MediaCrateUploadMode;
2860
+ status: MediaCrateMediaStatus;
2861
+ urls: MediaCrateStatusUrls;
2862
+ error?: string;
2863
+ retryAfterMs?: number;
2864
+ attemptCount?: number;
2865
+ subStatus?: "queued-for-capacity";
2866
+ queuedSince?: string;
2867
+ };
2868
+ type MediaCrateDuplicateResult = MediaCrateUploadResult;
2869
+ type MediaCrateMultipartStartResult = {
2870
+ message: string;
2871
+ data: {
2872
+ parsedFilePath: string;
2873
+ uploadId: string;
2874
+ key: string;
2875
+ assetId: string;
2876
+ generation: number;
2877
+ status: "started";
2878
+ };
2879
+ };
2880
+ type MediaCrateMultipartChunkResult = {
2881
+ message: string;
2882
+ data: {
2883
+ partNumber: number;
2884
+ eTag?: string | null;
2885
+ };
2886
+ };
2887
+ type MediaCrateStandaloneMultipartStartResult = MediaCrateUploadResult & {
2888
+ uploadId: string;
2889
+ targetKey: string;
2890
+ };
2891
+ type MediaCrateStandaloneMultipartChunkResult = {
2892
+ partNumber: number;
2893
+ eTag?: string | null;
2894
+ };
2895
+ type MediaCrateErrorResponse = {
2896
+ message: string;
2897
+ collidingKeys?: string[];
2898
+ };
2899
+ type MediaCrateMultipartSection = {
2900
+ partNumber: string;
2901
+ eTag: string;
2902
+ };
2903
+ type MediaCrateUploadProgressPhase = "starting" | "resuming" | "uploading" | "retrying" | "finishing" | "uploaded" | "error";
2904
+ type MediaCrateUploadProgress = {
2905
+ phase: MediaCrateUploadProgressPhase;
2906
+ bytesUploaded: number;
2907
+ totalBytes: number;
2908
+ partNumber?: number;
2909
+ totalParts?: number;
2910
+ attempt?: number;
2911
+ uploadId?: string;
2912
+ };
2913
+ type ReactNativeFormDataFile = {
2914
+ uri: string;
2915
+ type?: string;
2916
+ name?: string;
2917
+ };
2918
+ type MediaCrateUploadPartBody = Blob | ArrayBuffer | Uint8Array | string | ReactNativeFormDataFile;
2919
+ type MediaCrateUploadPartRequest = {
2920
+ start: number;
2921
+ end: number;
2922
+ partNumber: number;
2923
+ };
2924
+ type MediaCrateUploadSource = {
2925
+ name: string;
2926
+ type?: string;
2927
+ size: number;
2928
+ lastModified?: number;
2929
+ fingerprint?: string;
2930
+ /**
2931
+ * Set this to false for adapters that can only upload through multipart
2932
+ * form-data, for example some React Native URI-backed sources.
2933
+ */
2934
+ canUseSingleUpload?: boolean;
2935
+ getPart: (request: MediaCrateUploadPartRequest) => Promise<MediaCrateUploadPartBody>;
2936
+ };
2937
+ type MediaCrateMultipartSession = {
2938
+ key: string;
2939
+ mode: MediaCrateUploadMode;
2940
+ path: string;
2941
+ marketId: string;
2942
+ uploadId: string;
2943
+ chunkSize: number;
2944
+ totalBytes: number;
2945
+ totalParts: number;
2946
+ sourceFingerprint: string;
2947
+ overwrite: boolean;
2948
+ sections: MediaCrateMultipartSection[];
2949
+ targetKey?: string;
2950
+ startResult?: MediaCrateUploadResult;
2951
+ createdAt: number;
2952
+ updatedAt: number;
2953
+ };
2954
+ type MediaCrateMultipartSessionStore = {
2955
+ get: (key: string) => Promise<MediaCrateMultipartSession | null>;
2956
+ set: (key: string, session: MediaCrateMultipartSession) => Promise<void>;
2957
+ delete: (key: string) => Promise<void>;
2958
+ };
2959
+ type MediaCrateClientOptions = {
2960
+ baseUrl?: string;
2961
+ marketId: string;
2962
+ getFirebaseToken: () => Promise<string>;
2963
+ fetchImpl?: typeof fetch;
2964
+ sessionStore?: MediaCrateMultipartSessionStore;
2965
+ chunkSizeBytes?: number;
2966
+ maxPartAttempts?: number;
2967
+ maxFinishAttempts?: number;
2968
+ retryBaseDelayMs?: number;
2969
+ maxConcurrentParts?: number;
2970
+ defaultUploadStrategy?: MediaCrateUploadStrategy;
2971
+ sleep?: (durationMs: number) => Promise<void>;
2972
+ now?: () => number;
2973
+ random?: () => number;
2974
+ };
2975
+ type MediaCrateUploadOptions = {
2976
+ overwrite?: boolean;
2977
+ strategy?: MediaCrateUploadStrategy;
2978
+ chunkSizeBytes?: number;
2979
+ maxConcurrentParts?: number;
2980
+ sessionKey?: string;
2981
+ onProgress?: (progress: MediaCrateUploadProgress) => void;
2982
+ };
2983
+ type MediaCrateLotMediaUploadOptions = MediaCrateUploadOptions & {
2984
+ saleId: string;
2985
+ lotId: string;
2986
+ attributeId: string;
2987
+ source: MediaCrateUploadSource;
2988
+ fileName?: string;
2989
+ };
2990
+ type MediaCrateMediaUploadOptions = MediaCrateUploadOptions & {
2991
+ mode: MediaCrateMediaMode;
2992
+ path: string;
2993
+ source: MediaCrateUploadSource;
2994
+ };
2995
+ type MediaCrateDeleteOptions = {
2996
+ fileUrl: string;
2997
+ };
2998
+ type MediaCrateDuplicateOptions = {
2999
+ sourceUrl: string;
3000
+ targetFilePath: string;
3001
+ targetFileName?: string;
3002
+ overwrite?: boolean;
3003
+ };
3004
+ type ParsedErrorBody = Partial<MediaCrateErrorResponse> & {
3005
+ [key: string]: unknown;
3006
+ };
3007
+ declare class MediaCrateHttpError extends Error {
3008
+ status: number;
3009
+ method: string;
3010
+ url: string;
3011
+ body: ParsedErrorBody | string | null;
3012
+ collidingKeys?: string[];
3013
+ constructor(args: {
3014
+ status: number;
3015
+ method: string;
3016
+ url: string;
3017
+ message: string;
3018
+ body: ParsedErrorBody | string | null;
3019
+ collidingKeys?: string[];
3020
+ });
3021
+ }
3022
+ declare class MediaCrateUploadSourceError extends Error {
3023
+ constructor(message: string);
3024
+ }
3025
+ declare class InMemoryMediaCrateMultipartSessionStore implements MediaCrateMultipartSessionStore {
3026
+ private sessions;
3027
+ get(key: string): Promise<MediaCrateMultipartSession | null>;
3028
+ set(key: string, session: MediaCrateMultipartSession): Promise<void>;
3029
+ delete(key: string): Promise<void>;
3030
+ }
3031
+ declare function createWebUploadSource(file: Blob, opts?: {
3032
+ name?: string;
3033
+ type?: string;
3034
+ lastModified?: number;
3035
+ fingerprint?: string;
3036
+ }): MediaCrateUploadSource;
3037
+ declare class MediaCrateClient {
3038
+ readonly baseUrl: string;
3039
+ readonly marketId: string;
3040
+ private getFirebaseToken;
3041
+ private fetchImpl;
3042
+ private sessionStore;
3043
+ private chunkSizeBytes;
3044
+ private maxPartAttempts;
3045
+ private maxFinishAttempts;
3046
+ private retryBaseDelayMs;
3047
+ private maxConcurrentParts;
3048
+ private defaultUploadStrategy;
3049
+ private sleep;
3050
+ private now;
3051
+ private random;
3052
+ constructor(opts: MediaCrateClientOptions);
3053
+ createMediaPath(...segments: string[]): string;
3054
+ createLotMediaPath(args: {
3055
+ saleId: string;
3056
+ lotId: string;
3057
+ attributeId: string;
3058
+ fileName: string;
3059
+ }): string;
3060
+ uploadLotMedia(opts: MediaCrateLotMediaUploadOptions): Promise<MediaCrateUploadResult>;
3061
+ uploadMedia(opts: MediaCrateMediaUploadOptions): Promise<MediaCrateUploadResult>;
3062
+ private upload;
3063
+ getStatus(statusUrl: string): Promise<MediaCrateStatusResult>;
3064
+ delete(opts: MediaCrateDeleteOptions): Promise<void>;
3065
+ duplicate(opts: MediaCrateDuplicateOptions): Promise<MediaCrateDuplicateResult>;
3066
+ cancelMultipartUpload(args: {
3067
+ mode: MediaCrateUploadMode;
3068
+ path: string;
3069
+ uploadId: string;
3070
+ fileName?: string;
3071
+ sessionKey?: string;
3072
+ }): Promise<void>;
3073
+ private resolveUploadStrategy;
3074
+ private uploadSingle;
3075
+ private uploadMultipart;
3076
+ private getOrStartMultipartSession;
3077
+ private startMultipartUpload;
3078
+ private uploadPartWithRetry;
3079
+ private uploadMultipartPart;
3080
+ private finishMultipartUploadWithRetry;
3081
+ private finishMultipartUpload;
3082
+ private cancelDirectMultipartUpload;
3083
+ private cancelProcessedMultipartUpload;
3084
+ private runWithRetry;
3085
+ private getRetryDelay;
3086
+ private createBaseHeaders;
3087
+ private createUploadHeaders;
3088
+ private assertPathMatchesMarket;
3089
+ private urlFor;
3090
+ }
3091
+ declare function getMediaCrateBaseUrlFromEnv(env?: MediaCrateProjectEnv): string;
3092
+
3093
+ type CountryCode = keyof typeof EarTag.countryCodes;
3094
+ declare class EarTag {
3095
+ static regexISO24631: RegExp;
3096
+ static countryCodes: {
3097
+ [key: string]: string;
3098
+ };
3099
+ static get countryCodesByNumber(): {
3100
+ [code: string]: CountryCode;
3101
+ };
3102
+ private normalisedCountryCode;
3103
+ private _raw;
3104
+ get raw(): string;
3105
+ private _isEartag;
3106
+ isEartag(): boolean;
3107
+ private _isoCountryCode?;
3108
+ get isoCountryCode(): string | undefined;
3109
+ private _nationalIdentifier?;
3110
+ get nationalIdentifier(): string | undefined;
3111
+ constructor(input: string, fallbackCountryCode?: CountryCode | string | null);
3112
+ static parse(str: string, fallbackCountryCode?: CountryCode | string | null): EarTag;
3113
+ static format(str: string, marketCountry?: string | null | undefined): string | null;
3114
+ toString(): string;
3115
+ isISO24631(): boolean;
3116
+ toISO24631(): string;
3117
+ }
3118
+
3119
+ /**
3120
+ * Parses the bottom barcode on a UK cattle passport.
3121
+ *
3122
+ * The barcode is a 30-character fixed-width positional format:
3123
+ * [0-13] Eartag — 2 alpha country code + 12 char national ID (space-padded for shorter foreign tags)
3124
+ * [14-21] Date of birth — ddMMyyyy
3125
+ * [22] Sex — F or M
3126
+ * [23-27] Breed code — left-justified, space-padded to 5 chars
3127
+ * [28-29] Passport version — 2 digits
3128
+ *
3129
+ * UK animals fill all 12 digits of the national ID. Imported animals (DE, FR, BE, etc.)
3130
+ * have shorter national IDs so the field is right-padded with spaces.
3131
+ *
3132
+ * Examples:
3133
+ * UK12345671004215032023MHER 01 ← UK tag, breed HER
3134
+ * UK98765430018722112022FLIMX 01 ← UK tag, breed LIMX
3135
+ * DE04821 9315614092018FHF 01 ← German import, 10-digit national ID
3136
+ * FR72341 6850203052020FHF 01 ← French import, 10-digit national ID
3137
+ */
3138
+ declare class CattlePassport {
3139
+ static BARCODE_MIN_LENGTH: number;
3140
+ static BARCODE_MAX_LENGTH: number;
3141
+ private _raw;
3142
+ private _earTag;
3143
+ private _dateOfBirth;
3144
+ private _sex;
3145
+ private _breed;
3146
+ private _passportVersion;
3147
+ private constructor();
3148
+ static parse(code: string): CattlePassport | null;
3149
+ /** The original raw barcode string */
3150
+ get raw(): string;
3151
+ /** The eartag extracted from the barcode, e.g. "UK705946601313" or "DE0359581730" */
3152
+ get earTag(): string;
3153
+ /** Date of birth (UTC) */
3154
+ get dateOfBirth(): Date;
3155
+ /** Male or Female */
3156
+ get sex(): "Male" | "Female";
3157
+ /** Breed code, e.g. "AA", "HF", "LIMX" */
3158
+ get breed(): string;
3159
+ /** Passport version number */
3160
+ get passportVersion(): number;
3161
+ /** 2-letter country code, e.g. "UK", "DE", "FR" */
3162
+ get countryCode(): string;
3163
+ /** Format the eartag via the EarTag class. Falls back to the raw tag string. */
3164
+ get formattedEarTag(): string;
3165
+ /** Date of birth as DD/MM/YYYY */
3166
+ get formattedDateOfBirth(): string;
3167
+ toString(): string;
3168
+ }
3169
+
3170
+ declare function lotComparator<T extends {
3171
+ lotNumber: string;
3172
+ }>(a: T, b: T): number;
3173
+ declare function sortByLotNumber<T extends {
3174
+ lotNumber: string;
3175
+ }>(lots: T[]): T[];
3176
+ /***
3177
+ * Generate the next lot number in a sequence.
3178
+ * Handles various formats:
3179
+ * - Simple: "7" -> "8"
3180
+ * - Alphanumeric: "7A" -> "7B"
3181
+ * - Range: "1-3" -> "4", "1 - 3" -> "4" (flexible whitespace)
3182
+ * - Range with alpha: "1-3A" -> "3B"
3183
+ * - Compound: "1-3, 10" -> "11", "1-5, 7-9" -> "10"
3184
+ */
3185
+ declare function nextLotNumber(previousLotNumber: string): string;
3186
+
3187
+ export { CattlePassport, EarTag, InMemoryMediaCrateMultipartSessionStore, MEDIA_CRATE_ASSET_STATUSES, MEDIA_CRATE_DEFAULT_CHUNK_BYTES, MEDIA_CRATE_MEDIA_STATUSES, MEDIA_CRATE_MULTIPART_MAX_CHUNK_BYTES, MEDIA_CRATE_SINGLE_UPLOAD_MAX_BYTES, MEDIA_CRATE_V2_BASE_URL_ENV_VARS, MediaCrateClient, MediaCrateHttpError, MediaCrateUploadSourceError, Studio, StudioHeaders, types as StudioTypes, createAppManifest, createWebUploadSource, Studio as default, getMediaCrateBaseUrlFromEnv, getMediaCrateVariant, getMediaCrateVariantUrl, lotComparator, nextLotNumber, requireMediaCrateVariantUrl, sortByLotNumber };
3188
+ export type { ChunkedFile, CreateCustomerListPayload, CreateCustomerPayload, CustomerList, CustomerListAddMembersResponse, CustomerListDeleteResponse, CustomerListFilterGroup, CustomerListFilters, CustomerListMember, CustomerListMembersOptions, CustomerListMembersResponse, CustomerListPreviewResponse, CustomerListProductCodesResponse, CustomerListQuery, CustomerListRefreshResponse, CustomerListRemoveMemberResponse, CustomerListReportRow, CustomerListReportSummary, CustomerListRole, CustomerListType, CustomerListViewOptions, CustomerListViewResult, CustomerListsListOptions, CustomerListsListResponse, FarmAssuranceUpdate, KeeperDetailsUpdate, MediaCrateAssetMode, MediaCrateAssetStatus, MediaCrateClientOptions, MediaCrateDeleteOptions, MediaCrateDuplicateOptions, MediaCrateDuplicateResult, MediaCrateErrorResponse, MediaCrateExpectedUrls, MediaCrateExpectedVariant, MediaCrateLotMediaUploadOptions, MediaCrateMediaMode, MediaCrateMediaStatus, MediaCrateMediaUploadOptions, MediaCrateMultipartChunkResult, MediaCrateMultipartSection, MediaCrateMultipartSession, MediaCrateMultipartSessionStore, MediaCrateMultipartStartResult, MediaCrateProjectEnv, MediaCrateStandaloneMultipartChunkResult, MediaCrateStandaloneMultipartStartResult, MediaCrateStatusResult, MediaCrateStatusUrls, MediaCrateUploadMode, MediaCrateUploadOptions, MediaCrateUploadPartBody, MediaCrateUploadPartRequest, MediaCrateUploadProgress, MediaCrateUploadProgressPhase, MediaCrateUploadResult, MediaCrateUploadSource, MediaCrateUploadStrategy, MediaCrateVariantSelectionOptions, MediaCrateVariantSource, ReactNativeFormDataFile, RollingDateConfig, StudioInstance, StudioManifest, UpdateCustomerListPayload, UpdateCustomerPayload };