@weareconceptstudio/account 0.0.9 → 0.1.0

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.
Files changed (44) hide show
  1. package/dist/AccountProvider.d.ts +2 -1
  2. package/dist/AccountProvider.js +3 -3
  3. package/dist/components/OrderDetails/index.js +7 -5
  4. package/dist/components/OrderedItems/index.d.ts +1 -2
  5. package/dist/components/OrderedItems/index.js +52 -43
  6. package/dist/components/OrderedItems/style.js +1 -0
  7. package/dist/components/OrdersList/OrderItem/index.js +6 -4
  8. package/dist/components/OrdersList/index.js +5 -4
  9. package/dist/components/TotalCheckout/index.js +2 -13
  10. package/dist/components/TotalCheckout/style.js +0 -25
  11. package/dist/components/cart/Items/Simple/Item/index.js +10 -10
  12. package/dist/components/cart/Items/Simple/ItemMobile/index.js +23 -19
  13. package/dist/components/cart/Items/Simple/index.js +12 -6
  14. package/dist/components/cart/Items/Simple/style.js +1 -0
  15. package/dist/components/ui/Sequence/index.js +1 -1
  16. package/dist/modules/address/AddressForm/style.js +1 -4
  17. package/dist/modules/address/AddressProvider.d.ts +2 -1
  18. package/dist/modules/address/AddressProvider.js +14 -11
  19. package/dist/modules/address/ShippingBillingForm/style.js +1 -4
  20. package/dist/modules/address/ShippingBillingInfo/index.js +6 -9
  21. package/dist/templates/CartTemplate/index.js +1 -2
  22. package/dist/templates/CheckoutTemplate/index.d.ts +1 -2
  23. package/dist/templates/CheckoutTemplate/index.js +18 -7
  24. package/dist/templates/CheckoutTemplate/style.js +0 -99
  25. package/dist/templates/OrderHistoryTemplate/index.d.ts +1 -5
  26. package/dist/templates/OrderHistoryTemplate/index.js +14 -3
  27. package/dist/templates/OrderIndividualTemplate/index.d.ts +3 -3
  28. package/dist/templates/OrderIndividualTemplate/index.js +19 -11
  29. package/dist/templates/OrderIndividualTemplate/style.d.ts +2 -2
  30. package/dist/templates/OrderIndividualTemplate/style.js +2 -2
  31. package/dist/templates/ThankYouTemplate/index.d.ts +3 -0
  32. package/dist/templates/ThankYouTemplate/index.js +25 -0
  33. package/dist/templates/ThankYouTemplate/style.d.ts +2 -0
  34. package/dist/templates/ThankYouTemplate/style.js +124 -0
  35. package/dist/templates/index.d.ts +1 -0
  36. package/dist/templates/index.js +3 -1
  37. package/dist/translations/en.d.ts +2 -0
  38. package/dist/translations/en.js +2 -0
  39. package/dist/translations/hy.d.ts +2 -0
  40. package/dist/translations/hy.js +2 -0
  41. package/dist/translations/index.d.ts +6 -0
  42. package/dist/translations/ru.d.ts +2 -0
  43. package/dist/translations/ru.js +2 -0
  44. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  export function useAccountContext(): any;
2
- export function AccountProvider({ fontFamily, shopUrl, children, maxQty, currency, addressType, addressFormFields }: {
2
+ export function AccountProvider({ fontFamily, shopUrl, children, maxQty, currency, addressType, addressFormFields, useUser }: {
3
3
  fontFamily?: string;
4
4
  shopUrl?: string;
5
5
  children: any;
@@ -7,5 +7,6 @@ export function AccountProvider({ fontFamily, shopUrl, children, maxQty, currenc
7
7
  currency: any;
8
8
  addressType: any;
9
9
  addressFormFields: any;
10
+ useUser: any;
10
11
  }): React.JSX.Element;
11
12
  import React from 'react';
@@ -14,13 +14,13 @@ export const useAccountContext = () => {
14
14
  const context = useContext(AccountContext);
15
15
  return context;
16
16
  };
17
- export const AccountProvider = ({ fontFamily = 'core_Font', shopUrl = '/', children, maxQty = 99, currency, addressType, addressFormFields }) => {
17
+ export const AccountProvider = ({ fontFamily = 'core_Font', shopUrl = '/', children, maxQty = 99, currency, addressType, addressFormFields, useUser }) => {
18
18
  const { addTranslation } = useTranslation();
19
19
  useEffect(() => {
20
20
  addTranslation(translations, 'prepend');
21
21
  }, []);
22
- return (React.createElement(AccountContext.Provider, { value: { currency, maxQty, shopUrl } },
23
- React.createElement(AddressProvider, { addressType: addressType, addressFormFields: addressFormFields },
22
+ return (React.createElement(AccountContext.Provider, { value: { currency, maxQty, shopUrl, useUser } },
23
+ React.createElement(AddressProvider, { addressType: addressType, addressFormFields: addressFormFields, useUser: useUser },
24
24
  React.createElement(ThemeProvider, { theme: theme },
25
25
  React.createElement(AccountVariables, { fontFamily: fontFamily }),
26
26
  React.createElement(AccountHelperClass, null),
@@ -4,8 +4,10 @@ import { Text, useTranslation } from '@weareconceptstudio/core';
4
4
  import { handlePriceCheckFunc, numToLocalString } from '../../utils/_functions';
5
5
  //* Style
6
6
  import OrderDetailsStyle from './style';
7
- const OrderDetails = memo(({ className, status, order_date, delivery_date, order_number, total_items, total_price, currency, shippingCost }) => {
7
+ import { useAccountContext } from '../../AccountProvider';
8
+ const OrderDetails = memo(({ className, status, date, delivery_date, orderNumber, itemsCount, total, shippingCost }) => {
8
9
  const { translate } = useTranslation();
10
+ const { currency } = useAccountContext();
9
11
  return (React.createElement(OrderDetailsStyle, { className: `${className || ''}` },
10
12
  React.createElement(Text, { className: `account-p account-p1 account-font-bold account-primary-color1`, text: 'orderDetails' }),
11
13
  React.createElement("div", { className: `info-space-line` }),
@@ -18,7 +20,7 @@ const OrderDetails = memo(({ className, status, order_date, delivery_date, order
18
20
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1` },
19
21
  translate('orderDate'),
20
22
  ":"),
21
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value`, text: order_date })),
23
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value`, text: date })),
22
24
  React.createElement("div", { className: `order-detail-item-wrap` },
23
25
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1` },
24
26
  translate('deliverDate'),
@@ -28,12 +30,12 @@ const OrderDetails = memo(({ className, status, order_date, delivery_date, order
28
30
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1` },
29
31
  translate('orderNumber'),
30
32
  ":"),
31
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value`, text: order_number })),
33
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value`, text: orderNumber })),
32
34
  React.createElement("div", { className: `order-detail-item-wrap` },
33
35
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1` },
34
36
  translate('totalItems'),
35
37
  ":"),
36
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value`, text: total_items })),
38
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value`, text: itemsCount })),
37
39
  React.createElement("div", { className: `order-detail-item-wrap` },
38
40
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1` },
39
41
  translate('shippingCost'),
@@ -43,6 +45,6 @@ const OrderDetails = memo(({ className, status, order_date, delivery_date, order
43
45
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1` },
44
46
  translate('totalPrice'),
45
47
  ":"),
46
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value` }, handlePriceCheckFunc(total_price, currency)))));
48
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 value` }, handlePriceCheckFunc(total, currency)))));
47
49
  });
48
50
  export default OrderDetails;
@@ -1,7 +1,6 @@
1
1
  export default OrderedItems;
2
- declare function OrderedItems({ data: items, status, currency }: {
2
+ declare function OrderedItems({ data: items, status }: {
3
3
  data: any;
4
4
  status: any;
5
- currency: any;
6
5
  }): React.JSX.Element;
7
6
  import React from 'react';
@@ -2,60 +2,69 @@ import React, { useMemo } from 'react';
2
2
  import { Image, Text, useUi } from '@weareconceptstudio/core';
3
3
  //* Utils
4
4
  import { handlePriceCheckFunc } from '../../utils/_functions';
5
+ import { useAccountContext } from '../../AccountProvider';
5
6
  //* Components
6
7
  import AccountButton from '../ui/AccountButton';
7
8
  //* Styles
8
9
  import OrderedItemsStyle from './style';
9
- const OrderedItems = ({ data: items, status, currency }) => {
10
+ // TODO: product url
11
+ const OrderedItems = ({ data: items, status }) => {
10
12
  const { winWidth } = useUi();
13
+ const { currency } = useAccountContext();
11
14
  //! Store order items
12
15
  const storeOrderedItems = useMemo(() => {
13
- return items.map((item, index) => winWidth >= 768 ? (React.createElement("div", { key: index, className: `item-wrap` },
14
- React.createElement("div", { className: `item-inner-wrapper` },
15
- React.createElement("div", { className: `col-item tl-col-1 col-item-1 first-col` },
16
- React.createElement("div", { className: `image-wrapper` },
17
- React.createElement(Image, { src: item.product?.images[0]?.src, alt: item.product?.images[0]?.alt })),
18
- React.createElement("div", { className: `col-1-right-wrap` },
19
- React.createElement(AccountButton, { url: item.product.url, className: `capitalize`, text: item.product.name, btnType: `green-large-text` }),
20
- React.createElement("div", { className: `right-first-item-wrap` },
16
+ return items?.length > 0
17
+ ? items.map((item, index) => winWidth >= 768 ? (React.createElement("div", { key: index, className: `item-wrap` },
18
+ React.createElement("div", { className: `item-inner-wrapper` },
19
+ React.createElement("div", { className: `col-item tl-col-1 col-item-1 first-col` },
20
+ React.createElement("div", { className: `image-wrapper` },
21
+ React.createElement(Image, { src: item.product.image.src, alt: item.product.image.alt })),
22
+ React.createElement("div", { className: `col-1-right-wrap` },
23
+ React.createElement(AccountButton, { text: item.product.name, btnType: `green-large-text`, className: `ordered-item-title`, url: `menu/${item.product.slug}` }),
24
+ item.color ? (React.createElement("div", { className: `right-first-item-wrap` },
25
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `color` }),
26
+ "\u00A0",
27
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 capitalize`, text: item.color }))) : (React.createElement("div", { className: `right-first-item-wrap` },
28
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.product.short_info_1 }))),
29
+ item.size ? (React.createElement("div", { className: `right-second-item-wrap` },
30
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `size` }),
31
+ "\u00A0",
32
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.size }))) : (React.createElement("div", { className: `right-second-item-wrap` },
33
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.product.short_info_2 }))))),
34
+ React.createElement("div", { className: `col-item tl-col-2` },
35
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.qty })),
36
+ React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` },
37
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right`, text: handlePriceCheckFunc(item.price, currency) })),
38
+ React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap price-block` },
39
+ React.createElement("div", { className: `col-item-inner-wrap` },
40
+ React.createElement("div", { className: `flex-end-wrap` },
41
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right`, text: handlePriceCheckFunc(item.total, currency) }))))))) : (React.createElement("div", { key: index, className: `mobile-order-item-wrap` },
42
+ React.createElement("div", { className: `mobile-order-item-inner-wrap` },
43
+ React.createElement("div", { className: `mobile-image-wrap` },
44
+ React.createElement(Image, { src: item.product.image.src, alt: item.product.image.alt })),
45
+ React.createElement("div", { className: `mobile-info-wrap` },
46
+ React.createElement(AccountButton, { text: item.product.name, btnType: `green-large-text`, url: `/menu/${item.product.slug}`, className: `ordered-item-mobile-title` }),
47
+ item.color ? (React.createElement("div", { className: `mobile-info-item` },
21
48
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `color` }),
22
49
  "\u00A0",
23
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 capitalize`, text: item.color })),
24
- React.createElement("div", { className: `right-second-item-wrap` },
50
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 capitalize`, text: item.color }))) : (React.createElement("div", { className: `mobile-info-item` },
51
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.product.short_info_1 }))),
52
+ item.size ? (React.createElement("div", { className: `mobile-info-item` },
25
53
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `size` }),
26
54
  "\u00A0",
27
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.size })))),
28
- React.createElement("div", { className: `col-item tl-col-2` },
29
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.quantity })),
30
- React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` },
31
- React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right`, text: handlePriceCheckFunc(item.price, currency) })),
32
- React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap price-block` },
33
- React.createElement("div", { className: `col-item-inner-wrap` },
34
- React.createElement("div", { className: `flex-end-wrap` },
35
- React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right`, text: handlePriceCheckFunc(item.total, currency) }))))))) : (React.createElement("div", { key: index, className: `mobile-order-item-wrap` },
36
- React.createElement("div", { className: `mobile-order-item-inner-wrap` },
37
- React.createElement("div", { className: `mobile-image-wrap` },
38
- React.createElement(Image, { src: item.product?.images[0]?.src, alt: item.product?.images[0]?.alt })),
39
- React.createElement("div", { className: `mobile-info-wrap` },
40
- React.createElement(AccountButton, { className: `capitalize`, text: item.product.name, btnType: `green-large-text`, url: `/shop/product/${item.product.url}` }),
41
- React.createElement("div", { className: `mobile-info-item` },
42
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `color` }),
43
- "\u00A0",
44
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 capitalize`, text: item.color })),
45
- React.createElement("div", { className: `mobile-info-item` },
46
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `size` }),
47
- "\u00A0",
48
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.size })),
49
- React.createElement("div", { className: `mobile-info-item` },
50
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `quantityWithSymbol` }),
51
- "\u00A0",
52
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.quantity })),
53
- React.createElement("div", { className: `mobile-price-wrap nowrap` },
54
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mb-mt`, text: `price` }),
55
- React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: handlePriceCheckFunc(item.price, currency) })),
56
- React.createElement("div", { className: `mobile-total-price-wrap nowrap` },
57
- React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mb-mt`, text: `total` }),
58
- React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: handlePriceCheckFunc(item.total, currency) })))))));
55
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.size }))) : (React.createElement("div", { className: `mobile-info-item` },
56
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.product.short_info_2 }))),
57
+ React.createElement("div", { className: `mobile-info-item` },
58
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `quantityWithSymbol` }),
59
+ "\u00A0",
60
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: item.qty })),
61
+ React.createElement("div", { className: `mobile-price-wrap nowrap` },
62
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mb-mt`, text: `price` }),
63
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: handlePriceCheckFunc(item.price, currency) })),
64
+ React.createElement("div", { className: `mobile-total-price-wrap nowrap` },
65
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mb-mt`, text: `total` }),
66
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: handlePriceCheckFunc(item.total, currency) })))))))
67
+ : null;
59
68
  }, [items, currency, winWidth, status]);
60
69
  return (React.createElement(OrderedItemsStyle, { className: `ordered-items-wrapper` },
61
70
  React.createElement(Text, { className: 'account-p account-p1 account-font-bold account-primary-color1 ', text: 'orderItems' }),
@@ -126,6 +126,7 @@ const OrderedItemsStyle = styled.div `
126
126
 
127
127
  .col-1-right-wrap {
128
128
  flex: 1;
129
+ overflow-wrap: anywhere;
129
130
  margin-left: var(--account_col1RightWrapML);
130
131
 
131
132
  .btn-wrap {
@@ -4,17 +4,19 @@ import { Text } from '@weareconceptstudio/core';
4
4
  import { handlePriceCheckFunc } from '../../../utils/_functions';
5
5
  //* Components
6
6
  import AccountButton from '../../ui/AccountButton';
7
+ import { useAccountContext } from '../../../AccountProvider';
7
8
  const OrderItem = Memo(({ data }) => {
9
+ const { currency } = useAccountContext();
8
10
  return (React.createElement("div", { className: `order-table-item-wrap` },
9
11
  React.createElement("div", { className: `col-item od-col-1 nowrap` },
10
- React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: data.order_date })),
12
+ React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: data.date })),
11
13
  React.createElement("div", { className: `col-item od-col-2` },
12
- React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: data.total_items })),
14
+ React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: data.itemsCount })),
13
15
  React.createElement("div", { className: `col-item od-col-3 nowrap` },
14
- React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: `ID ${data.order_number}` })),
16
+ React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: `ID ${data.orderNumber}` })),
15
17
  React.createElement("div", { className: `col-item od-col-4 nowrap` }, data.status === 'delivered' ? (React.createElement(Text, { className: `account-p account-p4 account-font-bold account-primary-color1 account-primary-color5-bg status-item delivered`, text: 'delivered' })) : data.status === 'canceled' ? (React.createElement(Text, { className: `account-p account-p4 account-font-bold account-error-color account-secondary-color7-bg status-item canceled`, text: 'canceled' })) : (React.createElement(Text, { className: `account-p account-p4 account-font-bold account-secondary-color1 account-secondary-color8-bg status-item in-progress`, text: 'inProgress' }))),
16
18
  React.createElement("div", { className: `col-item od-col-5 nowrap` },
17
- React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: handlePriceCheckFunc(data.total_price, data.currency) })),
19
+ React.createElement(Text, { className: `account-p account-p4 account-font-medium account-primary-color1`, text: handlePriceCheckFunc(data.total, currency) })),
18
20
  React.createElement("div", { className: `col-item od-col-6 nowrap` },
19
21
  React.createElement(AccountButton, { text: 'viewOrder', btnType: `green-small-text`, url: `/account/order-history/${data.id}` }))));
20
22
  });
@@ -8,6 +8,7 @@ import Pagination from '../ui/Pagination';
8
8
  import AccountButton from '../ui/AccountButton';
9
9
  //* Style
10
10
  import OrdersListStyle from './style';
11
+ // TODO: status change
11
12
  const OrdersList = ({ data, total, pageSize, router, pathname, searchParams }) => {
12
13
  const { translate } = useTranslation();
13
14
  const { winWidth } = useUi();
@@ -41,19 +42,19 @@ const OrdersList = ({ data, total, pageSize, router, pathname, searchParams }) =
41
42
  React.createElement("div", { className: `left-wrap` },
42
43
  React.createElement("div", { className: `left-item-wrap` },
43
44
  React.createElement(Text, { className: `account-p account-p4 account-font-bold account-primary-color1`, text: `${translate('orderDate')}:` }),
44
- React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: item.order_date })),
45
+ React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: item.date })),
45
46
  React.createElement("div", { className: `left-item-wrap last` },
46
47
  React.createElement(Text, { className: `account-p account-p4 account-font-bold account-primary-color1`, text: `${translate('orderNumber')}:` }),
47
- React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: `ID ${item.order_number}` }))),
48
+ React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: `ID ${item.orderNumber}` }))),
48
49
  React.createElement("div", { className: `right-wrap` }, item.status === 'delivered' ? (React.createElement(Text, { className: `account-p account-p4 account-font-bold account-primary-color1 account-primary-color5-bg status-item delivered`, text: 'delivered' })) : item.status === 'canceled' ? (React.createElement(Text, { className: `account-p account-p4 account-font-bold account-error-color account-secondary-color7-bg status-item canceled`, text: 'canceled' })) : (React.createElement(Text, { className: `account-p account-p4 account-font-bold account-secondary-color1 account-secondary-color8-bg status-item in-progress`, text: 'inProgress' })))),
49
50
  React.createElement("div", { className: `last-col-wrap` },
50
51
  React.createElement("div", { className: `left-wrap` },
51
52
  React.createElement("div", { className: `left-item-wrap` },
52
53
  React.createElement(Text, { className: `account-p account-p4 account-font-bold account-primary-color1`, text: `${translate('totalItems')}:` }),
53
- React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: item.total_items })),
54
+ React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: item.itemsCount })),
54
55
  React.createElement("div", { className: `left-item-wrap last` },
55
56
  React.createElement(Text, { className: `account-p account-p4 account-font-bold account-primary-color1`, text: `${translate('totalPrice')}:` }),
56
- React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: handlePriceCheckFunc(item.total_price, item.currency) }))),
57
+ React.createElement(Text, { className: `account-p account-p4 account-font-regular account-primary-color1 value`, text: handlePriceCheckFunc(item.total, item.currency) }))),
57
58
  React.createElement("div", { className: `right-wrap` },
58
59
  React.createElement(AccountButton, { text: 'viewOrder', btnType: `green-small-text`, url: `/account/order-history${item.id}` })))));
59
60
  })));
@@ -6,7 +6,7 @@ import AccountButton from '../ui/AccountButton';
6
6
  import { handlePriceCheckFunc, numToLocalString } from '../../utils/_functions';
7
7
  //* Style
8
8
  import TotalCheckoutStyle from './style';
9
- // TODO: Note
9
+ import { Input } from '@weareconceptstudio/form';
10
10
  const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, itemsCount, subtotal, total, shippingCost }) => {
11
11
  const { currency } = useAccountContext();
12
12
  //! States
@@ -26,18 +26,7 @@ const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, i
26
26
  React.createElement("div", { className: `od-item-wrap` },
27
27
  React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-total`, text: `total` }),
28
28
  React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1 sticky-wrap-currnecy2`, text: itemsCount ? handlePriceCheckFunc(total, currency) : `0 ${currency}` })),
29
- typeof isShipping === 'boolean' && !isShipping ? (
30
- // <Input.TextArea
31
- // value={note}
32
- // autoSize={{ minRows: 5, maxRows: 10 }}
33
- // onChange={(e) => setNote(e.target.value)}
34
- // placeholder={translate('checkoutCommentPlaceholder')}
35
- // className={`comment-field account-p account-p3 account-font-regular account-primary-color1`}
36
- // />
37
- React.createElement("div", { style: {
38
- textAlign: 'center',
39
- margin: '16px 0',
40
- }, className: 'account-p account-p3 account-font-regular account-primary-color1' }, "Input Filed Textarea")) : null,
29
+ typeof isShipping === 'boolean' && !isShipping ? (React.createElement(Input.TextArea, { onChange: (e) => setNote(e.target.value), placeholder: 'checkoutCommentPlaceholder', containerClassName: `comment-field`, className: `account-p account-p3 account-font-regular account-primary-color1` })) : null,
41
30
  React.createElement(AccountButton, { url: buttonProps.url, btnType: `full-width`, text: buttonProps.text, type: buttonProps.type, disabled: buttonProps.disabled, onClick: () => buttonProps.handleClick && buttonProps.handleClick(note), className: `sticky-wrap-btn ${buttonProps.disabled ? 'disabled' : ''}` })))))));
42
31
  });
43
32
  export default TotalCheckout;
@@ -49,32 +49,7 @@ const TotalCheckoutStyle = styled.section `
49
49
 
50
50
  .comment-field {
51
51
  width: 100%;
52
- height: var(--sp10x);
53
- padding: var(--account_commentPadding);
54
52
  margin-top: var(--account_commentMarginTop);
55
- vertical-align: top;
56
- border: 2px solid var(--account_primaryColor5);
57
- border-radius: var(--sp1x);
58
- background: transparent;
59
- -ms-overflow-style: none; /* IE and Edge */
60
- scrollbar-width: none;
61
-
62
- ::-webkit-scrollbar {
63
- display: none;
64
- }
65
-
66
- ::placeholder {
67
- color: var(--account_primaryColor3);
68
- opacity: 1;
69
- }
70
-
71
- :-ms-input-placeholder {
72
- color: var(--account_primaryColor3);
73
- }
74
-
75
- ::-ms-input-placeholder {
76
- color: var(--account_primaryColor3);
77
- }
78
53
  }
79
54
 
80
55
  .btn-wrap {
@@ -20,25 +20,25 @@ const Item = memo(({ data, remove, select, isLast, actions, maxQty, currency })
20
20
  React.createElement("div", { className: `item-inner-wrapper` },
21
21
  React.createElement("div", { className: `col-item tl-col-1 col-item-1` },
22
22
  React.createElement("div", { className: `image-wrapper` },
23
- React.createElement(Image, { src: data?.product?.image?.src, alt: data?.product?.image?.alt })),
23
+ React.createElement(Image, { src: data.product.image.src, alt: data.product.image.alt })),
24
24
  React.createElement("div", { className: `col-1-right-wrap` },
25
- React.createElement(Button, { url: data.product?.url, text: data.product?.name, btnType: `green-large-text`, className: `capitalize title-btn`, target: pathname === '/cart/' || pathname === '/checkout' ? '_blank' : '_self' }),
25
+ React.createElement(Button, { text: data.product.name, btnType: `green-large-text`, url: `/menu/${data.product.slug}`, className: `capitalize title-btn`, target: pathname === '/cart/' || pathname === '/checkout' ? '_blank' : '_self' }),
26
26
  React.createElement("div", { className: `right-first-item-wrap` },
27
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 capitalize`, text: data.product.short_info_1 })),
27
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1`, text: data.product.short_info_1 })),
28
28
  React.createElement("div", { className: `right-second-item-wrap` },
29
29
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: data.product.short_info_2 })))),
30
- React.createElement("div", { className: `col-item tl-col-2` }, select ? (React.createElement("div", { className: `select-and-out-of-stock-wrap` }, !data.product?.out_of_stock ? (React.createElement(Select, { allowSearch: false, options: selectionList, value: data.qty, onChange: (val) => actions.add({
31
- productId: data.product.id,
30
+ React.createElement("div", { className: `col-item tl-col-2` }, select ? (React.createElement("div", { className: `select-and-out-of-stock-wrap` }, !data.product?.out_of_stock ? (React.createElement(Select, { value: data.qty, allowSearch: false, options: selectionList, onChange: (val) => actions.add({
32
31
  qty: val,
32
+ productId: data.product.id,
33
33
  }) })) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.qty })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.qty }))),
34
- React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, data?.product?.sale_price ? (React.createElement("div", null,
35
- React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-price`, text: handlePriceCheckFunc(data?.product?.sale_price, currency) }),
36
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-price1`, text: handlePriceCheckFunc(data.product?.price, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-price2`, text: handlePriceCheckFunc(data.product?.price, currency) }))),
34
+ React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, data.product?.sale_price ? (React.createElement("div", null,
35
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-price`, text: handlePriceCheckFunc(data.product.sale_price, currency) }),
36
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-price1`, text: handlePriceCheckFunc(data.product.price, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-price2`, text: handlePriceCheckFunc(data.product.price, currency) }))),
37
37
  React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap` },
38
38
  React.createElement("div", { className: `col-item-inner-wrap` },
39
- React.createElement("div", { className: `flex-end-wrap` }, data?.product.sale_price ? (React.createElement("div", null,
39
+ React.createElement("div", { className: `flex-end-wrap` }, data.product?.sale_price ? (React.createElement("div", null,
40
40
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-total`, text: `${data.sale_total} ${currency}` }),
41
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: handlePriceCheckFunc(data.product?.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2`, text: `${data.total} ${currency}` }))),
41
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: handlePriceCheckFunc(data.product.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2`, text: `${data.total} ${currency}` }))),
42
42
  React.createElement("div", { className: `favorite-and-remove-wrap` }, remove && (React.createElement("div", { className: `remove-btn-wrap` },
43
43
  React.createElement(Button, { text: 'remove', btnType: `green-small-text`, className: 'cart-remove-btn', onClick: () => actions.delete({ productId: data.product?.id }) }))))))),
44
44
  isLast ? React.createElement("div", { className: 'line' }) : null));
@@ -5,7 +5,7 @@ import Button from '../../../../ui/AccountButton';
5
5
  import { handlePriceCheckFunc } from '../../../../../utils/_functions';
6
6
  //TODO: Fake
7
7
  const pathname = '/cart/';
8
- const ItemMobile = memo(({ data, remove, select, isLast, actions, maxQty, currency }) => {
8
+ const ItemMobile = memo(({ data, remove, select, actions, maxQty, currency }) => {
9
9
  const selectionList = useMemo(() => {
10
10
  if (select) {
11
11
  const selectList = [];
@@ -16,35 +16,39 @@ const ItemMobile = memo(({ data, remove, select, isLast, actions, maxQty, curren
16
16
  }
17
17
  }, [data, select, maxQty]);
18
18
  return (React.createElement(React.Fragment, null,
19
- isLast ? React.createElement("div", { className: 'line' }) : null,
20
19
  React.createElement("div", { className: `mobile-order-item-wrap` },
21
20
  React.createElement("div", { className: `mobile-order-item-inner-wrap` },
22
21
  React.createElement("div", { className: `mobile-image-wrap` },
23
- React.createElement(Image, { src: data?.images?.[0].src, alt: data?.images?.[0].alt })),
22
+ React.createElement(Image, { src: data.product.image.src, alt: data.product.image.alt })),
24
23
  React.createElement("div", { className: `mobile-info-wrap` },
25
- React.createElement(Button, { url: data.product?.url, btnType: `green-large-text`, text: data.product?.name || data.name, className: `capitalize mobile-info-wrap-title`, target: pathname === '/cart/' || pathname === '/checkout/' ? '_blank' : '_self' }),
26
- select ? (React.createElement("div", { className: `select-and-out-of-stock-mobile-wrap` }, !data.product?.out_of_stock ? (React.createElement(Select, { allowSearch: false, options: selectionList, value: data.qty, onChange: (val) => actions.add({
27
- productId: data.product.id,
24
+ React.createElement(Button, { text: data.product.name, btnType: `green-large-text`, url: `/menu/${data.product.slug}`, className: `capitalize mobile-info-wrap-title`, target: pathname === '/cart/' || pathname === '/checkout/' ? '_blank' : '_self' }),
25
+ React.createElement("div", { className: 'mobile-info-item' },
26
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 mobile-short-info1`, text: data.product.short_info_1 })),
27
+ React.createElement("div", { className: 'mobile-info-item' },
28
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 mobile-short-info2`, text: data.product.short_info_2 })),
29
+ select ? (React.createElement("div", { className: `select-and-out-of-stock-mobile-wrap` }, !data.product?.out_of_stock ? (React.createElement(Select, { value: data.qty, allowSearch: false, options: selectionList, onChange: (val) => actions.add({
28
30
  qty: val,
31
+ productId: data.product.id,
29
32
  }) })) : (React.createElement("div", { className: `mobile-info-item` },
30
- React.createElement(Text, { className: `account-p account-p3 account-font-medium primaryColor1`, text: `quantityWithSymbol` }),
33
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity-with-symbol`, text: `quantityWithSymbol` }),
31
34
  "\u00A0",
32
- React.createElement(Text, { className: `account-p account-p3 account-font-medium primaryColor1`, text: data.qty || data.quantity }))))) : (React.createElement("div", { className: `mobile-info-item` },
33
- React.createElement(Text, { className: `account-p account-p3 account-font-medium primaryColor1`, text: `quantityWithSymbol` }),
35
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity`, text: data.qty }))))) : (React.createElement("div", { className: `mobile-info-item` },
36
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity-with-symbol2`, text: `quantityWithSymbol` }),
34
37
  "\u00A0",
35
- React.createElement(Text, { className: `account-p account-p3 account-font-medium primaryColor1`, text: data.qty || data.quantity }))),
38
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity2`, text: data.qty }))),
36
39
  React.createElement("div", { className: `mobile-price-wrap nowrap` },
37
- React.createElement(Text, { className: `account-p account-p3 account-font-medium primaryColor1 mb-mt`, text: `price` }),
38
- data?.discountedPrice ? (React.createElement("div", null,
39
- React.createElement(Text, { className: `account-p account-p3 account-font-bold secondaryColor2`, text: handlePriceCheckFunc(data?.product.discountedPrice, currency) }),
40
- React.createElement(Text, { className: `account-p account-p3 account-font-regular primaryColor2 lineThrough value`, text: handlePriceCheckFunc(data.product?.price, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold primaryColor1`, text: handlePriceCheckFunc(data.product?.price, currency) }))),
40
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mb-mt mobile-price-title`, text: `price` }),
41
+ data.product?.sale_price ? (React.createElement("div", null,
42
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 mobile-discounted-price`, text: handlePriceCheckFunc(data.product.sale_price, currency) }),
43
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value mobile-price`, text: handlePriceCheckFunc(data.product.price, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 mobile-price2`, text: handlePriceCheckFunc(data.product.price, currency) }))),
41
44
  React.createElement("div", { className: `mobile-total-price-wrap nowrap` },
42
- React.createElement(Text, { className: `account-p account-p3 account-font-medium primaryColor1 mb-mt`, text: `total` }),
43
- data.selectedOption?.discountedPrice ? (React.createElement("div", null,
44
- React.createElement(Text, { className: `account-p account-p3 account-font-bold secondaryColor2`, text: handlePriceCheckFunc(data.product?.discountedPrice * data.qty, currency) }),
45
- React.createElement(Text, { className: `account-p account-p3 account-font-regular primaryColor2 lineThrough`, text: handlePriceCheckFunc(data.product?.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold primaryColor1`, text: handlePriceCheckFunc(data.product?.price * data.qty || data.total, currency || currency) }))))),
45
+ React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mb-mt mobile-total`, text: `total` }),
46
+ data.product?.sale_price ? (React.createElement("div", null,
47
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 mobile-total-discounted-price`, text: `${data.sale_total} ${currency}` }),
48
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through mobile-total-price`, text: handlePriceCheckFunc(data.product.price * data.qty, currency) }))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 mobile-total-price2`, text: `${data.total} ${currency}` }))))),
46
49
  pathname === '/cart/' && (React.createElement("div", { className: `edit-remove-favorite-mobile-wrap` },
47
- React.createElement("div", { className: `favorite-remove-mobile-wrap` }, remove && (React.createElement(Button, { text: 'remove', btnType: `green-small-text`, onClick: () => actions.delete({ productId: data.product?.id }) })))))),
50
+ React.createElement("div", { className: 'empty' }),
51
+ React.createElement("div", { className: `favorite-remove-mobile-wrap` }, remove && (React.createElement(Button, { text: 'remove', btnType: `green-small-text`, onClick: () => actions.delete({ productId: data.product.id }) })))))),
48
52
  React.createElement("div", { className: 'line' })));
49
53
  });
50
54
  export default ItemMobile;
@@ -4,10 +4,12 @@ import { Text, useUi } from '@weareconceptstudio/core';
4
4
  import Item from './Item';
5
5
  import ItemMobile from './ItemMobile';
6
6
  import Button from '../../../ui/AccountButton';
7
+ import { useAccountContext } from '../../../../AccountProvider';
7
8
  //* Style
8
9
  import CartItemsStyle from './style';
9
- const CartItems = memo(({ data, className, title, smallFontSize, additionalParameters, actions, currency, maxQty }) => {
10
+ const CartItems = memo(({ data, className, title, smallFontSize, additionalParameters, actions }) => {
10
11
  const { winWidth } = useUi();
12
+ const { maxQty, currency } = useAccountContext();
11
13
  //! Store
12
14
  const orderStore = useMemo(() => {
13
15
  return winWidth >= 768 ? (React.createElement("div", { className: `order-items-table-wrap` },
@@ -20,11 +22,15 @@ const CartItems = memo(({ data, className, title, smallFontSize, additionalParam
20
22
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 nowrap align-right`, text: `price` })),
21
23
  React.createElement("div", { className: `title-wrap tl-col-4 title-item` },
22
24
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 nowrap align-right`, text: `total` }))),
23
- React.createElement("div", { className: `items-wrap` }, data?.map((item, index) => {
24
- return (React.createElement(Item, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, isLast: data.length - 1 == index, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
25
- })))) : (React.createElement("div", { className: `mobile-order-items-table-wrap` }, data?.map((item, index) => {
26
- return (React.createElement(ItemMobile, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, isLast: data.length - 1 == index, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
27
- })));
25
+ React.createElement("div", { className: `items-wrap` }, data?.length > 0
26
+ ? data.map((item, index) => {
27
+ return (React.createElement(Item, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, isLast: data.length - 1 == index, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
28
+ })
29
+ : null))) : (React.createElement("div", { className: `mobile-order-items-table-wrap` }, data?.length > 0
30
+ ? data.map((item, index) => {
31
+ return (React.createElement(ItemMobile, { key: index, data: item, maxQty: maxQty, actions: actions, currency: currency, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item }));
32
+ })
33
+ : null));
28
34
  }, [winWidth, data, additionalParameters, currency, actions, maxQty]);
29
35
  return (React.createElement(CartItemsStyle, { className: className || '' },
30
36
  additionalParameters.edit.list ? (React.createElement("div", { className: `title-edit-wrapper` },
@@ -131,6 +131,7 @@ const CartItemsStyle = styled.section `
131
131
  .col-1-right-wrap {
132
132
  flex: 1;
133
133
  margin-left: var(--col1RightWrapML);
134
+ overflow-wrap: anywhere;
134
135
 
135
136
  .title-btn {
136
137
  a,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Icon, Text } from '@weareconceptstudio/core';
2
+ import { Text } from '@weareconceptstudio/core';
3
3
  //* Style
4
4
  import SequenceStyle from './style';
5
5
  //* Icons
@@ -16,16 +16,13 @@ const AddressFormStyle = styled.div `
16
16
  .form-wrapper {
17
17
  display: flex;
18
18
  flex-wrap: wrap;
19
+ row-gap: var(--account_antFormItemMTop);
19
20
  margin-left: calc(-1 * calc(var(--account_formItemDistance) / 2));
20
21
  margin-right: calc(-1 * calc(var(--account_formItemDistance) / 2));
21
22
 
22
23
  .form-item {
23
24
  width: var(--account_antFormItemWidth);
24
25
  padding: 0 calc(var(--account_formItemDistance) / 2);
25
-
26
- &:not(:nth-child(1), :nth-child(2)) {
27
- margin-top: var(--account_antFormItemMTop);
28
- }
29
26
  }
30
27
  }
31
28
 
@@ -1,7 +1,8 @@
1
1
  export function useAddressContext(): any;
2
- export function AddressProvider({ addressType, addressFormFields, children }: {
2
+ export function AddressProvider({ addressType, addressFormFields, useUser, children }: {
3
3
  addressType: any;
4
4
  addressFormFields?: any[];
5
+ useUser: any;
5
6
  children: any;
6
7
  }): React.JSX.Element;
7
8
  import React from 'react';
@@ -5,7 +5,8 @@ export const useAddressContext = () => {
5
5
  const context = useContext(AddressContext);
6
6
  return context;
7
7
  };
8
- export const AddressProvider = ({ addressType, addressFormFields = [], children }) => {
8
+ export const AddressProvider = ({ addressType, addressFormFields = [], useUser, children }) => {
9
+ const userContext = useUser();
9
10
  const [addresses, setAddresses] = useState(addressType ? { billing: [], shipping: [] } : []);
10
11
  const [selectedAddresses, setSelectedAddresses] = useState(addressType ? { billing: {}, shipping: {} } : {});
11
12
  const hasAddressType = useMemo(() => {
@@ -18,16 +19,18 @@ export const AddressProvider = ({ addressType, addressFormFields = [], children
18
19
  return !(addresses.length > 0);
19
20
  }, [hasAddressType, addresses]);
20
21
  useEffect(() => {
21
- api.get({ url: 'addresses' }).then((res) => {
22
- setAddresses(res.data);
23
- setSelectedAddresses(addressType
24
- ? {
25
- shipping: res.data[0],
26
- billing: res.data[0],
27
- }
28
- : res.data[0]);
29
- });
30
- }, []);
22
+ if (userContext.isLoggedIn) {
23
+ api.get({ url: 'addresses' }).then((res) => {
24
+ setAddresses(res.data);
25
+ setSelectedAddresses(addressType
26
+ ? {
27
+ shipping: res.data[0],
28
+ billing: res.data[0],
29
+ }
30
+ : res.data[0]);
31
+ });
32
+ }
33
+ }, [userContext.isLoggedIn]);
31
34
  const createAddress = async (data) => {
32
35
  return await api.post('addresses', data).then((res) => {
33
36
  setAddresses(res.data);