merchi_cart 0.0.3-b → 0.0.3-d
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 +2 -1
- package/lib/index.js +1 -1
- package/lib/panels/PanelClientCheckout.js +6 -7
- package/lib/store.js +3 -4
- package/package.json +1 -1
package/lib/Cart.js
CHANGED
|
@@ -15,6 +15,7 @@ import { Provider, useSelector } from 'react-redux';
|
|
|
15
15
|
import { store } from './store';
|
|
16
16
|
import CartAlert from './CartAlert';
|
|
17
17
|
import CartHeader from './CartHeader';
|
|
18
|
+
import CartNav from './tabs/CartNav';
|
|
18
19
|
import CartTotals from './CartTotals';
|
|
19
20
|
import CartProvider, { useCartContext } from './CartProvider';
|
|
20
21
|
import { ButtonBack, ButtonClearCart, ButtonNextDynamic, } from './buttons';
|
|
@@ -34,7 +35,7 @@ function CartComponents() {
|
|
|
34
35
|
initMerchiCart(domainId);
|
|
35
36
|
}
|
|
36
37
|
}, [domainId, includeTheme, initialiseCart]);
|
|
37
|
-
return (_jsxs(_Fragment, { children: [_jsx(CartHeader, {}), _jsx(CartAlert, {}), fetchingCart ? (_jsx(LoadingTemplate, {})) : cartSettingsInvalid ? (_jsx(CartPaymentSettingsInvalid, {})) : (_jsxs("div", { className: 'merchi-tab-pane', children: [_jsx(PanelClearCart, {}), _jsx(PanelEditCartItem, {}), _jsx(PanelCartItems, {}), _jsx(PanelCartShipment, {}), _jsx(PanelClientCheckout, {}), _jsx(PanelPaymentSuccess, {}), ![tabIdItem, tabIdClearCart, tabIdPaymentSuccess].includes(activeTab) &&
|
|
38
|
+
return (_jsxs(_Fragment, { children: [_jsx(CartHeader, {}), _jsx(CartAlert, {}), _jsx(CartNav, {}), fetchingCart ? (_jsx(LoadingTemplate, {})) : cartSettingsInvalid ? (_jsx(CartPaymentSettingsInvalid, {})) : (_jsxs("div", { className: 'merchi-tab-pane', children: [_jsx(PanelClearCart, {}), _jsx(PanelEditCartItem, {}), _jsx(PanelCartItems, {}), _jsx(PanelCartShipment, {}), _jsx(PanelClientCheckout, {}), _jsx(PanelPaymentSuccess, {}), ![tabIdItem, tabIdClearCart, tabIdPaymentSuccess].includes(activeTab) &&
|
|
38
39
|
_jsxs(_Fragment, { children: [_jsx(CartFooter, { children: _jsx(CartTotals, {}) }), _jsxs(CartFooter, { children: [_jsx(ButtonClearCart, {}), _jsx(ButtonBack, {}), _jsx(ButtonNextDynamic, {})] })] })] }))] }));
|
|
39
40
|
}
|
|
40
41
|
export default function Cart(props) {
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Cart from './Cart';
|
|
2
|
-
import { getMerchiCart, getMerchiCartValues, isMerchiCartFetching, } from './store';
|
|
2
|
+
import { actionGetMerchiCart as getMerchiCart, getMerchiCartValues, isMerchiCartFetching, } from './store';
|
|
3
3
|
export { getMerchiCart, getMerchiCartValues, isMerchiCartFetching, };
|
|
4
4
|
export default Cart;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
3
|
import { tabIdCheckout } from '../slices/sliceCart';
|
|
4
|
-
import CartNav from '../tabs/CartNav';
|
|
5
4
|
import { CheckoutContainer, InnerContainer, } from '../components/containers';
|
|
6
5
|
import CartClient from '../components/CartClient';
|
|
7
6
|
import CartShipment from '../components/CartShipment';
|
|
@@ -15,11 +14,11 @@ function PanelClientCheckout() {
|
|
|
15
14
|
var _a = useSelector(function (s) { return s.stateCart; }), cart = _a.cart, needsShipping = _a.needsShipping;
|
|
16
15
|
var client = cart.client, domain = cart.domain;
|
|
17
16
|
var company = domain && domain.company;
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
return (_jsx(CartTabPanel, { tabId: tabIdCheckout, children: _jsx(CartBody, { style: { paddingTop: '2rem' }, children: client && client.id > -1 ?
|
|
18
|
+
_jsxs(_Fragment, { children: [_jsx(CheckoutContainer, { children: _jsx(InnerContainer, { paddingBottom: '3rem', children: _jsx(CartClient, { client: client }) }) }), needsShipping &&
|
|
19
|
+
_jsx(CheckoutContainer, { children: _jsx(InnerContainer, { paddingBottom: '3rem', children: _jsx(CartShipment, { cart: cart }) }) }), Boolean(company) && company.acceptSquare &&
|
|
20
|
+
_jsx(CheckoutContainer, { children: _jsx(InnerContainer, { paddingBottom: '3rem', children: _jsx(FormSquarePayment, {}) }) }), _jsx(CheckoutContainer, { children: _jsx(InnerContainer, { children: _jsx(FormStripePayment, {}) }) })] })
|
|
21
|
+
:
|
|
22
|
+
_jsxs(_Fragment, { children: [_jsx(CheckoutContainer, { children: _jsxs(InnerContainer, { paddingBottom: '3rem', children: [_jsx(Title, { icon: faUserPlus, Title: 'Checkout as new customer' }), _jsx(FormNewCustomer, {})] }) }), _jsx(CheckoutContainer, { children: _jsxs(InnerContainer, { paddingBottom: '3rem', children: [_jsx(Title, { icon: faUserTag, Title: 'Checkout as returning customer' }), _jsx(FormReturningCustomer, {})] }) })] }) }) }));
|
|
24
23
|
}
|
|
25
24
|
export default PanelClientCheckout;
|
package/lib/store.js
CHANGED
|
@@ -148,7 +148,6 @@ function cartAndCookie(domainId) {
|
|
|
148
148
|
return __awaiter(this, void 0, void 0, function () {
|
|
149
149
|
var cart;
|
|
150
150
|
return __generator(this, function (_a) {
|
|
151
|
-
console.log(domainId, 'what is this thing in cartAndCookie');
|
|
152
151
|
cart = makeCart({ domain: { id: domainId } }, true);
|
|
153
152
|
return [2 /*return*/, cart.create({ embed: cartEmbed })
|
|
154
153
|
.then(function (c) {
|
|
@@ -483,7 +482,7 @@ function getCart(domainId, cartIdAndToken) {
|
|
|
483
482
|
createAndSetNewCartCookie(domainId);
|
|
484
483
|
});
|
|
485
484
|
}
|
|
486
|
-
export function
|
|
485
|
+
export function actionGetMerchiCart(domainId) {
|
|
487
486
|
return __awaiter(this, void 0, void 0, function () {
|
|
488
487
|
var cartIdAndToken;
|
|
489
488
|
return __generator(this, function (_a) {
|
|
@@ -545,9 +544,9 @@ export function doCartComplete() {
|
|
|
545
544
|
}
|
|
546
545
|
export function initMerchiCart(domainId) {
|
|
547
546
|
dispatch(setDomainId(domainId));
|
|
548
|
-
|
|
547
|
+
actionGetMerchiCart(domainId);
|
|
549
548
|
if (window && window !== undefined) {
|
|
550
|
-
window.getCart = function () { return
|
|
549
|
+
window.getCart = function () { return actionGetMerchiCart(domainId); };
|
|
551
550
|
window.isMerchiCartFetching = isMerchiCartFetching;
|
|
552
551
|
window.getMerchiCartValues = getMerchiCartValues;
|
|
553
552
|
}
|