@weareconceptstudio/account 0.1.7 → 0.1.8

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.
@@ -1,12 +1,6 @@
1
1
  export default CartTemplate;
2
- declare function CartTemplate({ items, itemsCount, shippingCost, loading, children, subtotal, total, actions, btnDisabled, checkoutUrl }: {
3
- items: any;
4
- itemsCount: any;
5
- shippingCost: any;
6
- loading: any;
2
+ declare function CartTemplate({ children, actions, btnDisabled, checkoutUrl }: {
7
3
  children: any;
8
- subtotal: any;
9
- total: any;
10
4
  actions: any;
11
5
  btnDisabled: any;
12
6
  checkoutUrl?: string;
@@ -5,22 +5,15 @@ import { TotalCheckout, AccountButton } from '../../../components';
5
5
  import { useAccountContext } from '../../../AccountProvider';
6
6
  import AccountContainer from '../../../components/AccountContainer';
7
7
  //* SVG
8
- const leftArrow = (React.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 16 16' },
9
- React.createElement("rect", { width: '16', height: '16', fill: 'var(--account_primaryColor1)' }),
10
- React.createElement("g", { id: 'Murakami_shopping cart _11272024_v1' },
11
- React.createElement("rect", { width: '1920', height: '1663', transform: 'translate(-88 -132)', fill: 'var(--account_backgroundColor)' }),
12
- React.createElement("g", { id: 'Group 28943' },
13
- React.createElement("g", { id: 'Group 28946' })),
14
- React.createElement("g", { id: 'Frame 29201' },
15
- React.createElement("g", { id: '24x24_Arrow 10' },
16
- React.createElement("g", { id: 'Group 28934' },
17
- React.createElement("path", { id: 'Vector', d: 'M5.99192 8.01047L10.376 12.3945L9.38603 13.3845L5.00197 9.00042L5.99192 8.01047Z', fill: 'var(--account_primaryColor1)' }),
18
- React.createElement("path", { id: 'Vector_2', d: 'M4.99973 7.05105L9.38379 2.66699L10.3737 3.65694L5.98968 8.041L4.99973 7.05105Z', fill: 'var(--account_primaryColor1)' })))))));
8
+ const leftArrow = (React.createElement("svg", { fill: 'none', viewBox: '0 0 16 16', xmlns: 'http://www.w3.org/2000/svg' },
9
+ React.createElement("path", { d: 'M6.11061 7.98292L11.0193 12.8916L9.91087 14L5.00219 9.09133L6.11061 7.98292Z', fill: 'var(--account_primaryColor1)' }),
10
+ React.createElement("path", { d: 'M4.99977 6.90868L9.90845 2L11.0169 3.10841L6.10818 8.01709L4.99977 6.90868Z', fill: 'var(--account_primaryColor1)' })));
19
11
  //* Styles
20
12
  import CartTemplateStyle from './style';
21
- const CartTemplate = ({ items, itemsCount, shippingCost, loading, children, subtotal, total, actions, btnDisabled, checkoutUrl = '/checkout/' }) => {
22
- const { shopUrl } = useAccountContext();
13
+ const CartTemplate = ({ children, actions, btnDisabled, checkoutUrl = '/checkout/' }) => {
14
+ const { shopUrl, useCart } = useAccountContext();
23
15
  const { translate } = useTranslation();
16
+ const { items, itemsCount, shippingCost, loading, subtotal, total } = useCart();
24
17
  return (React.createElement(Page, { className: 'cart use-account' },
25
18
  React.createElement(AccountContainer, null,
26
19
  React.createElement(CartTemplateStyle, null,
@@ -28,7 +21,7 @@ const CartTemplate = ({ items, itemsCount, shippingCost, loading, children, subt
28
21
  url: checkoutUrl,
29
22
  disabled: btnDisabled,
30
23
  text: 'proceedToCheckout',
31
- } }, itemsCount > 0 ? (React.createElement(React.Fragment, null,
24
+ } }, !loading ? (itemsCount > 0 ? (React.createElement(React.Fragment, null,
32
25
  shopUrl ? (React.createElement(AccountButton, { url: shopUrl, btnType: `purple-text`, className: `back-to-shop` },
33
26
  leftArrow,
34
27
  translate('backToShop'))) : null,
@@ -38,7 +31,7 @@ const CartTemplate = ({ items, itemsCount, shippingCost, loading, children, subt
38
31
  horizontalLine: true,
39
32
  edit: { list: false },
40
33
  } }),
41
- shopUrl ? (React.createElement(AccountButton, { url: shopUrl, btnType: `purple-text`, text: `continueShopping`, className: `continue-shop-text` })) : null)) : (!loading && (React.createElement(EmptyCart, { data: items, shoppingUrl: shopUrl })))),
34
+ shopUrl ? (React.createElement(AccountButton, { url: shopUrl, btnType: `purple-text`, text: `continueShopping`, className: `continue-shop-text` })) : null)) : (React.createElement(EmptyCart, { data: items, shoppingUrl: shopUrl }))) : null),
42
35
  children))));
43
36
  };
44
37
  export default CartTemplate;
@@ -1,9 +1,3 @@
1
1
  export default CheckoutTemplate;
2
- declare function CheckoutTemplate({ itemsCount, items, total, subtotal, shippingCost }: {
3
- itemsCount: any;
4
- items: any;
5
- total: any;
6
- subtotal: any;
7
- shippingCost: any;
8
- }): React.JSX.Element;
2
+ declare function CheckoutTemplate(): React.JSX.Element;
9
3
  import React from 'react';
@@ -1,14 +1,17 @@
1
- import React, { useCallback, useRef, useState } from 'react';
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { api, Page } from '@weareconceptstudio/core';
3
3
  import { Sequence, TotalCheckout } from '../../../components';
4
4
  import { useAddressContext } from '../../address';
5
+ import { useAccountContext } from '../../../AccountProvider';
5
6
  import StepReview from './StepReview';
6
7
  import StepShipping from './StepShipping';
7
8
  import AccountContainer from '../../../components/AccountContainer';
8
9
  //* Styles
9
10
  import CheckoutTemplateStyle from './style';
10
- const CheckoutTemplate = ({ itemsCount, items, total, subtotal, shippingCost }) => {
11
+ const CheckoutTemplate = () => {
11
12
  const { checkoutAddressId } = useAddressContext();
13
+ const { useCart } = useAccountContext();
14
+ const { items, itemsCount, subtotal, total, shippingCost } = useCart();
12
15
  const [checkoutData, setCheckoutData] = useState({
13
16
  note: '',
14
17
  paymentType: 'cash_on_delivery',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weareconceptstudio/account",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Concept Studio Account",
5
5
  "author": "Concept Studio",
6
6
  "license": "ISC",