@marteye/studiojs 1.1.9 → 1.1.11

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,3 +1,17 @@
1
+ /**
2
+ * Search result interface based on the API implementation
3
+ */
4
+ interface SearchResult {
5
+ hits: Array<{
6
+ id: string;
7
+ marketId: string;
8
+ title: string;
9
+ [key: string]: any;
10
+ }>;
11
+ processingTimeMs: number;
12
+ query: string;
13
+ }
14
+
1
15
  type Timestamp = string;
2
16
  type ClientType = "Seller" | "Buyer";
3
17
  type SuperType = "Sheep" | "Goats" | "Cattle" | "Pigs" | "Horses" | "Deer" | "Poultry" | "Machinery" | "Antiques" | "Other";
@@ -1024,6 +1038,30 @@ declare namespace types {
1024
1038
  export { type types_Accessory as Accessory, type types_Address as Address, type types_AddressWrapper as AddressWrapper, type types_AdjustmentTarget as AdjustmentTarget, type types_AdjustmentTotalTarget as AdjustmentTotalTarget, type types_AdjustmentsConfiguration as AdjustmentsConfiguration, type types_AppParameterConfig as AppParameterConfig, type types_AttributeDefinition as AttributeDefinition, type types_AttributeValueType as AttributeValueType, type types_BankDetails as BankDetails, type types_Cart as Cart, type types_CartItem as CartItem, type types_ChequeField as ChequeField, type types_ClientType as ClientType, type types_CurrenciesWithGuinea as CurrenciesWithGuinea, type types_Currency as Currency, type types_Customer as Customer, type types_CustomerFromSearch as CustomerFromSearch, type types_DeviceType as DeviceType, type types_DraftInvoice as DraftInvoice, type types_EmailWrapper as EmailWrapper, type types_FarmAssurances as FarmAssurances, type types_FieldPositions as FieldPositions, type types_IncrementLadder as IncrementLadder, type types_IncrementLadderItem as IncrementLadderItem, type types_Invoice as Invoice, type types_InvoiceField as InvoiceField, type types_InvoiceLineItem as InvoiceLineItem, type types_InvoiceTotalAdjustmentConfiguration as InvoiceTotalAdjustmentConfiguration, type types_InvoiceTotals as InvoiceTotals, type types_LineItemAdjustmentConfiguration as LineItemAdjustmentConfiguration, types_LivestockSuperTypes as LivestockSuperTypes, type types_Lot as Lot, type types_LotGeneratedValues as LotGeneratedValues, type types_LotIssue as LotIssue, type types_LotItem as LotItem, type types_LotSaleStatus as LotSaleStatus, type types_LotWithItemsAsArray as LotWithItemsAsArray, type types_Market as Market, type types_MarketBankDetails as MarketBankDetails, type types_MarketReportHeaders as MarketReportHeaders, type types_MartEyeLiveSaleSettings as MartEyeLiveSaleSettings, type types_MartEyeTimedSaleSettings as MartEyeTimedSaleSettings, type types_Media as Media, type types_MemberSharingConfiguration as MemberSharingConfiguration, type types_ObjectType as ObjectType, type types_Payment as Payment, type types_PaymentMethod as PaymentMethod, type types_Payout as Payout, type types_PayoutMethod as PayoutMethod, type types_PhoneNumberWrapper as PhoneNumberWrapper, type types_Printer as Printer, type types_Product as Product, type types_ProductCodeConfiguration as ProductCodeConfiguration, type types_ProductConfiguration as ProductConfiguration, type types_Sale as Sale, type types_SaleFromSearch as SaleFromSearch, type types_SettingsAccessories as SettingsAccessories, type types_SettingsAdjustmentsConfiguration as SettingsAdjustmentsConfiguration, type types_SettingsGlobalAttributes as SettingsGlobalAttributes, type types_SettingsMarketDefaults as SettingsMarketDefaults, type types_SettingsPrinters as SettingsPrinters, type types_SettingsProductCodes as SettingsProductCodes, type types_SettingsTaxRates as SettingsTaxRates, type types_ShortCustomerDetails as ShortCustomerDetails, type types_SimplePaymentIn as SimplePaymentIn, type types_SimplePaymentOut as SimplePaymentOut, type types_StudioAppPartial as StudioAppPartial, type types_SubtotalGroups as SubtotalGroups, type types_SuperType as SuperType, type types_SupportedAttributeTypes as SupportedAttributeTypes, type types_SupportedCountryCode as SupportedCountryCode, types_SupportedCurrencyCodes as SupportedCurrencyCodes, types_SupportedPaymentMethods as SupportedPaymentMethods, types_SupportedSuperTypes as SupportedSuperTypes, types_SupportedUnitsOfSale as SupportedUnitsOfSale, type types_TablePosition as TablePosition, type types_TaxRate as TaxRate, type types_UnitOfSale as UnitOfSale, type types_WebhookEvent as WebhookEvent, type types_WebhookEventName as WebhookEventName, types_supportedWebhookEvents as supportedWebhookEvents };
1025
1039
  }
1026
1040
 
1041
+ interface CreateCustomerPayload {
1042
+ firstName?: string;
1043
+ lastName?: string;
1044
+ email?: string;
1045
+ phone?: string;
1046
+ tradingName: string;
1047
+ accountNumberPrefix?: string;
1048
+ accountNumber?: string;
1049
+ cphNumber?: string;
1050
+ farmName?: string;
1051
+ address: {
1052
+ company?: string;
1053
+ firstName?: string;
1054
+ lastName?: string;
1055
+ address1: string;
1056
+ address2?: string;
1057
+ city: string;
1058
+ province?: string;
1059
+ zip: string;
1060
+ country: string;
1061
+ };
1062
+ marteyeUid?: string;
1063
+ }
1064
+
1027
1065
  declare function Studio(info?: {
1028
1066
  apiKey?: string;
1029
1067
  baseUrl?: string;
@@ -1173,6 +1211,15 @@ declare function Studio(info?: {
1173
1211
  list: (marketId: string) => Promise<TaxRate[]>;
1174
1212
  get: (marketId: string, id: string) => Promise<TaxRate>;
1175
1213
  };
1214
+ customers: {
1215
+ list: (marketId: string) => Promise<Customer>;
1216
+ get: (marketId: string, customerId: string) => Promise<Customer>;
1217
+ avatar: (marketId: string, customerId: string) => Promise<Customer>;
1218
+ create: (marketId: string, customerData: CreateCustomerPayload) => Promise<Customer>;
1219
+ };
1220
+ search: {
1221
+ query: (marketId: string, query: string) => Promise<SearchResult>;
1222
+ };
1176
1223
  };
1177
1224
 
1178
1225
  /**
package/dist/index.esm.js CHANGED
@@ -67,7 +67,7 @@ function SimpleHttpClient(baseUrl, apiKey, fetch, defaultTimeout, debug = false)
67
67
  }
68
68
 
69
69
  // Path: studiojs/src/resources/markets.ts
70
- function create$9(_) {
70
+ function create$b(_) {
71
71
  const actions = {
72
72
  /***
73
73
  * This is used to construct the action from the request body
@@ -97,7 +97,7 @@ function create$9(_) {
97
97
  return actions;
98
98
  }
99
99
 
100
- function create$8(httpClient) {
100
+ function create$a(httpClient) {
101
101
  return {
102
102
  list: async (marketId) => {
103
103
  return httpClient.get(`/${marketId}/adjustments`);
@@ -108,7 +108,26 @@ function create$8(httpClient) {
108
108
  };
109
109
  }
110
110
 
111
- function create$7(httpClient) {
111
+ // Path: studiojs/src/resources/markets.ts
112
+ function create$9(httpClient) {
113
+ let customers = {
114
+ list: async (marketId) => {
115
+ return httpClient.get(`/${marketId}/customers`);
116
+ },
117
+ get: async (marketId, customerId) => {
118
+ return httpClient.get(`/${marketId}/customers/${customerId}`);
119
+ },
120
+ avatar: async (marketId, customerId) => {
121
+ return httpClient.get(`/${marketId}/customers/${customerId}/avatar`);
122
+ },
123
+ create: async (marketId, customerData) => {
124
+ return httpClient.post(`/${marketId}/customers`, customerData);
125
+ },
126
+ };
127
+ return customers;
128
+ }
129
+
130
+ function create$8(httpClient) {
112
131
  return {
113
132
  create: async (marketId, saleId, lotId, data) => {
114
133
  return httpClient.post(`/${marketId}/sales/${saleId}/lots/${lotId}/items`, data);
@@ -122,7 +141,7 @@ function create$7(httpClient) {
122
141
  };
123
142
  }
124
143
 
125
- function create$6(httpClient) {
144
+ function create$7(httpClient) {
126
145
  return {
127
146
  get: async (marketId, saleId, lotId) => {
128
147
  return httpClient.get(`/${marketId}/sales/${saleId}/lots/${lotId}`);
@@ -142,7 +161,7 @@ function create$6(httpClient) {
142
161
  };
143
162
  }
144
163
 
145
- function create$5(httpClient) {
164
+ function create$6(httpClient) {
146
165
  const markets = {
147
166
  get: async (marketId) => {
148
167
  return httpClient.get(`/${marketId}`);
@@ -164,7 +183,7 @@ function create$5(httpClient) {
164
183
  return markets;
165
184
  }
166
185
 
167
- function create$4(httpClient) {
186
+ function create$5(httpClient) {
168
187
  return {
169
188
  list: async (marketId) => {
170
189
  return httpClient.get(`/${marketId}/product_codes`);
@@ -175,7 +194,7 @@ function create$4(httpClient) {
175
194
  };
176
195
  }
177
196
 
178
- function create$3(httpClient) {
197
+ function create$4(httpClient) {
179
198
  return {
180
199
  get: async (marketId, saleId) => {
181
200
  return httpClient.get(`/${marketId}/sales/${saleId}`);
@@ -192,6 +211,21 @@ function create$3(httpClient) {
192
211
  };
193
212
  }
194
213
 
214
+ function create$3(httpClient) {
215
+ let search = {
216
+ /**
217
+ * Search for documents within a market
218
+ * @param marketId - ID of the market to search in
219
+ * @param query - Search query string
220
+ * @returns Search results containing matching documents
221
+ */
222
+ query: async (marketId, query) => {
223
+ return httpClient.get(`/${marketId}/search`, { q: query });
224
+ },
225
+ };
226
+ return search;
227
+ }
228
+
195
229
  function create$2(httpClient) {
196
230
  return {
197
231
  get: async (marketId) => {
@@ -249,16 +283,18 @@ function create(_) {
249
283
 
250
284
  function resources(httpClient) {
251
285
  return {
252
- markets: create$5(httpClient),
253
- sales: create$3(httpClient),
254
- lots: create$6(httpClient),
255
- lotitems: create$7(httpClient),
286
+ markets: create$6(httpClient),
287
+ sales: create$4(httpClient),
288
+ lots: create$7(httpClient),
289
+ lotitems: create$8(httpClient),
256
290
  webhooks: create(),
257
- actions: create$9(),
291
+ actions: create$b(),
258
292
  settings: create$2(httpClient),
259
- adjustments: create$8(httpClient),
260
- productCodes: create$4(httpClient),
293
+ adjustments: create$a(httpClient),
294
+ productCodes: create$5(httpClient),
261
295
  taxRates: create$1(httpClient),
296
+ customers: create$9(httpClient),
297
+ search: create$3(httpClient),
262
298
  };
263
299
  }
264
300