@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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var slice = require('./chunks/slice-Dpwqdz65.js');
3
+ var slice = require('./chunks/slice-CJ4WSj5p.js');
4
4
  var slice$1 = require('./chunks/slice-CkWobkWw.js');
5
5
  var useAuth = require('./chunks/useAuth-DKhvUX_r.js');
6
6
  require('aws-amplify');
@@ -2,8 +2,8 @@
2
2
 
3
3
  var toolkit = require('@reduxjs/toolkit');
4
4
  var storage = require('@react-native-async-storage/async-storage');
5
- var slice = require('../chunks/slice-Dpwqdz65.js');
6
- var shared = require('../chunks/shared-CdwWllrh.js');
5
+ var slice = require('../chunks/slice-CJ4WSj5p.js');
6
+ var shared = require('../chunks/shared-Dg7JQIWA.js');
7
7
  require('aws-amplify');
8
8
  require('../chunks/slice-CkWobkWw.js');
9
9
  require('react-redux');
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var toolkit = require('@reduxjs/toolkit');
4
- var slice = require('../chunks/slice-Dpwqdz65.js');
5
- var shared = require('../chunks/shared-CdwWllrh.js');
4
+ var slice = require('../chunks/slice-CJ4WSj5p.js');
5
+ var shared = require('../chunks/shared-Dg7JQIWA.js');
6
6
  require('aws-amplify');
7
7
  require('../chunks/slice-CkWobkWw.js');
8
8
  require('react-redux');
@@ -1,5 +1,5 @@
1
1
  import { combineSlices } from '@reduxjs/toolkit';
2
- import { A as cartSlice, a as authApi, c as contentApi, p as paymentApi, b as productsApi, o as ordersApi } from './slice-BD3oWPrI.js';
2
+ import { A as cartSlice, a as authApi, c as contentApi, p as paymentApi, b as productsApi, o as ordersApi } from './slice-_b4ee7tw.js';
3
3
  import { a as authSlice } from './slice-ChJ8ZvmP.js';
4
4
 
5
5
  // This file exists just so TypeScript has a module at ./store for IDEs/build.
@@ -9,4 +9,4 @@ import { a as authSlice } from './slice-ChJ8ZvmP.js';
9
9
  const rootReducer = combineSlices(cartSlice, authSlice, authApi, contentApi, paymentApi, productsApi, ordersApi);
10
10
 
11
11
  export { rootReducer as r };
12
- //# sourceMappingURL=shared-PYY2b9oT.js.map
12
+ //# sourceMappingURL=shared-CztMTb2m.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-PYY2b9oT.js","sources":["../../../lib/store/shared.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;AACA;AAUA;AAEA;MACa,WAAW,GAAG,aAAa,CACtC,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS;;;;"}
1
+ {"version":3,"file":"shared-CztMTb2m.js","sources":["../../../lib/store/shared.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;AACA;AAUA;AAEA;MACa,WAAW,GAAG,aAAa,CACtC,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS;;;;"}
@@ -6547,10 +6547,13 @@ const cartSlice = createSlice({
6547
6547
  },
6548
6548
  addToCart: (state, action) => {
6549
6549
  const { options, item } = action.payload;
6550
- const newTotal = state.netTotal + options.selectedPrice;
6550
+ const price = Number(options?.selectedPrice) || 0;
6551
+ const currentNetTotal = Number(state.netTotal) || 0;
6552
+ const newTotal = currentNetTotal + price;
6551
6553
  const taxAmount = newTotal * (state.taxRate.percentage / 100);
6552
6554
  const grossTotal = newTotal + taxAmount;
6553
- const addItem = item ? { ...item, options } : null;
6555
+ const sanitizedOptions = { ...options, selectedPrice: price };
6556
+ const addItem = item ? { ...item, options: sanitizedOptions } : null;
6554
6557
  if (!addItem) {
6555
6558
  return state;
6556
6559
  }
@@ -6574,7 +6577,9 @@ const cartSlice = createSlice({
6574
6577
  },
6575
6578
  removeFromCart: (state, action) => {
6576
6579
  const { id, price } = action.payload;
6577
- const newTotal = state.netTotal - price;
6580
+ const sanitizedPrice = Number(price) || 0;
6581
+ const currentNetTotal = Number(state.netTotal) || 0;
6582
+ const newTotal = currentNetTotal - sanitizedPrice;
6578
6583
  const taxAmount = newTotal * (state.taxRate.percentage / 100);
6579
6584
  const grossTotal = newTotal + taxAmount;
6580
6585
  return {
@@ -6621,4 +6626,4 @@ const selectCartItemsIds = createSelector$1([selectMediaInCart], (items) => {
6621
6626
  cartSlice.reducer;
6622
6627
 
6623
6628
  export { formatPress as $, cartSlice as A, setTaxRate as B, resetTaxRate as C, setPromoCode as D, removePromoCode as E, addToCart as F, updateCart as G, removeFromCart as H, emptyCart as I, toggleCart as J, selectMediaInCart as K, selectCartTotal as L, selectCartNetTotal as M, selectCartTaxRate as N, selectCartTaxAmount as O, selectCartCount as P, selectCartStatus as Q, selectPromoCode as R, selectCartItems as S, selectCartItemsIds as T, formatUserPayload as U, formatPromos as V, formatWorkout as W, formatShortform as X, formatFaqs as Y, formatPages as Z, formatSettings as _, authApi as a, formatGuests as a0, formatVideos as a1, formatSections as a2, formatSchedule as a3, formatChallenges as a4, formatChallengeDays as a5, formatSecondsToISO8601Duration as a6, formatAuthSession as a7, formatFedaratedSession as a8, formatSocialAuthSession as a9, formatConfig as aa, formatSectionPanels as ab, formatSectionItems as ac, formatTaxonomies as ad, formatSeries as ae, formatSeasons as af, formatLongform as ag, formatMediaItem as ah, isWeb as ai, isReactNative as aj, getPlatform as ak, runOnPlatform as al, onlyUnique as am, applyCoupon as an, applyTax as ao, toCamelCaseObject as ap, createUnwrappingBaseQuery as aq, productsApi as b, contentApi as c, useResetPasswordAuthMutation as d, useRegisterMutation as e, useVerifyUserQuery as f, useLazyVerifyUserQuery as g, useGetUserInfoQuery as h, useLazyGetUserInfoQuery as i, useUpdateUserInfoMutation as j, useForgottenPasswordMutation as k, useVerifyUserAttributesQuery as l, useLazyVerifyUserAttributesQuery as m, useVerifyUserResendQuery as n, ordersApi as o, paymentApi as p, useLazyVerifyUserResendQuery as q, useUpdateUserMutation as r, useGetProductsQuery as s, useLazyGetProductsQuery as t, useResetPasswordMutation as u, usePurchaseProductMutation as v, useFetchOrdersQuery as w, useLazyFetchOrdersQuery as x, useGetOrdersQuery as y, useGetOrderQuery as z };
6624
- //# sourceMappingURL=slice-BD3oWPrI.js.map
6629
+ //# sourceMappingURL=slice-_b4ee7tw.js.map