@nuskin/ns-shop 7.10.2 → 7.10.3-comx-1477.2
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 +27 -10
- package/src/cart/cartItem.js +1 -0
package/package.json
CHANGED
package/src/cart/cart.js
CHANGED
|
@@ -1392,6 +1392,7 @@ export default function Cart(cartData) {
|
|
|
1392
1392
|
|
|
1393
1393
|
const getCartAddQty = (flatItem, diffQty, referrer) => ({
|
|
1394
1394
|
'ecommerce': {
|
|
1395
|
+
'total': parseFloat(((flatItem.price || 0) * Math.abs(diffQty)).toFixed(2)),
|
|
1395
1396
|
'add': {
|
|
1396
1397
|
'actionField': {
|
|
1397
1398
|
'list': referrer
|
|
@@ -1406,22 +1407,38 @@ export default function Cart(cartData) {
|
|
|
1406
1407
|
|
|
1407
1408
|
const getCartRemoveQty = (flatItem, diffQty) => ({
|
|
1408
1409
|
'ecommerce': {
|
|
1410
|
+
'total': parseFloat(((flatItem.price || 0) * Math.abs(diffQty)).toFixed(2)),
|
|
1409
1411
|
'remove': {
|
|
1410
1412
|
'products': [getProductInfoForPublish(flatItem, diffQty)]
|
|
1411
1413
|
}
|
|
1412
1414
|
}
|
|
1413
1415
|
});
|
|
1414
1416
|
|
|
1415
|
-
const getProductInfoForPublish = (flatItem, diffQty) =>
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1417
|
+
const getProductInfoForPublish = (flatItem, diffQty) => {
|
|
1418
|
+
const taxonomy = Array.isArray(flatItem.taxonomy)
|
|
1419
|
+
? flatItem.taxonomy
|
|
1420
|
+
: (flatItem.taxonomy
|
|
1421
|
+
? String(flatItem.taxonomy)
|
|
1422
|
+
.split(',')
|
|
1423
|
+
.map((value) => value.trim())
|
|
1424
|
+
.filter((value) => value.length > 0)
|
|
1425
|
+
: ['all_products']);
|
|
1426
|
+
|
|
1427
|
+
return {
|
|
1428
|
+
'name': flatItem.title,
|
|
1429
|
+
'id': flatItem.sku,
|
|
1430
|
+
'price': flatItem.price || 0,
|
|
1431
|
+
'unit_price': flatItem.unitPrice,
|
|
1432
|
+
'unit_sales_price': flatItem.price || 0,
|
|
1433
|
+
'taxonomy': taxonomy,
|
|
1434
|
+
'sales_price': flatItem.salesPrice,
|
|
1435
|
+
'product_image_url': flatItem.product_image_url,
|
|
1436
|
+
'subtotal': parseFloat(((flatItem.price || 0) * Math.abs(diffQty)).toFixed(2)),
|
|
1437
|
+
'brand': flatItem.brand || 'Nuskin',
|
|
1438
|
+
'category': taxonomy.length > 0 ? taxonomy.join(',') : 'all_products',
|
|
1439
|
+
'quantity': Math.abs(diffQty)
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1425
1442
|
|
|
1426
1443
|
function getCartInfo(options) {
|
|
1427
1444
|
return {
|
package/src/cart/cartItem.js
CHANGED
|
@@ -378,6 +378,7 @@ export default function CartItem(cartItemData) {
|
|
|
378
378
|
retVal.marketAttributes = this.product.marketAttributes;
|
|
379
379
|
retVal.product_image_url = this.product.fullImage;
|
|
380
380
|
retVal.taxonomy = 'all_products';
|
|
381
|
+
retVal.variantsLabel = this.product.variantsLabel;
|
|
381
382
|
retVal.salesPrice = AccountManager.isLoggedIn()? this.salesPrice() : null;
|
|
382
383
|
retVal.unitPrice = AccountManager.isLoggedIn()? this.unitPrice() : null;
|
|
383
384
|
|