@crmcom/self-service-sdk 3.0.0-build.12 → 3.0.0-build.16
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/index.d.ts +2 -0
- package/orders.js +58 -0
- package/package.json +1 -1
- package/rewards.js +38 -0
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>;
|
|
@@ -382,6 +383,7 @@ export declare const rewards: {
|
|
|
382
383
|
searchRewardSchemes(params?: PaginationParams & { is_signed?: boolean; name?: string }): Promise<SDKResult>;
|
|
383
384
|
verifyClosedLoopScheme(params: { sign_up_code: string }): Promise<SDKResult>;
|
|
384
385
|
sendRefferals(params?: { recipients?: any[]; action?: string }): Promise<SDKResult>;
|
|
386
|
+
listRefferals(params?: PaginationParams & { date?: string; date_gt?: string; date_gte?: string; date_lt?: string; date_lte?: string; reference_number?: string; referred_by_contact_id?: string; referred_contact_id?: string; state?: string; organisations?: string }): Promise<SDKResult>;
|
|
385
387
|
redeemPass(params?: { code?: string; pin?: string; wallet_id?: string }): Promise<SDKResult>;
|
|
386
388
|
reclaimPurchase(params?: { purchase_id?: string; merchant_tap?: string; venue_tap?: string; net_amount?: number; tax_amount?: number; discount_amount?: number; total_amount?: number; transaction_code?: string }): Promise<SDKResult>;
|
|
387
389
|
signUpRewardScheme(params: { reward_scheme_id: string; email_address?: string; sign_up_code?: 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
package/rewards.js
CHANGED
|
@@ -10,6 +10,7 @@ export const rewards = {
|
|
|
10
10
|
searchRewardSchemes,
|
|
11
11
|
verifyClosedLoopScheme,
|
|
12
12
|
sendRefferals,
|
|
13
|
+
listRefferals,
|
|
13
14
|
redeemPass,
|
|
14
15
|
reclaimPurchase,
|
|
15
16
|
signUpRewardScheme,
|
|
@@ -232,6 +233,43 @@ async function sendRefferals({
|
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
|
|
236
|
+
async function listRefferals({
|
|
237
|
+
page = 1,
|
|
238
|
+
size = 20,
|
|
239
|
+
date,
|
|
240
|
+
date_gt,
|
|
241
|
+
date_gte,
|
|
242
|
+
date_lt,
|
|
243
|
+
date_lte,
|
|
244
|
+
include_total,
|
|
245
|
+
order,
|
|
246
|
+
state,
|
|
247
|
+
sort,
|
|
248
|
+
} = {}) {
|
|
249
|
+
try {
|
|
250
|
+
let response = await httpUtil.get({
|
|
251
|
+
resourcePath: '/v2/referrals',
|
|
252
|
+
queryParams: {
|
|
253
|
+
page,
|
|
254
|
+
size,
|
|
255
|
+
date,
|
|
256
|
+
date_gt,
|
|
257
|
+
date_gte,
|
|
258
|
+
date_lt,
|
|
259
|
+
date_lte,
|
|
260
|
+
include_total,
|
|
261
|
+
order,
|
|
262
|
+
state,
|
|
263
|
+
sort
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
return createCommonResult(response);
|
|
267
|
+
} catch (e) {
|
|
268
|
+
logger.error('Exception listRefferals:', e);
|
|
269
|
+
return createResult(ErrorCodes.UNKNOWN, e);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
235
273
|
async function redeemPass({
|
|
236
274
|
code,
|
|
237
275
|
pin,
|