@nuskin/ns-product-lib 2.14.2 → 2.14.3-cx24-5962.2
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -202,8 +202,8 @@ function mapProduct(product, market, locale, config) {
|
|
202
202
|
"groupOffer": false,
|
203
203
|
"personalOffer": false,
|
204
204
|
"savedEventName": '',
|
205
|
-
"salesLabel": defaultVariant.
|
206
|
-
"eventName": defaultVariant.
|
205
|
+
"salesLabel": mapPromos(defaultVariant, !!kitBundleProducts).message || '',
|
206
|
+
"eventName": mapPromos(defaultVariant, !!kitBundleProducts).offerId || '',
|
207
207
|
"sizeWeight": '',
|
208
208
|
"nettoWeight": "",
|
209
209
|
"searchScore": 0,
|
@@ -506,4 +506,16 @@ function mapProductStatus(status) {
|
|
506
506
|
return newStatus;
|
507
507
|
}
|
508
508
|
|
509
|
+
function mapPromos(product, isKitBundle = false) {
|
510
|
+
if (isKitBundle) {
|
511
|
+
const { pricingJson } = product
|
512
|
+
const parsedPricing = JSON.parse(pricingJson)
|
513
|
+
const promotion = parsedPricing.promotion
|
514
|
+
return (promotion && promotion.length >= 1) ? { message: promotion[0].message, offerId: promotion[0].offerId } : { message: '', offerId: '' }
|
515
|
+
} else {
|
516
|
+
return { message: product.salesLabel || product.salesText, offerId: product.salesLabel || product.salesText }
|
517
|
+
}
|
518
|
+
|
519
|
+
}
|
520
|
+
|
509
521
|
module.exports = getProduct;
|