@nuskin/ns-shop 7.0.5-cx1-13272.4 → 7.0.5-cx1-13272.6
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
CHANGED
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,12 +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?.product)
|
|
548
|
-
item.product.eventName = savedEventName;
|
|
549
|
-
|
|
550
|
-
return item;
|
|
551
544
|
}
|
|
552
545
|
|
|
553
546
|
const syncProductItems = async (order, sapProducts, adr, includeSapItems) => {
|