@nuskin/ns-shop 7.0.5-cx1-13272.5 → 7.0.5-cx1-13272.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cart/cart.js +7 -6
- package/src/cart/cartService.js +5 -2
- package/src/order/orderAdapter.js +1 -7
package/package.json
CHANGED
package/src/cart/cart.js
CHANGED
|
@@ -832,11 +832,12 @@ export default function Cart(cartData) {
|
|
|
832
832
|
};
|
|
833
833
|
|
|
834
834
|
this.updateProductEventPrice = function(item, activeEvents) {
|
|
835
|
-
let
|
|
835
|
+
let eventNameAdded = false;
|
|
836
836
|
const user = UserService.getUser();
|
|
837
837
|
const priceType = ShopContext.getPriceType(item.isAdr(), user);
|
|
838
|
+
const eventName = item.product.eventName;
|
|
838
839
|
if (item.product.setPriceAndPvFromType(priceType, activeEvents)) {
|
|
839
|
-
|
|
840
|
+
if (!eventName && item.product.eventName) eventNameAdded = true;
|
|
840
841
|
SalesEventService.logAnalyticInfo(
|
|
841
842
|
'product-price-to-event-price',
|
|
842
843
|
item.product.eventName,
|
|
@@ -850,16 +851,16 @@ export default function Cart(cartData) {
|
|
|
850
851
|
}
|
|
851
852
|
});
|
|
852
853
|
}
|
|
853
|
-
return
|
|
854
|
+
return eventNameAdded;
|
|
854
855
|
};
|
|
855
856
|
|
|
856
857
|
this.updateEventPrices = function(activeEvents) {
|
|
857
|
-
let
|
|
858
|
+
let eventNameAdded = false;
|
|
858
859
|
getCartItems({cartItems: true}).forEach(item => {
|
|
859
860
|
if (this.updateProductEventPrice(item, activeEvents))
|
|
860
|
-
|
|
861
|
+
eventNameAdded = true;
|
|
861
862
|
});
|
|
862
|
-
return
|
|
863
|
+
return eventNameAdded;
|
|
863
864
|
};
|
|
864
865
|
|
|
865
866
|
this.setMissingEventNames = async (order) => {
|
package/src/cart/cartService.js
CHANGED
|
@@ -237,9 +237,9 @@ async function checkForMissingEventNames(order) {
|
|
|
237
237
|
const orderItems = cart.getItems({cartOrderItems: true});
|
|
238
238
|
orderItems.map((item) => {
|
|
239
239
|
const sapItem = order.sapItems.find((sapItem) => (
|
|
240
|
-
sapItem.
|
|
240
|
+
sapItem.sku === item.product.sku && sapItem.isAdr === item.adr
|
|
241
241
|
));
|
|
242
|
-
if (sapItem && item.eventName && !sapItem.eventName)
|
|
242
|
+
if (sapItem && item.product.eventName && !sapItem.eventName)
|
|
243
243
|
outOfSync = true;
|
|
244
244
|
});
|
|
245
245
|
|
|
@@ -371,6 +371,7 @@ async function addProductToCart(options) {
|
|
|
371
371
|
const language = options.product.lang || options.product.language;
|
|
372
372
|
options.product.lang = language;
|
|
373
373
|
options.product.language = language;
|
|
374
|
+
const eventName = options.product.eventName;
|
|
374
375
|
|
|
375
376
|
let itemKey = cart.addProduct({
|
|
376
377
|
id: options.id,
|
|
@@ -390,6 +391,8 @@ async function addProductToCart(options) {
|
|
|
390
391
|
});
|
|
391
392
|
|
|
392
393
|
const item = itemKey ? cart.getItemByKey(itemKey) : null;
|
|
394
|
+
// eventName would get nulled out if sapItem
|
|
395
|
+
item.product.eventName = eventName;
|
|
393
396
|
setCart(cart, item ? !item.isSapLineItem() : true);
|
|
394
397
|
return itemKey;
|
|
395
398
|
}
|
|
@@ -530,8 +530,7 @@ async function addSapItem(newItem, sapItem, sapSkus, adr, isAdrItem, replace) {
|
|
|
530
530
|
handleRedetermination(product, sapItem, sapSkus, adr, isAdrItem); // removes items from sapSkus
|
|
531
531
|
|
|
532
532
|
// Only honor the OneTime flag from SAP if we are a ADR order
|
|
533
|
-
|
|
534
|
-
const item = await CartService.addProductToCart({
|
|
533
|
+
return await CartService.addProductToCart({
|
|
535
534
|
product: product,
|
|
536
535
|
qty: sapItem.LineItem.RequestedQuantity,
|
|
537
536
|
adr: (adr && isAdrItem),
|
|
@@ -542,11 +541,6 @@ async function addSapItem(newItem, sapItem, sapSkus, adr, isAdrItem, replace) {
|
|
|
542
541
|
isBusinessPortfolio: newItem.businessPortfolio,
|
|
543
542
|
replace: replace
|
|
544
543
|
})
|
|
545
|
-
|
|
546
|
-
// eventName would have gotten nulled out. Fix it here.
|
|
547
|
-
if (item && item.product) item.product.eventName = savedEventName;
|
|
548
|
-
|
|
549
|
-
return item;
|
|
550
544
|
}
|
|
551
545
|
|
|
552
546
|
const syncProductItems = async (order, sapProducts, adr, includeSapItems) => {
|