@nuskin/ns-product-lib 1.4.3 → 1.5.0-cx24-1810.2
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/CHANGELOG.md +28 -0
- package/package.json +4 -2
- package/src/index.js +3 -1
- package/src/product.js +1 -0
- package/src/productData.js +65 -0
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
# [1.5.0-cx24-1810.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.1...v1.5.0-cx24-1810.2) (2022-07-16)
|
2
|
+
|
3
|
+
|
4
|
+
### New
|
5
|
+
|
6
|
+
* Get Product Data from Equinox (#CX24-1810) ([43fd345](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/43fd3458296f7eb88f157da6665bd0fe05020f79)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
7
|
+
|
8
|
+
# [1.5.0-cx24-1810.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.4.4...v1.5.0-cx24-1810.1) (2022-07-07)
|
9
|
+
|
10
|
+
|
11
|
+
### New
|
12
|
+
|
13
|
+
* Adding product data to get from different source (#CX24-1810) ([5b7f0c1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5b7f0c1015361ff9aa6f2f21f649fea1b7174b29)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
14
|
+
* Creating EQ product data query (#CX24-1810) ([77fadd2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/77fadd25bbe26044502ef80663e1cc91625c4602)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
15
|
+
* Creating EQ product data query (#CX24-1810) ([9047a30](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9047a30356d707fcf246af6a2aeb47d502f077bf)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
16
|
+
* Creating EQ product data query (#CX24-1810) ([8d9741f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8d9741f48bbdab5a5704ac38262bd8f56ff1d180)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
17
|
+
* Creating EQ product data query (#CX24-1810) ([9e630e3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9e630e33e4aee1049ddfb60af1f299d90eadee08)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
18
|
+
* Creating EQ product data query (#CX24-1810) ([9dc067e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9dc067e9e2dbb18aa327222339521d205d2086f8)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
19
|
+
* Creating EQ product data query (#CX24-1810) ([a846bdc](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a846bdc2976d12d722dfca77e136e3f47e27998c)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
20
|
+
* Creating EQ product data query (#CX24-1810) ([4be96a8](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4be96a89388dc2b226d0f02361f533fb3565b36b)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
21
|
+
|
22
|
+
## [1.4.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.4.3...v1.4.4) (2022-06-10)
|
23
|
+
|
24
|
+
|
25
|
+
### Fix
|
26
|
+
|
27
|
+
* Add locallyProduced flag from productStatus data in addPricingFromStatus function (#CX17-5611) ([0b4b819](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/0b4b819125e3dc0f4cc61a2116bcaeacb9555f9b)), closes [#CX17-5611](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX17-5611)
|
28
|
+
|
1
29
|
## [1.4.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.4.2...v1.4.3) (2022-05-03)
|
2
30
|
|
3
31
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.0-cx24-1810.2",
|
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": {
|
@@ -29,7 +29,9 @@
|
|
29
29
|
"prettier": "1.19.1"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@nuskin/ns-common-lib": "1.3.0"
|
32
|
+
"@nuskin/ns-common-lib": "1.3.0",
|
33
|
+
"@nuskin/ns-util": "3.103.0-cx24-1810.2",
|
34
|
+
"axios": "^0.27.2"
|
33
35
|
},
|
34
36
|
"files": [
|
35
37
|
"src/"
|
package/src/index.js
CHANGED
@@ -12,6 +12,7 @@ const ProductContentMapper = require("./productContentMapper.js");
|
|
12
12
|
const ProductStatus = require("./productStatus.js");
|
13
13
|
const ProductStatusMapper = require("./productStatusMapper.js");
|
14
14
|
const ProductUtils = require("./productUtils.js");
|
15
|
+
const ProductData = require('./productData.js');
|
15
16
|
|
16
17
|
module.exports = {
|
17
18
|
Agelocme,
|
@@ -20,5 +21,6 @@ module.exports = {
|
|
20
21
|
ProductContentMapper,
|
21
22
|
ProductStatus,
|
22
23
|
ProductStatusMapper,
|
23
|
-
ProductUtils
|
24
|
+
ProductUtils,
|
25
|
+
ProductData
|
24
26
|
};
|
package/src/product.js
CHANGED
@@ -291,6 +291,7 @@ const Product = function(productData) {
|
|
291
291
|
this.status = productStatus.status;
|
292
292
|
this.availableQuantity = productStatus.availableQuantity;
|
293
293
|
this.maxQuantity = productStatus.maxQuantity || 999;
|
294
|
+
this.locallyProduced = productStatus.locallyProduced || false;
|
294
295
|
if (productStatus.backordered) {
|
295
296
|
this.backOrderDate = productStatus.backorderedAvailableDate;
|
296
297
|
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
const axios = require("axios");
|
3
|
+
|
4
|
+
const ProductData = {
|
5
|
+
getProductData: async function (skus, runConfig, marketConfig, isEqEnabled) {
|
6
|
+
let productResponse = {};
|
7
|
+
let locale = `${runConfig.language}_${runConfig.country}`;
|
8
|
+
if (isEqEnabled) {
|
9
|
+
let lambdaUrl = "https://storefront.api.wde.nuskin.io/orchestrationservices/storefront/catalogs/search";
|
10
|
+
const payload = {
|
11
|
+
storeId: "422",
|
12
|
+
filter:
|
13
|
+
'{"filters":[{"field":"index_key_skuId","operation":"IN","value":"' +
|
14
|
+
skus.toString() +
|
15
|
+
'"}]}'
|
16
|
+
|
17
|
+
};
|
18
|
+
let productDataResponse = await axios.request({
|
19
|
+
method: "get",
|
20
|
+
url: lambdaUrl,
|
21
|
+
data: payload,
|
22
|
+
headers: this.getProductDataRequestHeaders(marketConfig),
|
23
|
+
responseType: "json"
|
24
|
+
});
|
25
|
+
|
26
|
+
productResponse = this.eqProductMapper(productDataResponse)
|
27
|
+
|
28
|
+
} else {
|
29
|
+
let lambdaUrl = `${marketConfig.awsUrl}/productData/v1`;
|
30
|
+
const payload = {
|
31
|
+
locale: locale,
|
32
|
+
skus: skus
|
33
|
+
};
|
34
|
+
productResponse = await axios.request({
|
35
|
+
method: "post",
|
36
|
+
url: lambdaUrl,
|
37
|
+
data: payload,
|
38
|
+
headers: this.getProductDataRequestHeaders(marketConfig),
|
39
|
+
responseType: "json"
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
return productResponse;
|
44
|
+
},
|
45
|
+
|
46
|
+
findMarket: function (code, eqMarkets) {
|
47
|
+
return eqMarkets.filter(
|
48
|
+
function (eqMarkets) { return eqMarkets.code == code }
|
49
|
+
);
|
50
|
+
},
|
51
|
+
|
52
|
+
eqProductMapper: function (productDataResponse) {
|
53
|
+
return productDataResponse;
|
54
|
+
},
|
55
|
+
|
56
|
+
getProductDataRequestHeaders: function (marketConfig) {
|
57
|
+
return {
|
58
|
+
"Content-Type": "application/json",
|
59
|
+
client_id: marketConfig.checkout.clientId,
|
60
|
+
client_secret: marketConfig.checkout.clientSecret
|
61
|
+
};
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
module.exports = ProductData;
|