@riosst100/pwa-marketplace 1.6.9 → 1.7.1

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/package.json +1 -1
  2. package/src/componentOverrideMapping.js +4 -0
  3. package/src/components/CollectibleGameSets/collectibleGameSets.js +0 -4
  4. package/src/components/FilterTop/filterTop.js +0 -2
  5. package/src/components/FilterTopBackup/CustomFilters/customFilters.js +0 -1
  6. package/src/components/ProductLabel/index.js +47 -0
  7. package/src/components/ProductListTab/productListTab.js +51 -5
  8. package/src/components/ProductListTab/productListTab.module.css +1 -1
  9. package/src/components/RelatedProduct/relatedProduct.js +1 -1
  10. package/src/components/ShopBy/shopBy copy.js +172 -0
  11. package/src/components/ShopBy/shopBy.js +0 -1
  12. package/src/components/ShopBySets/shopBySets.js +0 -3
  13. package/src/components/SportCardsSets/index.js +2 -0
  14. package/src/components/SportCardsSets/sportCardsSets.js +372 -0
  15. package/src/components/SportCardsSets/sportCardsSets.module.css +76 -0
  16. package/src/components/SportCardsSets/sportCardsSets.shimmer.js +50 -0
  17. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/__fixtures__/apolloMocks.js +33 -0
  18. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/carousel.gql.ce.js +16 -0
  19. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/carousel.gql.ee.js +17 -0
  20. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/carousel.js +38 -0
  21. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/index.js +1 -0
  22. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/useCarousel.js +25 -0
  23. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/configAggregator.js +26 -0
  24. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/index.js +1 -0
  25. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/products.js +369 -0
  26. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/products.module.css +0 -0
  27. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/banner.module.css +103 -0
  28. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/configAggregator.js +17 -0
  29. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/index.js +2 -0
  30. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.js +221 -0
  31. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.module.css +231 -0
  32. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.shimmer.js +126 -0
  33. package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.shimmer.module.css +5 -0
  34. package/src/overwrites/pagebuilder/lib/utils.js +224 -0
  35. package/src/overwrites/peregrine/lib/talons/FilterSidebar/useFilterSidebar.js +60 -0
  36. package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +4 -1
  37. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryFragments.gql.js +8 -0
  38. package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +44 -0
  39. package/src/overwrites/venia-ui/lib/RootComponents/CMS/cms.js +73 -0
  40. package/src/overwrites/venia-ui/lib/RootComponents/CMS/cms.module.css +25 -0
  41. package/src/overwrites/venia-ui/lib/RootComponents/CMS/cms.shimmer.js +18 -0
  42. package/src/overwrites/venia-ui/lib/RootComponents/CMS/index.js +7 -0
  43. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +12 -1
  44. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +3 -3
  45. package/src/overwrites/venia-ui/lib/components/App/app.js +131 -0
  46. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.module.css +1 -0
  47. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +1 -1
  48. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +4 -1
  49. package/src/overwrites/venia-ui/lib/components/Gallery/item.js +13 -3
  50. package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +1 -1
  51. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/auctionDetail.js +176 -138
  52. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/preOrderDetail.js +19 -10
  53. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +5 -26
  54. package/src/overwrites/venia-ui/lib/components/RichContent/richContent.module.css +3 -3
  55. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.js +0 -1
  56. package/src/overwrites/venia-ui/lib/index.module.css +137 -0
  57. package/src/overwrites/venia-ui/lib/tokens.module.css +167 -0
  58. package/src/talons/CollectibleGameSets/collectibleGameSets.gql.js +15 -1
  59. package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +0 -11
  60. package/src/talons/FilterTop/useFilterTop.js +0 -2
  61. package/src/talons/ShopBy/useShopBy.js +0 -22
  62. package/src/talons/SportCardsSets/sportCardsSets.gql.js +46 -0
  63. package/src/talons/SportCardsSets/useSportCardsSets.js +170 -0
  64. package/src/talons/SubCategoryPage/useSubCategoryPage.js +0 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "1.6.9",
4
+ "version": "1.7.1",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -45,4 +45,8 @@ module.exports = componentOverrideMapping = {
45
45
  [`@magento/venia-ui/lib/components/Main/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Main/index.js',
46
46
  [`@magento/venia-ui/lib/components/Footer/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Footer/index.js',
47
47
  [`@magento/venia-ui/lib/components/Newsletter/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Newsletter/index.js',
48
+ [`@magento/pagebuilder/lib/ContentTypes/Products/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/pagebuilder/lib/ContentTypes/Products/index.js',
49
+ [`@magento/venia-ui/lib/RootComponents/CMS/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/CMS/index.js',
50
+ [`@magento/pagebuilder/lib/ContentTypes/Slider/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/pagebuilder/lib/ContentTypes/Slider/index.js',
51
+ [`@magento/venia-ui/lib/components/App/app.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/App/app.js',
48
52
  };
@@ -51,16 +51,12 @@ const CollectibleGameSets = props => {
51
51
  // value: 'all'
52
52
  // });
53
53
 
54
- // console.log(currentSort)
55
-
56
54
  const classes = useStyle(defaultClasses);
57
55
 
58
56
  const talonProps = useCollectibleGameSets({ searchQuery, setActive, currentSort });
59
57
 
60
58
  const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey, productType, filteredCollectibleGameSets, availableGroups } = talonProps;
61
59
 
62
- console.log(availableGroups)
63
-
64
60
  if (loading && !collectibleGameSets)
65
61
  return <CollectibleGameSetsShimmer />;
66
62
  if (error && !collectibleGameSets) return <ErrorView />;
@@ -84,8 +84,6 @@ const FilterTop = props => {
84
84
  // });
85
85
  // const allowedFiltersArr = ['card_rarity','card_print_version','card_set', 'card_product_type'];
86
86
 
87
- // console.log(customFilters)
88
-
89
87
  const filtersList = useMemo(
90
88
  () =>
91
89
  Array.from(filterItems, ([group, items], iteration) => {
@@ -49,7 +49,6 @@ const CustomFilters = props => {
49
49
  return elements;
50
50
  }, [filterState, removeItem]);
51
51
 
52
- // console.log(activeFilters)\\
53
52
 
54
53
  // const handleClick = useCallback(() => {
55
54
  // removeItem({ group, item });
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import cn from 'classnames';
3
+
4
+ const ProductLabel = (props) => {
5
+ const {
6
+ rootClassName = '',
7
+ item
8
+ } = props;
9
+
10
+ const preorderData = item ? item.preorder : null;
11
+ const isPreOrder = preorderData && preorderData.is_preorder ? true : false;
12
+
13
+ const auctionData = item ? item.auction_data : null;
14
+ const isAuction = auctionData && auctionData.is_auction ? true : false;
15
+
16
+ const priceRangeData = item?.price_range;
17
+
18
+ const salePrice = priceRangeData?.maximum_price?.discount?.amount_off;
19
+ const regularPrice = priceRangeData?.maximum_price?.regular_price?.value;
20
+
21
+ return (
22
+ <div
23
+ className={cn(
24
+ 'flex flex-row flex-wrap gap-y-1.5 gap-x-[5px] absolute p-[5px] z-[1]',
25
+ rootClassName
26
+ )}
27
+ >
28
+ {salePrice > 0 && <div className='bg-yellow-400 rounded px-2.5 py-[6px] w-fit top-0 left-0'>
29
+ <span className='text-white text-xs font-medium'>
30
+ {salePrice/regularPrice*100}% off
31
+ </span>
32
+ </div>}
33
+ {isPreOrder && <div className='bg-darkblue-900 rounded px-2.5 py-[6px] w-fit top-0 left-0'>
34
+ <span className='text-white text-xs font-medium'>
35
+ Pre Order
36
+ </span>
37
+ </div>}
38
+ {isAuction && <div className='bg-blue-700 rounded px-2.5 py-[6px] w-fit top-0 left-0'>
39
+ <span className='text-white text-xs font-medium'>
40
+ Auction
41
+ </span>
42
+ </div>}
43
+ </div>
44
+ )
45
+ }
46
+
47
+ export default ProductLabel
@@ -1,12 +1,23 @@
1
- import React, { useState } from 'react';
1
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import { useStyle } from '@magento/venia-ui/lib/classify';
5
5
  import defaultClasses from './productListTab.module.css';
6
+ import { useFilterSidebar } from '@magento/peregrine/lib/talons/FilterSidebar';
7
+ import CurrentTopFilter from '@riosst100/pwa-marketplace/src/components/FilterTop/CurrentTopFilters/currentTopFilter';
6
8
 
7
9
  const ProductListTab = props => {
8
10
 
9
- const { activeTab, setActiveTab } = props
11
+ const { activeTab, setActiveTab, filters } = props
12
+
13
+ const talonProps = useFilterSidebar({ filters });
14
+ const {
15
+ filterApi,
16
+ filterState,
17
+ handleApply
18
+ } = talonProps;
19
+
20
+ const { toggleItem, removeItem } = filterApi;
10
21
 
11
22
  const classes = useStyle(defaultClasses, props.classes);
12
23
 
@@ -22,11 +33,11 @@ const ProductListTab = props => {
22
33
  },
23
34
  {
24
35
  'label': 'Sale',
25
- 'value': 'sale'
36
+ 'value': 'special_price'
26
37
  },
27
38
  {
28
39
  'label': 'Pre Order',
29
- 'value': 'preorder'
40
+ 'value': 'lof_preorder'
30
41
  },
31
42
  {
32
43
  'label': 'Auction',
@@ -34,13 +45,48 @@ const ProductListTab = props => {
34
45
  }
35
46
  ];
36
47
 
48
+ const handleClickremove = useCallback((group, item) => {
49
+ removeItem({ group, item });
50
+ if (typeof handleApply === 'function') {
51
+ handleApply(group, item);
52
+ }
53
+ }, [removeItem, handleApply]);
54
+
55
+ const handleToggleItem = useCallback((group, item) => {
56
+ toggleItem({ group, item });
57
+ if (typeof handleApply === 'function') {
58
+ handleApply(group, item);
59
+ }
60
+ }, [toggleItem, handleApply]);
61
+
62
+ const handleClick = (targetGroup) => {
63
+ setActiveTab(targetGroup);
64
+
65
+ const item = { value: "1", label: 'Yes', title: 'Yes' };
66
+
67
+ for (const [group, items] of filterState) {
68
+ for (const item of items) {
69
+ const { title, value } = item || {};
70
+ const key = `${group}::${title}_${value}`;
71
+
72
+ if (productTabs.some(e => e.value === group)) {
73
+ handleClickremove(group, item)
74
+ }
75
+ }
76
+ }
77
+
78
+ if (targetGroup != "all") {
79
+ handleToggleItem(targetGroup, item)
80
+ }
81
+ }
82
+
37
83
  return (
38
84
  <div className={classes.root} aria-busy="true">
39
85
  <nav>
40
86
  <ul className={classes.buttonContainer}>
41
87
  {productTabs.map(({label, value}, index) =>
42
88
  <li key={index}>
43
- <button onClick={() => setActiveTab(value)} className={
89
+ <button onClick={() => handleClick(value)} className={
44
90
  (index == 0 ? classes.firstButton : (index == productTabs.length-1 ? classes.lastButton : classes.middleButton)) + (activeTab == value ? ' ' + classes.activeButton : '')
45
91
  }>{label}</button>
46
92
  </li>
@@ -57,7 +57,7 @@
57
57
  composes: button;
58
58
  composes: text-colorDefault from global;
59
59
  composes: bg-white from global;
60
- composes: border-r-0 from global;
60
+ /* composes: border-l-0 from global; */
61
61
  composes: border-gray-100 from global;
62
62
  composes: rounded-l-lg from global;
63
63
  border-radius: 6px 0px 0px 6px;
@@ -86,7 +86,7 @@ const relatedProduct = (props) => {
86
86
  key={item.id}
87
87
  item={item}
88
88
  storeConfig={storeConfig}
89
- rootClassName="px-4 block"
89
+ rootClassName="px-2 block"
90
90
  />
91
91
  )
92
92
  })}
@@ -0,0 +1,172 @@
1
+ import React, { Fragment, useEffect, useMemo, useState } from 'react';
2
+ import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
3
+ import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
4
+ import { Link } from 'react-router-dom';
5
+ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
6
+ import defaultClasses from './shopBy.module.css';
7
+ import { useStyle } from '@magento/venia-ui/lib/classify';
8
+ import cn from 'classnames';
9
+ import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
10
+ import { ShopByShimmer } from '@riosst100/pwa-marketplace/src/components/ShopBy';
11
+ import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
12
+ import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
13
+ import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
14
+ import { useShopBy } from '@riosst100/pwa-marketplace/src/talons/ShopBy/useShopBy';
15
+
16
+ const ShopBy = props => {
17
+ const [active, setActive] = useState('all');
18
+
19
+ const [searchQuery, setSearchQuery] = useState('');
20
+
21
+
22
+ const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: {
23
+ sortText: 'All (A-Z)',
24
+ value: 'all'
25
+ }});
26
+
27
+ const [currentSort] = sortProps;
28
+
29
+ // const [sortBy, setSortBy] = useState({
30
+ // sortText: 'All (A-Z)',
31
+ // value: 'all'
32
+ // });
33
+
34
+
35
+ const classes = useStyle(defaultClasses);
36
+
37
+ const talonProps = useShopBy({ searchQuery, setActive, currentSort });
38
+
39
+ const { error, loading, dataResult, categoryUrlSuffix, categoryUrlKey, productType, filteredCollectibleGameSets, availableGroups, attributeData, alpha, category } = talonProps;
40
+
41
+ if (loading && !dataResult)
42
+ return <ShopByShimmer />;
43
+ if (error && !dataResult) return <ErrorView />;
44
+
45
+ if (!dataResult && !loading && !error) {
46
+ return <ShopByShimmer />;
47
+ }
48
+
49
+ const newData = searchQuery ? filteredCollectibleGameSets : dataResult;
50
+
51
+ const setRelases = availableGroups.map((group, index) => {
52
+ const optionsResult = [];
53
+
54
+ if (active === 'all' || active === group) {
55
+ dataResult[group].map((option, index) => {
56
+ const { label, value } = option;
57
+
58
+ const categoryUrl = resourceUrl(
59
+ `/${categoryUrlKey}${categoryUrlSuffix || ''}?${attributeData.attribute_code}[filter]=${label},${value}`
60
+ );
61
+
62
+ optionsResult.push(<li className='list-none'>
63
+ <Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-2">
64
+ {label}
65
+ </Link>
66
+ </li>)
67
+ })
68
+
69
+ return (
70
+ <>
71
+ {optionsResult ?
72
+ <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
73
+ <div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' >
74
+ {group}
75
+ </div>
76
+ <div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
77
+ </div> : ''}
78
+ </>
79
+ );
80
+ }
81
+
82
+ return null;
83
+ });
84
+
85
+ const handleActive = (val) => {
86
+ setActive(val);
87
+
88
+ //
89
+
90
+
91
+ setSearchQuery('')
92
+ }
93
+
94
+ let availableSortBy = [
95
+ {
96
+ 'label': 'All (A-Z)',
97
+ 'value': 'all'
98
+ }
99
+ ];
100
+
101
+ let title = "All Sets";
102
+ if (productType == "expansion-sets") {
103
+ title = "Expansion Sets";
104
+ } else if (productType == "artist") {
105
+ title = "Artist";
106
+ }
107
+
108
+ return (
109
+ <Fragment>
110
+ <StoreTitle>{title}</StoreTitle>
111
+ <h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
112
+ {attributeData ? 'By ' + attributeData.label : 'Shop By'}
113
+ </h1>
114
+ <div className='border border-gray-100 px-6'>
115
+ {dataResult ? (
116
+ <div
117
+ className={classes.toolbar}
118
+ >
119
+ <div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={setSearchQuery} /></div>
120
+ <CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
121
+ </div>
122
+ ) : ''}
123
+ {productType != "expansion-sets" ? (
124
+ <>
125
+ <section className='single_list-indexing-container relative m-auto py-10'>
126
+ <ul className='flex gap-2 justify-center flex-wrap'>
127
+ <li>
128
+ <button
129
+ className={cn(
130
+ 'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
131
+ 'leading-4 font-medium text-base hover_bg-gray-50'
132
+ )}
133
+ onClick={() => {
134
+ handleActive('all')
135
+ }}
136
+ >
137
+ {active == 'all' ? <b>All</b> : 'All'}
138
+ </button>
139
+ </li>
140
+ {alpha.map((letter, index) => (
141
+ <li key={index}>
142
+ <button
143
+ className={cn(
144
+ 'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
145
+ 'leading-4 font-medium text-base ',
146
+ availableGroups.includes(letter) > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
147
+ )}
148
+ onClick={() => {
149
+ handleActive(letter)
150
+ }}
151
+ disabled={availableGroups.includes(letter) > 0 ? false : true}
152
+ >
153
+ {active == letter ? <b>{letter}</b> : letter}
154
+ </button>
155
+ </li>
156
+ ))}
157
+ </ul>
158
+ </section>
159
+ </>
160
+ ) : ''}
161
+ <Divider className="mb-5 px-4 mt-5" />
162
+ <section className='singles-container'>
163
+ <div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
164
+ {Object.keys(dataResult).length != 0 ? setRelases : (searchQuery ? <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found for <b>{searchQuery}</b> search query.</div> : <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found.</div>)}
165
+ </div>
166
+ </section>
167
+ </div>
168
+ </Fragment>
169
+ );
170
+ }
171
+
172
+ export default ShopBy;
@@ -102,7 +102,6 @@ const ShopBy = props => {
102
102
  // value: 'all'
103
103
  // });
104
104
 
105
- // console.log(currentSort)
106
105
 
107
106
  const classes = useStyle(defaultClasses);
108
107
 
@@ -54,7 +54,6 @@ const ShopBySets = props => {
54
54
  // value: 'all'
55
55
  // });
56
56
 
57
- // console.log(currentSort)
58
57
 
59
58
  const classes = useStyle(defaultClasses);
60
59
 
@@ -113,7 +112,6 @@ const ShopBySets = props => {
113
112
  })
114
113
  }
115
114
 
116
- // console.log('setsResult: '+setsResult.length);
117
115
  let setsResultSplitted = [];
118
116
  if (active == release_type || newCollectibleGameSets.length == 1) {
119
117
  setsResultSplitted = splitToNChunks(setsResult, 3);
@@ -201,7 +199,6 @@ const ShopBySets = props => {
201
199
  title = "By Year";
202
200
  }
203
201
 
204
- console.log(availableGroups)
205
202
 
206
203
  return (
207
204
  <Fragment>
@@ -0,0 +1,2 @@
1
+ export { default } from './sportCardsSets';
2
+ export { default as SportCardsSetsShimmer } from './sportCardsSets.shimmer';