@nuskin/ns-product-lib 2.14.2 → 2.14.3-cx24-5962.1
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,15 @@ 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 promotion = pricingJson.promotion
|
513
|
+
return (promotion && promotion.length >= 1) ? { message: promotion[0].message, offerId: promotion[0].offerId } : { message: '', offerId: '' }
|
514
|
+
} else {
|
515
|
+
return { message: product.salesLabel || product.salesText, offerId: product.salesLabel || product.salesText }
|
516
|
+
}
|
517
|
+
|
518
|
+
}
|
519
|
+
|
509
520
|
module.exports = getProduct;
|