@nuskin/ns-product-lib 2.3.1-cx12-5910.1 → 2.4.0-cx12-5910.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +72 -2
- package/package.json +4 -3
- package/src/contentstack/contentstack.js +52 -14
- package/src/product.js +6 -0
- package/src/productData.js +153 -23
package/CHANGELOG.md
CHANGED
@@ -1,9 +1,46 @@
|
|
1
|
-
|
1
|
+
# [2.4.0-cx12-5910.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.3.0...v2.4.0-cx12-5910.1) (2022-11-04)
|
2
2
|
|
3
3
|
|
4
4
|
### Fix
|
5
5
|
|
6
|
-
*
|
6
|
+
* To make multiple products work (#CX24-2444) ([46df2ca](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/46df2ca14761217b43456a83897b9e34d1e99165)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
7
|
+
* use platform-specific values when initialized ([18de006](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/18de006211ab396f4d7fa40d0089c8e185d9cee9))
|
8
|
+
|
9
|
+
### New
|
10
|
+
|
11
|
+
* added support for inventory label (#CX24-2186) ([532819b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/532819b94ff574bfd3c6629dd9fa161512dbf92f)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
|
12
|
+
|
13
|
+
### Release
|
14
|
+
|
15
|
+
* Automated changes by GitLab pipeline [skip ci] ([3c083ce](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3c083ceb0d8b7725f573951c70abda7fd1f7ed70))
|
16
|
+
* Automated changes by GitLab pipeline [skip ci] ([56ceb8c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/56ceb8c9b3b3f821721dec97fcb1156e1ca01f89))
|
17
|
+
* Automated changes by GitLab pipeline [skip ci] ([74679c6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/74679c67fb1265078e13f0f4208da1ea108f9fa8))
|
18
|
+
|
19
|
+
### Update
|
20
|
+
|
21
|
+
* added support for variant and price (#CX24-2186) ([65abfb4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65abfb488402c15eff697879f00f57288126a35a)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
|
22
|
+
* added variant label (#CX24-2186) ([6f3f006](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/6f3f006763e113809efc7b44643a446dbe0ab52b)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
|
23
|
+
|
24
|
+
# [2.4.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.3.0...v2.4.0) (2022-10-26)
|
25
|
+
|
26
|
+
|
27
|
+
### Fix
|
28
|
+
|
29
|
+
* To make multiple products work (#CX24-2444) ([ce4c483](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ce4c483b7fbb0527e60045d8174fd503a67e63fa)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
30
|
+
|
31
|
+
### New
|
32
|
+
|
33
|
+
* added support for inventory label (#CX24-2186) ([3e27481](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3e2748106cd6098086dbd6b738964deabacc875d)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
|
34
|
+
|
35
|
+
### Release
|
36
|
+
|
37
|
+
* Automated changes by GitLab pipeline [skip ci] ([8f75316](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8f75316b692ddccda5b7bea830ee6dc625b942c7))
|
38
|
+
* Automated changes by GitLab pipeline [skip ci] ([36dca5b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/36dca5b92285ae6d8ae96345256df92102efad8e))
|
39
|
+
|
40
|
+
### Update
|
41
|
+
|
42
|
+
* added support for variant and price (#CX24-2186) ([e0bf8f2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e0bf8f280a838dfa4cc613e5bc34d254dbdc8e1a)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
|
43
|
+
* added variant label (#CX24-2186) ([4c223b3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4c223b34438ed73cb824716cacb93482486f8195)), closes [#CX24-2186](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2186)
|
7
44
|
|
8
45
|
# [2.3.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.2.0...v2.3.0) (2022-10-14)
|
9
46
|
|
@@ -41,6 +78,39 @@
|
|
41
78
|
|
42
79
|
* replace runConfig and marketConfig parameters of getProductData with locale and market (CX24-2382) ([b7b8ac7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b7b8ac7fa946df0b3690f700d00f5acfb0073bcf))
|
43
80
|
|
81
|
+
### Fix
|
82
|
+
|
83
|
+
* To make multiple products work (#CX24-2444) ([1cbe500](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1cbe5000d2649157de3bdb6456d601fdeecbd3b6)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
84
|
+
* To make multiple products work (#CX24-2444) ([b4c2218](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b4c221853dca33f2c0b06a06d6ead7fc50e9f0c6)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
85
|
+
|
86
|
+
### Release
|
87
|
+
|
88
|
+
* Automated changes by GitLab pipeline [skip ci] ([a974a24](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a974a244a85ee42eca3540b88429d16edcbf57ce))
|
89
|
+
* Automated changes by GitLab pipeline [skip ci] ([aa21d8d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/aa21d8dcbed15a1c0798f882b4667bcc2bc071dc))
|
90
|
+
|
91
|
+
### Update
|
92
|
+
|
93
|
+
* updating the product data map (#CX24-2103) ([ea914a4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ea914a4079c2472adcd449fac09be85f22671493)), closes [#CX24-2103](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2103)
|
94
|
+
|
95
|
+
# [2.0.0-cx24-21035.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.0.0-cx24-21035.1...v2.0.0-cx24-21035.2) (2022-09-22)
|
96
|
+
|
97
|
+
|
98
|
+
### Fix
|
99
|
+
|
100
|
+
* To make multiple products work (#CX24-2444) ([1cbe500](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1cbe5000d2649157de3bdb6456d601fdeecbd3b6)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
101
|
+
* To make multiple products work (#CX24-2444) ([b4c2218](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b4c221853dca33f2c0b06a06d6ead7fc50e9f0c6)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
102
|
+
|
103
|
+
### Release
|
104
|
+
|
105
|
+
* Automated changes by GitLab pipeline [skip ci] ([aa21d8d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/aa21d8dcbed15a1c0798f882b4667bcc2bc071dc))
|
106
|
+
|
107
|
+
### Update
|
108
|
+
|
109
|
+
* updating the product data map (#CX24-2103) ([ea914a4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ea914a4079c2472adcd449fac09be85f22671493)), closes [#CX24-2103](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2103)
|
110
|
+
|
111
|
+
# [2.0.0-cx24-21035.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.0.0-cx24-21035.1...v2.0.0-cx24-21035.2) (2022-09-22)
|
112
|
+
|
113
|
+
|
44
114
|
### Fix
|
45
115
|
|
46
116
|
* To make multiple products work (#CX24-2444) ([b4c2218](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b4c221853dca33f2c0b06a06d6ead7fc50e9f0c6)), closes [#CX24-2444](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2444)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.4.0-cx12-5910.1",
|
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": {
|
@@ -19,13 +19,14 @@
|
|
19
19
|
"license": "ISC",
|
20
20
|
"homepage": "https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/blob/master/README.md",
|
21
21
|
"devDependencies": {
|
22
|
+
"axios-mock-adapter": "1.21.2",
|
22
23
|
"eslint": "5.16.0",
|
23
24
|
"eslint-config-google": "0.14.0",
|
24
25
|
"eslint-config-prettier": "4.1.0",
|
25
26
|
"eslint-plugin-json": "2.1.1",
|
26
27
|
"eslint-plugin-prettier": "3.1.2",
|
27
|
-
"
|
28
|
-
"jest": "
|
28
|
+
"jest": "29.2.2",
|
29
|
+
"jest-environment-jsdom": "29.2.2",
|
29
30
|
"jest-sonar-reporter": "2.0.0",
|
30
31
|
"prettier": "1.19.1"
|
31
32
|
},
|
@@ -4,14 +4,51 @@ const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
|
|
4
4
|
const config = require('./environment');
|
5
5
|
|
6
6
|
// contentstack HTTP service
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
'
|
13
|
-
|
14
|
-
|
7
|
+
const platform = usePlatformSpecificVariables();
|
8
|
+
const http = axios.create({ baseURL: platform.baseURL, headers: platform.headers });
|
9
|
+
|
10
|
+
// usePlatformVariables returns an object with platform-specific values; defaults to Lambda environment
|
11
|
+
function usePlatformSpecificVariables() {
|
12
|
+
if (typeof window !== 'undefined') {
|
13
|
+
return useWebEnvironment();
|
14
|
+
}
|
15
|
+
|
16
|
+
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
17
|
+
return useMobileEnvironment();
|
18
|
+
}
|
19
|
+
|
20
|
+
return useLambdaEnvironment();
|
21
|
+
}
|
22
|
+
|
23
|
+
function useWebEnvironment() {
|
24
|
+
console.log('web');
|
25
|
+
const env = getEnvironmentFromUrl(window.location.host);
|
26
|
+
const envConfig = config.getCredentials(env);
|
27
|
+
const baseURL = `${envConfig.url}/stacks/${envConfig.apiKey}?environment=${envConfig.env}`;
|
28
|
+
const headers = {
|
29
|
+
'access_token': `${envConfig.accessToken}`,
|
30
|
+
'Content-Type': 'application/json'
|
31
|
+
};
|
32
|
+
|
33
|
+
return { baseURL, env, headers }
|
34
|
+
}
|
35
|
+
|
36
|
+
function useMobileEnvironment() {
|
37
|
+
// ...
|
38
|
+
}
|
39
|
+
|
40
|
+
function useLambdaEnvironment() {
|
41
|
+
console.log('lambda');
|
42
|
+
const env = {};
|
43
|
+
const baseURL = `contentstack-call-for-lambda`;
|
44
|
+
const headers = {
|
45
|
+
'access_token': `contentstack-access-token-for-lambda`,
|
46
|
+
'Content-Type': 'application/json'
|
47
|
+
};
|
48
|
+
|
49
|
+
return { baseURL, env, headers }
|
50
|
+
}
|
51
|
+
|
15
52
|
|
16
53
|
// in-memory caching
|
17
54
|
const cacheKeys = { aemConfig: 'aemConfig', equinoxMarkets: 'equinoxMarkets', kongUrl: 'kongUrl' };
|
@@ -19,7 +56,7 @@ const cacheTTLInSeconds = 30 * 1000;
|
|
19
56
|
const cache = {
|
20
57
|
[cacheKeys.aemConfig]: { data: null, ttl: Date.now() + cacheTTLInSeconds },
|
21
58
|
[cacheKeys.equinoxMarkets]: { data: null, ttl: Date.now() + cacheTTLInSeconds },
|
22
|
-
[cacheKeys.kongUrl]: { data: null, ttl: Date.now() + cacheTTLInSeconds}
|
59
|
+
[cacheKeys.kongUrl]: { data: null, ttl: Date.now() + cacheTTLInSeconds }
|
23
60
|
};
|
24
61
|
|
25
62
|
/**
|
@@ -67,7 +104,7 @@ function getCachedData(key) {
|
|
67
104
|
async function getAEMConfig() {
|
68
105
|
try {
|
69
106
|
if (isCacheExpired(cacheKeys.aemConfig)) {
|
70
|
-
const marketConfig = `market_config_${env}`;
|
107
|
+
const marketConfig = `market_config_${platform.env}`;
|
71
108
|
const variables = { uid: 'blt52b0b83a89763791' };
|
72
109
|
const query = `query AemConfigByUid($uid: String!) {
|
73
110
|
aem_config(uid: $uid) {
|
@@ -114,7 +151,7 @@ async function getAEMConfig() {
|
|
114
151
|
async function getEquinoxMarkets() {
|
115
152
|
try {
|
116
153
|
if (isCacheExpired(cacheKeys.equinoxMarkets)) {
|
117
|
-
const marketConfig = `${env}_markets`;
|
154
|
+
const marketConfig = `${platform.env}_markets`;
|
118
155
|
const variables = { uid: 'blt5633ff9e560f14ef' };
|
119
156
|
const query = `query EquinoxMarketsByUid($uid: String!) {
|
120
157
|
equinox_markets(uid: $uid) {
|
@@ -151,7 +188,7 @@ async function getKongUrl() {
|
|
151
188
|
const query = `query KongUrlByUid($uid: String!) {
|
152
189
|
equinox_markets(uid: $uid) {
|
153
190
|
kong_urls {
|
154
|
-
${env}
|
191
|
+
${platform.env}
|
155
192
|
}
|
156
193
|
}
|
157
194
|
}`;
|
@@ -160,9 +197,9 @@ async function getKongUrl() {
|
|
160
197
|
data: { variables, query }
|
161
198
|
});
|
162
199
|
|
163
|
-
setCachedData(cacheKeys.kongUrl, data.equinox_markets.kong_urls[env]);
|
200
|
+
setCachedData(cacheKeys.kongUrl, data.equinox_markets.kong_urls[platform.env]);
|
164
201
|
}
|
165
|
-
|
202
|
+
|
166
203
|
return getCachedData(cacheKeys.kongUrl);
|
167
204
|
} catch (error) {
|
168
205
|
console.error(error);
|
@@ -199,6 +236,7 @@ async function contentstackService(config) {
|
|
199
236
|
|
200
237
|
try {
|
201
238
|
const response = await http.post('', data);
|
239
|
+
console.log(response);
|
202
240
|
return response.data
|
203
241
|
} catch (error) {
|
204
242
|
console.error(error.response.data.errors);
|
package/src/product.js
CHANGED
@@ -72,6 +72,10 @@ const Product = function(productData) {
|
|
72
72
|
// agelocme stuff
|
73
73
|
this.agelocme = null; // object containing agelocme information (like code, label, name)
|
74
74
|
|
75
|
+
//equinox inventory / stock label
|
76
|
+
//@example "IN STOCK"
|
77
|
+
this.inventory = "";
|
78
|
+
|
75
79
|
this.setMarketAttributes = function(productStatus) {
|
76
80
|
if (productStatus.marketAttributes) {
|
77
81
|
this.marketAttributes = productStatus.marketAttributes;
|
@@ -518,6 +522,7 @@ const Product = function(productData) {
|
|
518
522
|
retData.marketAttributes = this.marketAttributes;
|
519
523
|
retData.restrictedMarkets = this.restrictedMarkets;
|
520
524
|
retData.addOns = this.addOns;
|
525
|
+
retData.inventory = this.inventory;
|
521
526
|
|
522
527
|
return retData;
|
523
528
|
};
|
@@ -626,6 +631,7 @@ const Product = function(productData) {
|
|
626
631
|
this.marketAttributes = productData.marketAttributes;
|
627
632
|
this.addOns = productData.addOns || [];
|
628
633
|
this.restrictedMarkets = productData.restrictedMarkets || [];
|
634
|
+
this.inventory = productData.inventory || "";
|
629
635
|
|
630
636
|
if (data.priceType) {
|
631
637
|
this.addPricing(data.priceType, data.price);
|
package/src/productData.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
const axios = require("axios");
|
3
3
|
const contentstack = require('./contentstack/contentstack');
|
4
|
-
const
|
4
|
+
const Product = require("./product");
|
5
5
|
|
6
6
|
/** @type {*} */
|
7
7
|
const ProductData = {
|
8
8
|
/**
|
9
|
-
* @param {string[]} skus
|
10
|
-
* @param {string} locale
|
11
|
-
* @param {string} market
|
12
|
-
* @param {boolean} isEquinoxEnabled
|
9
|
+
* @param {string[]} skus
|
10
|
+
* @param {string} locale
|
11
|
+
* @param {string} market
|
12
|
+
* @param {boolean} isEquinoxEnabled
|
13
13
|
*/
|
14
14
|
getProductData: async function (skus, locale, market, isEquinoxEnabled = false) {
|
15
15
|
const localeMarket = `${locale}_${market}`;
|
@@ -28,9 +28,8 @@ const ProductData = {
|
|
28
28
|
getProductFromEquinox: async function (skus, locale, storeID) {
|
29
29
|
const filter = '{"filters":[{"field":"index_key_skuId","operation":"IN","value":"' + skus.toString() + '"}]}';
|
30
30
|
axios.defaults.withCredentials = true;
|
31
|
-
|
31
|
+
|
32
32
|
const url = await contentstack.getKongUrl() + `/orchestrationservices/storefront/catalogs/search/`;
|
33
|
-
console.log("Dynamic URL", url)
|
34
33
|
const href = `${url}?filter=${encodeURI(filter)}`;
|
35
34
|
const response = await axios.request({
|
36
35
|
method: 'get',
|
@@ -78,7 +77,7 @@ const ProductData = {
|
|
78
77
|
responseType: 'json'
|
79
78
|
});
|
80
79
|
},
|
81
|
-
|
80
|
+
|
82
81
|
/**
|
83
82
|
* @param {contentstack.MarketConfig} marketConfig
|
84
83
|
*/
|
@@ -90,20 +89,150 @@ const ProductData = {
|
|
90
89
|
};
|
91
90
|
},
|
92
91
|
|
92
|
+
/**
|
93
|
+
* Map product variant
|
94
|
+
* @todo remove unnecessary fields
|
95
|
+
* @param {*} eqVariant
|
96
|
+
* @returns Array<Product>
|
97
|
+
*/
|
98
|
+
eqProductVariantMapper : function (eqVariant) {
|
99
|
+
|
100
|
+
let imageURL = eqVariant.properties.imageURL;
|
101
|
+
const regex = /\d+.\d+/
|
102
|
+
let thumbnailImage = ''
|
103
|
+
|
104
|
+
if (imageURL.includes('contentstack')) {
|
105
|
+
thumbnailImage = imageURL + '?width=40'
|
106
|
+
} else {
|
107
|
+
thumbnailImage = imageURL.replace(regex,'40.40')
|
108
|
+
}
|
109
|
+
|
110
|
+
return {
|
111
|
+
"sku": eqVariant.identifier,
|
112
|
+
"globalProductID": eqVariant.identifier,
|
113
|
+
"title": eqVariant.properties.name,
|
114
|
+
"country": eqVariant.properties.market,
|
115
|
+
"language": "en",
|
116
|
+
"shortDescr": eqVariant.properties.description,
|
117
|
+
"longDescr": eqVariant.properties.productDetailsDescription,
|
118
|
+
"fullImage": imageURL,
|
119
|
+
"imageAltText": eqVariant.properties.name,
|
120
|
+
"productCarouselImages": [
|
121
|
+
{
|
122
|
+
"contentType": "img",
|
123
|
+
"src": "/content/products/24/00/35/24003529/jcr:content/fullImage.imgw.1280.1280.png",
|
124
|
+
"alt": ""
|
125
|
+
}
|
126
|
+
],
|
127
|
+
"thumbnail": thumbnailImage,
|
128
|
+
"ingredients": eqVariant.properties.ingredients,
|
129
|
+
"benefits": eqVariant.properties.benefits,
|
130
|
+
"usage": eqVariant.properties.usage,
|
131
|
+
"resources": eqVariant.properties.resources,
|
132
|
+
"videos": "",
|
133
|
+
"movie": "",
|
134
|
+
"youtube": "",
|
135
|
+
"salesEventText": "",
|
136
|
+
"contentSection": [
|
137
|
+
{
|
138
|
+
"sectionContent": "<div class=\"contentSections\"><div class=\"contentSection section\"><div>\n<h3>BENEFITS</h3>\n<div>\n<div class=\"sectionContent parsys\"><div class=\"text parbase section\">\n<p>Green tea has been used in China for thousands of years for its health-preserving and revitalizing power. Modern science has identified powerful antioxidants in green tea called polyphenols. One group of polyphenols called catechins is particularly potent and is highly effective at neutralizing free radicals at the cellular level. Catechins support healthy cell function while providing antioxidant protection to critical cell structures such as DNA. Clinical studies show catechins interfere with the production of certain enzymes involved in cell damage. Additionally, catechins have been demonstrated to cause a thermogenic effect that enhances the body s metabolic rate. Tegreen 97<sup>®</sup> from Pharmanex is a proprietary, highly concentrated extract of the catechins found in green tea. Tegreen 97<sup>®</sup> is one of the most potent antioxidant supplements on the market with a 97 percent polyphenol content, 65% catechins. Each Tegreen 97<sup>®</sup> capsule contains the catechin equivalent of approximately seven cups of green tea and is 99.5 percent caffeine free.</p>\r\n\n</div>\n\n</div>\n\n</div>\n</div>\n</div>\n<div class=\"contentSection section\"><div>\n<h3>USAGE</h3>\n<div>\n<div class=\"sectionContent parsys\"><div class=\"text parbase section\">\n<p>As a dietary supplement, take one (1) to four (4) capsules daily; preferably one (1) to two (2) each morning and evening with food. Store in a cool, dry place.</p>\r\n\n</div>\n\n</div>\n\n</div>\n</div>\n</div>\n<div class=\"contentSection section\"><div>\n<h3>INGREDIENTS</h3>\n<div>\n<div class=\"sectionContent parsys\"><div class=\"text parbase section\">\n<table border=\"1\" cellspacing=\"1\" cellpadding=\"0\" width=\"360\"><tbody>\r\n<tr>\r\n<td><b>Nutritional Facts</b></td>\r\n<td><b>Amount</b></td>\r\n<td><b>% Daily Value</b></td>\r\n</tr>\r\n<tr>\r\n<td colspan=\"3\"><b>Serving Size: 1 Capsule<br>\r\nServings Per Container: 120</b></td>\r\n</tr>\r\n<tr>\r\n<td width=\"55%\">Green tea leaf (20:1) Extract (<i>Camellia sinensis</i></td>\r\n<td width=\"20%\">250 mg</td>\r\n<td width=\"25%\"> </td>\r\n</tr>\r\n<tr>\r\n<td width=\"55%\" colspan=\"3\">* Daily Value not established</td>\r\n</tr>\r\n<tr>\r\n<td width=\"55%\" colspan=\"3\"><b>Other Ingredients: Gelatin, Silicon Dioxide, Microcrystalline Cellulose, Magnesium Stearate.</b></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<p> </p>\r\n\n</div>\n\n</div>\n\n</div>\n</div>\n</div>\n</div>\n"
|
139
|
+
}
|
140
|
+
],
|
141
|
+
"scanQualified": eqVariant.properties.scanQualifiedCount,
|
142
|
+
"availableQuantity": eqVariant.inventoryProperties.atpQty,
|
143
|
+
"maxQuantity": 999,
|
144
|
+
"points": "",
|
145
|
+
"cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
146
|
+
"pv":eqVariant.priceFacets.PV,
|
147
|
+
"priceType": "WRTL",
|
148
|
+
"price": eqVariant.priceFacets["Regular Price"],
|
149
|
+
"priceMap": {
|
150
|
+
"WRTL": eqVariant.priceFacets["Regular Price"],
|
151
|
+
"WADW-WRTL": eqVariant.priceFacets["Regular Price"],
|
152
|
+
"WADR": 9999.01,
|
153
|
+
"RTL": eqVariant.priceFacets["Regular Price"],
|
154
|
+
"WWHL": eqVariant.priceFacets["Wholesale Price"],
|
155
|
+
"WADW": 9998.01,
|
156
|
+
"WHL": eqVariant.priceFacets["Wholesale Price"]
|
157
|
+
},
|
158
|
+
"cvMap": {
|
159
|
+
"WWHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
160
|
+
"WADW": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
161
|
+
"WHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : ''
|
162
|
+
},
|
163
|
+
"pvMap": {
|
164
|
+
"WWHL": eqVariant.priceFacets.PV,
|
165
|
+
"WADW": eqVariant.priceFacets.PV,
|
166
|
+
"WHL": eqVariant.priceFacets.PV
|
167
|
+
},
|
168
|
+
"orderTypes": {
|
169
|
+
"adr": true,
|
170
|
+
"order": true,
|
171
|
+
"zpfc": false,
|
172
|
+
"zadp": true,
|
173
|
+
"ars": true,
|
174
|
+
"kiosk": true,
|
175
|
+
"mobile": true,
|
176
|
+
"preferred customer": true,
|
177
|
+
"retail": true,
|
178
|
+
"web": true,
|
179
|
+
"web display": true
|
180
|
+
},
|
181
|
+
"division": eqVariant.properties.division,
|
182
|
+
"backOrderDate": null,
|
183
|
+
"locallyProduced": false,
|
184
|
+
"agelocme": null,
|
185
|
+
"count": "",
|
186
|
+
"flavor": "",
|
187
|
+
"size": eqVariant.properties.size,
|
188
|
+
"shade": "",
|
189
|
+
"status": this.switchStatusFromEquinox(eqVariant.properties.status),
|
190
|
+
"variantType": "Other",
|
191
|
+
"variantDropdownLabel": eqVariant.properties.variantLabel || "",
|
192
|
+
"variantDropdownPlaceholder": "Select Type",
|
193
|
+
"variantsLabel": eqVariant.properties.variantLabel || "",
|
194
|
+
"groupOffer": false,
|
195
|
+
"personalOffer": false,
|
196
|
+
"savedEventName": null,
|
197
|
+
"salesLabel": "",
|
198
|
+
"eventName": null,
|
199
|
+
"sizeWeight": '',
|
200
|
+
"nettoWeight": "",
|
201
|
+
"searchScore": 0,
|
202
|
+
"isExclusive": false,
|
203
|
+
"marketAttributes": {
|
204
|
+
"discount": true,
|
205
|
+
"redeem": true,
|
206
|
+
"earn": true
|
207
|
+
},
|
208
|
+
"restrictedMarkets": [],
|
209
|
+
"addOns": []
|
210
|
+
};
|
211
|
+
},
|
212
|
+
|
93
213
|
eqProductMapper: function (productDataResponse) {
|
94
214
|
let prod = [];
|
95
215
|
let count = 0;
|
216
|
+
let variants = {};
|
96
217
|
|
97
218
|
let prodArr = productDataResponse.map((data) => {
|
98
219
|
let imageURL = data.sku[count].properties.imageURL;
|
99
220
|
const regex = /\d+.\d+/
|
100
221
|
let thumbnailImage = ''
|
101
|
-
|
222
|
+
|
102
223
|
if (imageURL.includes('contentstack')) {
|
103
224
|
thumbnailImage = imageURL + '?width=40'
|
104
225
|
} else {
|
105
226
|
thumbnailImage = imageURL.replace(regex,'40.40')
|
106
227
|
}
|
228
|
+
|
229
|
+
if (data.sku && data.sku.length > 1) {
|
230
|
+
data.sku.map(variant => {
|
231
|
+
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
232
|
+
return variant;
|
233
|
+
});
|
234
|
+
}
|
235
|
+
|
107
236
|
prod = {
|
108
237
|
"sku": data.sku[count].identifier,
|
109
238
|
"globalProductID": data.identifier,
|
@@ -132,11 +261,11 @@ const ProductData = {
|
|
132
261
|
"salesEventText": "",
|
133
262
|
"contentSection": [
|
134
263
|
{
|
135
|
-
"sectionContent": "<div class=\"contentSections\"
|
264
|
+
"sectionContent": "<div class=\"contentSections\"></div>\n"
|
136
265
|
}
|
137
266
|
],
|
138
267
|
"scanQualified": data.properties.scanQualifiedCount,
|
139
|
-
"availableQuantity":
|
268
|
+
"availableQuantity": data.sku[count].inventoryProperties.atpQty,
|
140
269
|
"maxQuantity": 999,
|
141
270
|
"points": "",
|
142
271
|
"cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
|
@@ -148,9 +277,9 @@ const ProductData = {
|
|
148
277
|
"WADW-WRTL": data.sku[count].priceFacets["Regular Price"],
|
149
278
|
"WADR": 9999.01,
|
150
279
|
"RTL": data.sku[count].priceFacets["Regular Price"],
|
151
|
-
"WWHL": 9998.01,
|
152
280
|
"WADW": 9998.01,
|
153
|
-
"WHL":
|
281
|
+
"WHL": data.sku[count].priceFacets["Wholesale Price"],
|
282
|
+
"WWHL": data.sku[count].priceFacets["Wholesale Price"]
|
154
283
|
},
|
155
284
|
"cvMap": {
|
156
285
|
"WWHL": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
|
@@ -187,9 +316,9 @@ const ProductData = {
|
|
187
316
|
"shade": "",
|
188
317
|
"status": this.switchStatusFromEquinox(data.sku[count].properties.productStatus),
|
189
318
|
"variantType": "Other",
|
190
|
-
"variantDropdownLabel": "
|
319
|
+
"variantDropdownLabel": data.sku[count].properties.variantLabel || "",
|
191
320
|
"variantDropdownPlaceholder": "Select Type",
|
192
|
-
"variantsLabel": "
|
321
|
+
"variantsLabel": data.sku[count].properties.variantLabel || "",
|
193
322
|
"groupOffer": false,
|
194
323
|
"personalOffer": false,
|
195
324
|
"savedEventName": null,
|
@@ -197,8 +326,7 @@ const ProductData = {
|
|
197
326
|
"eventName": null,
|
198
327
|
"sizeWeight": '',
|
199
328
|
"nettoWeight": "",
|
200
|
-
"variants":
|
201
|
-
},
|
329
|
+
"variants": variants,
|
202
330
|
"searchScore": 0,
|
203
331
|
"isExclusive": data.sku[count].properties.isExclusive,
|
204
332
|
"marketAttributes": {
|
@@ -207,9 +335,11 @@ const ProductData = {
|
|
207
335
|
"earn": true
|
208
336
|
},
|
209
337
|
"restrictedMarkets": [],
|
210
|
-
"addOns": []
|
338
|
+
"addOns": [],
|
339
|
+
"inventory": data.sku[count].inventory || "" //inventory label
|
340
|
+
|
211
341
|
};
|
212
|
-
let newProduct = new
|
342
|
+
let newProduct = new Product(prod);
|
213
343
|
return newProduct
|
214
344
|
})
|
215
345
|
|
@@ -252,13 +382,13 @@ const ProductData = {
|
|
252
382
|
},
|
253
383
|
|
254
384
|
/**
|
255
|
-
*
|
256
|
-
* @param {*} custType
|
257
|
-
*
|
385
|
+
*
|
386
|
+
* @param {*} custType
|
387
|
+
*
|
258
388
|
*/
|
259
389
|
switchCustType: function (custType) {
|
260
390
|
let newCustType = [];
|
261
|
-
if (custType.includes('Brand Affiliate - Business Entity') || custType.includes('Brand Affiliate - Individual'))
|
391
|
+
if (custType.includes('Brand Affiliate - Business Entity') || custType.includes('Brand Affiliate - Individual'))
|
262
392
|
newCustType.push(10)
|
263
393
|
if (custType.includes('Retail Customer'))
|
264
394
|
newCustType.push(20)
|