merchi_cart 0.0.2-i → 0.0.2-m

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/lib/Cart.js CHANGED
@@ -37,5 +37,5 @@ function CartComponents() {
37
37
  _jsxs(_Fragment, { children: [_jsx(CartFooter, { children: _jsx(CartTotals, {}) }), _jsxs(CartFooter, { children: [_jsx(ButtonClearCart, {}), _jsx(ButtonBack, {}), _jsx(ButtonNextDynamic, {})] })] })] }))] }));
38
38
  }
39
39
  export default function Cart(props) {
40
- return (_jsx(CartProvider, __assign({}, props, { children: _jsxs(Provider, { store: store, children: [_jsx(CartComponents, {}), _jsx(CartHeader, {}), _jsx(CartAlert, {})] }) })));
40
+ return (_jsx(CartProvider, __assign({}, props, { children: _jsx(Provider, { store: store, children: _jsx(CartComponents, {}) }) })));
41
41
  }
package/lib/CartAlert.js CHANGED
@@ -8,8 +8,8 @@ import { useCartContext } from './CartProvider';
8
8
  function CartAlert() {
9
9
  var classNameBtnClose = useCartContext().classNameBtnClose;
10
10
  var alert = useSelector(function (s) { return s.stateCartAlert; }).alert;
11
- var icon = alert.icon, message = alert.message, show = alert.show, Title = alert.Title;
11
+ var icon = alert.icon, message = alert.message, show = alert.show, title = alert.title;
12
12
  return (_jsx(_Fragment, { children: show && (_jsxs(Alert, { alertType: alert.type, children: [icon &&
13
- _jsx(FontAwesomeIcon, { icon: icon }), " ", _jsx("strong", { children: Title }), " ", message, _jsx("button", { type: "button", className: classNameBtnClose, "data-bs-dismiss": "alert", "aria-label": "Close", onClick: closeAlert, children: _jsx(FontAwesomeIcon, { icon: faTimes }) })] })) }));
13
+ _jsx(FontAwesomeIcon, { icon: icon }), " ", _jsx("strong", { children: title }), " ", message, _jsx("button", { type: "button", className: classNameBtnClose, "data-bs-dismiss": "alert", "aria-label": "Close", onClick: closeAlert, children: _jsx(FontAwesomeIcon, { icon: faTimes }) })] })) }));
14
14
  }
15
15
  export default CartAlert;
@@ -3,9 +3,15 @@ import { useSelector } from 'react-redux';
3
3
  import { useCartContext } from '../CartProvider';
4
4
  export default function CartTabPanel(_a) {
5
5
  var children = _a.children, tabId = _a.tabId;
6
- var _b = useSelector(function (s) { return s; }).stateCart, activeTab = _b.activeTab, tabs = _b.tabs;
6
+ var _b = useSelector(function (s) { return s.stateCart; }), activeTab = _b.activeTab, tabs = _b.tabs;
7
7
  var classNameCartTabPanel = useCartContext().classNameCartTabPanel;
8
8
  var activeTabValues = tabs[activeTab];
9
- var display = tabId === activeTabValues.tabId ? 'block' : 'none';
9
+ var display = tabId === -1 && activeTab === -1
10
+ ? 'block'
11
+ : tabId === -2 && activeTab === -2
12
+ ? 'block'
13
+ : tabId === activeTabValues.tabId
14
+ ? 'block'
15
+ : 'none';
10
16
  return (_jsx("div", { className: classNameCartTabPanel, style: { display: display }, children: children }));
11
17
  }
@@ -9,14 +9,14 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useDispatch, useSelector } from 'react-redux';
14
14
  import { useForm } from 'react-hook-form';
15
15
  import InputsAddress from './InputsAddress';
16
16
  import { CheckoutContainer, InnerContainer, } from '../components/containers';
17
17
  import { Title } from '../components';
18
- import { updateCartShipmentAddress, } from '../store';
19
- import { sliceCartShipment } from '../slices/sliceCartShipment';
18
+ import { updateCartShipmentAddress, saveCartShipmentAddressAndGoToNextTab, } from '../store';
19
+ import { shipmentFormId, sliceCartShipment } from '../slices/sliceCartShipment';
20
20
  import { faMapMarkerAlt } from '@fortawesome/free-solid-svg-icons';
21
21
  import { useCartContext } from '../CartProvider';
22
22
  var AddressGeoSuggestInput = function (props) { return (_jsx(InputsAddress, __assign({}, props, { name: 'receiverAddress' }))); };
@@ -54,6 +54,6 @@ export function ActiveFormShipmentAddressAndNotes() {
54
54
  updateShipmentAddress(address));
55
55
  updateCartShipmentAddress();
56
56
  }
57
- return (_jsx(_Fragment, {}));
57
+ return (_jsx(FormShipmentAddressAndNotes, { address: receiverAddress, addressFieldsOpen: addressFieldsOpen, formId: shipmentFormId, notes: receiverNotes, setCartShipmentAddress: saveCartShipmentAddressAndGoToNextTab, toggleAddressFields: toggleAddressFieldsOpen, updateCartShipmentAddress: actionUpdateCartShipmentAddress }));
58
58
  }
59
59
  export default FormShipmentAddressAndNotes;
@@ -1,17 +1,20 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useSelector } from 'react-redux';
3
3
  import { faTruck } from '@fortawesome/free-solid-svg-icons';
4
+ import { ActiveFormShipmentAddressAndNotes } from '../forms/FormShipmentAddressAndNotes';
4
5
  import { CheckoutContainer, InnerContainer, } from '../components/containers';
5
- import { Alert, CartBody, CartTabPanel, LoadingTemplateSm, Title, } from '../components';
6
+ import { Alert, CartBody, CartTabPanel, LoadingTemplateSm, ShipmentGroupCard, Title, } from '../components';
6
7
  import { tabIdShipment } from '../slices/sliceCart';
7
8
  import CartNav from '../tabs/CartNav';
8
9
  function PanelCartShipment() {
9
- var _a = useSelector(function (s) { return s; }).stateCartShipment, fetchingShipmentGroups = _a.fetchingShipmentGroups, shipmentGroups = _a.shipmentGroups;
10
- return (_jsxs(CartTabPanel, { tabId: tabIdShipment, children: [_jsx(CartNav, {}), _jsx(CartBody, { style: { paddingTop: '2rem' }, children: _jsxs("div", { className: 'merchi-cart-tab-content', children: [_jsx(CheckoutContainer, { textAlign: 'left', children: _jsx(InnerContainer, { width: 700, paddingBottom: '3rem', children: _jsx(_Fragment, {}) }) }), fetchingShipmentGroups ? (_jsx(CheckoutContainer, { children: _jsxs(InnerContainer, { width: 700, children: [_jsx(LoadingTemplateSm, {}), _jsx("p", { children: "Fetching shipping options." })] }) })) : (_jsxs(_Fragment, { children: [_jsx(CheckoutContainer, { textAlign: 'left', children: _jsx(InnerContainer, { paddingBottom: '1rem', width: 700, children: _jsx(Title, { icon: faTruck, title: shipmentGroups.length > 1 ?
10
+ var _a = useSelector(function (s) { return s.stateCartShipment; }), fetchingShipmentGroups = _a.fetchingShipmentGroups, shipmentGroups = _a.shipmentGroups;
11
+ return (_jsxs(CartTabPanel, { tabId: tabIdShipment, children: [_jsx(CartNav, {}), _jsx(CartBody, { style: { paddingTop: '2rem' }, children: _jsxs("div", { className: 'merchi-cart-tab-content', children: [_jsx(CheckoutContainer, { textAlign: 'left', children: _jsx(InnerContainer, { width: 700, paddingBottom: '3rem', children: _jsx(ActiveFormShipmentAddressAndNotes, {}) }) }), fetchingShipmentGroups ? (_jsx(CheckoutContainer, { children: _jsxs(InnerContainer, { width: 700, children: [_jsx(LoadingTemplateSm, {}), _jsx("p", { children: "Fetching shipping options." })] }) })) : (_jsxs(_Fragment, { children: [_jsx(CheckoutContainer, { textAlign: 'left', children: _jsx(InnerContainer, { paddingBottom: '1rem', width: 700, children: _jsx(Title, { icon: faTruck, title: shipmentGroups.length > 1 ?
11
12
  'Select shipment methods'
12
13
  : shipmentGroups.length ?
13
14
  'Select a shipment method'
14
15
  : '' }) }) }), _jsx(CheckoutContainer, { textAlign: 'left', children: _jsxs(InnerContainer, { paddingBottom: '1rem', width: 700, children: [shipmentGroups.length > 1 &&
15
- _jsx(Alert, { alertType: 'warning', children: "Items within this cart are warehoused in different locations and will be shipped separately. Please select how you would like your items to be shipped." }), _jsx(_Fragment, {})] }) })] }))] }) })] }));
16
+ _jsx(Alert, { alertType: 'warning', children: "Items within this cart are warehoused in different locations and will be shipped separately. Please select how you would like your items to be shipped." }), shipmentGroups.map(function (group, index) {
17
+ return _jsx(ShipmentGroupCard, { group: group, groupIndex: index }, "".concat(index, "-shipment-group"));
18
+ })] }) })] }))] }) })] }));
16
19
  }
17
20
  export default PanelCartShipment;
@@ -6,7 +6,7 @@ export var sliceCartAlert = createSlice({
6
6
  icon: faInfoCircle,
7
7
  message: '',
8
8
  show: false,
9
- Title: '',
9
+ title: '',
10
10
  type: 'info',
11
11
  },
12
12
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_cart",
3
- "version": "0.0.2-i",
3
+ "version": "0.0.2-m",
4
4
  "description": "Merchi's cart",
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.tsx",