@nuskin/ns-product-lib 2.18.0-brw-4218.2 → 2.18.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/src/graph-ql/product.js +5 -11
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.18.0
|
3
|
+
"version": "2.18.0",
|
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": {
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"@nuskin/configuration-sdk": "2.3.2",
|
23
23
|
"@nuskin/ns-common-lib": "1.4.7",
|
24
24
|
"@nuskin/ns-util": "4.5.4",
|
25
|
-
"@nuskin/product-lib": "2.2.0
|
25
|
+
"@nuskin/product-lib": "2.2.0",
|
26
26
|
"axios": "1.6.7",
|
27
27
|
"axios-mock-adapter": "1.21.2",
|
28
28
|
"eslint": "^8.56.0",
|
package/src/graph-ql/product.js
CHANGED
@@ -353,13 +353,13 @@ function mapVariants(product) {
|
|
353
353
|
* @returns {array} kitBundleProducts
|
354
354
|
*/
|
355
355
|
function mapChildSKU(kitBundleProducts) {
|
356
|
-
if (!kitBundleProducts || !kitBundleProducts.kitProducts) {
|
356
|
+
if (!kitBundleProducts || !kitBundleProducts.kitProducts) /* istanbul ignore next */ {
|
357
357
|
return [];
|
358
358
|
}
|
359
359
|
const personalOffer = typeof sessionStorage !== 'undefined' && sessionStorage.getItem('personalOffer') ? JSON.parse(sessionStorage.getItem('personalOffer')) : false
|
360
360
|
return kitBundleProducts.kitProducts.map((kitProduct) => {
|
361
361
|
const { product } = kitProduct;
|
362
|
-
if (product.variants.length > 1 && typeof personalOffer === 'object') {
|
362
|
+
if (product.variants.length > 1 && typeof personalOffer === 'object') /* istanbul ignore next */ {
|
363
363
|
return product.variants.map((variant) => {
|
364
364
|
return {
|
365
365
|
productId: product.id,
|
@@ -519,6 +519,7 @@ function mapOrderTypes(availableChannels, purchaseTypes) {
|
|
519
519
|
* @param {string} status
|
520
520
|
* @returns {string} status
|
521
521
|
*/
|
522
|
+
/* istanbul ignore next */
|
522
523
|
function mapProductStatus(status) {
|
523
524
|
const { equinoxStatus } = ProductStatus;
|
524
525
|
let newStatus = '';
|
@@ -545,6 +546,7 @@ function mapProductStatus(status) {
|
|
545
546
|
return newStatus;
|
546
547
|
}
|
547
548
|
|
549
|
+
/* istanbul ignore next */
|
548
550
|
function mapPromos(product) {
|
549
551
|
if ((product.price.retailSales !== null && product.price.retailSales >= 0) || (product.price.wholesaleSales !== null && product.price.wholesaleSales >= 0)) {
|
550
552
|
if (product.pricingJson) {
|
@@ -587,17 +589,9 @@ function mapPromos(product) {
|
|
587
589
|
return { message: product.salesLabel, offerId: null, priceMap: {}, cvMap: {}, pvMap: {} }
|
588
590
|
}
|
589
591
|
return {message: null, offerId: null}
|
590
|
-
// if (isKitBundle) {
|
591
|
-
// const { pricingJson } = product
|
592
|
-
// const parsedPricing = JSON.parse(pricingJson)
|
593
|
-
// const promotion = parsedPricing.promotion
|
594
|
-
// return (promotion && promotion.length >= 1) ? { message: promotion[0].message, offerId: promotion[0].offerId } : { message: '', offerId: '' }
|
595
|
-
// } else {
|
596
|
-
// return { message: product.salesLabel || product.salesText, offerId: product.salesLabel || product.salesText }
|
597
|
-
// }
|
598
|
-
|
599
592
|
}
|
600
593
|
|
594
|
+
/* istanbul ignore next */
|
601
595
|
function parseOktaObject(okta) {
|
602
596
|
if (!okta || typeof okta !== 'string') {
|
603
597
|
return null;
|