@nuskin/ns-product-lib 2.13.3-cx24-5694.2 → 2.13.3-cx24-5694.4
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/graph-ql/mappers/originalPrice.js +1 -1
- package/src/graph-ql/mappers/retailPrice.js +3 -4
- package/src/graph-ql/mappers/retailSubscriptionPrice.js +1 -1
- package/src/graph-ql/mappers/wholesalePrice.js +3 -4
- package/src/graph-ql/mappers/wholesaleSubscriptionPrice.js +1 -1
- package/src/graph-ql/product.js +6 -6
- package/src/graph-ql/query/index.js +1 -1
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
*/
|
11
11
|
function originalPrice(product, isWholesale = false, isBundleKit = false) {
|
12
12
|
const { price, totalPrice } = product;
|
13
|
-
const productPrice =
|
13
|
+
const productPrice = price ? price : totalPrice;
|
14
14
|
|
15
15
|
if (isBundleKit) {
|
16
16
|
|
@@ -4,19 +4,18 @@
|
|
4
4
|
* Map retail price
|
5
5
|
* Map retailSales if it has sales/promotions
|
6
6
|
* @param {obj} product
|
7
|
-
* @param {boolean} isBundleKit
|
8
7
|
* @return {number} retailPrice
|
9
8
|
*/
|
10
|
-
function retailPrice(product
|
9
|
+
function retailPrice(product) {
|
11
10
|
const { price, totalPrice } = product;
|
12
|
-
const productPrice =
|
11
|
+
const productPrice = price ? price : totalPrice;
|
13
12
|
|
14
13
|
if (productPrice.retailSales) {
|
15
14
|
|
16
15
|
return productPrice.retailSales;
|
17
16
|
}
|
18
17
|
|
19
|
-
return
|
18
|
+
return productPrice.retail;
|
20
19
|
|
21
20
|
}
|
22
21
|
|
@@ -4,18 +4,17 @@
|
|
4
4
|
* Map wholesale price
|
5
5
|
* Map wholesaleSales if it has sales/promotions
|
6
6
|
* @param {*} product
|
7
|
-
* @param {boolean} isBundleKit
|
8
7
|
* @return {number} wholesalePrice
|
9
8
|
*/
|
10
|
-
function wholeSalePrice(product
|
9
|
+
function wholeSalePrice(product) {
|
11
10
|
const { price, totalPrice } = product;
|
12
|
-
const productPrice =
|
11
|
+
const productPrice = price ? price : totalPrice;
|
13
12
|
|
14
13
|
if (productPrice.wholesaleSales) {
|
15
14
|
return productPrice.wholesaleSales;
|
16
15
|
}
|
17
16
|
|
18
|
-
return
|
17
|
+
return productPrice.wholesale;
|
19
18
|
}
|
20
19
|
|
21
20
|
module.exports = wholeSalePrice;
|
package/src/graph-ql/product.js
CHANGED
@@ -86,14 +86,14 @@ async function getProduct(id, market, locale, config) {
|
|
86
86
|
* @return {obj} prices
|
87
87
|
*/
|
88
88
|
function mapPrices(product, isKitBundle = false) {
|
89
|
-
const originalPrice = mapOriginalPrice(product, isKitBundle);
|
90
|
-
const retailPrice = mapRetailPrice(product
|
91
|
-
const wholesalePrice = mapWholesalePrice(product
|
92
|
-
const originalWholeSalePrice = mapOriginalPrice(product, true, isKitBundle);
|
89
|
+
const originalPrice = mapOriginalPrice(product, false, isKitBundle) || 0;
|
90
|
+
const retailPrice = mapRetailPrice(product) || 0;
|
91
|
+
const wholesalePrice = mapWholesalePrice(product) || 0;
|
92
|
+
const originalWholeSalePrice = mapOriginalPrice(product, true, isKitBundle) || 0;
|
93
93
|
|
94
94
|
//map subscription (ADR) prices
|
95
|
-
const retailSubscriptionPrice = mapRetailSubscriptionPrice(product);
|
96
|
-
const wholesaleSubscriptionPrice = mapWholesaleSubscriptionPrice(product);
|
95
|
+
const retailSubscriptionPrice = mapRetailSubscriptionPrice(product) || 0;
|
96
|
+
const wholesaleSubscriptionPrice = mapWholesaleSubscriptionPrice(product) || 0;
|
97
97
|
|
98
98
|
return {
|
99
99
|
originalPrice,
|