@searchspring/snap-store-mobx
Advanced tools
Comparing version 0.58.2 to 0.58.3
@@ -47,8 +47,9 @@ "use strict"; | ||
get: function () { | ||
var price = 0; | ||
var newPrice = 0; | ||
this.items.forEach(function (item) { | ||
var _a; | ||
price += +(((_a = item.display.mappings.core) === null || _a === void 0 ? void 0 : _a.price) || 0) * item.quantity; | ||
// account for string prices, and floating 0s. | ||
newPrice = (newPrice * 100 + +(+((((_a = item.display.mappings.core) === null || _a === void 0 ? void 0 : _a.price) || 0) * 100) * item.quantity)) / 100 || 0; | ||
}); | ||
return price; | ||
return newPrice; | ||
}, | ||
@@ -60,8 +61,12 @@ enumerable: false, | ||
get: function () { | ||
var price = 0; | ||
var newPrice = 0; | ||
this.items.forEach(function (item) { | ||
var _a, _b; | ||
price += (+(((_a = item.display.mappings.core) === null || _a === void 0 ? void 0 : _a.msrp) || 0) || +(((_b = item.display.mappings.core) === null || _b === void 0 ? void 0 : _b.price) || 0) || 0) * item.quantity; | ||
// account for string prices, and floating 0s. | ||
newPrice = | ||
(newPrice * 100 + | ||
+((+((((_a = item.display.mappings.core) === null || _a === void 0 ? void 0 : _a.msrp) || 0) * 100) || +((((_b = item.display.mappings.core) === null || _b === void 0 ? void 0 : _b.price) || 0) * 100) || 0) * item.quantity)) / | ||
100 || 0; | ||
}); | ||
return price; | ||
return newPrice; | ||
}, | ||
@@ -68,0 +73,0 @@ enumerable: false, |
@@ -25,14 +25,19 @@ import { observable, computed, makeObservable } from 'mobx'; | ||
get price() { | ||
let price = 0; | ||
let newPrice = 0; | ||
this.items.forEach((item) => { | ||
price += +(item.display.mappings.core?.price || 0) * item.quantity; | ||
// account for string prices, and floating 0s. | ||
newPrice = (newPrice * 100 + +(+((item.display.mappings.core?.price || 0) * 100) * item.quantity)) / 100 || 0; | ||
}); | ||
return price; | ||
return newPrice; | ||
} | ||
get msrp() { | ||
let price = 0; | ||
let newPrice = 0; | ||
this.items.forEach((item) => { | ||
price += (+(item.display.mappings.core?.msrp || 0) || +(item.display.mappings.core?.price || 0) || 0) * item.quantity; | ||
// account for string prices, and floating 0s. | ||
newPrice = | ||
(newPrice * 100 + | ||
+((+((item.display.mappings.core?.msrp || 0) * 100) || +((item.display.mappings.core?.price || 0) * 100) || 0) * item.quantity)) / | ||
100 || 0; | ||
}); | ||
return price; | ||
return newPrice; | ||
} | ||
@@ -39,0 +44,0 @@ addItems(items) { |
{ | ||
"name": "@searchspring/snap-store-mobx", | ||
"version": "0.58.2", | ||
"version": "0.58.3", | ||
"description": "Snap MobX Store", | ||
@@ -23,8 +23,8 @@ "main": "dist/cjs/index.js", | ||
"dependencies": { | ||
"@searchspring/snap-toolbox": "^0.58.2", | ||
"@searchspring/snap-toolbox": "^0.58.3", | ||
"mobx": "6.9.0" | ||
}, | ||
"devDependencies": { | ||
"@searchspring/snap-client": "^0.58.2", | ||
"@searchspring/snap-url-manager": "^0.58.2" | ||
"@searchspring/snap-client": "^0.58.3", | ||
"@searchspring/snap-url-manager": "^0.58.3" | ||
}, | ||
@@ -35,3 +35,3 @@ "sideEffects": false, | ||
], | ||
"gitHead": "4c7b492e09e8c0c20bbaa178ad9d3d4225a57ad2" | ||
"gitHead": "d46572dc3453d97aac5ebc3d6c2d41333539de2e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
372565
7055