@techstuff-dev/foundation-api-utils 2.3.0 → 2.3.1
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/dist/cjs/chunks/{shared-CdwWllrh.js → shared-Dg7JQIWA.js} +2 -2
- package/dist/cjs/chunks/{shared-CdwWllrh.js.map → shared-Dg7JQIWA.js.map} +1 -1
- package/dist/cjs/chunks/{slice-Dpwqdz65.js → slice-CJ4WSj5p.js} +9 -4
- package/dist/cjs/chunks/{slice-Dpwqdz65.js.map → slice-CJ4WSj5p.js.map} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/store/index.native.js +2 -2
- package/dist/cjs/store/index.web.js +2 -2
- package/dist/esm/chunks/{shared-PYY2b9oT.js → shared-CztMTb2m.js} +2 -2
- package/dist/esm/chunks/{shared-PYY2b9oT.js.map → shared-CztMTb2m.js.map} +1 -1
- package/dist/esm/chunks/{slice-BD3oWPrI.js → slice-_b4ee7tw.js} +9 -4
- package/dist/esm/chunks/{slice-BD3oWPrI.js.map → slice-_b4ee7tw.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/store/index.native.js +2 -2
- package/dist/esm/store/index.web.js +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var toolkit = require('@reduxjs/toolkit');
|
|
4
|
-
var slice = require('./slice-
|
|
4
|
+
var slice = require('./slice-CJ4WSj5p.js');
|
|
5
5
|
var slice$1 = require('./slice-CkWobkWw.js');
|
|
6
6
|
|
|
7
7
|
// This file exists just so TypeScript has a module at ./store for IDEs/build.
|
|
@@ -11,4 +11,4 @@ var slice$1 = require('./slice-CkWobkWw.js');
|
|
|
11
11
|
const rootReducer = toolkit.combineSlices(slice.cartSlice, slice$1.authSlice, slice.authApi, slice.contentApi, slice.paymentApi, slice.productsApi, slice.ordersApi);
|
|
12
12
|
|
|
13
13
|
exports.rootReducer = rootReducer;
|
|
14
|
-
//# sourceMappingURL=shared-
|
|
14
|
+
//# sourceMappingURL=shared-Dg7JQIWA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-
|
|
1
|
+
{"version":3,"file":"shared-Dg7JQIWA.js","sources":["../../../lib/store/shared.ts"],"sourcesContent":[null],"names":["combineSlices","cartSlice","authSlice","authApi","contentApi","paymentApi","productsApi","ordersApi"],"mappings":";;;;;;AAAA;AACA;AAUA;AAEA;MACa,WAAW,GAAGA,qBAAa,CACtCC,eAAS,EACTC,iBAAS,EACTC,aAAO,EACPC,gBAAU,EACVC,gBAAU,EACVC,iBAAW,EACXC,eAAS;;;;"}
|
|
@@ -6549,10 +6549,13 @@ const cartSlice = toolkit.createSlice({
|
|
|
6549
6549
|
},
|
|
6550
6550
|
addToCart: (state, action) => {
|
|
6551
6551
|
const { options, item } = action.payload;
|
|
6552
|
-
const
|
|
6552
|
+
const price = Number(options?.selectedPrice) || 0;
|
|
6553
|
+
const currentNetTotal = Number(state.netTotal) || 0;
|
|
6554
|
+
const newTotal = currentNetTotal + price;
|
|
6553
6555
|
const taxAmount = newTotal * (state.taxRate.percentage / 100);
|
|
6554
6556
|
const grossTotal = newTotal + taxAmount;
|
|
6555
|
-
const
|
|
6557
|
+
const sanitizedOptions = { ...options, selectedPrice: price };
|
|
6558
|
+
const addItem = item ? { ...item, options: sanitizedOptions } : null;
|
|
6556
6559
|
if (!addItem) {
|
|
6557
6560
|
return state;
|
|
6558
6561
|
}
|
|
@@ -6576,7 +6579,9 @@ const cartSlice = toolkit.createSlice({
|
|
|
6576
6579
|
},
|
|
6577
6580
|
removeFromCart: (state, action) => {
|
|
6578
6581
|
const { id, price } = action.payload;
|
|
6579
|
-
const
|
|
6582
|
+
const sanitizedPrice = Number(price) || 0;
|
|
6583
|
+
const currentNetTotal = Number(state.netTotal) || 0;
|
|
6584
|
+
const newTotal = currentNetTotal - sanitizedPrice;
|
|
6580
6585
|
const taxAmount = newTotal * (state.taxRate.percentage / 100);
|
|
6581
6586
|
const grossTotal = newTotal + taxAmount;
|
|
6582
6587
|
return {
|
|
@@ -6703,4 +6708,4 @@ exports.useUpdateUserMutation = useUpdateUserMutation;
|
|
|
6703
6708
|
exports.useVerifyUserAttributesQuery = useVerifyUserAttributesQuery;
|
|
6704
6709
|
exports.useVerifyUserQuery = useVerifyUserQuery;
|
|
6705
6710
|
exports.useVerifyUserResendQuery = useVerifyUserResendQuery;
|
|
6706
|
-
//# sourceMappingURL=slice-
|
|
6711
|
+
//# sourceMappingURL=slice-CJ4WSj5p.js.map
|