@crmcom/self-service-sdk 3.0.0-build.12 → 3.0.0-build.13

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/orders.js +58 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -294,6 +294,7 @@ export declare const orders: {
294
294
  getProductCategories(params?: { available_in_order_menus?: boolean; include_total?: boolean; organisation_id?: string; parent_id?: string; return_all?: boolean; page?: number; size?: number; sort?: string; order?: string }): Promise<SDKResult>;
295
295
  getProducts(params?: { product_ids?: string; product_skus?: string; brand_id?: string; category_id?: string; classification?: string; composition?: string; country?: string; currency?: string; custom_fields?: string; family_id?: string; fulfilled_by?: string; include_custom_fields?: boolean; include_total?: boolean; is_modifier?: boolean; name?: string; order_catalog_id?: string; order_category_id?: string; owned_by?: string; search_value?: string; supply_method?: string; type_id?: string; page?: number; size?: number; sort?: string; order?: string }): Promise<SDKResult>;
296
296
  getProductsWithFacets(params?: Record<string, any>): Promise<SDKResult>;
297
+ getProductsByCatalogue(params?: Record<string, any>): Promise<SDKResult>;
297
298
  getProduct(id: string, params: { fulfilled_by?: string; supply_method?: string }): Promise<SDKResult>;
298
299
  getProductVariants(params: { fulfilled_by?: string; supply_method?: string; include_characteristics?: boolean }, productId: string): Promise<SDKResult>;
299
300
  getProductComponents(productId: string, params: { fulfilled_by?: string; supply_method?: string }): Promise<SDKResult>;
package/orders.js CHANGED
@@ -11,6 +11,7 @@ export const orders = {
11
11
  getProductCategories,
12
12
  getProducts,
13
13
  getProductsWithFacets,
14
+ getProductsByCatalogue,
14
15
  getProduct,
15
16
  getProductVariants,
16
17
  getProductComponents,
@@ -315,6 +316,63 @@ async function getProductsWithFacets({
315
316
  }
316
317
  }
317
318
 
319
+ async function getProductsByCatalogue({
320
+ order_catalog_id,
321
+ order_category_id,
322
+ name,
323
+ owned_by,
324
+ fulfilled_by,
325
+ type_id,
326
+ category_id,
327
+ brand_id,
328
+ family_id,
329
+ supply_method,
330
+ currency,
331
+ country,
332
+ classification,
333
+ composition,
334
+ custom_fields,
335
+ include_custom_fields,
336
+ product_ids,
337
+ product_skus,
338
+ search_value,
339
+ } = {},) {
340
+ try {
341
+ let validity_date = Math.floor(new Date().getTime() / 1000.0);
342
+ let query = {
343
+ order_catalog_id,
344
+ order_category_id,
345
+ name,
346
+ owned_by,
347
+ fulfilled_by,
348
+ type_id,
349
+ category_id,
350
+ brand_id,
351
+ family_id,
352
+ supply_method,
353
+ currency,
354
+ country,
355
+ classification,
356
+ composition,
357
+ custom_fields,
358
+ include_custom_fields,
359
+ product_ids,
360
+ product_skus,
361
+ search_value,
362
+ }
363
+ query["validity_date"] = validity_date;
364
+ let response = await httpUtil.get({
365
+ resourcePath: '/v2/products/analytics/by_catalogue',
366
+ withAccessToken: true,
367
+ queryParams: query
368
+ });
369
+ return createCommonResult(response);
370
+ } catch (e) {
371
+ logger.error('Exception getProducts:', e);
372
+ return createResult(ErrorCodes.UNKNOWN, e);
373
+ }
374
+ }
375
+
318
376
  async function getProductBrands({
319
377
  brand_ids,
320
378
  include_total,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crmcom/self-service-sdk",
3
- "version": "3.0.0-build.12",
3
+ "version": "3.0.0-build.13",
4
4
  "description": "Official CRM.COM Self-Service JavaScript SDK for consumer-facing API integration",
5
5
  "type": "module",
6
6
  "main": "index.js",