@marteye/studiojs 1.1.45 → 1.1.47-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.
@@ -1,7 +1,7 @@
1
1
  export default function SimpleHttpClient(baseUrl: string, apiKey: string, fetch: any, defaultTimeout: number, debug?: boolean): {
2
2
  get: <T>(path: string, queryParams?: any) => Promise<T>;
3
- post: <T>(path: string, body: any) => Promise<T>;
4
- patch: <T>(path: string, body: any) => Promise<T>;
5
- delete: <T>(path: string) => Promise<T>;
3
+ post: <T_1>(path: string, body: any) => Promise<T_1>;
4
+ patch: <T_2>(path: string, body: any) => Promise<T_2>;
5
+ delete: <T_3>(path: string) => Promise<T_3>;
6
6
  };
7
7
  export type HttpClient = ReturnType<typeof SimpleHttpClient>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { HttpClient } from "../net/http";
2
3
  export default function create(_: HttpClient): {
3
4
  /***
@@ -0,0 +1,214 @@
1
+ import { HttpClient } from "../net/http";
2
+ export type CustomerListType = "simple" | "smart";
3
+ export type CustomerListRole = "buyer" | "seller" | "both";
4
+ export interface GeoBounds {
5
+ north: number;
6
+ south: number;
7
+ east: number;
8
+ west: number;
9
+ }
10
+ export interface RollingDateConfig {
11
+ windowDays: number;
12
+ originalStart: string;
13
+ originalEnd: string;
14
+ }
15
+ export interface CustomerListQuery {
16
+ role: CustomerListRole;
17
+ filter?: string;
18
+ excludeFilters?: string[];
19
+ bounds?: GeoBounds;
20
+ rollingDateConfig?: RollingDateConfig;
21
+ secondaryFilter?: {
22
+ role: CustomerListRole;
23
+ filter?: string;
24
+ bounds?: GeoBounds;
25
+ rollingDateConfig?: RollingDateConfig;
26
+ };
27
+ }
28
+ export interface CustomerList {
29
+ id: string;
30
+ marketId: string;
31
+ name: string;
32
+ slug: string;
33
+ description?: string;
34
+ type: CustomerListType;
35
+ query?: CustomerListQuery;
36
+ rollingDateConfig?: RollingDateConfig;
37
+ excludedCustomerIds?: string[];
38
+ memberCount: number;
39
+ refreshStatus?: "idle" | "refreshing" | "failed";
40
+ refreshError?: string;
41
+ lastRefreshedAt?: string;
42
+ lastRefreshDurationMs?: number;
43
+ lastRefreshCostEstimate?: number;
44
+ lastRollingDateRange?: {
45
+ start: string;
46
+ end: string;
47
+ };
48
+ createdAt: string;
49
+ createdBy: string;
50
+ updatedAt: string;
51
+ updatedBy: string;
52
+ }
53
+ export interface CustomerListMember {
54
+ marketId: string;
55
+ listId: string;
56
+ customerId: string;
57
+ dateAdded: string;
58
+ addedBy: string;
59
+ customerDisplayName?: string;
60
+ customerAccountNumber?: string;
61
+ email?: string;
62
+ phoneNumber?: string;
63
+ }
64
+ export interface CustomerListFilterGroup {
65
+ role: CustomerListRole;
66
+ dateStart?: string | null;
67
+ dateEnd?: string | null;
68
+ productCodes?: string[];
69
+ geoBounds?: GeoBounds | null;
70
+ rollingDateConfig?: RollingDateConfig;
71
+ }
72
+ export interface CustomerListFilters {
73
+ role?: CustomerListRole | null;
74
+ dateStart?: string | null;
75
+ dateEnd?: string | null;
76
+ productCodes?: string[];
77
+ excludeDateStart?: string | null;
78
+ excludeDateEnd?: string | null;
79
+ excludedProductCodes?: string[];
80
+ geoBounds?: GeoBounds | null;
81
+ boughtOnlineOnly?: boolean;
82
+ cattleBreeds?: string[];
83
+ sheepBreeds?: string[];
84
+ rollingDateConfig?: RollingDateConfig;
85
+ secondaryFilter?: CustomerListFilterGroup | null;
86
+ }
87
+ export interface CustomerListReportRow {
88
+ customerId: string;
89
+ displayName?: string | null;
90
+ accountNumber?: string | null;
91
+ purchasedItemCount: number;
92
+ totalPurchasedValueInCents: number;
93
+ soldItemCount: number;
94
+ totalSoldValueInCents: number;
95
+ lastSaleDate?: string | null;
96
+ lastPurchaseDate?: string | null;
97
+ productCodesSold?: string[] | null;
98
+ productCodesBought?: string[] | null;
99
+ latitude?: number | null;
100
+ longitude?: number | null;
101
+ address1?: string | null;
102
+ address2?: string | null;
103
+ city?: string | null;
104
+ province?: string | null;
105
+ zip?: string | null;
106
+ country?: string | null;
107
+ email?: string | null;
108
+ phoneNumber?: string | null;
109
+ }
110
+ export interface CustomerListReportSummary {
111
+ totalCustomers: number;
112
+ totalSoldValueInCents: number;
113
+ totalPurchasedValueInCents: number;
114
+ customersWithLocation: number;
115
+ uniqueProductCodes: string[];
116
+ }
117
+ export type CustomerListViewResult = {
118
+ mode: "simple";
119
+ list: CustomerList;
120
+ members: CustomerListMember[];
121
+ total: number;
122
+ } | {
123
+ mode: "smart";
124
+ list: CustomerList;
125
+ effectiveFilters: CustomerListFilters;
126
+ rows: CustomerListReportRow[];
127
+ summary: CustomerListReportSummary;
128
+ };
129
+ export interface CustomerListsListOptions {
130
+ type?: CustomerListType;
131
+ limit?: number;
132
+ offset?: number;
133
+ }
134
+ export interface CustomerListMembersOptions {
135
+ limit?: number;
136
+ offset?: number;
137
+ includeArchived?: boolean;
138
+ }
139
+ export interface CustomerListViewOptions {
140
+ identifierType?: "auto" | "id" | "slug";
141
+ limit?: number;
142
+ offset?: number;
143
+ allMembers?: boolean;
144
+ refresh?: boolean;
145
+ }
146
+ export interface CustomerListsListResponse {
147
+ lists: CustomerList[];
148
+ total: number;
149
+ }
150
+ export interface CustomerListMembersResponse {
151
+ members: CustomerListMember[];
152
+ total: number;
153
+ hasMore: boolean;
154
+ }
155
+ export interface CustomerListPreviewResponse {
156
+ rows: CustomerListReportRow[];
157
+ summary: CustomerListReportSummary;
158
+ }
159
+ export interface CustomerListProductCodesResponse {
160
+ uniqueProductCodes: string[];
161
+ }
162
+ export interface CustomerListAddMembersResponse {
163
+ added: number;
164
+ alreadyMembers: number;
165
+ notFound: number;
166
+ memberCount: number;
167
+ }
168
+ export interface CustomerListRemoveMemberResponse {
169
+ removed: boolean;
170
+ memberCount: number;
171
+ }
172
+ export interface CustomerListDeleteResponse {
173
+ deleted: boolean;
174
+ membersRemoved: number;
175
+ }
176
+ export interface CustomerListRefreshResponse {
177
+ refreshStatus: "refreshing";
178
+ message: string;
179
+ }
180
+ export type CreateCustomerListPayload = {
181
+ name: string;
182
+ description?: string;
183
+ type: "simple";
184
+ } | {
185
+ name: string;
186
+ description?: string;
187
+ type: "smart";
188
+ query?: CustomerListQuery;
189
+ filters?: CustomerListFilters;
190
+ };
191
+ export interface UpdateCustomerListPayload {
192
+ name?: string;
193
+ description?: string | null;
194
+ query?: CustomerListQuery;
195
+ filters?: Partial<CustomerListFilters>;
196
+ }
197
+ export default function create(httpClient: HttpClient): {
198
+ list: (marketId: string, options?: CustomerListsListOptions) => Promise<CustomerListsListResponse>;
199
+ listAll: (marketId: string, options?: Omit<CustomerListsListOptions, "offset">) => Promise<CustomerList[]>;
200
+ get: (marketId: string, listId: string) => Promise<CustomerList>;
201
+ getBySlug: (marketId: string, slug: string) => Promise<CustomerList>;
202
+ create: (marketId: string, payload: CreateCustomerListPayload) => Promise<CustomerList>;
203
+ update: (marketId: string, listId: string, payload: UpdateCustomerListPayload) => Promise<CustomerList>;
204
+ delete: (marketId: string, listId: string) => Promise<CustomerListDeleteResponse>;
205
+ refresh: (marketId: string, listId: string) => Promise<CustomerListRefreshResponse>;
206
+ getMembers: (marketId: string, listId: string, options?: CustomerListMembersOptions) => Promise<CustomerListMembersResponse>;
207
+ getAllMembers: (marketId: string, listId: string, options?: Omit<CustomerListMembersOptions, "offset">) => Promise<CustomerListMember[]>;
208
+ addMembers: (marketId: string, listId: string, customerIds: string[]) => Promise<CustomerListAddMembersResponse>;
209
+ removeMember: (marketId: string, listId: string, customerId: string) => Promise<CustomerListRemoveMemberResponse>;
210
+ preview: (marketId: string, filters: CustomerListFilters) => Promise<CustomerListPreviewResponse>;
211
+ listProductCodes: (marketId: string) => Promise<CustomerListProductCodesResponse>;
212
+ view: (marketId: string, listIdOrSlug: string, options?: CustomerListViewOptions) => Promise<CustomerListViewResult>;
213
+ };
214
+ export type CustomerLists = ReturnType<typeof create>;
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from "../net/http";
2
- import { Lot, LotSaleStatus, ReadOptions } from "../types";
2
+ import { DeleteLotsResponse, Lot, LotDeletePreflightResponse, LotSaleStatus, ReadOptions } from "../types";
3
3
  /**
4
4
  * Defines the possible status values for a lot in a sale
5
5
  */
@@ -50,5 +50,8 @@ export default function create(httpClient: HttpClient): {
50
50
  inputAccessories?: Record<string, any>;
51
51
  }) => Promise<Lot>;
52
52
  delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
53
+ deletePreflight: (marketId: string, saleId: string, lotId: string) => Promise<LotDeletePreflightResponse>;
54
+ deletePreflightBatch: (marketId: string, saleId: string, lotIds: string[]) => Promise<DeleteLotsResponse>;
55
+ deleteBatch: (marketId: string, saleId: string, lotIds: string[], confirmedLotIds?: string[]) => Promise<DeleteLotsResponse>;
53
56
  };
54
57
  export type Lots = ReturnType<typeof create>;
@@ -70,6 +70,7 @@ export default function create(httpClient: HttpClient): {
70
70
  cascade?: boolean;
71
71
  reportEmail?: string;
72
72
  queueLots?: boolean;
73
+ markSubjectLotsAsSold?: boolean;
73
74
  } | null;
74
75
  }) => Promise<Sale>;
75
76
  };
@@ -0,0 +1,7 @@
1
+ import { HttpClient } from "../net/http";
2
+ import { SendSMSPayload, SMSTask } from "../types";
3
+ export default function create(httpClient: HttpClient): {
4
+ sendSMS: (marketId: string, data: SendSMSPayload) => Promise<SMSTask>;
5
+ getSMS: (marketId: string, smsId: string) => Promise<SMSTask>;
6
+ };
7
+ export type SMS = ReturnType<typeof create>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { HttpClient } from "../net/http";
2
3
  import { WebhookEvent } from "../types";
3
4
  export default function create(_: HttpClient): {