@nuskin/ns-product-lib 2.13.0-cx24-5107.4 → 2.13.0-cx24-5107.6
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 +15 -0
- package/package.json +1 -1
- package/src/graph-ql/product.js +11 -7
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# [2.13.0-cx24-5107.6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.5...v2.13.0-cx24-5107.6) (2023-09-29)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* added productData count ([4896fc3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4896fc38b9ac841de4ac825659d58500c3bd360b))
|
7
|
+
* remove config log ([72739a9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/72739a9a893ccfa8b3ca76056eab088f5dddef28))
|
8
|
+
|
9
|
+
# [2.13.0-cx24-5107.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.4...v2.13.0-cx24-5107.5) (2023-09-28)
|
10
|
+
|
11
|
+
|
12
|
+
### Fix
|
13
|
+
|
14
|
+
* single variant ([3464822](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3464822e8b3cbdba7ba576ff19247becb00e8a73))
|
15
|
+
|
1
16
|
# [2.13.0-cx24-5107.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.3...v2.13.0-cx24-5107.4) (2023-09-28)
|
2
17
|
|
3
18
|
|
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -53,9 +53,11 @@ async function getProduct(id, market, locale, config) {
|
|
53
53
|
if (data && data.data && data.data.productById) {
|
54
54
|
const product = mapProduct(data.data.productById, market, locale, config);
|
55
55
|
productData.products.push(new Product(product));
|
56
|
+
productData.count = productData.products.length;
|
56
57
|
}
|
58
|
+
|
57
59
|
} catch (e) {
|
58
|
-
console.log(
|
60
|
+
console.log(`Unable to fetch product detail for SKU ${id}`);
|
59
61
|
}
|
60
62
|
|
61
63
|
return {
|
@@ -161,7 +163,9 @@ function mapProduct(product, market, locale, config) {
|
|
161
163
|
|
162
164
|
}
|
163
165
|
|
164
|
-
if
|
166
|
+
//map only if it is normal product
|
167
|
+
if (product.variants && !kitBundleProducts) {
|
168
|
+
console.log(variants);
|
165
169
|
productDetail.variants = mapVariants(product);
|
166
170
|
}
|
167
171
|
|
@@ -190,8 +194,8 @@ function mapProduct(product, market, locale, config) {
|
|
190
194
|
*/
|
191
195
|
function mapVariants(product) {
|
192
196
|
|
193
|
-
//return if it
|
194
|
-
if (!product.variants
|
197
|
+
//return if it has no variant
|
198
|
+
if (!product.variants) {
|
195
199
|
return [];
|
196
200
|
}
|
197
201
|
|
@@ -252,7 +256,7 @@ function mapVariants(product) {
|
|
252
256
|
"personalOffer": false,
|
253
257
|
"savedEventName": '',
|
254
258
|
"salesLabel": '',
|
255
|
-
"eventName":
|
259
|
+
"eventName": null,
|
256
260
|
"sizeWeight": '',
|
257
261
|
"nettoWeight": "",
|
258
262
|
"searchScore": 0,
|
@@ -272,8 +276,8 @@ function mapVariants(product) {
|
|
272
276
|
* @returns {object} promotion
|
273
277
|
*/
|
274
278
|
function getPromotions(config) {
|
275
|
-
console.log(`
|
276
|
-
return
|
279
|
+
console.log(`store ID : `, config.store_id);
|
280
|
+
return null;
|
277
281
|
}
|
278
282
|
|
279
283
|
/**
|