@marteye/studiojs 1.1.24 → 1.1.25

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,107 +1,5 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const videoTaskSchema: z.ZodEnum<["compressed", "thumbnail"]>;
4
- declare const imageSizeSchema: z.ZodEnum<["small", "medium", "large"]>;
5
- type ImageSize = z.infer<typeof imageSizeSchema>;
6
- type VideoTask = z.infer<typeof videoTaskSchema>;
7
- type SupportedFileTypesNames$1 = "image" | "video" | "file";
8
- type VariantProcessingState = {
9
- fileName: string;
10
- thumbHash: string;
11
- path: string;
12
- url: string;
13
- fileType: string;
14
- variants: Partial<Record<ImageSize | VideoTask, {
15
- url: string;
16
- isProcessing: boolean;
17
- type: SupportedFileTypesNames$1;
18
- }>>;
19
- };
20
- /**
21
- |--------------------------------------------------
22
- | END OF MEDIA CRATE CODE
23
- |--------------------------------------------------
24
- */
25
- type MediaFinishUploadResponse = {
26
- message: string;
27
- mediaType: string;
28
- process: VariantProcessingState;
29
- };
30
- type MediaUploadOptions = {
31
- marketId: string;
32
- saleId: string;
33
- lotId: string;
34
- attributeId: string;
35
- options?: {
36
- bucket?: "raw";
37
- parallelParts?: number;
38
- baseUrl?: string;
39
- progressCallback?: (progress: {
40
- /**
41
- * The state of the upload
42
- */
43
- state: "uploading" | "finished" | "failed" | "starting";
44
- /**
45
- * The progress of the upload
46
- */
47
- progress: number;
48
- /**
49
- * The current part number
50
- */
51
- currentPart?: number;
52
- /**
53
- * The total parts
54
- */
55
- totalParts?: number;
56
- }) => void;
57
- };
58
- };
59
- type ChunkedFile = {
60
- partNumber: string;
61
- chunk: string;
62
- fileExtension: string;
63
- fileMimeType: string;
64
- };
65
- type FileInput = {
66
- file: File;
67
- uploadConfig: MediaUploadOptions;
68
- };
69
- type ChunkedInput = {
70
- fileName: string;
71
- chunks: ChunkedFile[];
72
- uploadConfig: MediaUploadOptions;
73
- };
74
- /**
75
- * Handles the complete file upload process including chunking and progress tracking -
76
- * WEB: Pass in a file and we will chunk it and upload it in parallel
77
- * NATIVE: You need to chunk the file yourself.
78
- * @param {FileInput | ChunkedInput} input - Either {file, options} or {fileName, chunks, options}
79
- * @returns {Promise<MediaFinishUploadResponse>}
80
- * @throws {Error} When upload fails
81
- */
82
- declare const uploadFile: (input: FileInput | ChunkedInput, token: string) => Promise<MediaFinishUploadResponse>;
83
-
84
- declare function SimpleHttpClient(baseUrl: string, apiKey: string, fetch: any, defaultTimeout: number, debug?: boolean): {
85
- get: <T>(path: string, queryParams?: any) => Promise<T>;
86
- post: <T>(path: string, body: any) => Promise<T>;
87
- delete: <T>(path: string) => Promise<T>;
88
- };
89
- type HttpClient = ReturnType<typeof SimpleHttpClient>;
90
-
91
- /**
92
- * Search result interface based on the API implementation
93
- */
94
- interface SearchResult {
95
- hits: Array<{
96
- id: string;
97
- marketId: string;
98
- title: string;
99
- [key: string]: any;
100
- }>;
101
- processingTimeMs: number;
102
- query: string;
103
- }
104
-
105
3
  type Timestamp = string;
106
4
  type ClientType = "Seller" | "Buyer";
107
5
  type SuperType = "Sheep" | "Goats" | "Cattle" | "Pigs" | "Horses" | "Deer" | "Poultry" | "Machinery" | "Antiques" | "Other";
@@ -547,6 +445,7 @@ interface Product {
547
445
  };
548
446
  }
549
447
  interface Cart {
448
+ customerId: string;
550
449
  updatedAt: Timestamp;
551
450
  itemsById: {
552
451
  [itemId: string]: CartItem;
@@ -665,7 +564,7 @@ declare const IMAGE_SIZES_VALUES: readonly ["small", "medium", "large"];
665
564
  declare const VIDEO_TASKS_VALUES: readonly ["compressed", "thumbnail"];
666
565
  type ImageSizes = (typeof IMAGE_SIZES_VALUES)[number];
667
566
  type VideoTasks = (typeof VIDEO_TASKS_VALUES)[number];
668
- type SupportedFileTypesNames = "image" | "video" | "file";
567
+ type SupportedFileTypesNames$1 = "image" | "video" | "file";
669
568
  interface Media {
670
569
  id: string;
671
570
  fileName: string;
@@ -676,7 +575,7 @@ interface Media {
676
575
  url: string;
677
576
  isLocal?: boolean;
678
577
  isProcessing: boolean;
679
- type: SupportedFileTypesNames;
578
+ type: SupportedFileTypesNames$1;
680
579
  }>>;
681
580
  }
682
581
  type MarketReportHeaders = "grossServices" | "vatOnServices" | "grossGoods" | "vatOnGoods" | "netTotal" | "contra";
@@ -927,6 +826,11 @@ interface Invoice extends Omit<Omit<Omit<Omit<DraftInvoice, "ledgerAccountTotals
927
826
  */
928
827
  internalNextInvoiceId: string | null;
929
828
  emailNotifications?: string[];
829
+ emailStatus?: {
830
+ recipient: string;
831
+ status: "sent" | "delivered" | "opened" | "bounced";
832
+ timestamp: Timestamp;
833
+ }[];
930
834
  pitchPayLink: string | null;
931
835
  }
932
836
  /**
@@ -1135,7 +1039,6 @@ type types_SuperType = SuperType;
1135
1039
  type types_SupportedAttributeTypes = SupportedAttributeTypes;
1136
1040
  type types_SupportedCountryCode = SupportedCountryCode;
1137
1041
  declare const types_SupportedCurrencyCodes: typeof SupportedCurrencyCodes;
1138
- type types_SupportedFileTypesNames = SupportedFileTypesNames;
1139
1042
  declare const types_SupportedPaymentMethods: typeof SupportedPaymentMethods;
1140
1043
  declare const types_SupportedSuperTypes: typeof SupportedSuperTypes;
1141
1044
  declare const types_SupportedUnitsOfSale: typeof SupportedUnitsOfSale;
@@ -1149,7 +1052,122 @@ type types_WebhookEventName = WebhookEventName;
1149
1052
  declare const types_supportedWebhookEvents: typeof supportedWebhookEvents;
1150
1053
  declare namespace types {
1151
1054
  export { types_IMAGE_SIZES_VALUES as IMAGE_SIZES_VALUES, types_LivestockSuperTypes as LivestockSuperTypes, types_SupportedCurrencyCodes as SupportedCurrencyCodes, types_SupportedPaymentMethods as SupportedPaymentMethods, types_SupportedSuperTypes as SupportedSuperTypes, types_SupportedUnitsOfSale as SupportedUnitsOfSale, types_VIDEO_TASKS_VALUES as VIDEO_TASKS_VALUES, types_supportedWebhookEvents as supportedWebhookEvents };
1152
- export type { types_Accessory as Accessory, types_Address as Address, types_AddressWrapper as AddressWrapper, types_AdjustmentTarget as AdjustmentTarget, types_AdjustmentTotalTarget as AdjustmentTotalTarget, types_AdjustmentsConfiguration as AdjustmentsConfiguration, types_AppParameterConfig as AppParameterConfig, types_AttributeDefinition as AttributeDefinition, types_AttributeValueType as AttributeValueType, types_BankDetails as BankDetails, types_Cart as Cart, types_CartItem as CartItem, types_ChequeField as ChequeField, types_ClientType as ClientType, types_CurrenciesWithGuinea as CurrenciesWithGuinea, types_Currency as Currency, types_Customer as Customer, types_CustomerFromSearch as CustomerFromSearch, types_DeviceType as DeviceType, types_DraftInvoice as DraftInvoice, types_EmailWrapper as EmailWrapper, types_FarmAssurances as FarmAssurances, types_FieldPositions as FieldPositions, types_ImageSizes as ImageSizes, types_IncrementLadder as IncrementLadder, types_IncrementLadderItem as IncrementLadderItem, types_Invoice as Invoice, types_InvoiceField as InvoiceField, types_InvoiceLineItem as InvoiceLineItem, types_InvoiceTotalAdjustmentConfiguration as InvoiceTotalAdjustmentConfiguration, types_InvoiceTotals as InvoiceTotals, types_LineItemAdjustmentConfiguration as LineItemAdjustmentConfiguration, types_Lot as Lot, types_LotGeneratedValues as LotGeneratedValues, types_LotIssue as LotIssue, types_LotItem as LotItem, types_LotSaleStatus as LotSaleStatus, types_LotWithItemsAsArray as LotWithItemsAsArray, types_Market as Market, types_MarketBankDetails as MarketBankDetails, types_MarketReportHeaders as MarketReportHeaders, types_MartEyeLiveSaleSettings as MartEyeLiveSaleSettings, types_MartEyeTimedSaleSettings as MartEyeTimedSaleSettings, types_Media as Media, types_MemberSharingConfiguration as MemberSharingConfiguration, types_ObjectType as ObjectType, types_Payment as Payment, types_PaymentMethod as PaymentMethod, types_Payout as Payout, types_PayoutMethod as PayoutMethod, types_PhoneNumberWrapper as PhoneNumberWrapper, types_Printer as Printer, types_Product as Product, types_ProductCodeConfiguration as ProductCodeConfiguration, types_ProductConfiguration as ProductConfiguration, types_Sale as Sale, types_SaleFromSearch as SaleFromSearch, types_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_StudioAppPartial as StudioAppPartial, types_SubtotalGroups as SubtotalGroups, types_SuperType as SuperType, types_SupportedAttributeTypes as SupportedAttributeTypes, types_SupportedCountryCode as SupportedCountryCode, types_SupportedFileTypesNames as SupportedFileTypesNames, types_TablePosition as TablePosition, types_TaxRate as TaxRate, types_UnitOfSale as UnitOfSale, types_VideoTasks as VideoTasks, types_WebhookEvent as WebhookEvent, types_WebhookEventName as WebhookEventName };
1055
+ export type { types_Accessory as Accessory, types_Address as Address, types_AddressWrapper as AddressWrapper, types_AdjustmentTarget as AdjustmentTarget, types_AdjustmentTotalTarget as AdjustmentTotalTarget, types_AdjustmentsConfiguration as AdjustmentsConfiguration, types_AppParameterConfig as AppParameterConfig, types_AttributeDefinition as AttributeDefinition, types_AttributeValueType as AttributeValueType, types_BankDetails as BankDetails, types_Cart as Cart, types_CartItem as CartItem, types_ChequeField as ChequeField, types_ClientType as ClientType, types_CurrenciesWithGuinea as CurrenciesWithGuinea, types_Currency as Currency, types_Customer as Customer, types_CustomerFromSearch as CustomerFromSearch, types_DeviceType as DeviceType, types_DraftInvoice as DraftInvoice, types_EmailWrapper as EmailWrapper, types_FarmAssurances as FarmAssurances, types_FieldPositions as FieldPositions, types_ImageSizes as ImageSizes, types_IncrementLadder as IncrementLadder, types_IncrementLadderItem as IncrementLadderItem, types_Invoice as Invoice, types_InvoiceField as InvoiceField, types_InvoiceLineItem as InvoiceLineItem, types_InvoiceTotalAdjustmentConfiguration as InvoiceTotalAdjustmentConfiguration, types_InvoiceTotals as InvoiceTotals, types_LineItemAdjustmentConfiguration as LineItemAdjustmentConfiguration, types_Lot as Lot, types_LotGeneratedValues as LotGeneratedValues, types_LotIssue as LotIssue, types_LotItem as LotItem, types_LotSaleStatus as LotSaleStatus, types_LotWithItemsAsArray as LotWithItemsAsArray, types_Market as Market, types_MarketBankDetails as MarketBankDetails, types_MarketReportHeaders as MarketReportHeaders, types_MartEyeLiveSaleSettings as MartEyeLiveSaleSettings, types_MartEyeTimedSaleSettings as MartEyeTimedSaleSettings, types_Media as Media, types_MemberSharingConfiguration as MemberSharingConfiguration, types_ObjectType as ObjectType, types_Payment as Payment, types_PaymentMethod as PaymentMethod, types_Payout as Payout, types_PayoutMethod as PayoutMethod, types_PhoneNumberWrapper as PhoneNumberWrapper, types_Printer as Printer, types_Product as Product, types_ProductCodeConfiguration as ProductCodeConfiguration, types_ProductConfiguration as ProductConfiguration, types_Sale as Sale, types_SaleFromSearch as SaleFromSearch, types_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_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_UnitOfSale as UnitOfSale, types_VideoTasks as VideoTasks, types_WebhookEvent as WebhookEvent, types_WebhookEventName as WebhookEventName };
1056
+ }
1057
+
1058
+ declare const videoTaskSchema: z.ZodEnum<["compressed", "thumbnail"]>;
1059
+ declare const imageSizeSchema: z.ZodEnum<["thumbnail", "small", "medium", "large"]>;
1060
+ type ImageSize = z.infer<typeof imageSizeSchema>;
1061
+ type VideoTask = z.infer<typeof videoTaskSchema>;
1062
+ type SupportedFileTypesNames = "image" | "video" | "file";
1063
+ type VariantProcessingState = {
1064
+ fileName: string;
1065
+ thumbHash: string;
1066
+ path: string;
1067
+ url: string;
1068
+ fileType: string;
1069
+ variants: Partial<Record<ImageSize | VideoTask, {
1070
+ url: string;
1071
+ isProcessing: boolean;
1072
+ type: SupportedFileTypesNames;
1073
+ }>>;
1074
+ };
1075
+ /**
1076
+ |--------------------------------------------------
1077
+ | END OF MEDIA CRATE CODE
1078
+ |--------------------------------------------------
1079
+ */
1080
+ type MediaFinishUploadResponse = {
1081
+ message: string;
1082
+ mediaType: string;
1083
+ process: VariantProcessingState;
1084
+ };
1085
+ type MediaUploadOptions = {
1086
+ marketId: string;
1087
+ saleId: string;
1088
+ lotId: string;
1089
+ attributeId: string;
1090
+ options?: {
1091
+ bucket?: "raw";
1092
+ parallelParts?: number;
1093
+ baseUrl?: string;
1094
+ progressCallback?: (progress: {
1095
+ /**
1096
+ * The state of the upload
1097
+ */
1098
+ state: "uploading" | "finished" | "failed" | "starting";
1099
+ /**
1100
+ * The progress of the upload
1101
+ */
1102
+ progress: number;
1103
+ /**
1104
+ * The current part number
1105
+ */
1106
+ currentPart?: number;
1107
+ /**
1108
+ * The total parts
1109
+ */
1110
+ totalParts?: number;
1111
+ }) => void;
1112
+ };
1113
+ };
1114
+ type ChunkedFile = {
1115
+ partNumber: string;
1116
+ chunk: string;
1117
+ fileExtension: string;
1118
+ fileMimeType: string;
1119
+ };
1120
+ type FileInput = {
1121
+ file: File;
1122
+ uploadConfig: MediaUploadOptions;
1123
+ };
1124
+ type ChunkedInput = {
1125
+ fileName: string;
1126
+ chunks: ChunkedFile[];
1127
+ uploadConfig: MediaUploadOptions;
1128
+ };
1129
+ /**
1130
+ * Handles the complete file upload process including chunking and progress tracking -
1131
+ * WEB: Pass in a file and we will chunk it and upload it in parallel
1132
+ * NATIVE: You need to chunk the file yourself.
1133
+ * @param {FileInput | ChunkedInput} input - Either {file, options} or {fileName, chunks, options}
1134
+ * @returns {Promise<MediaFinishUploadResponse>}
1135
+ * @throws {Error} When upload fails
1136
+ */
1137
+ declare const uploadMultipartFile: (input: FileInput | ChunkedInput, token: string) => Promise<MediaFinishUploadResponse>;
1138
+ type SingleFileInput = {
1139
+ file?: File;
1140
+ filePath?: never;
1141
+ uploadConfig: MediaUploadOptions;
1142
+ } | {
1143
+ filePath?: string;
1144
+ file?: never;
1145
+ uploadConfig: MediaUploadOptions;
1146
+ };
1147
+ declare const uploadSingleFile: (input: SingleFileInput, token: string) => Promise<{
1148
+ message: string;
1149
+ data: Media;
1150
+ }>;
1151
+
1152
+ declare function SimpleHttpClient(baseUrl: string, apiKey: string, fetch: any, defaultTimeout: number, debug?: boolean): {
1153
+ get: <T>(path: string, queryParams?: any) => Promise<T>;
1154
+ post: <T>(path: string, body: any) => Promise<T>;
1155
+ delete: <T>(path: string) => Promise<T>;
1156
+ };
1157
+ type HttpClient = ReturnType<typeof SimpleHttpClient>;
1158
+
1159
+ /**
1160
+ * Search result interface based on the API implementation
1161
+ */
1162
+ interface SearchResult {
1163
+ hits: Array<{
1164
+ id: string;
1165
+ marketId: string;
1166
+ title: string;
1167
+ [key: string]: any;
1168
+ }>;
1169
+ processingTimeMs: number;
1170
+ query: string;
1153
1171
  }
1154
1172
 
1155
1173
  interface CreateCustomerPayload {
@@ -1283,6 +1301,7 @@ declare function resources(httpClient: HttpClient): {
1283
1301
  endAt?: string | null;
1284
1302
  saleStatus?: LotSaleStatus;
1285
1303
  metadata?: Record<string, any>;
1304
+ inputAccessories?: Record<string, any>;
1286
1305
  }) => Promise<Lot>;
1287
1306
  delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
1288
1307
  };
@@ -1333,7 +1352,11 @@ declare function resources(httpClient: HttpClient): {
1333
1352
  query: (marketId: string, query: string) => Promise<SearchResult>;
1334
1353
  };
1335
1354
  files: {
1336
- uploadFile: (input: Parameters<typeof uploadFile>[0], token: string) => Promise<{
1355
+ uploadSingleFile: (input: Parameters<typeof uploadSingleFile>[0], token: string) => Promise<{
1356
+ message: string;
1357
+ data: Media;
1358
+ }>;
1359
+ uploadMultipartFile: (input: Parameters<typeof uploadMultipartFile>[0], token: string) => Promise<{
1337
1360
  message: string;
1338
1361
  mediaType: string;
1339
1362
  process: VariantProcessingState;
@@ -1462,6 +1485,7 @@ declare function Studio(info?: {
1462
1485
  endAt?: string | null;
1463
1486
  saleStatus?: LotSaleStatus;
1464
1487
  metadata?: Record<string, any>;
1488
+ inputAccessories?: Record<string, any>;
1465
1489
  }) => Promise<Lot>;
1466
1490
  delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
1467
1491
  };
@@ -1512,7 +1536,11 @@ declare function Studio(info?: {
1512
1536
  query: (marketId: string, query: string) => Promise<SearchResult>;
1513
1537
  };
1514
1538
  files: {
1515
- uploadFile: (input: Parameters<typeof uploadFile>[0], token: string) => Promise<{
1539
+ uploadSingleFile: (input: Parameters<typeof uploadSingleFile>[0], token: string) => Promise<{
1540
+ message: string;
1541
+ data: Media;
1542
+ }>;
1543
+ uploadMultipartFile: (input: Parameters<typeof uploadMultipartFile>[0], token: string) => Promise<{
1516
1544
  message: string;
1517
1545
  mediaType: string;
1518
1546
  process: VariantProcessingState;
@@ -1587,5 +1615,42 @@ declare function createAppManifest(appConfig: {
1587
1615
  readonly manifest: StudioManifest;
1588
1616
  };
1589
1617
 
1590
- export { Studio, StudioHeaders, types as StudioTypes, createAppManifest, Studio as default };
1618
+ type CountryCode = keyof typeof EarTag.countryCodes;
1619
+ declare class EarTag {
1620
+ static regexISO24631: RegExp;
1621
+ static countryCodes: {
1622
+ [key: string]: string;
1623
+ };
1624
+ static get countryCodesByNumber(): {
1625
+ [code: string]: CountryCode;
1626
+ };
1627
+ private normalisedCountryCode;
1628
+ private _raw;
1629
+ get raw(): string;
1630
+ private _isEartag;
1631
+ isEartag(): boolean;
1632
+ private _isoCountryCode?;
1633
+ get isoCountryCode(): string | undefined;
1634
+ private _nationalIdentifier?;
1635
+ get nationalIdentifier(): string | undefined;
1636
+ constructor(input: string, fallbackCountryCode?: CountryCode | string | null);
1637
+ static parse(str: string, fallbackCountryCode?: CountryCode | string | null): EarTag;
1638
+ static format(str: string, marketCountry?: string | null | undefined): string | null;
1639
+ toString(): string;
1640
+ isISO24631(): boolean;
1641
+ toISO24631(): string;
1642
+ }
1643
+
1644
+ declare function lotComparator<T extends {
1645
+ lotNumber: string;
1646
+ }>(a: T, b: T): number;
1647
+ declare function sortByLotNumber<T extends {
1648
+ lotNumber: string;
1649
+ }>(lots: T[]): T[];
1650
+ /***
1651
+ * Generate the next lot number in a sequence:
1652
+ */
1653
+ declare function nextLotNumber(previousLotNumber: string): string;
1654
+
1655
+ export { EarTag, Studio, StudioHeaders, types as StudioTypes, createAppManifest, Studio as default, lotComparator, nextLotNumber, sortByLotNumber };
1591
1656
  export type { ChunkedFile, StudioInstance, StudioManifest };