@open-tender/store 0.1.299 → 0.1.300

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.
@@ -12,7 +12,12 @@ var CartItem = function (_a) {
12
12
  var _e = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _e.cartItem, checkoutCartItem = _e.checkoutCartItem;
13
13
  var display_cals = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_cals;
14
14
  var increment = (0, react_1.useCallback)(function () { return dispatch((0, slices_1.incrementItemInCart)(item)); }, [item, dispatch]);
15
- var decrement = (0, react_1.useCallback)(function () { return dispatch((0, slices_1.decrementItemInCart)(item)); }, [dispatch, item]);
15
+ var decrement = (0, react_1.useCallback)(function () {
16
+ if (item.quantity === 1) {
17
+ dispatch((0, slices_1.showNotification)("".concat(item.name, " removed from cart")));
18
+ }
19
+ dispatch((0, slices_1.decrementItemInCart)(item));
20
+ }, [dispatch, item]);
16
21
  var remove = function () { return dispatch((0, slices_1.removeItemFromCart)(item)); };
17
22
  var edit = function () {
18
23
  dispatch((0, slices_1.setCurrentItem)(item));
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { useAppDispatch, useAppSelector } from '../app/hooks';
3
- import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskApi, selectKioskConfig, selectStoreSettings, setCurrentItem, toggleCartSummary } from '../slices';
3
+ import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskApi, selectKioskConfig, selectStoreSettings, setCurrentItem, showNotification, toggleCartSummary } from '../slices';
4
4
  import { default as QuantityContainer } from './Quantity';
5
5
  var CartItem = function (_a) {
6
6
  var item = _a.item, _b = _a.isLast, isLast = _b === void 0 ? false : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, _d = _a.isCheckout, isCheckout = _d === void 0 ? false : _d, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView;
@@ -9,7 +9,12 @@ var CartItem = function (_a) {
9
9
  var _e = useAppSelector(selectKioskConfig), config = _e.cartItem, checkoutCartItem = _e.checkoutCartItem;
10
10
  var display_cals = useAppSelector(selectStoreSettings).display_cals;
11
11
  var increment = useCallback(function () { return dispatch(incrementItemInCart(item)); }, [item, dispatch]);
12
- var decrement = useCallback(function () { return dispatch(decrementItemInCart(item)); }, [dispatch, item]);
12
+ var decrement = useCallback(function () {
13
+ if (item.quantity === 1) {
14
+ dispatch(showNotification("".concat(item.name, " removed from cart")));
15
+ }
16
+ dispatch(decrementItemInCart(item));
17
+ }, [dispatch, item]);
13
18
  var remove = function () { return dispatch(removeItemFromCart(item)); };
14
19
  var edit = function () {
15
20
  dispatch(setCurrentItem(item));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.1.299",
3
+ "version": "0.1.300",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",