@marteye/studiojs 1.0.0 → 1.1.1

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/types.d.ts CHANGED
@@ -1,13 +1,940 @@
1
- export default function Studio(apiKey: string, baseUrl?: string, defaultTimeout?: number): {
2
- markets: {
3
- get: (marketId: string) => Promise<import("all-types").Market>;
1
+ type Timestamp = string;
2
+ export type ClientType = "Seller" | "Buyer";
3
+ export type SuperType = "Sheep" | "Goats" | "Cattle" | "Pigs" | "Horses" | "Deer" | "Poultry" | "Machinery" | "Antiques" | "Other";
4
+ export declare const SupportedSuperTypes: SuperType[];
5
+ export declare const LivestockSuperTypes: SuperType[];
6
+ export type Currency = "GBP" | "EUR" | "USD";
7
+ export declare const SupportedCurrencyCodes: Currency[];
8
+ export type SupportedCountryCode = "GB-ENG" | "GB-SCT" | "GB-WLS" | "GB-NIR" | "IE";
9
+ export type CurrenciesWithGuinea = Currency | "GUINEA-GBP";
10
+ export type UnitOfSale = "Per KG" | "Per Item" | "Per Lot" | "Per 1000KG";
11
+ export declare const SupportedUnitsOfSale: UnitOfSale[];
12
+ export type PaymentMethod = "BACS" | "Cheque" | "BankTransfer" | "Cash" | "Card" | "Credit";
13
+ export type PayoutMethod = "BACS" | "Cheque" | "Cash";
14
+ export declare const SupportedPaymentMethods: PaymentMethod[];
15
+ export interface Market {
16
+ id: string;
17
+ createdAt: Timestamp;
18
+ updatedAt: Timestamp;
19
+ name: string;
20
+ description: string;
21
+ logo: string;
22
+ primaryColour: string;
23
+ secondaryColour: string;
24
+ countryCode: SupportedCountryCode;
25
+ address: Address;
26
+ telephone?: string;
27
+ vatNumber?: string;
28
+ email?: string;
29
+ movementLocationNumbers?: {
30
+ number: string;
31
+ type: "CPH" | "Herd Number" | "Flock Number" | "Other";
32
+ createdAt: Timestamp;
33
+ }[];
34
+ paymentInstructions?: string;
35
+ }
36
+ export interface SettingsMarketDefaults {
37
+ updatedAt: Timestamp;
38
+ updatedBy: string | null;
39
+ marketId: string;
40
+ name: string;
41
+ description: string;
42
+ address: Address;
43
+ defaultCurrency: Currency;
44
+ defaultPayoutPreference: PayoutMethod;
45
+ defaultUnitOfSale: UnitOfSale;
46
+ defaultSuperType?: SuperType | null;
47
+ lotDescriptionTemplateMap?: {
48
+ default: string | undefined;
49
+ [supertype: string]: string | undefined;
4
50
  };
51
+ rostrumAttributesMap?: {
52
+ default: string[] | undefined;
53
+ [supertype: string]: string[] | undefined;
54
+ };
55
+ selectDocumentIdsMap: {
56
+ [supertype: string]: string[];
57
+ };
58
+ }
59
+ export interface SettingsProductCodes {
60
+ [code: string]: ProductCodeConfiguration;
61
+ }
62
+ export interface SettingsTaxRates {
63
+ [id: string]: TaxRate;
64
+ }
65
+ export interface SettingsAdjustmentsConfiguration {
66
+ [id: string]: AdjustmentsConfiguration;
67
+ }
68
+ export interface SettingsAccessories {
69
+ [id: string]: Accessory;
70
+ }
71
+ export interface SettingsPrinters {
72
+ [id: string]: Printer;
73
+ }
74
+ export type DeviceType = "globeWeigh" | "allflexRaceReader";
75
+ export interface Accessory {
76
+ deviceId: string;
77
+ deviceType: DeviceType;
78
+ friendlyName: string;
79
+ endOfMessagePattern: string;
80
+ host: string;
81
+ isEnabled: boolean;
82
+ port: number;
83
+ regex: string;
84
+ saleProfileId: string;
85
+ timeoutMs: number;
86
+ updatedAt: Timestamp;
87
+ createdAt: Timestamp;
88
+ }
89
+ /**
90
+ * @description Configuration for the printer
91
+ */
92
+ export interface Printer {
93
+ id: string;
94
+ createdAt: Timestamp;
95
+ updatedAt: Timestamp;
96
+ /**
97
+ * @description The name of the printer. Its the same as the id
98
+ */
99
+ name: string;
100
+ friendlyName: string;
101
+ chequePrinter?: boolean;
102
+ /**
103
+ * The next cheque number to use when printing a cheque
104
+ */
105
+ nextChequeNumber?: number;
106
+ lastPrintedAt?: Timestamp;
107
+ lastPrinterMessage?: string;
108
+ }
109
+ export interface SettingsGlobalAttributes {
110
+ [id: string]: AttributeDefinition;
111
+ }
112
+ export type AttributeValueType = string | number | boolean | Timestamp | Media;
113
+ /****
114
+ * Used to grant a user access to a market.
115
+ * Each member of staff should have their own.
116
+ */
117
+ export interface MemberSharingConfiguration {
118
+ uid: string;
119
+ createdAt: Timestamp;
120
+ updatedAt: Timestamp;
121
+ displayName?: string;
122
+ photoURL?: string;
123
+ marketId: string;
124
+ role: "Owner" | "Admin" | "Editor";
125
+ }
126
+ export interface Sale {
127
+ id: string;
128
+ createdAt: Timestamp;
129
+ updatedAt: Timestamp;
130
+ updatedBy?: string | null;
131
+ startsAt: Timestamp;
132
+ closedAt?: Timestamp | null;
133
+ marketId: string;
134
+ name: string;
135
+ recurring?: null | "Weekly" | "Bi-weekly" | "Monthly";
136
+ defaultProductCode: string;
137
+ /**
138
+ * Default attributes values for any new lot item
139
+ */
140
+ attributeDefaults?: {
141
+ [attributekey: string]: AttributeValueType;
142
+ };
143
+ /**
144
+ * the codes that are allowed for the sale
145
+ */
146
+ availableProductCodes: string[];
147
+ /**
148
+ * the supertypes from the product codes. e..g Cattle, Sheep, Pigs etc
149
+ */
150
+ superTypes: SuperType[];
151
+ attributeSet: AttributeDefinition[];
152
+ attributeSetByProductCode: {
153
+ [code: string]: string[];
154
+ };
155
+ currentLotGroup?: string | null;
156
+ nextLotGroup?: string | null;
157
+ /**
158
+ * Auto queue the next lot when the current lot is sold in rostrum
159
+ */
160
+ autoQueue?: boolean;
161
+ /**
162
+ * The sale profile ID to use for this sale. Which is used to find settings specific devices and printers etc.
163
+ */
164
+ saleProfileId?: string | null;
165
+ /**
166
+ * Show the display board
167
+ */
168
+ displayBoard?: boolean;
169
+ martEyeId?: string | null;
170
+ marteyeSettings?: MartEyeTimedSaleSettings | MartEyeLiveSaleSettings | null;
171
+ }
172
+ export interface MartEyeLiveSaleSettings {
173
+ description?: string;
174
+ image?: string;
175
+ logo?: string;
176
+ type: "LIVE";
177
+ location?: string | null;
178
+ descriptionLines?: string[];
179
+ descriptionLink?: string;
180
+ deposit?: number;
181
+ hidePrices?: boolean;
182
+ hideReplay?: boolean;
183
+ labels?: string[];
184
+ tags?: string[];
185
+ }
186
+ export interface MartEyeTimedSaleSettings {
187
+ description?: string;
188
+ image?: string;
189
+ logo?: string;
190
+ type: "TIMED";
191
+ /**
192
+ * The location of the sale. This could be a physical location Ring 1 / Ring 2 / Farm Address etc
193
+ */
194
+ location?: string | null;
195
+ details?: {
196
+ markdownBase64: string;
197
+ title: string;
198
+ }[];
199
+ cover?: string;
200
+ primaryColour?: string;
201
+ secondaryColour?: string;
202
+ foregroundColour?: string;
203
+ extensionTime: number;
204
+ incrementLadder: IncrementLadder;
205
+ hideNav?: boolean;
206
+ signInOverrideLink?: string;
207
+ published?: boolean;
208
+ pin?: boolean;
209
+ labels?: string[];
210
+ deposit?: number;
211
+ cascade?: boolean;
212
+ reportEmail?: string;
213
+ }
214
+ export type IncrementLadder = IncrementLadderItem[];
215
+ export interface IncrementLadderItem {
216
+ max: number;
217
+ increment: number;
218
+ }
219
+ export interface SaleFromSearch extends Omit<Omit<Omit<Sale, "createdAt">, "updatedAt">, "startsAt"> {
220
+ createdAt: number;
221
+ updatedAt: number;
222
+ startsAt: number;
223
+ }
224
+ export type LotSaleStatus = "Sold" | "Unsold" | "Rerun" | "Resold" | null;
225
+ export interface Lot {
226
+ id: string;
227
+ saleId: string;
228
+ marketId: string;
229
+ createdAt: Timestamp;
230
+ updatedAt: Timestamp;
231
+ updatedBy?: string | null;
232
+ productCode: string;
233
+ superType?: SuperType;
234
+ isLivestock?: boolean;
235
+ attributes: {
236
+ [key: string]: AttributeValueType;
237
+ };
238
+ loadingAttributes?: {
239
+ [attributePath: string]: {
240
+ id: string;
241
+ startAt: Timestamp;
242
+ path: string;
243
+ };
244
+ };
245
+ itemMap: {
246
+ [itemId: string]: LotItem;
247
+ };
248
+ sellerCasual?: string | null;
249
+ sellerCustomerId: string | null;
250
+ seller?: ShortCustomerDetails;
251
+ lotNumber?: string | null;
252
+ index: number;
253
+ group?: string;
254
+ remarks?: string;
255
+ notes?: string;
256
+ currency: CurrenciesWithGuinea;
257
+ unitOfSale: UnitOfSale;
258
+ unitPriceInCents?: number;
259
+ buyerCasual?: string | null;
260
+ buyerCustomerId: string | null;
261
+ buyer?: ShortCustomerDetails | null;
262
+ startedAt?: Timestamp;
263
+ endedAt?: Timestamp;
264
+ sellerInvoiceId: string | null;
265
+ sellerInvoiceNumber?: number | undefined | null;
266
+ buyerInvoiceId: string | null;
267
+ buyerInvoiceNumber?: number | undefined | null;
268
+ voidedSellerInvoiceIds?: string[];
269
+ voidedBuyerInvoiceIds?: string[];
270
+ saleStatus?: LotSaleStatus;
271
+ void?: boolean;
272
+ originalLot?: string;
273
+ metadata: {
274
+ [key: string]: any;
275
+ };
276
+ generated?: LotGeneratedValues;
277
+ issues?: {
278
+ [issueId: string]: LotIssue;
279
+ };
280
+ resolvedIssues?: {
281
+ [issueId: string]: LotIssue;
282
+ };
283
+ /***
284
+ * Default values for any new lot item
285
+ */
286
+ itemAttributeDefaults?: {
287
+ [attributekey: string]: AttributeValueType;
288
+ };
289
+ }
290
+ type LotIssueCode = "unknown-attribute" | "validation-error" | "staff-flagged";
291
+ export interface LotIssue {
292
+ id: string;
293
+ itemId?: string | null;
294
+ path?: string | null;
295
+ code: LotIssueCode;
296
+ description: string;
297
+ severity: "error" | "warning" | "info";
298
+ createdAt: Timestamp;
299
+ createdBy: string;
300
+ blockCheckout: boolean;
301
+ }
302
+ export interface LotWithItemsAsArray extends Omit<Lot, "itemMap"> {
303
+ items: LotItem[];
304
+ }
305
+ export interface LotGeneratedValues {
306
+ totalValueInCents?: number | null;
307
+ description?: string | null;
308
+ pricePerKiloInCents?: number | null;
309
+ averageWeightKg?: number | null;
310
+ pricePerItemInCents?: number | null;
311
+ countOfItems?: number | null;
312
+ }
313
+ export interface ShortCustomerDetails {
314
+ isSet: boolean;
315
+ id?: string;
316
+ copiedInAt?: Timestamp;
317
+ accountNumber?: string;
318
+ bidderNumber?: number | null;
319
+ displayName?: string;
320
+ avatar?: string | null;
321
+ }
322
+ export interface LotItem {
323
+ id: string;
324
+ createdAt: Timestamp;
325
+ updatedAt: Timestamp;
326
+ updatedBy?: string | null;
327
+ index: number;
328
+ attributes: {
329
+ [key: string]: AttributeValueType;
330
+ };
331
+ notes: {
332
+ id: string;
333
+ text: string;
334
+ createdAt: Timestamp;
335
+ }[];
336
+ metadata: {
337
+ [key: string]: string | number | boolean | Timestamp | Media;
338
+ };
339
+ }
340
+ /***
341
+ * A market may offer other products and services. This is a way to track those.
342
+ * They simply create a line item on the invoice
343
+ *
344
+ * /settings/products
345
+ */
346
+ export interface Product {
347
+ id: string;
348
+ createdAt: Timestamp;
349
+ updatedAt: Timestamp;
350
+ marketId: string;
351
+ name: string;
352
+ taxRateId: string;
353
+ defaultUnitPriceInCents: number;
354
+ unitPriceIncludesVat?: boolean;
355
+ applyToClients: ClientType[];
356
+ subtotalGroup?: SubtotalGroups | null | undefined;
357
+ passThroughFundsToAnotherCustomer?: boolean;
358
+ isEnabled?: boolean;
359
+ metadata: {
360
+ [key: string]: string | number | boolean | Timestamp | Media;
361
+ };
362
+ }
363
+ /***
364
+ * When a product is added to a cart it becomes a CartProductItem
365
+ *
366
+ *
367
+ * markets/ballymena/carts/{userId}
368
+ *
369
+ * {id: CartItem}
370
+ */
371
+ export interface CartItem {
372
+ id: string;
373
+ createdAt: Timestamp;
374
+ updatedAt: Timestamp;
375
+ updatedBy?: string | null;
376
+ marketId: string;
377
+ customerId: string;
378
+ productId: string;
379
+ clientType: ClientType;
380
+ quantity: number;
381
+ unitPriceInCents: number;
382
+ passthroughFundsToCustomerId?: string | null;
383
+ generated?: {
384
+ totalInCents: number;
385
+ };
386
+ }
387
+ /***
388
+ * Items have codes. And those codes are used to apply the correct commission rates, report movements etc.
389
+ */
390
+ export interface ProductCodeConfiguration {
391
+ code: string;
392
+ createdAt?: Timestamp;
393
+ updatedAt?: Timestamp;
394
+ updatedBy?: string | null;
395
+ superType: SuperType;
396
+ description: string;
397
+ icon?: string;
398
+ metadata: {
399
+ [key: string]: string | number | boolean | Timestamp | Media;
400
+ };
401
+ taxRateId: string;
402
+ subtotalGroup?: SubtotalGroups | null;
403
+ adjustmentIds: string[];
404
+ unitPriceIncludesVat?: boolean;
405
+ totalExVatRebatePecentage?: number;
406
+ defaultCurrency?: CurrenciesWithGuinea;
407
+ defaultUnitOfSale: UnitOfSale;
408
+ defaultLotRange?: {
409
+ min: number;
410
+ max: number;
411
+ };
412
+ attributeDefaults?: {
413
+ [attributekey: string]: AttributeValueType;
414
+ };
415
+ lotDescriptionTemplate?: string;
416
+ rostrumAttributes?: string[];
417
+ selectDocumentIds?: string[] | null;
418
+ }
419
+ /***
420
+ * How the products are stored in settings
421
+ */
422
+ export interface ProductConfiguration {
423
+ [id: string]: Product;
424
+ }
425
+ /***
426
+ * A market may offer other products and services. This is a way to track those.
427
+ * They simply create a line item on the invoice
428
+ */
429
+ export interface Product {
430
+ id: string;
431
+ createdAt: Timestamp;
432
+ updatedAt: Timestamp;
433
+ marketId: string;
434
+ name: string;
435
+ taxRateId: string;
436
+ defaultUnitPriceInCents: number;
437
+ unitPriceIncludesVat?: boolean;
438
+ applyToClients: ClientType[];
439
+ subtotalGroup?: SubtotalGroups | null | undefined;
440
+ passThroughFundsToAnotherCustomer?: boolean;
441
+ relatedTo?: {
442
+ lotId: string;
443
+ saleId: string;
444
+ } | null;
445
+ obfusicate?: boolean;
446
+ metadata: {
447
+ [key: string]: string | number | boolean | Timestamp | Media;
448
+ };
449
+ }
450
+ export interface Cart {
451
+ updatedAt: Timestamp;
452
+ itemsById: {
453
+ [itemId: string]: CartItem;
454
+ };
455
+ }
456
+ export interface EmailWrapper {
457
+ email: string;
458
+ isVerified: boolean;
459
+ createdAt: Timestamp;
460
+ }
461
+ export interface PhoneNumberWrapper {
462
+ phoneNumber: string;
463
+ isVerified: boolean;
464
+ createdAt: Timestamp;
465
+ }
466
+ export interface AddressWrapper {
467
+ address: Address;
468
+ createdAt: Timestamp;
469
+ updatedAt?: Timestamp;
470
+ updatedBy?: string | null;
471
+ }
472
+ export interface FarmAssurances {
473
+ createdAt: Timestamp;
474
+ updatedAt?: Timestamp;
475
+ updatedBy?: string | null;
476
+ memberReference: string;
477
+ expiryDate: Timestamp;
478
+ scope?: "Beef" | "Dairy" | "Pork" | "Sheep" | "Other";
479
+ }
480
+ export type BankDetails = {
481
+ accountName?: string;
482
+ } & ({
483
+ accountNumber: string;
484
+ sortCode: string;
485
+ IBAN?: never;
486
+ } | {
487
+ IBAN: string;
488
+ accountNumber?: never;
489
+ sortCode?: never;
490
+ });
491
+ /**
492
+ * Used to store the bank details for a market
493
+ */
494
+ export type MarketBankDetails = {
495
+ name: string;
496
+ bankId: string;
497
+ address: Address;
498
+ } & ({
499
+ accountNumber: string;
500
+ sortCode: string;
501
+ IBAN?: never;
502
+ } | {
503
+ IBAN: string;
504
+ accountNumber?: never;
505
+ sortCode?: never;
506
+ });
507
+ export interface Customer {
508
+ id: string;
509
+ createdAt: Timestamp;
510
+ updatedAt: Timestamp;
511
+ updatedBy?: string | null;
512
+ marketId: string;
513
+ isMarketAccount?: boolean;
514
+ accountNumber?: string;
515
+ bidderNumber?: number | null;
516
+ firstName?: string | null;
517
+ lastName?: string | null;
518
+ tradingName?: string | null;
519
+ email?: EmailWrapper;
520
+ phoneNumber?: PhoneNumberWrapper;
521
+ otherPhoneNumbers?: PhoneNumberWrapper[];
522
+ address: AddressWrapper;
523
+ otherAddresses: {
524
+ [addressId: string]: AddressWrapper;
525
+ };
526
+ photoURL?: string | null;
527
+ payoutPreference?: PayoutMethod;
528
+ bankDetails?: BankDetails;
529
+ attributeDefaultsBuyer?: {
530
+ [attributekey: string]: AttributeValueType[];
531
+ };
532
+ attributeDefaultsSeller?: {
533
+ [attributekey: string]: AttributeValueType[];
534
+ };
535
+ preferSettleDebtsFirst?: boolean;
536
+ vatNumber?: string;
537
+ metadata: {
538
+ [key: string]: string | number | boolean | Timestamp | Media;
539
+ };
540
+ lastItemPurchaseDate?: Timestamp;
541
+ lastItemSaleDate?: Timestamp;
542
+ hasPurchasedItems?: boolean;
543
+ hasSoldItems?: boolean;
544
+ notes?: string;
545
+ }
546
+ export interface CustomerFromSearch extends Omit<Customer, "createdAt" | "updatedAt" | "lastItemPurchaseDate" | "lastItemSaleDate"> {
547
+ createdAt: number;
548
+ updatedAt: number;
549
+ lastItemPurchaseDate?: number;
550
+ lastItemSaleDate?: number;
551
+ }
552
+ export interface Address {
553
+ id: string;
554
+ nickname?: string;
555
+ company?: string;
556
+ firstName?: string;
557
+ lastName?: string;
558
+ address1: string;
559
+ address2?: string;
560
+ city: string;
561
+ province?: string;
562
+ zip: string;
563
+ country: string;
564
+ }
565
+ interface ImageThumbnail {
566
+ url: string;
567
+ width: number;
568
+ height: number;
569
+ }
570
+ export interface Media {
571
+ id: string;
572
+ url: string;
573
+ type: "image/jpeg" | "image/png" | "video/mp4" | "application/pdf";
574
+ filename: string;
575
+ thumbnails?: {
576
+ small?: ImageThumbnail;
577
+ medium?: ImageThumbnail;
578
+ large?: ImageThumbnail;
579
+ };
580
+ }
581
+ export type MarketReportHeaders = "grossServices" | "vatOnServices" | "grossGoods" | "vatOnGoods" | "netTotal" | "contra";
582
+ /**
583
+ * Content types which will denote the position of the data on the invoice wihth out with a cheque
584
+ */
585
+ export type FieldPositions = {
586
+ id: ChequeField | InvoiceField;
587
+ x: number;
588
+ y: number;
589
+ };
590
+ export type InvoiceField = "invoiceNumber" | "invoiceDate" | "description" | "lotNumber" | "quantity" | "weight" | "unitPrice" | "grossLineTotal" | "accountRef" | "accountName" | "businessAddress" | "customerAddress" | "lineItemsStartLine" | "footerBoundaryLine" | "vatNumber" | "saleName" | "subTotal" | "subTotalTable" | "tagList" | "tagNumber";
591
+ export type ChequeField = "chequeDate" | "chequeNumber" | "payee" | "amount" | "amountInWords" | "hunderdsOfThousands" | "tensOfThousands" | "thousands" | "hundreds" | "tens" | "units";
592
+ export type SubtotalGroups = "Commission" | string;
593
+ export type AdjustmentTotalTarget = "Per Invoice" | "Total - finalTotalInCents" | "Total - lotTotalLessCommissionInCentsExVat";
594
+ export type AdjustmentTarget = UnitOfSale | AdjustmentTotalTarget;
595
+ /***
596
+ * Commission is added as a line item. Can also be used for levies etc
597
+ */
598
+ export interface AdjustmentsConfiguration {
599
+ id: string;
600
+ createdAt: Timestamp;
601
+ updatedAt: Timestamp;
602
+ updatedBy?: string | null;
603
+ name?: string | null;
604
+ description?: string | null;
605
+ applyToClients: ClientType[];
606
+ subtotalGroup?: SubtotalGroups | null | undefined;
607
+ type: "commission" | "levy" | "vat-rebate";
608
+ filter?: {
609
+ currency?: CurrenciesWithGuinea | null;
610
+ quantity?: {
611
+ min?: number;
612
+ max?: number;
613
+ } | null;
614
+ unitPrice?: {
615
+ minInCents?: number;
616
+ maxInCents?: number;
617
+ } | null;
618
+ totalPrice?: {
619
+ minInCents?: number;
620
+ maxInCents?: number;
621
+ } | null;
622
+ customerIsVATRegistered?: boolean | null;
623
+ customerWithinTaxRegion?: boolean | null;
624
+ attribute?: {
625
+ key: string;
626
+ value: string | number | boolean | null;
627
+ } | null;
628
+ };
629
+ taxRateId: string;
630
+ adjustment: Adjustment & {
631
+ target: AdjustmentTarget;
632
+ };
633
+ }
634
+ interface Adjustment {
635
+ percentage?: {
636
+ value?: number;
637
+ floorInCents?: number;
638
+ ceilingInCents?: number;
639
+ } | null;
640
+ fixedAmountInCents?: number | null;
641
+ }
642
+ export interface LineItemAdjustmentConfiguration extends AdjustmentsConfiguration {
643
+ adjustment: Adjustment & {
644
+ target: UnitOfSale;
645
+ };
646
+ }
647
+ export interface InvoiceTotalAdjustmentConfiguration extends AdjustmentsConfiguration {
648
+ adjustment: Adjustment & {
649
+ target: AdjustmentTotalTarget;
650
+ };
651
+ }
652
+ /***
653
+ * Tax config is used to generate the invoice but the user can still edit the invoice, overriding the final values.
654
+ */
655
+ export interface TaxRate {
656
+ id: string;
657
+ createdAt: Timestamp;
658
+ updatedAt: Timestamp;
659
+ marketId: string;
660
+ description: string;
661
+ taxSubtotalGroup?: string | null;
662
+ percentage: number;
663
+ isExportTaxRate?: boolean;
664
+ }
665
+ export interface Payment {
666
+ id: string;
667
+ createdAt: Timestamp;
668
+ updatedAt: Timestamp;
669
+ updatedBy?: string;
670
+ transactionDate: Timestamp;
671
+ marketId: string;
672
+ customerId: string;
673
+ method: PaymentMethod;
674
+ amountInCents: number;
675
+ reference: string | null;
676
+ status: "complete" | "void";
677
+ voidedAt?: Timestamp | null;
678
+ voidedBy?: string | null;
679
+ voidReason?: string | null;
680
+ invoiceIds: string[];
681
+ transactionIds: string[];
682
+ }
683
+ export interface Payout {
684
+ id: string;
685
+ marketId: string;
686
+ createdAt: Timestamp;
687
+ updatedAt: Timestamp;
688
+ updatedBy: string | null;
689
+ customerId: string;
690
+ method: PayoutMethod | "Credit";
691
+ amountInCents: number;
692
+ accountName?: string;
693
+ accountNumber?: string;
694
+ sortCode?: string;
695
+ chequeMadePayableTo?: string;
696
+ transactionDate: Timestamp;
697
+ reference: string | null;
698
+ status: "pending" | "complete" | "void";
699
+ notes: string | null;
700
+ completedAt?: Timestamp | null;
701
+ completedBy?: string | null;
702
+ voidedAt?: Timestamp | null;
703
+ voidedBy?: string | null;
704
+ voidReason?: string | null;
705
+ transactionIds: string[];
706
+ invoiceIds: string[];
707
+ }
708
+ export interface DraftInvoice extends InvoiceTotals {
709
+ id: string;
710
+ currency: Currency;
711
+ status: "draft";
712
+ issuedAt?: Timestamp;
713
+ lotIdents: {
714
+ lotId: string;
715
+ saleId: string;
716
+ }[];
717
+ clientType: ClientType;
718
+ customerId: string;
719
+ customerAccountNumber: string;
720
+ name: string;
721
+ address: Address;
722
+ email: string | null;
723
+ superTypes?: SuperType[];
724
+ customerIsVATRegistered: boolean;
725
+ customerWithinTaxRegion: boolean;
726
+ lineItems: InvoiceLineItem[];
727
+ adjustmentLineItems: InvoiceLineItem[];
728
+ vatNumber?: string;
729
+ extraProductIds: string[];
730
+ payoutMethod?: PayoutMethod | null;
731
+ payoutParams?: {
732
+ settleDebtsFirst: boolean;
733
+ accountName?: string;
734
+ accountNumber?: string;
735
+ sortCode?: string;
736
+ chequeMadePayableTo?: string;
737
+ };
738
+ potentialPayoutsById?: {
739
+ [payoutId: string]: {
740
+ id: string;
741
+ amountInCents: number;
742
+ paymentMethod: PaymentMethod;
743
+ invoice?: {
744
+ id: string;
745
+ invoiceNumber: number;
746
+ fullyPaid: boolean;
747
+ };
748
+ };
749
+ };
750
+ attributeValues?: {
751
+ [attributekey: string]: AttributeValueType;
752
+ };
753
+ attributes: AttributeDefinition[];
754
+ averages?: {
755
+ label: string;
756
+ value: number;
757
+ formattedValue: string;
758
+ }[];
759
+ paymentInstructions?: string | null;
760
+ }
761
+ export interface InvoiceTotals {
762
+ lotTotalInCentsExVat: number;
763
+ vatOnLotTotalInCents: number;
764
+ commissionTotalInCents?: number;
765
+ vatOnCommissionInCents?: number;
766
+ nonCommissionAdjustmentsInCents?: number;
767
+ vatOnAdjustmentsInCents?: number;
768
+ subtotalGroupTotals: {
769
+ [key in SubtotalGroups]: number;
770
+ };
771
+ taxSubtotalGroupTotals: {
772
+ [key in string]: number;
773
+ };
774
+ finalTotalInCents: number;
775
+ }
776
+ export interface SimplePaymentIn {
777
+ paymentId: string;
778
+ amountInCents: number;
779
+ paymentMethod: PaymentMethod;
780
+ reference: string | null;
781
+ paidAt: Timestamp;
782
+ }
783
+ /**
784
+ * Used on invoice to show the payout. Use payout collection for the source of truth
785
+ */
786
+ export interface SimplePaymentOut {
787
+ payoutId: string;
788
+ amountInCents: number;
789
+ paymentMethod: PaymentMethod;
790
+ reference: string | null;
791
+ paidAt: Timestamp;
792
+ }
793
+ export interface Invoice extends Omit<Omit<Omit<Omit<DraftInvoice, "ledgerAccountTotals">, "potentialPayoutsById">, "payoutParams">, "status"> {
794
+ id: string;
795
+ invoiceNumber: number;
796
+ createdAt: Timestamp;
797
+ updatedAt: Timestamp;
798
+ updatedBy?: string | null;
799
+ marketId: string;
800
+ saleIds: string[];
5
801
  sales: {
6
- get: (marketId: string, saleId: string) => Promise<import("all-types").Sale>;
802
+ id: string;
803
+ name?: string;
804
+ }[];
805
+ transactionIds?: string[];
806
+ status: "draft" | "issued" | "void" | "imported" | "paid";
807
+ paymentsInById: {
808
+ [paymentId: string]: SimplePaymentIn;
809
+ };
810
+ payoutMethod: PayoutMethod | null;
811
+ payoutsById: {
812
+ [payoutId: string]: SimplePaymentOut;
813
+ };
814
+ voidReason?: string;
815
+ voidedAt?: Timestamp;
816
+ voidedBy?: string;
817
+ description?: string;
818
+ footnotes?: string[];
819
+ metadata: {
820
+ [key: string]: string | number | boolean | Timestamp | Media;
821
+ };
822
+ /***
823
+ * this is important to add when adding an invoice
824
+ * it creates a lock so we only ever get sequential invoice numbers
825
+ * The invoice will have this as null until the next invoice is created
826
+ */
827
+ internalNextInvoiceId: string | null;
828
+ emailNotifications?: string[];
829
+ pitchPayLink: string | null;
830
+ }
831
+ export interface Printer {
832
+ name: string;
833
+ id: string;
834
+ }
835
+ export interface InvoiceLineItem {
836
+ id: string;
837
+ createdAt: Timestamp;
838
+ updatedAt: Timestamp;
839
+ subtotalGroup?: SubtotalGroups | null;
840
+ clientType: ClientType;
841
+ description: string;
842
+ index?: number;
843
+ quantity: number;
844
+ impreciseUnitPriceInCents: number;
845
+ unitOfSale?: UnitOfSale;
846
+ unitPriceIncludesVat?: boolean;
847
+ taxRate: TaxRate;
848
+ taxAmountInCents: number;
849
+ discountAmountInCents?: number;
850
+ totalAmountInCentsExVat: number;
851
+ saleId?: string;
852
+ lotId?: string;
853
+ lotProductCode?: string;
854
+ superType?: SuperType | null;
855
+ productId?: string;
856
+ productRelatedTo?: {
857
+ lotId: string;
858
+ saleId: string;
859
+ } | null;
860
+ productObfusicate?: boolean;
861
+ passthroughFundsToCustomerId?: string | null;
862
+ adjustmentConfig?: AdjustmentsConfiguration;
863
+ metadata: {
864
+ [key: string]: string | number | boolean | Timestamp | Media | {
865
+ [key: string]: string | number | boolean | Timestamp;
866
+ };
867
+ };
868
+ }
869
+ export interface TablePosition {
870
+ id: InvoiceField | ChequeField | MarketReportHeaders;
871
+ title: string;
872
+ cellWidth: number;
873
+ halign: "left" | "center" | "right";
874
+ }
875
+ export 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";
876
+ export 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"];
877
+ export type ObjectType = "market" | "sale" | "lot" | "invoice" | "payment" | "customer" | "member";
878
+ export interface WebhookEvent<T> {
879
+ id: string;
880
+ createdAt: Timestamp;
881
+ trigger: WebhookEventName;
882
+ marketId: string;
883
+ objectType: ObjectType;
884
+ data: {
885
+ object: T;
886
+ objectBefore?: T;
7
887
  };
8
- lots: {
9
- get: (marketId: string, saleId: string, lotId: string) => Promise<import("all-types").Lot>;
888
+ }
889
+ export type SupportedAttributeTypes = "string" | "number" | "boolean" | "date" | "datetime" | "time";
890
+ export interface AttributeDefinition {
891
+ id: string;
892
+ name: string;
893
+ shortName?: string;
894
+ description?: string;
895
+ applyTo: string[];
896
+ level: "item" | "lot";
897
+ readonly?: boolean;
898
+ lotDetailFlyoutGroup?: string;
899
+ buyerCheckoutGroup?: string;
900
+ sellerCheckoutGroup?: string;
901
+ buyerCustomerAttribute?: boolean;
902
+ sellerCustomerAttribute?: boolean;
903
+ defaultHiddenOnSaleSheet?: boolean;
904
+ prefillableFromPreviousLot?: boolean;
905
+ hidden?: boolean;
906
+ showInSellerDetailsPanel?: boolean;
907
+ displayTemplate?: string;
908
+ displayTemplateMultiValue?: string;
909
+ type: SupportedAttributeTypes;
910
+ requiredPreSale: boolean;
911
+ requiredToCheckout: boolean;
912
+ minValue?: number;
913
+ maxValue?: number;
914
+ minLength?: number;
915
+ maxLength?: number;
916
+ regexPattern?: string;
917
+ minDateExpression?: string;
918
+ maxDateExpression?: string;
919
+ allowedValues?: string[];
920
+ }
921
+ export interface StudioAppPartial {
922
+ id: string;
923
+ name: string;
924
+ version: string;
925
+ description: string;
926
+ icon: string;
927
+ parameterConfig: AppParameterConfig[];
928
+ parameterValues: {
929
+ [key: string]: string | number | boolean | string[];
10
930
  };
931
+ }
932
+ export type AppParameterConfig = {
933
+ id: string;
934
+ type: "string" | "number" | "boolean" | "string[]" | "password";
935
+ label: string;
936
+ description?: string;
937
+ required?: boolean;
938
+ defaultValue?: string | number | boolean | string[];
11
939
  };
12
-
13
- //# sourceMappingURL=types.d.ts.map
940
+ export {};