@marteye/studiojs 1.1.24 → 1.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,90 @@
1
+ import { HttpClient } from "../net/http";
2
+ import { Application } from "../types";
3
+ export interface CreateApplicationPayload {
4
+ displayName: string;
5
+ phoneNumber?: string;
6
+ email?: string;
7
+ address: {
8
+ firstLine: string;
9
+ secondLine?: string;
10
+ county?: string;
11
+ postCode: string;
12
+ };
13
+ dateOfMarteyeAccountCreation?: string;
14
+ hasWonLotsOnMarteye?: boolean;
15
+ isApprovedAtOtherMarkets?: boolean;
16
+ marteyeUid: string;
17
+ notes?: string;
18
+ }
19
+ export interface UpdateApplicationPayload {
20
+ displayName?: string;
21
+ phoneNumber?: string;
22
+ email?: string;
23
+ address?: {
24
+ firstLine?: string;
25
+ secondLine?: string;
26
+ county?: string;
27
+ postCode?: string;
28
+ };
29
+ notes?: string;
30
+ }
31
+ export interface ListApplicationsOptions {
32
+ lastId?: string;
33
+ status?: "pending" | "approved" | "rejected";
34
+ }
35
+ export interface ListApplicationsResponse {
36
+ applications: Application[];
37
+ lastId: string | null;
38
+ hasMore: boolean;
39
+ }
40
+ export default function create(httpClient: HttpClient): {
41
+ /**
42
+ * List applications for a market with optional filtering
43
+ * @param marketId - ID of the market
44
+ * @param options - Optional query parameters for filtering and pagination
45
+ * @returns Paginated list of applications
46
+ */
47
+ list: (marketId: string, options?: ListApplicationsOptions) => Promise<ListApplicationsResponse>;
48
+ /**
49
+ * Get a single application by ID
50
+ * @param marketId - ID of the market
51
+ * @param applicationId - ID of the application
52
+ * @returns The application details
53
+ */
54
+ get: (marketId: string, applicationId: string) => Promise<Application>;
55
+ /**
56
+ * Create a new application
57
+ * @param marketId - ID of the market
58
+ * @param applicationData - The application data
59
+ * @returns The created application
60
+ */
61
+ create: (marketId: string, applicationData: CreateApplicationPayload) => Promise<Application>;
62
+ /**
63
+ * Update an existing application
64
+ * @param marketId - ID of the market
65
+ * @param applicationId - ID of the application to update
66
+ * @param updateData - The fields to update
67
+ * @returns The updated application
68
+ * @throws Error if the application is already approved or rejected
69
+ */
70
+ update: (marketId: string, applicationId: string, updateData: UpdateApplicationPayload) => Promise<Application>;
71
+ /**
72
+ * Approve an application
73
+ * @param marketId - ID of the market
74
+ * @param applicationId - ID of the application to approve
75
+ * @param notes - Optional notes for the approval
76
+ * @returns The approved application
77
+ * @throws Error if the application is not in pending status
78
+ */
79
+ approve: (marketId: string, applicationId: string, notes?: string) => Promise<Application>;
80
+ /**
81
+ * Reject an application
82
+ * @param marketId - ID of the market
83
+ * @param applicationId - ID of the application to reject
84
+ * @param notes - Optional notes for the rejection
85
+ * @returns The rejected application
86
+ * @throws Error if the application is not in pending status
87
+ */
88
+ reject: (marketId: string, applicationId: string, notes?: string) => Promise<Application>;
89
+ };
90
+ export type Applications = ReturnType<typeof create>;
@@ -1,6 +1,10 @@
1
- import { uploadFile } from "../utils/multipart-upload";
1
+ import { uploadMultipartFile, uploadSingleFile } from "../utils/multipart-upload";
2
2
  export default function create(): {
3
- uploadFile: (input: Parameters<typeof uploadFile>[0], token: string) => Promise<{
3
+ uploadSingleFile: (input: Parameters<typeof uploadSingleFile>[0], token: string) => Promise<{
4
+ message: string;
5
+ data: import("../types").Media;
6
+ }>;
7
+ uploadMultipartFile: (input: Parameters<typeof uploadMultipartFile>[0], token: string) => Promise<{
4
8
  message: string;
5
9
  mediaType: string;
6
10
  process: import("../utils/multipart-upload").VariantProcessingState;
@@ -41,6 +41,7 @@ export default function create(httpClient: HttpClient): {
41
41
  endAt?: string | null;
42
42
  saleStatus?: LotSaleStatus;
43
43
  metadata?: Record<string, any>;
44
+ inputAccessories?: Record<string, any>;
44
45
  }) => Promise<Lot>;
45
46
  delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
46
47
  };
@@ -108,6 +108,7 @@ export default function resources(httpClient: HttpClient): {
108
108
  endAt?: string | null;
109
109
  saleStatus?: import("./types").LotSaleStatus;
110
110
  metadata?: Record<string, any>;
111
+ inputAccessories?: Record<string, any>;
111
112
  }) => Promise<import("./types").Lot>;
112
113
  delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
113
114
  };
@@ -132,6 +133,14 @@ export default function resources(httpClient: HttpClient): {
132
133
  actions: {
133
134
  constructAction: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
134
135
  };
136
+ applications: {
137
+ list: (marketId: string, options?: import("./resources/applications").ListApplicationsOptions) => Promise<import("./resources/applications").ListApplicationsResponse>;
138
+ get: (marketId: string, applicationId: string) => Promise<import("./types").Application>;
139
+ create: (marketId: string, applicationData: import("./resources/applications").CreateApplicationPayload) => Promise<import("./types").Application>;
140
+ update: (marketId: string, applicationId: string, updateData: import("./resources/applications").UpdateApplicationPayload) => Promise<import("./types").Application>;
141
+ approve: (marketId: string, applicationId: string, notes?: string) => Promise<import("./types").Application>;
142
+ reject: (marketId: string, applicationId: string, notes?: string) => Promise<import("./types").Application>;
143
+ };
135
144
  settings: {
136
145
  get: (marketId: string) => Promise<import("./types").SettingsMarketDefaults>;
137
146
  };
@@ -158,7 +167,11 @@ export default function resources(httpClient: HttpClient): {
158
167
  query: (marketId: string, query: string) => Promise<import("./resources/search").SearchResult>;
159
168
  };
160
169
  files: {
161
- uploadFile: (input: Parameters<typeof import("./utils/multipart-upload").uploadFile>[0], token: string) => Promise<{
170
+ uploadSingleFile: (input: Parameters<typeof import("./utils/multipart-upload").uploadSingleFile>[0], token: string) => Promise<{
171
+ message: string;
172
+ data: import("./types").Media;
173
+ }>;
174
+ uploadMultipartFile: (input: Parameters<typeof import("./utils/multipart-upload").uploadMultipartFile>[0], token: string) => Promise<{
162
175
  message: string;
163
176
  mediaType: string;
164
177
  process: import("./utils/multipart-upload").VariantProcessingState;
package/dist/studio.d.ts CHANGED
@@ -117,6 +117,7 @@ export declare function Studio(info?: {
117
117
  endAt?: string | null;
118
118
  saleStatus?: import("./types").LotSaleStatus;
119
119
  metadata?: Record<string, any>;
120
+ inputAccessories?: Record<string, any>;
120
121
  }) => Promise<import("./types").Lot>;
121
122
  delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
122
123
  };
@@ -141,6 +142,14 @@ export declare function Studio(info?: {
141
142
  actions: {
142
143
  constructAction: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
143
144
  };
145
+ applications: {
146
+ list: (marketId: string, options?: import("./resources/applications").ListApplicationsOptions) => Promise<import("./resources/applications").ListApplicationsResponse>;
147
+ get: (marketId: string, applicationId: string) => Promise<import("./types").Application>;
148
+ create: (marketId: string, applicationData: import("./resources/applications").CreateApplicationPayload) => Promise<import("./types").Application>;
149
+ update: (marketId: string, applicationId: string, updateData: import("./resources/applications").UpdateApplicationPayload) => Promise<import("./types").Application>;
150
+ approve: (marketId: string, applicationId: string, notes?: string) => Promise<import("./types").Application>;
151
+ reject: (marketId: string, applicationId: string, notes?: string) => Promise<import("./types").Application>;
152
+ };
144
153
  settings: {
145
154
  get: (marketId: string) => Promise<import("./types").SettingsMarketDefaults>;
146
155
  };
@@ -167,7 +176,11 @@ export declare function Studio(info?: {
167
176
  query: (marketId: string, query: string) => Promise<import("./resources/search").SearchResult>;
168
177
  };
169
178
  files: {
170
- uploadFile: (input: Parameters<typeof import("./utils/multipart-upload").uploadFile>[0], token: string) => Promise<{
179
+ uploadSingleFile: (input: Parameters<typeof import("./utils/multipart-upload").uploadSingleFile>[0], token: string) => Promise<{
180
+ message: string;
181
+ data: import("./types").Media;
182
+ }>;
183
+ uploadMultipartFile: (input: Parameters<typeof import("./utils/multipart-upload").uploadMultipartFile>[0], token: string) => Promise<{
171
184
  message: string;
172
185
  mediaType: string;
173
186
  process: import("./utils/multipart-upload").VariantProcessingState;
package/dist/types.d.ts CHANGED
@@ -463,6 +463,7 @@ export interface Product {
463
463
  };
464
464
  }
465
465
  export interface Cart {
466
+ customerId: string;
466
467
  updatedAt: Timestamp;
467
468
  itemsById: {
468
469
  [itemId: string]: CartItem;
@@ -564,6 +565,31 @@ export interface CustomerFromSearch extends Omit<Customer, "createdAt" | "update
564
565
  lastItemPurchaseDate?: number;
565
566
  lastItemSaleDate?: number;
566
567
  }
568
+ export interface Application {
569
+ id: string;
570
+ createdAt: Timestamp;
571
+ updatedAt: Timestamp;
572
+ marketId: string;
573
+ status: "pending" | "approved" | "rejected";
574
+ displayName: string;
575
+ phoneNumber?: string;
576
+ email?: string;
577
+ address: {
578
+ firstLine: string;
579
+ secondLine?: string;
580
+ county?: string;
581
+ postCode: string;
582
+ };
583
+ dateOfMarteyeAccountCreation?: Timestamp;
584
+ hasWonLotsOnMarteye?: boolean;
585
+ isApprovedAtOtherMarkets?: boolean;
586
+ marteyeUid: string;
587
+ notes?: string;
588
+ approvedBy?: string;
589
+ rejectedBy?: string;
590
+ approvedAt?: Timestamp;
591
+ rejectedAt?: Timestamp;
592
+ }
567
593
  export interface Address {
568
594
  id: string;
569
595
  nickname?: string;
@@ -655,6 +681,14 @@ interface Adjustment {
655
681
  ceilingInCents?: number;
656
682
  } | null;
657
683
  fixedAmountInCents?: number | null;
684
+ ladder?: {
685
+ steps: {
686
+ percentageValue?: number;
687
+ upToAmountInCents?: number | null;
688
+ }[];
689
+ floorInCents?: number;
690
+ ceilingInCents?: number;
691
+ };
658
692
  }
659
693
  export interface LineItemAdjustmentConfiguration extends AdjustmentsConfiguration {
660
694
  adjustment: Adjustment & {
@@ -818,6 +852,7 @@ export interface Invoice extends Omit<Omit<Omit<Omit<DraftInvoice, "ledgerAccoun
818
852
  sales: {
819
853
  id: string;
820
854
  name?: string;
855
+ startsAt?: Timestamp;
821
856
  }[];
822
857
  transactionIds?: string[];
823
858
  status: "draft" | "issued" | "void" | "imported" | "paid";
@@ -843,6 +878,11 @@ export interface Invoice extends Omit<Omit<Omit<Omit<DraftInvoice, "ledgerAccoun
843
878
  */
844
879
  internalNextInvoiceId: string | null;
845
880
  emailNotifications?: string[];
881
+ emailStatus?: {
882
+ recipient: string;
883
+ status: "sent" | "delivered" | "opened" | "bounced";
884
+ timestamp: Timestamp;
885
+ }[];
846
886
  pitchPayLink: string | null;
847
887
  }
848
888
  export interface Printer {
@@ -17,8 +17,8 @@ export default class EarTag {
17
17
  private _nationalIdentifier?;
18
18
  get nationalIdentifier(): string | undefined;
19
19
  constructor(input: string, fallbackCountryCode?: CountryCode | string | null);
20
- static parse(str: string, fallbackCountryCode?: CountryCode): EarTag;
21
- static format(str: string): string | null;
20
+ static parse(str: string, fallbackCountryCode?: CountryCode | string | null): EarTag;
21
+ static format(str: string, marketCountry?: string | null | undefined): string | null;
22
22
  toString(): string;
23
23
  isISO24631(): boolean;
24
24
  toISO24631(): string;
@@ -0,0 +1,10 @@
1
+ export declare function lotComparator<T extends {
2
+ lotNumber: string;
3
+ }>(a: T, b: T): number;
4
+ export declare function sortByLotNumber<T extends {
5
+ lotNumber: string;
6
+ }>(lots: T[]): T[];
7
+ /***
8
+ * Generate the next lot number in a sequence:
9
+ */
10
+ export declare function nextLotNumber(previousLotNumber: string): string;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { Media } from "../types";
2
3
  /**
3
4
  |--------------------------------------------------
4
5
  | START OF MEDIA CRATE CODE
@@ -14,10 +15,10 @@ export declare const processorPayload: z.ZodObject<{
14
15
  assetPath: string;
15
16
  suffix: string;
16
17
  }>;
17
- export declare const IMAGE_SIZES_VALUES: readonly ["small", "medium", "large"];
18
+ export declare const IMAGE_SIZES_VALUES: readonly ["thumbnail", "small", "medium", "large"];
18
19
  export declare const VIDEO_TASKS_VALUES: readonly ["compressed", "thumbnail"];
19
20
  export declare const videoTaskSchema: z.ZodEnum<["compressed", "thumbnail"]>;
20
- export declare const imageSizeSchema: z.ZodEnum<["small", "medium", "large"]>;
21
+ export declare const imageSizeSchema: z.ZodEnum<["thumbnail", "small", "medium", "large"]>;
21
22
  export type ImageSize = z.infer<typeof imageSizeSchema>;
22
23
  export type ProcessorPayload = z.infer<typeof processorPayload>;
23
24
  export type VideoVMPayload = ProcessorPayload & {
@@ -76,6 +77,12 @@ export type MediaUploadOptions = {
76
77
  }) => void;
77
78
  };
78
79
  };
80
+ /**
81
+ |--------------------------------------------------
82
+ | Make a File Path
83
+ |--------------------------------------------------
84
+ */
85
+ export declare function createFilePath(marketId: string, saleId: string, lotId: string, attributeId: string, fileName: string): string;
79
86
  /**
80
87
  * Starts a multipart upload process for a file
81
88
  * @param {Object} params - The parameters for starting the upload
@@ -197,5 +204,18 @@ export type ChunkedInput = {
197
204
  * @returns {Promise<MediaFinishUploadResponse>}
198
205
  * @throws {Error} When upload fails
199
206
  */
200
- export declare const uploadFile: (input: FileInput | ChunkedInput, token: string) => Promise<MediaFinishUploadResponse>;
207
+ export declare const uploadMultipartFile: (input: FileInput | ChunkedInput, token: string) => Promise<MediaFinishUploadResponse>;
208
+ export type SingleFileInput = {
209
+ file?: File;
210
+ filePath?: never;
211
+ uploadConfig: MediaUploadOptions;
212
+ } | {
213
+ filePath?: string;
214
+ file?: never;
215
+ uploadConfig: MediaUploadOptions;
216
+ };
217
+ export declare const uploadSingleFile: (input: SingleFileInput, token: string) => Promise<{
218
+ message: string;
219
+ data: Media;
220
+ }>;
201
221
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marteye/studiojs",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "MartEye Studio JavaScript SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,7 @@
25
25
  "build": "npm run clean && rollup -c",
26
26
  "watch": "rollup -c -w",
27
27
  "test": "jest --coverage",
28
+ "test:watch": "jest --watch",
28
29
  "build:types": "tsc --emitDeclarationOnly",
29
30
  "build:publish": "npm run build && npm publish --access public"
30
31
  },