@nuskin/ns-product-lib 2.6.0-cx24-3464.6 → 2.6.0-cx24-3464.7
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/productData.js +24 -12
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [2.6.0-cx24-3464.7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3464.6...v2.6.0-cx24-3464.7) (2023-03-10)
|
2
|
+
|
3
|
+
|
4
|
+
### Update
|
5
|
+
|
6
|
+
* get child skus to be used for add-to-cart #CX24-3464 ([e9059db](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e9059db52bdd09dce542f905202f2b12ea017324)), closes [#CX24-3464](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3464)
|
7
|
+
|
1
8
|
# [2.6.0-cx24-3464.6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0-cx24-3464.5...v2.6.0-cx24-3464.6) (2023-03-10)
|
2
9
|
|
3
10
|
|
package/package.json
CHANGED
package/src/productData.js
CHANGED
@@ -32,7 +32,27 @@ const ProductData = {
|
|
32
32
|
},
|
33
33
|
|
34
34
|
getProductFromEquinox: async function (skus, locale, config) {
|
35
|
+
const response = await this.searchEquinoxProduct(skus, locale, config);
|
35
36
|
|
37
|
+
if (response.data.product) {
|
38
|
+
return await this.eqProductMapper(response.data.product, skus);
|
39
|
+
}
|
40
|
+
|
41
|
+
return {
|
42
|
+
status: 400,
|
43
|
+
messages: [response.data.message],
|
44
|
+
data: { count: 0, products: [] }
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
/**
|
49
|
+
*
|
50
|
+
* @param {string[]} skus
|
51
|
+
* @param {string} locale
|
52
|
+
* @param {ConfigMap} config
|
53
|
+
* @returns
|
54
|
+
*/
|
55
|
+
searchEquinoxProduct: async function(skus, locale, config) {
|
36
56
|
let skuFilter = [];
|
37
57
|
|
38
58
|
if(Array.isArray(skus)) {
|
@@ -61,15 +81,7 @@ const ProductData = {
|
|
61
81
|
withCredentials: true
|
62
82
|
});
|
63
83
|
|
64
|
-
|
65
|
-
return await this.eqProductMapper(response.data.product, skus);
|
66
|
-
}
|
67
|
-
|
68
|
-
return {
|
69
|
-
status: 400,
|
70
|
-
messages: [response.data.message],
|
71
|
-
data: { count: 0, products: [] }
|
72
|
-
}
|
84
|
+
return response;
|
73
85
|
},
|
74
86
|
|
75
87
|
getEquinoxRequestHeaders() {
|
@@ -495,8 +507,8 @@ const ProductData = {
|
|
495
507
|
return { sku, qty };
|
496
508
|
});
|
497
509
|
const skus = kits.map(k => k.sku);
|
498
|
-
const res = await this.
|
499
|
-
const childSkus = res.
|
510
|
+
const res = await this.searchEquinoxProduct(skus, locale, config);
|
511
|
+
const childSkus = res.product.map(p => this.buildChildSkus(kits, p));
|
500
512
|
|
501
513
|
return childSkus;
|
502
514
|
}
|
@@ -505,8 +517,8 @@ const ProductData = {
|
|
505
517
|
},
|
506
518
|
|
507
519
|
buildChildSkus: function(kits, product) {
|
508
|
-
const kit = kits.filter(k => k.sku === product.sku[0].identifier)[0];
|
509
520
|
const sku = product.sku[0];
|
521
|
+
const kit = kits.filter(k => k.sku === sku.identifier);
|
510
522
|
|
511
523
|
return {
|
512
524
|
productId: product.identifier,
|