@nuskin/ns-product-lib 2.6.0-cx24-3503.1 → 2.6.0-cx24-3372.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +25 -5
- package/package.json +3 -3
- package/src/productData.js +46 -38
package/CHANGELOG.md
CHANGED
@@ -1,11 +1,31 @@
|
|
1
|
-
# [2.6.0-cx24-
|
1
|
+
# [2.6.0-cx24-3372.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3372.3...v2.6.0-cx24-3372.4) (2023-03-02)
|
2
2
|
|
3
3
|
|
4
|
-
###
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* inventoryProperties atpQty ([60ec521](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/60ec521223367abcd9570969c0e65522f76afe43))
|
7
|
+
|
8
|
+
# [2.6.0-cx24-3372.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3372.2...v2.6.0-cx24-3372.3) (2023-03-02)
|
9
|
+
|
10
|
+
|
11
|
+
### Fix
|
12
|
+
|
13
|
+
* Kit mapping ([af76396](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/af76396940d95988bbcfad73fc047381945847bb))
|
14
|
+
|
15
|
+
# [2.6.0-cx24-3372.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3372.1...v2.6.0-cx24-3372.2) (2023-03-01)
|
16
|
+
|
17
|
+
|
18
|
+
### New
|
19
|
+
|
20
|
+
* Product Kit API search ([4260768](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/426076856ed7d1d90f536fc249d84e1bd88e2d12))
|
21
|
+
|
22
|
+
# [2.6.0-cx24-3372.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0...v2.6.0-cx24-3372.1) (2023-03-01)
|
23
|
+
|
24
|
+
|
25
|
+
### New
|
5
26
|
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* use latest version of configuration-sdk and ns-util (CX24-3503) ([d343dbf](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d343dbfcd5b4d946746576f84ae5157bcef403ea))
|
27
|
+
* Product Kit API search ([0d69d93](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/0d69d931b989ccc250b698148c78db17a003bc13))
|
28
|
+
* Product Kit API search ([d549e15](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d549e15fa7c967d1b2bbede6d3c2695ecc66265c))
|
9
29
|
|
10
30
|
# [2.5.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.1...v2.5.0) (2023-02-22)
|
11
31
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.6.0-cx24-
|
3
|
+
"version": "2.6.0-cx24-3372.4",
|
4
4
|
"description": "This project contains shared Product models and code between the backend and frontend.",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"scripts": {
|
@@ -31,9 +31,9 @@
|
|
31
31
|
"prettier": "1.19.1"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@nuskin/configuration-sdk": "
|
34
|
+
"@nuskin/configuration-sdk": "1.0.1",
|
35
35
|
"@nuskin/ns-common-lib": "1.4.5",
|
36
|
-
"@nuskin/ns-util": "
|
36
|
+
"@nuskin/ns-util": "3.107.0",
|
37
37
|
"axios": "0.27.2",
|
38
38
|
"qs": "6.11.0"
|
39
39
|
},
|
package/src/productData.js
CHANGED
@@ -18,14 +18,14 @@ const ProductData = {
|
|
18
18
|
const localeMarket = `${locale}_${market}`;
|
19
19
|
|
20
20
|
if (isEquinoxEnabled) {
|
21
|
-
|
21
|
+
let config = (await getConfiguration({
|
22
|
+
configMapNames: ['Equinox_Markets'],
|
22
23
|
country: market,
|
23
24
|
environment: contentstackEnv(),
|
24
25
|
clientId: '735b1eb810304bba966af0891ab54053'
|
25
|
-
};
|
26
|
-
const config = (await getConfiguration(['Equinox_Markets'], options)).Equinox_Markets;
|
26
|
+
}));
|
27
27
|
|
28
|
-
if (config.country_code === market && config.active) {
|
28
|
+
if (config.Equinox_Markets.country_code === market && config.Equinox_Markets.active) {
|
29
29
|
return await this.getProductFromEquinox(skus, localeMarket, config);
|
30
30
|
}
|
31
31
|
}
|
@@ -33,17 +33,24 @@ const ProductData = {
|
|
33
33
|
},
|
34
34
|
|
35
35
|
getProductFromEquinox: async function (skus, locale, config) {
|
36
|
-
|
36
|
+
|
37
|
+
let skuFilter = [];
|
38
|
+
|
39
|
+
skus.forEach((sku) => {
|
40
|
+
skuFilter.push(`index_key_productId="${sku}" OR index_key_skuId="${sku}"`)
|
41
|
+
})
|
42
|
+
|
43
|
+
const filter = skuFilter.join(" OR ")
|
37
44
|
axios.defaults.withCredentials = true;
|
38
45
|
|
39
|
-
const url = `${config.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
40
|
-
const href = `${url}?filter
|
46
|
+
const url = `${config.Equinox_Markets.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
47
|
+
const href = `${url}?filter='\\\\''${encodeURI(filter)}'\\''`;
|
41
48
|
const response = await axios.request({
|
42
49
|
method: 'get',
|
43
50
|
url: href,
|
44
51
|
params: {
|
45
52
|
locale,
|
46
|
-
storeId: config.store_id
|
53
|
+
storeId: config.Equinox_Markets.store_id
|
47
54
|
},
|
48
55
|
headers: this.getEquinoxRequestHeaders(),
|
49
56
|
responseType: 'json'
|
@@ -324,7 +331,8 @@ const ProductData = {
|
|
324
331
|
let variants = {};
|
325
332
|
|
326
333
|
let prodArr = productDataResponse.map((data) => {
|
327
|
-
let
|
334
|
+
let product = (data.type && data.type === "kit") ? data : data.sku[count];
|
335
|
+
let imageURL = product.properties.imageURL;
|
328
336
|
const regex = /\d+.\d+/
|
329
337
|
let thumbnailImage = ''
|
330
338
|
|
@@ -347,15 +355,15 @@ const ProductData = {
|
|
347
355
|
eventLabels,
|
348
356
|
computedPrice,
|
349
357
|
defaultProductPrice
|
350
|
-
} = this.getEqProductPromotions(
|
351
|
-
const productPrice = eventName ? defaultProductPrice :
|
352
|
-
const discountedPrice = eventName ? computedPrice :
|
358
|
+
} = this.getEqProductPromotions(product);
|
359
|
+
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
360
|
+
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
353
361
|
|
354
362
|
prod = {
|
355
|
-
"sku":
|
363
|
+
"sku": product.identifier,
|
356
364
|
"globalProductID": data.identifier,
|
357
365
|
"title": data.properties.name,
|
358
|
-
"country":
|
366
|
+
"country": product.properties.market,
|
359
367
|
"language": "en",
|
360
368
|
"shortDescr": data.properties.description,
|
361
369
|
"longDescr": data.properties.productDetailsDescription,
|
@@ -372,7 +380,7 @@ const ProductData = {
|
|
372
380
|
"ingredients": data.properties.ingredients,
|
373
381
|
"benefits": data.properties.benefits,
|
374
382
|
"usage": data.properties.usage,
|
375
|
-
"resources":
|
383
|
+
"resources": product.properties.resources,
|
376
384
|
"videos": "",
|
377
385
|
"movie": "",
|
378
386
|
"youtube": "",
|
@@ -383,48 +391,48 @@ const ProductData = {
|
|
383
391
|
}
|
384
392
|
],
|
385
393
|
"scanQualified": data.properties.scanQualifiedCount,
|
386
|
-
"availableQuantity":
|
394
|
+
"availableQuantity": product.inventoryProperties.atpQty || 0,
|
387
395
|
"maxQuantity": 999,
|
388
396
|
"points": "",
|
389
|
-
"cv": (
|
390
|
-
"pv":
|
397
|
+
"cv": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
398
|
+
"pv": product.priceFacets.PV,
|
391
399
|
"priceType": "WRTL",
|
392
400
|
"price": discountedPrice,
|
393
401
|
"priceMap": {
|
394
402
|
"WRTL": productPrice,
|
395
|
-
"WADW-WRTL":
|
396
|
-
"WADR":
|
397
|
-
"RTL":
|
398
|
-
"WADW":
|
399
|
-
"WHL":
|
400
|
-
"WWHL":
|
403
|
+
"WADW-WRTL": product.priceFacets["Regular Price"],
|
404
|
+
"WADR": product.priceFacets["Regular Price"],
|
405
|
+
"RTL": product.priceFacets["Regular Price"],
|
406
|
+
"WADW": product.priceFacets["Wholesale Price"],
|
407
|
+
"WHL": product.priceFacets["Wholesale Price"],
|
408
|
+
"WWHL": product.priceFacets["Wholesale Price"]
|
401
409
|
},
|
402
410
|
"cvMap": {
|
403
|
-
"WWHL": (
|
404
|
-
"WADW": (
|
405
|
-
"WHL": (
|
411
|
+
"WWHL": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
412
|
+
"WADW": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
413
|
+
"WHL": (product.priceFacets.CV) ? product.priceFacets.CV : ''
|
406
414
|
},
|
407
415
|
"pvMap": {
|
408
|
-
"WWHL":
|
409
|
-
"WADW":
|
410
|
-
"WHL":
|
416
|
+
"WWHL": product.priceFacets.PV,
|
417
|
+
"WADW": product.priceFacets.PV,
|
418
|
+
"WHL": product.priceFacets.PV
|
411
419
|
},
|
412
|
-
"orderTypes": this._setOrderType(
|
420
|
+
"orderTypes": this._setOrderType(product.properties),
|
413
421
|
"childSkus": [],
|
414
|
-
"custTypes": this.switchCustType(
|
422
|
+
"custTypes": this.switchCustType(product.properties.customerTypes),
|
415
423
|
"division": data.properties.division,
|
416
424
|
"backOrderDate": null,
|
417
425
|
"locallyProduced": false,
|
418
426
|
"agelocme": null,
|
419
427
|
"count": "",
|
420
428
|
"flavor": "",
|
421
|
-
"size":
|
429
|
+
"size": product.properties.size,
|
422
430
|
"shade": "",
|
423
|
-
"status": this.switchStatusFromEquinox(
|
431
|
+
"status": this.switchStatusFromEquinox(product.properties.productStatus),
|
424
432
|
"variantType": "Other",
|
425
|
-
"variantDropdownLabel":
|
433
|
+
"variantDropdownLabel": product.properties.variantLabel || "",
|
426
434
|
"variantDropdownPlaceholder": "Select Type",
|
427
|
-
"variantsLabel":
|
435
|
+
"variantsLabel": product.properties.variantLabel || "",
|
428
436
|
"groupOffer": false,
|
429
437
|
"personalOffer": false,
|
430
438
|
"savedEventName": eventName,
|
@@ -434,7 +442,7 @@ const ProductData = {
|
|
434
442
|
"nettoWeight": "",
|
435
443
|
"variants": variants,
|
436
444
|
"searchScore": 0,
|
437
|
-
"isExclusive":
|
445
|
+
"isExclusive": product.properties.isExclusive || false,
|
438
446
|
"marketAttributes": {
|
439
447
|
"discount": true,
|
440
448
|
"redeem": true,
|
@@ -442,7 +450,7 @@ const ProductData = {
|
|
442
450
|
},
|
443
451
|
"restrictedMarkets": [],
|
444
452
|
"addOns": [],
|
445
|
-
"inventory":
|
453
|
+
"inventory": product.inventory || "", //inventory label
|
446
454
|
"equinoxProductId": data.identifier
|
447
455
|
};
|
448
456
|
let newProduct = new Product(prod);
|