@weareconceptstudio/account 0.0.3 → 0.0.4

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 (64) hide show
  1. package/dist/AccountProvider.d.ts +7 -0
  2. package/dist/AccountProvider.js +27 -0
  3. package/dist/components/AddressForm/index.js +10 -7
  4. package/dist/components/AddressItem/index.d.ts +10 -1
  5. package/dist/components/AddressItem/index.js +6 -6
  6. package/dist/components/AddressWrap/index.d.ts +7 -0
  7. package/dist/components/AddressWrap/index.js +24 -0
  8. package/dist/components/EmptyAddress/index.d.ts +3 -0
  9. package/dist/components/EmptyAddress/index.js +6 -0
  10. package/dist/components/FavoriteButton/index.d.ts +3 -0
  11. package/dist/components/FavoriteButton/index.js +42 -0
  12. package/dist/components/TotalCheckout/index.js +4 -4
  13. package/dist/components/{EmptyCart → cart/EmptyCart}/index.js +1 -2
  14. package/dist/components/cart/Items/Simple/Item/index.d.ts +3 -0
  15. package/dist/components/cart/Items/Simple/Item/index.js +67 -0
  16. package/dist/components/cart/Items/Simple/ItemMobile/index.d.ts +3 -0
  17. package/dist/components/cart/Items/Simple/ItemMobile/index.js +73 -0
  18. package/dist/components/cart/Items/Simple/index.d.ts +3 -0
  19. package/dist/components/cart/Items/Simple/index.js +35 -0
  20. package/dist/components/cart/Items/Simple/style.d.ts +2 -0
  21. package/dist/components/cart/Items/Simple/style.js +641 -0
  22. package/dist/components/cart/index.d.ts +2 -0
  23. package/dist/components/cart/index.js +2 -0
  24. package/dist/components/index.d.ts +5 -9
  25. package/dist/components/index.js +5 -9
  26. package/dist/components/{AccountButton → ui/AccountButton}/index.js +1 -1
  27. package/dist/components/{CustomCheckbox → ui/CustomCheckbox}/index.js +1 -1
  28. package/dist/components/{WarningMessageForPopup → ui/WarningMessageForPopup}/index.js +2 -2
  29. package/dist/components/ui/index.d.ts +6 -0
  30. package/dist/components/ui/index.js +6 -0
  31. package/dist/index.d.ts +2 -1
  32. package/dist/index.js +2 -1
  33. package/dist/templates/AddressesTemplate/index.d.ts +4 -1
  34. package/dist/templates/AddressesTemplate/index.js +7 -19
  35. package/dist/templates/AddressesTemplate/style.js +4 -4
  36. package/dist/templates/CartTemplate/index.d.ts +11 -1
  37. package/dist/templates/CartTemplate/index.js +13 -12
  38. package/package.json +1 -1
  39. package/dist/AccountConfig.d.ts +0 -5
  40. package/dist/AccountConfig.js +0 -21
  41. /package/dist/components/{EmptyCart → cart/EmptyCart}/index.d.ts +0 -0
  42. /package/dist/components/{EmptyCart → cart/EmptyCart}/style.d.ts +0 -0
  43. /package/dist/components/{EmptyCart → cart/EmptyCart}/style.js +0 -0
  44. /package/dist/components/{AccountButton → ui/AccountButton}/index.d.ts +0 -0
  45. /package/dist/components/{AccountButton → ui/AccountButton}/style.d.ts +0 -0
  46. /package/dist/components/{AccountButton → ui/AccountButton}/style.js +0 -0
  47. /package/dist/components/{CustomCheckbox → ui/CustomCheckbox}/index.d.ts +0 -0
  48. /package/dist/components/{CustomCheckbox → ui/CustomCheckbox}/style.d.ts +0 -0
  49. /package/dist/components/{CustomCheckbox → ui/CustomCheckbox}/style.js +0 -0
  50. /package/dist/components/{Pagination → ui/Pagination}/index.d.ts +0 -0
  51. /package/dist/components/{Pagination → ui/Pagination}/index.js +0 -0
  52. /package/dist/components/{Pagination → ui/Pagination}/style.d.ts +0 -0
  53. /package/dist/components/{Pagination → ui/Pagination}/style.js +0 -0
  54. /package/dist/components/{Sequence → ui/Sequence}/index.d.ts +0 -0
  55. /package/dist/components/{Sequence → ui/Sequence}/index.js +0 -0
  56. /package/dist/components/{Sequence → ui/Sequence}/style.d.ts +0 -0
  57. /package/dist/components/{Sequence → ui/Sequence}/style.js +0 -0
  58. /package/dist/components/{WarningMessage → ui/WarningMessage}/index.d.ts +0 -0
  59. /package/dist/components/{WarningMessage → ui/WarningMessage}/index.js +0 -0
  60. /package/dist/components/{WarningMessage → ui/WarningMessage}/style.d.ts +0 -0
  61. /package/dist/components/{WarningMessage → ui/WarningMessage}/style.js +0 -0
  62. /package/dist/components/{WarningMessageForPopup → ui/WarningMessageForPopup}/index.d.ts +0 -0
  63. /package/dist/components/{WarningMessageForPopup → ui/WarningMessageForPopup}/style.d.ts +0 -0
  64. /package/dist/components/{WarningMessageForPopup → ui/WarningMessageForPopup}/style.js +0 -0
@@ -0,0 +1,7 @@
1
+ export function useAccountContext(): any;
2
+ export function AccountProvider({ fontFamily, children, currency }: {
3
+ fontFamily?: string;
4
+ children: any;
5
+ currency: any;
6
+ }): React.JSX.Element;
7
+ import React from 'react';
@@ -0,0 +1,27 @@
1
+ import React, { createContext, useContext, useEffect } from 'react';
2
+ import { useTranslation } from '@weareconceptstudio/core';
3
+ import { ThemeProvider } from 'styled-components';
4
+ //* Translations
5
+ import translations from './translations';
6
+ //* Styles
7
+ import theme from './styles/theme';
8
+ import AccountHelperClass from './styles/helperClass';
9
+ import AccountVariables from './styles/variables';
10
+ import AccountTypography from './styles/typography';
11
+ const AccountContext = createContext(null);
12
+ export const useAccountContext = () => {
13
+ const context = useContext(AccountContext);
14
+ return context;
15
+ };
16
+ export const AccountProvider = ({ fontFamily = 'core_Font', children, currency }) => {
17
+ const { addTranslation } = useTranslation();
18
+ useEffect(() => {
19
+ addTranslation(translations, 'prepend');
20
+ }, []);
21
+ return (React.createElement(AccountContext.Provider, { value: { currency } },
22
+ React.createElement(ThemeProvider, { theme: theme },
23
+ React.createElement(AccountVariables, { fontFamily: fontFamily }),
24
+ React.createElement(AccountHelperClass, null),
25
+ React.createElement(AccountTypography, null),
26
+ children)));
27
+ };
@@ -64,13 +64,13 @@ const AddressForm = Memo(({ title, data, selected, createAddress, updateAddress
64
64
  }, []);
65
65
  return (React.createElement(AddressFormStyle, { theme: theme(globalTheme) },
66
66
  React.createElement(Text, { tag: `h6`, text: title, className: `account-h6 account-font-bold account-primary-color1` }),
67
- React.createElement(Form, { ref: form, onSubmit: onFinish, onChange: handleFormChange, initialValues: data || { type: selected.type, country_id: 1 } },
67
+ React.createElement(Form, { ref: form, onSubmit: onFinish, onChange: handleFormChange, initialValues: data },
68
68
  React.createElement("div", { className: `form-wrapper` },
69
69
  React.createElement(Form.Item, { name: 'country_id', label: 'country' },
70
70
  React.createElement(Select, { placeholder: 'Armenia',
71
71
  // options={globalData.regions}
72
72
  disabled: true })),
73
- React.createElement(Form.Item, { name: 'type' },
73
+ React.createElement(Form.Item, { name: 'type', required: false },
74
74
  React.createElement(Input, { type: 'hidden' })),
75
75
  React.createElement(Form.Item, { name: 'first_name', label: 'firstName' },
76
76
  React.createElement(Input, { placeholder: 'firstNamePlaceholder' })),
@@ -88,11 +88,14 @@ const AddressForm = Memo(({ title, data, selected, createAddress, updateAddress
88
88
  React.createElement(Input.Number, { placeholder: 'zipCodePlaceholder' })),
89
89
  React.createElement(Form.Item, { name: 'phone', label: 'phone' },
90
90
  React.createElement(PhoneNumber, null))),
91
- React.createElement("div", { className: `default-info-wrap` }, !data?.is_default ? (React.createElement("div", { className: `banner-wrap cursor-pointer`, onClick: () => setIsChecked(!isChecked) },
92
- isChecked ? (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
93
- React.createElement(CheckboxCheckedIcon, null))) : (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
94
- React.createElement(CheckboxIcon, null))),
95
- React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1`, text: `${selected.type === 'shipping' ? 'makeYourDefaultShippingAddress' : 'makeYourDefaultBillingAddress'}` }))) : (React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1`, text: `${selected.type === 'shipping' ? 'thisYourDefaultShippingAddress' : 'thisYourDefaultBillingAddress'}` }))),
91
+ React.createElement("div", { className: `default-info-wrap` }, !data?.is_default ? (React.createElement("div", { className: `banner-wrap cursor-pointer`, onClick: () => setIsChecked(!isChecked) }, isChecked ? (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
92
+ React.createElement(CheckboxCheckedIcon, null))) : (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
93
+ React.createElement(CheckboxIcon, null))))) : (React.createElement("div", null, "Test")
94
+ // <Text
95
+ // className={`account-p account-p2 account-font-medium account-primary-color1`}
96
+ // text={`${selected.type === 'shipping' ? 'thisYourDefaultShippingAddress' : 'thisYourDefaultBillingAddress'}`}
97
+ // />
98
+ )),
96
99
  React.createElement("div", { className: `cancel-and-save-wrap` },
97
100
  React.createElement(AccountButton, { text: `cancel`, onClick: closePopup, btnType: `green-large-text` }),
98
101
  React.createElement(AccountButton, { type: 'submit', text: `saveAndApply`, btnType: `full-width`, className: `${isDisabled ? 'disabled' : ''}` })))));
@@ -1,3 +1,12 @@
1
1
  export default AddressItem;
2
- declare const AddressItem: React.NamedExoticComponent<object>;
2
+ declare function AddressItem({ title, data, checkout_review, select_address, type, onClick, checkedId, setCheckedId }: {
3
+ title: any;
4
+ data: any;
5
+ checkout_review: any;
6
+ select_address: any;
7
+ type: any;
8
+ onClick: any;
9
+ checkedId: any;
10
+ setCheckedId: any;
11
+ }): React.JSX.Element;
3
12
  import React from 'react';
@@ -1,14 +1,12 @@
1
- import React, { memo as Memo, useCallback } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { Text, useUi } from '@weareconceptstudio/core';
3
3
  //* Components
4
4
  import AddressForm from '../AddressForm';
5
5
  import AccountButton from '../AccountButton';
6
- import WarningMessageForPopup from '../WarningMessageForPopup';
6
+ import WarningMessageForPopup from '../ui/WarningMessageForPopup';
7
7
  //* Style
8
8
  import AddressItemStyle from './style';
9
- //TODO:
10
- const deleteAddress = () => { };
11
- const AddressItem = Memo(({ title, data, checkout_review, select_address, type, onClick, checkedId, setCheckedId }) => {
9
+ const AddressItem = ({ title, data, checkout_review, select_address, type, onClick, checkedId, setCheckedId }) => {
12
10
  const { openPopup } = useUi();
13
11
  //! Handle Popups
14
12
  const handleDeletePopup = useCallback(() => {
@@ -17,6 +15,8 @@ const AddressItem = Memo(({ title, data, checkout_review, select_address, type,
17
15
  const handleEditAddressPopup = useCallback(() => {
18
16
  openPopup(React.createElement(AddressForm, { data: data, selected: { value: true, type: data.type }, title: type === 'billing' ? `updateYourBillingAddress` : `updateYourShippingAddress` }));
19
17
  }, [data]);
18
+ //TODO:
19
+ const deleteAddress = () => { };
20
20
  return (data && (React.createElement(AddressItemStyle, { className: `item-container` },
21
21
  checkout_review && (React.createElement("div", { className: `change-address-wrap` },
22
22
  React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1`, text: title }),
@@ -37,5 +37,5 @@ const AddressItem = Memo(({ title, data, checkout_review, select_address, type,
37
37
  !select_address && !data.is_default && (React.createElement(React.Fragment, null,
38
38
  React.createElement("div", { className: `vertical-line` }),
39
39
  React.createElement(AccountButton, { text: `remove`, btnType: `green-small-text`, onClick: handleDeletePopup })))))))));
40
- });
40
+ };
41
41
  export default AddressItem;
@@ -0,0 +1,7 @@
1
+ export default AddressWrap;
2
+ declare function AddressWrap({ title, addresses, className }: {
3
+ title?: string;
4
+ addresses?: any[];
5
+ className: any;
6
+ }): React.JSX.Element;
7
+ import React from 'react';
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import { Text, useUi } from '@weareconceptstudio/core';
4
+ import AccountButton from '../AccountButton';
5
+ import EmptyAddress from '../EmptyAddress';
6
+ import AddressItem from '../AddressItem';
7
+ import AddressForm from '../AddressForm';
8
+ const AddressWrap = ({ title = 'addresses', addresses = [], className }) => {
9
+ const { openPopup } = useUi();
10
+ const classString = classNames('address-wrap', {
11
+ [className]: className,
12
+ });
13
+ const handleAddNewAddressPopup = () => {
14
+ openPopup(React.createElement(AddressForm, null));
15
+ };
16
+ return (React.createElement("div", { className: classString },
17
+ React.createElement("div", { className: `address-title-container` },
18
+ React.createElement(Text, { className: `account-p account-p1 account-font-bold account-primary-color1`, text: title }),
19
+ React.createElement(AccountButton, { text: `addNewAdd`, btnType: `purple-text`, onClick: handleAddNewAddressPopup })),
20
+ addresses.length > 0 ? (React.createElement("div", { className: `flex-wrapper` }, addresses.map((item, index) => {
21
+ return (React.createElement(AddressItem, { key: index, data: item }));
22
+ }))) : (React.createElement(EmptyAddress, null))));
23
+ };
24
+ export default AddressWrap;
@@ -0,0 +1,3 @@
1
+ export default EmptyAddress;
2
+ declare function EmptyAddress(): React.JSX.Element;
3
+ import React from 'react';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Text } from '@weareconceptstudio/core';
3
+ const EmptyAddress = () => {
4
+ return (React.createElement(Text, { className: `account-p account-p2 account-font-regular account-primary-color1 empty-address-text`, text: `emptyAddress` }));
5
+ };
6
+ export default EmptyAddress;
@@ -0,0 +1,3 @@
1
+ export default FavoriteButton;
2
+ declare const FavoriteButton: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,42 @@
1
+ import React, { memo, useCallback, useMemo } from 'react';
2
+ import Button from '../ui/AccountButton';
3
+ const addToFavorite = () => { };
4
+ const removeFavorite = () => { };
5
+ //* Icons
6
+ const favoriteIcon = (React.createElement("svg", { version: '1.1', viewBox: '0 0 32 32', xmlns: 'http://www.w3.org/2000/svg' },
7
+ React.createElement("path", { id: 'path-1', fill: '#ecefec', d: 'M14.622 0l-12.889 7.911-1.733 13.867 7.822 8.8 13.911 1.422 10.267-11.689-3.6-16.711-13.778-3.6z' }),
8
+ React.createElement("path", { id: 'path-2', fill: '#8c9b8b', d: 'M17.066 24.8c-0.178 0-0.267-0.044-0.356-0.178l-10.667-9.911c-0.222-0.222-0.222-0.533-0.044-0.756l4.622-5.511c0.178-0.222 0.444-0.267 0.622-0.089l5.689 3.111 3.733-4.089c0.089-0.089 0.267-0.178 0.444-0.178s0.311 0.044 0.356 0.222l4.489 5.467c0.178 0.222 0.178 0.489 0 0.622l-8.533 11.067c-0.044 0.133-0.133 0.222-0.356 0.222z' }),
9
+ React.createElement("path", { id: 'path-3', fill: '#b2bdb1', d: 'M17.067 24.978c-0.178 0-0.311-0.044-0.444-0.178l-10.667-9.956c-0.267-0.222-0.267-0.622-0.044-0.933l4.578-5.511c0.222-0.267 0.533-0.311 0.844-0.178l5.556 3.067 3.689-4.044c0.133-0.133 0.311-0.222 0.533-0.222 0.178 0 0.356 0.089 0.489 0.267l4.489 5.511c0.178 0.222 0.178 0.578 0 0.844l-8.533 11.067c-0.133 0.133-0.267 0.222-0.489 0.267zM7.289 14.267l9.689 9.022 7.778-10.044-3.689-4.533-3.511 3.867c-0.222 0.222-0.533 0.267-0.8 0.133l-5.6-3.067-3.867 4.622z' })));
10
+ const FavoriteButton = memo(({ type, favorites, productId, optionId, variantId, qty }) => {
11
+ //! Check Active Favorite
12
+ const isFavorite = useMemo(() => {
13
+ return favorites.some((favorite) => favorite.product.id === productId && favorite.selectedOption.id === optionId && favorite.selectedVariant.id === variantId);
14
+ }, [favorites, productId, variantId, optionId]);
15
+ //! Add to favorite
16
+ const addFavoriteHandleClick = useCallback(() => {
17
+ isFavorite
18
+ ? removeFavorite({
19
+ productId,
20
+ variantId,
21
+ optionId,
22
+ })
23
+ : addToFavorite({
24
+ productId,
25
+ variantId,
26
+ optionId,
27
+ qty,
28
+ update: true,
29
+ });
30
+ }, [productId, variantId, optionId, qty, isFavorite]);
31
+ return type === 'withIcon' ? (
32
+ // <Icon
33
+ // name={`favorite`}
34
+ // className={`pi-favorite ${isFavorite ? 'pi-active' : ''}`}
35
+ // onClick={addFavoriteHandleClick}>
36
+ // <span className='path1' />
37
+ // <span className='path2' />
38
+ // <span className='path3' />
39
+ // </Icon>
40
+ React.createElement("div", { onClick: addFavoriteHandleClick, className: `pi-favorite ${isFavorite ? 'pi-active' : ''}` }, favoriteIcon)) : (React.createElement(Button, { text: 'addToWishlist', btnType: `green-small-text`, onClick: addFavoriteHandleClick, className: `wishlist-btn ${isFavorite ? 'active' : ''}` }));
41
+ });
42
+ export default FavoriteButton;
@@ -1,15 +1,14 @@
1
1
  import React, { memo, useState, useEffect } from 'react';
2
2
  import { Text, useUi } from '@weareconceptstudio/core';
3
- import { Input } from '@weareconceptstudio/form';
3
+ import { useAccountContext } from '../../AccountProvider';
4
4
  import AccountButton from '../AccountButton';
5
5
  //* Utils
6
6
  import { handlePriceCheckFunc, numToLocalString } from '../../utils/_functions';
7
7
  //* Style
8
8
  import TotalCheckoutStyle from './style';
9
- //TODO: Input filed textarea
10
- // TODO: itemsCount, subtotal, total, loading, currency, shippingCost
11
- const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, itemsCount, subtotal, total, loading, currency, shippingCost }) => {
9
+ const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, itemsCount, subtotal, total, loading, shippingCost }) => {
12
10
  const { winWidth } = useUi();
11
+ const { currency } = useAccountContext();
13
12
  //! States
14
13
  const [headerHeight, setHeaderHeight] = useState();
15
14
  const [note, setNote] = useState();
@@ -17,6 +16,7 @@ const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, i
17
16
  useEffect(() => {
18
17
  setHeaderHeight(document.getElementsByTagName('header')[0]?.clientHeight);
19
18
  }, [winWidth]);
19
+ console.log(shippingCost);
20
20
  return (React.createElement(TotalCheckoutStyle, { "$headerHeight": headerHeight },
21
21
  React.createElement("div", { className: `cart-main-wrap` },
22
22
  React.createElement("div", { className: `left-panel-wrap panel` }, children),
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Text } from '@weareconceptstudio/core';
3
+ import AccountButton from '../../ui/AccountButton';
3
4
  //* Style
4
5
  import EmptyCartStyle from './style';
5
- //* Components
6
- import AccountButton from '../AccountButton';
7
6
  const EmptyCart = ({ shoppingUrl }) => {
8
7
  return (React.createElement(EmptyCartStyle, null,
9
8
  React.createElement("div", { className: `empty-cart-wrap` },
@@ -0,0 +1,3 @@
1
+ export default Item;
2
+ declare const Item: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,67 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { Image, Text, useUi } from '@weareconceptstudio/core';
3
+ import { Select } from '@weareconceptstudio/form';
4
+ import { useAccountContext } from '../../../../../AccountProvider';
5
+ import { handlePriceCheckFunc } from '../../../../../utils/_functions';
6
+ import Button from '../../../../ui/AccountButton';
7
+ import FavoriteButton from '../../../../FavoriteButton';
8
+ // import ProductIndividual from '@/components/common/ProductIndividual';
9
+ //TODO: Fake
10
+ const pathname = '/cart/';
11
+ const addToCart = () => { };
12
+ const removeCart = () => { };
13
+ const Item = memo(({ data, edit, favorite, remove, select, isLast, favorites, deleteCartItem }) => {
14
+ const { openPopup } = useUi();
15
+ const { currency } = useAccountContext();
16
+ const selectionList = useMemo(() => {
17
+ if (select) {
18
+ const selectList = [];
19
+ for (let index = 1; index <= data?.qty; index++) {
20
+ selectList.push({ value: index, label: index });
21
+ }
22
+ return selectList;
23
+ }
24
+ }, [data, select]);
25
+ return (React.createElement("div", { className: `item-wrap` },
26
+ React.createElement("div", { className: 'line' }),
27
+ React.createElement("div", { className: `item-inner-wrapper` },
28
+ React.createElement("div", { className: `col-item tl-col-1 col-item-1` },
29
+ React.createElement("div", { className: `image-wrapper` },
30
+ React.createElement(Image, { src: data?.product?.image?.src, alt: data?.product?.image?.alt })),
31
+ React.createElement("div", { className: `col-1-right-wrap` },
32
+ React.createElement(Button, { url: data.product?.url, className: `capitalize`, text: data.product?.name, btnType: `green-large-text`, target: pathname === '/cart/' || pathname === '/checkout' ? '_blank' : '_self' }),
33
+ edit && !data.product?.out_of_stock ? (React.createElement("div", { className: `edit-btn-wrap empty` },
34
+ React.createElement(Button, { text: 'edit', btnType: `green-small-text`, onClick: () => openPopup(
35
+ // <ProductIndividual
36
+ // isPopup
37
+ // qty={data.qty}
38
+ // itemId={data.id}
39
+ // selectedOption={data.selectedOption}
40
+ // selectedVariant={data.selectedVariant}
41
+ // {...data.product}
42
+ // />
43
+ React.createElement("div", null, "Product Individual")) }))) : pathname === '/cart/' ? (React.createElement(Text, { className: `p p3 apercuPro_Bold account-primary-color3 underline opacityZero empty`, text: 'empty' })) : (''))),
44
+ 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 ? (
45
+ // <FormSelect
46
+ // list={selectionList}
47
+ // getPopupContainer={false}
48
+ // selectedValue={data.qty}
49
+ // onChange={(val) => addToCart({ productId: data.product?.id, variantId: data.selectedVariant?.id, optionId: data.selectedOption?.id, qty: val, update: true })}
50
+ // />
51
+ React.createElement(Select, { allowSearch: false, options: selectionList, value: 1, onChange: (val) => console.log(`Select ${val}`) })) : (React.createElement(Text, { className: `p p3 account-font-medium account-primary-color1`, text: data.qty })))) : (React.createElement(Text, { className: `p p3 account-font-medium account-primary-color1`, text: data.qty }))),
52
+ React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, data?.discountedPrice ? (React.createElement("div", null,
53
+ React.createElement(Text, { className: `p p3 apercuPro_Bold account-secondary-color2 alignRight`, text: handlePriceCheckFunc(data?.discountedPrice, currency) }),
54
+ React.createElement(Text, { className: `p p3 account-font-regular account-primary-color2 lineThrough value alignRight`, text: handlePriceCheckFunc(data.product?.price, currency) }))) : (React.createElement(Text, { className: `p p3 account-font-bold account-primary-color1 alignRight`, text: handlePriceCheckFunc(data.product?.price, currency) }))),
55
+ React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap` },
56
+ React.createElement("div", { className: `col-item-inner-wrap` },
57
+ React.createElement("div", { className: `flex-end-wrap` }, data?.discountedPrice ? (React.createElement("div", null,
58
+ React.createElement(Text, { className: `p p3 account-font-bold account-secondary-color2 alignRight`, text: handlePriceCheckFunc(data?.discountedPrice * data.qty, currency) }),
59
+ React.createElement(Text, { className: `p p3 account-font-regular account-primary-color2 lineThrough value alignRight`, text: handlePriceCheckFunc(data.product?.price * data.qty, currency) }))) : (React.createElement(Text, { className: `p p3 account-font-bold account-primary-color1 alignRight`, text: handlePriceCheckFunc(data.product?.price * data.qty, currency) }))),
60
+ React.createElement("div", { className: `favorite-and-remove-wrap` },
61
+ favorite && !data.product?.out_of_stock && (React.createElement("div", { className: `favorite-btn-wrap` },
62
+ React.createElement(FavoriteButton, { qty: data.qty, type: `withText`, favorites: favorites, productId: data.product?.id, optionId: data.selectedOption?.id, variantId: data.selectedVariant?.id }))),
63
+ remove && (React.createElement("div", { className: `remove-btn-wrap` },
64
+ React.createElement(Button, { text: 'remove', btnType: `green-small-text`, onClick: () => deleteCartItem({ productId: data.product?.id }) }))))))),
65
+ isLast ? React.createElement("div", { className: 'line' }) : null));
66
+ });
67
+ export default Item;
@@ -0,0 +1,3 @@
1
+ export default ItemMobile;
2
+ declare const ItemMobile: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,73 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { Image, Text, useUi } from '@weareconceptstudio/core';
3
+ import { Select } from '@weareconceptstudio/form';
4
+ import Button from '../../../../ui/AccountButton';
5
+ import { useAccountContext } from '../../../../../AccountProvider';
6
+ //* Utils
7
+ import { handlePriceCheckFunc } from '../../../../../utils/_functions';
8
+ //* Components
9
+ import FavoriteButton from '../../../../FavoriteButton';
10
+ // import ProductIndividual from '@/components/common/ProductIndividual';
11
+ //TODO: Fake
12
+ const pathname = '/cart/';
13
+ const addToCart = () => { };
14
+ const removeCart = () => { };
15
+ const ItemMobile = memo(({ data, additionalParameters, isLast, favorites }) => {
16
+ const { openPopup } = useUi();
17
+ const { currency } = useAccountContext();
18
+ const selectionList = useMemo(() => {
19
+ if (additionalParameters.select) {
20
+ const selectList = [];
21
+ for (let index = 1; index <= data.qty; index++) {
22
+ selectList.push({ value: index, label: index });
23
+ }
24
+ return selectList;
25
+ }
26
+ }, [data]);
27
+ return (React.createElement(React.Fragment, null,
28
+ isLast ? React.createElement("div", { className: 'line' }) : null,
29
+ React.createElement("div", { className: `mobile-order-item-wrap` },
30
+ React.createElement("div", { className: `mobile-order-item-inner-wrap` },
31
+ React.createElement("div", { className: `mobile-image-wrap` },
32
+ React.createElement(Image, { src: data?.images?.[0].src, alt: data?.images?.[0].alt })),
33
+ React.createElement("div", { className: `mobile-info-wrap` },
34
+ React.createElement(Button, { className: `capitalize`, url: data.product?.url, btnType: `green-large-text`, text: data.product?.name || data.name, target: pathname === '/cart/' || pathname === '/checkout/' ? '_blank' : '_self' }),
35
+ additionalParameters.select ? (React.createElement("div", { className: `select-and-out-of-stock-mobile-wrap` }, !data.product?.out_of_stock ? (
36
+ // <FormSelect
37
+ // list={selectionList}
38
+ // selectedValue={data.qty}
39
+ // className={`quantity-select-mobile-wrap`}
40
+ // onChange={(val) => addToCart({ productId: data.product.id, variantId: data.selectedVariant.id, optionId: data.selectedOption.id, qty: val, update: true })}
41
+ // />
42
+ React.createElement(Select, { allowSearch: false, options: selectionList, value: 1, onChange: (val) => console.log(val) })) : (React.createElement("div", { className: `mobile-info-item` },
43
+ React.createElement(Text, { className: `p p3 apercuPro_Medium primaryColor1`, text: `quantityWithSymbol` }),
44
+ "\u00A0",
45
+ React.createElement(Text, { className: `p p3 apercuPro_Medium primaryColor1`, text: data.qty }))))) : (React.createElement("div", { className: `mobile-info-item` },
46
+ React.createElement(Text, { className: `p p3 apercuPro_Medium primaryColor1`, text: `quantityWithSymbol` }),
47
+ "\u00A0",
48
+ React.createElement(Text, { className: `p p3 apercuPro_Medium primaryColor1`, text: data.qty || data.quantity }))),
49
+ React.createElement("div", { className: `mobile-price-wrap nowrap` },
50
+ React.createElement(Text, { className: `p p3 apercuPro_Medium primaryColor1 mb-mt`, text: `price` }),
51
+ data?.discountedPrice ? (React.createElement("div", null,
52
+ React.createElement(Text, { className: `p p3 apercuPro_Bold secondaryColor2`, text: handlePriceCheckFunc(data?.product.discountedPrice, currency) }),
53
+ React.createElement(Text, { className: `p p3 apercuPro_Regular primaryColor2 lineThrough value`, text: handlePriceCheckFunc(data.product?.price, currency) }))) : (React.createElement(Text, { className: `p p3 apercuPro_Bold primaryColor1`, text: handlePriceCheckFunc(data.product?.price, currency) }))),
54
+ React.createElement("div", { className: `mobile-total-price-wrap nowrap` },
55
+ React.createElement(Text, { className: `p p3 apercuPro_Medium primaryColor1 mb-mt`, text: `total` }),
56
+ data.selectedOption?.discountedPrice ? (React.createElement("div", null,
57
+ React.createElement(Text, { className: `p p3 apercuPro_Bold secondaryColor2`, text: handlePriceCheckFunc(data.product?.discountedPrice * data.qty, currency) }),
58
+ React.createElement(Text, { className: `p p3 apercuPro_Regular primaryColor2 lineThrough`, text: handlePriceCheckFunc(data.product?.price * data.qty, currency) }))) : (React.createElement(Text, { className: `p p3 apercuPro_Bold primaryColor1`, text: handlePriceCheckFunc(data.product?.price * data.qty || data.total, currency || currency) }))))),
59
+ pathname === '/cart/' && (React.createElement("div", { className: `edit-remove-favorite-mobile-wrap` },
60
+ additionalParameters.edit.item && !data.product?.out_of_stock ? (React.createElement(Button, { text: 'edit', btnType: `green-small-text`, onClick: () => openPopup(
61
+ // <ProductIndividual
62
+ // isPopup
63
+ // qty={data.qty}
64
+ // itemId={data.id}
65
+ // selectedOption={data.selectedOption}
66
+ // selectedVariant={data.selectedVariant}
67
+ // {...data.product}
68
+ // />
69
+ React.createElement("div", null, "Product Individual")) })) : (React.createElement(Text, { className: `p p3 apercuPro_Bold primaryColor3 underline opacityZero empty`, text: 'empty' })),
70
+ React.createElement("div", { className: `favorite-remove-mobile-wrap` }, additionalParameters.remove && (React.createElement(Button, { text: 'remove', btnType: `green-small-text`, onClick: () => removeCart({ productId: data.product.id, variantId: data.selectedVariant.id, optionId: data.selectedOption.id }) })))))),
71
+ React.createElement("div", { className: 'line' })));
72
+ });
73
+ export default ItemMobile;
@@ -0,0 +1,3 @@
1
+ export default CartItems;
2
+ declare const CartItems: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,35 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { Text, useUi } from '@weareconceptstudio/core';
3
+ //* Components
4
+ import Item from './Item';
5
+ import ItemMobile from './ItemMobile';
6
+ //* Style
7
+ import CartItemsStyle from './style';
8
+ const CartItems = memo(({ data, className, title, smallFontSize, additionalParameters, currency, isLast, favorites, deleteCartItem }) => {
9
+ const { winWidth } = useUi();
10
+ //! Store
11
+ const orderStore = useMemo(() => {
12
+ return winWidth >= 768 ? (React.createElement("div", { className: `order-items-table-wrap` },
13
+ React.createElement("div", { className: `titles-wrap` },
14
+ React.createElement("div", { className: `title-wrap tl-col-1` },
15
+ React.createElement(Text, { className: `p p3 account-font-bold account-primary-color1 nowrap`, text: `item` })),
16
+ React.createElement("div", { className: `title-wrap tl-col-2` },
17
+ React.createElement(Text, { className: `p p3 account-font-bold account-primary-color1 nowrap`, text: `quantity` })),
18
+ React.createElement("div", { className: `title-wrap tl-col-3 title-item` },
19
+ React.createElement(Text, { className: `p p3 account-font-bold account-primary-color1 nowrap alignRight`, text: `price` })),
20
+ React.createElement("div", { className: `title-wrap tl-col-4 title-item` },
21
+ React.createElement(Text, { className: `p p3 account-font-bold account-primary-color1 nowrap alignRight`, text: `total` }))),
22
+ React.createElement("div", { className: `items-wrap` }, data?.map((item, index) => {
23
+ return (React.createElement(Item, { key: index, data: item, currency: currency, favorites: favorites, isLast: data.length - 1 == index, select: additionalParameters.select, remove: additionalParameters.remove, edit: additionalParameters.edit.item, favorite: additionalParameters.favorite, deleteCartItem: deleteCartItem }));
24
+ })))) : (React.createElement("div", { className: `mobile-order-items-table-wrap` }, data?.map((item, index) => {
25
+ return (React.createElement(ItemMobile, { key: index, data: item, isLast: isLast, currency: currency, favorites: favorites, additionalParameters: additionalParameters }));
26
+ })));
27
+ }, [winWidth, data, additionalParameters, currency]);
28
+ return (React.createElement(CartItemsStyle, { className: className || '' },
29
+ additionalParameters.edit.list ? (React.createElement("div", { className: `title-edit-wrapper` },
30
+ React.createElement(Text, { className: `p ${smallFontSize ? 'p2' : 'p1'} account-font-bold account-primary-color1`, text: title }),
31
+ React.createElement(Button, { url: '/cart/', text: `editCart`, btnType: `green-small-text` }))) : (React.createElement(Text, { className: `p ${smallFontSize ? 'p2' : 'p1'} account-font-bold account-primary-color1`, text: title })),
32
+ additionalParameters.horizontalLine && React.createElement("div", { className: `order-items-line` }),
33
+ orderStore));
34
+ });
35
+ export default CartItems;
@@ -0,0 +1,2 @@
1
+ export default CartItemsStyle;
2
+ declare const CartItemsStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;