@riosst100/pwa-marketplace 2.1.3 → 2.1.5

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 (57) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +6 -0
  3. package/src/components/FavoriteSeller/AddToListButton/addToListButton.js +54 -54
  4. package/src/components/FavoriteSeller/AddToListButton/addToListButton.module.css +17 -17
  5. package/src/components/FavoriteSeller/AddToListButton/index.js +1 -1
  6. package/src/components/FavoriteSeller/AddToListButton/useCommonToasts.js +33 -33
  7. package/src/components/FilterTop/CustomFilters/customFilters.js +130 -132
  8. package/src/components/FilterTop/filterTop.js +1 -8
  9. package/src/components/LinkToOtherStores/index.js +61 -0
  10. package/src/components/NonSportCardsSets/nonSportCardsSets.js +0 -2
  11. package/src/components/RFQ/index.js +6 -3
  12. package/src/components/SellerDetail/sellerDetail.js +18 -1
  13. package/src/components/SellerInformation/sellerInformation.js +5 -3
  14. package/src/components/SellerSocialMedia/index.js +96 -0
  15. package/src/components/SetsData/index.js +2 -0
  16. package/src/components/SetsData/setsData.js +349 -0
  17. package/src/components/SetsData/setsData.module.css +76 -0
  18. package/src/components/SetsData/setsData.shimmer.js +50 -0
  19. package/src/components/ShopBy/shopBy.js +3 -2
  20. package/src/overwrites/pagebuilder/lib/ContentTypes/Products/products.js +13 -0
  21. package/src/overwrites/peregrine/lib/talons/MagentoRoute/magentoRoute.gql.js +27 -0
  22. package/src/overwrites/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js +193 -0
  23. package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +40 -9
  24. package/src/overwrites/peregrine/lib/talons/ProductImageCarousel/useProductImageCarousel.js +77 -0
  25. package/src/overwrites/peregrine/lib/talons/ProductOptions/useOption.js +59 -0
  26. package/src/overwrites/peregrine/lib/talons/ProductOptions/useTile.js +47 -0
  27. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryFragments.gql.js +13 -0
  28. package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +23 -0
  29. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +11 -3
  30. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +0 -6
  31. package/src/overwrites/venia-ui/lib/components/AccountInformationPage/accountInformationPage.js +0 -1
  32. package/src/overwrites/venia-ui/lib/components/AccountInformationPage/editForm.js +0 -1
  33. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +0 -3
  34. package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderSummary/orderSummary.js +0 -1
  35. package/src/overwrites/venia-ui/lib/components/Gallery/item.js +17 -3
  36. package/src/overwrites/venia-ui/lib/components/Price/price.js +113 -0
  37. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/auctionDetail.js +1 -1
  38. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +77 -104
  39. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.js +3 -1
  40. package/src/overwrites/venia-ui/lib/components/ProductOptions/option.js +112 -0
  41. package/src/overwrites/venia-ui/lib/components/ProductOptions/option.module.css +30 -0
  42. package/src/overwrites/venia-ui/lib/components/ProductOptions/options.js +49 -0
  43. package/src/overwrites/venia-ui/lib/components/ProductOptions/tile.js +118 -0
  44. package/src/overwrites/venia-ui/lib/components/ProductOptions/tile.module.css +68 -0
  45. package/src/overwrites/venia-ui/lib/components/ProductOptions/tileList.js +78 -0
  46. package/src/overwrites/venia-ui/lib/components/ProductOptions/tileList.module.css +6 -0
  47. package/src/overwrites/venia-ui/lib/components/ProductOptions/tileList.shimmer.js +32 -0
  48. package/src/talons/CustomFilters/useCustomFilters.js +0 -2
  49. package/src/talons/FavoriteSeller/AddToListButton/addToListButton.gql.js +30 -30
  50. package/src/talons/FavoriteSeller/AddToListButton/useAddToFavoriteListButton.js +0 -1
  51. package/src/talons/LegoSets/useLegoSets.js +0 -5
  52. package/src/talons/Seller/useSeller.js +1 -1
  53. package/src/talons/SetsData/setsData.gql.js +70 -0
  54. package/src/talons/SetsData/useSetsData.js +225 -0
  55. package/src/talons/ShopBy/shopBy.gql.js +12 -6
  56. package/src/talons/ShopBy/useShopBy.js +13 -4
  57. package/src/talons/TrainsSets/useTrainsSets.js +0 -3
@@ -0,0 +1,118 @@
1
+ import React from 'react';
2
+ import { bool, func, number, oneOfType, shape, string } from 'prop-types';
3
+ import { useIntl } from 'react-intl';
4
+ import { useStyle } from '@magento/venia-ui/lib/classify';
5
+ import defaultClasses from './tile.module.css';
6
+ import { useTile } from '@magento/peregrine/lib/talons/ProductOptions/useTile';
7
+ import Image from '@magento/venia-ui/lib/components/Image';
8
+ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
9
+
10
+ const getClassName = (
11
+ name,
12
+ isSelected,
13
+ hasFocus,
14
+ isOptionOutOfStock,
15
+ isEverythingOutOfStock
16
+ ) =>
17
+ `${name}${isSelected ? '_selected' : ''}${hasFocus ? '_focused' : ''}${
18
+ isEverythingOutOfStock || isOptionOutOfStock ? '_outOfStock' : ''
19
+ }`;
20
+
21
+ const Tile = props => {
22
+ const {
23
+ hasFocus,
24
+ isSelected,
25
+ item: { label, value_index },
26
+ onClick,
27
+ isEverythingOutOfStock,
28
+ isOptionOutOfStock,
29
+ setHoveredMedia,
30
+ itemVariant
31
+ } = props;
32
+
33
+ const talonProps = useTile({
34
+ onClick,
35
+ itemVariant,
36
+ setHoveredMedia,
37
+ value_index
38
+ });
39
+
40
+ const { handleMouseLeave, handleMouseEnter, handleClick, variantImg } = talonProps;
41
+ const classes = useStyle(defaultClasses, props.classes);
42
+ const className =
43
+ classes[
44
+ getClassName(
45
+ 'root',
46
+ isSelected,
47
+ hasFocus,
48
+ isOptionOutOfStock,
49
+ isEverythingOutOfStock
50
+ )
51
+ ];
52
+ const { formatMessage } = useIntl();
53
+ const ariaLabelView = formatMessage(
54
+ {
55
+ id: 'ProductOptions.productSize',
56
+ defaultMessage: 'Fashion size {label}'
57
+ },
58
+ { label: label }
59
+ );
60
+
61
+ const ariaLabelSelected = formatMessage(
62
+ {
63
+ id: 'productOptions.selectedSize',
64
+ defaultMessage: 'Fashion size {label} button Selected'
65
+ },
66
+ { label: label }
67
+ );
68
+
69
+ const result = isSelected ? ariaLabelSelected : ariaLabelView;
70
+
71
+ // variantImg
72
+ let image = (
73
+ <Image
74
+ alt=''
75
+ classes={{
76
+ root: classes.variantImageSwatch
77
+ }}
78
+ resource={variantImg}
79
+ width={24}
80
+ />
81
+ );
82
+
83
+ return (
84
+ <button
85
+ className={className}
86
+ onClick={handleClick}
87
+ onMouseEnter={handleMouseEnter}
88
+ onFocus={handleMouseEnter}
89
+ onTouchStart={handleMouseEnter}
90
+ onMouseLeave={handleMouseLeave}
91
+ title={label}
92
+ type="button"
93
+ data-cy="Tile-button"
94
+ aria-label={result}
95
+ disabled={isEverythingOutOfStock || isOptionOutOfStock}
96
+ >
97
+ {image}
98
+ <span className={classes.label}>{label}</span>
99
+ </button>
100
+ );
101
+ };
102
+
103
+ export default Tile;
104
+
105
+ Tile.propTypes = {
106
+ hasFocus: bool,
107
+ isSelected: bool,
108
+ item: shape({
109
+ label: string.isRequired,
110
+ value_index: oneOfType([number, string]).isRequired
111
+ }).isRequired,
112
+ onClick: func.isRequired
113
+ };
114
+
115
+ Tile.defaultProps = {
116
+ hasFocus: false,
117
+ isSelected: false
118
+ };
@@ -0,0 +1,68 @@
1
+ .root {
2
+ composes: root from '@magento/venia-ui/lib/components/clickable.module.css';
3
+
4
+ /* composes: border from global; */
5
+ /* composes: border-solid from global; */
6
+ /* composes: border-strong from global; */
7
+ /* composes: h-[3rem] from global; */
8
+ /* composes: min-w-[3rem] from global; */
9
+ /* composes: px-2xs from global; */
10
+ /* composes: py-0 from global; */
11
+ /* composes: rounded-sm from global; */
12
+ position: relative;
13
+ border: 1px solid rgb(230 233 234);
14
+ border-radius: 2px;
15
+ padding: .5rem;
16
+ align-items: center;
17
+ }
18
+
19
+ .variantImageSwatch {
20
+ width: 24px;
21
+ height: 24px;
22
+ }
23
+
24
+ .root:hover {
25
+ border-color: rgba(247, 107, 28);
26
+ color: rgba(247, 107, 28);
27
+ }
28
+
29
+ .label {
30
+ padding-left: 0.4rem;
31
+ padding-right: 5px;
32
+ }
33
+
34
+ .root_selected {
35
+ composes: root;
36
+
37
+ /* composes: bg-gray-900 from global;
38
+ composes: text-white from global; */
39
+ border-color: rgba(247, 107, 28);
40
+ color: rgba(247, 107, 28);
41
+ }
42
+
43
+ .root_focused {
44
+ composes: root;
45
+ }
46
+
47
+ .root_selected_focused {
48
+ composes: root_selected;
49
+ }
50
+
51
+ .root_outOfStock,
52
+ .root_selected_outOfStock {
53
+ composes: root;
54
+ composes: bg-disabledTile from global;
55
+ composes: opacity-50 from global;
56
+ composes: border-2 from global;
57
+ composes: border-solid from global;
58
+ composes: border-gray-400 from global;
59
+ composes: text-gray-600 from global;
60
+ }
61
+ .root_outOfStock:after,
62
+ .root_selected_outOfStock:after {
63
+ content: '';
64
+ position: absolute;
65
+ border-top: 2px solid rgb(var(--venia-global-color-gray-400));
66
+ width: 62px;
67
+ transform: rotate(-45deg);
68
+ }
@@ -0,0 +1,78 @@
1
+ import React, { useMemo } from 'react';
2
+ import { arrayOf, func, object, shape, string } from 'prop-types';
3
+ import Tile from './tile';
4
+
5
+ import { useStyle } from '@magento/venia-ui/lib/classify';
6
+ import defaultClasses from './tileList.module.css';
7
+
8
+ const TileList = props => {
9
+ const {
10
+ getItemKey,
11
+ selectedValue = {},
12
+ items,
13
+ onSelectionChange,
14
+ isEverythingOutOfStock,
15
+ outOfStockVariants,
16
+ setHoveredMedia,
17
+ filteredVariants
18
+ } = props;
19
+
20
+ const classes = useStyle(defaultClasses, props.classes);
21
+
22
+ const tiles = useMemo(
23
+ () =>
24
+ items.map(item => {
25
+ const value_index = item.value_index;
26
+
27
+ const itemVariant = filteredVariants.filter(variant => {
28
+ return variant.attributes.some(attribute => attribute.value_index === value_index);
29
+ });
30
+
31
+ const isSelected = item.label === selectedValue.label;
32
+ let isOptionOutOfStock;
33
+ if (outOfStockVariants && outOfStockVariants.length > 0) {
34
+ const flatOutOfStockArray = outOfStockVariants.flat();
35
+ isOptionOutOfStock = flatOutOfStockArray.includes(
36
+ item.value_index
37
+ );
38
+ }
39
+
40
+ return (
41
+ <Tile
42
+ key={getItemKey(item)}
43
+ isSelected={isSelected}
44
+ item={item}
45
+ setHoveredMedia={setHoveredMedia}
46
+ itemVariant={itemVariant}
47
+ onClick={onSelectionChange}
48
+ isEverythingOutOfStock={isEverythingOutOfStock}
49
+ isOptionOutOfStock={isOptionOutOfStock}
50
+ />
51
+ );
52
+ }),
53
+ [
54
+ getItemKey,
55
+ selectedValue.label,
56
+ items,
57
+ onSelectionChange,
58
+ isEverythingOutOfStock,
59
+ outOfStockVariants
60
+ ]
61
+ );
62
+
63
+ return <div className={classes.root}>{tiles}</div>;
64
+ };
65
+
66
+ TileList.propTypes = {
67
+ classes: shape({
68
+ root: string
69
+ }),
70
+ getItemKey: func,
71
+ selectedValue: object,
72
+ items: arrayOf(object),
73
+ onSelectionChange: func
74
+ };
75
+
76
+ TileList.displayName = 'TileList';
77
+
78
+ export default TileList;
@@ -0,0 +1,6 @@
1
+ .root {
2
+ composes: gap-xs from global;
3
+ composes: grid from global;
4
+ composes: grid-flow-col from global;
5
+ grid-template-columns: repeat(auto-fit, minmax(3rem, max-content));
6
+ }
@@ -0,0 +1,32 @@
1
+ import React, { useMemo } from 'react';
2
+ import { shape, string } from 'prop-types';
3
+ import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
4
+
5
+ import { useStyle } from '@magento/venia-ui/lib/classify';
6
+ import defaultClasses from './tileList.module.css';
7
+
8
+ const TileListShimmer = props => {
9
+ const classes = useStyle(defaultClasses, props.classes);
10
+
11
+ const tiles = useMemo(() => {
12
+ return Array.from({ length: 3 })
13
+ .fill(null)
14
+ .map((value, index) => {
15
+ return <Shimmer width={3} height={3} key={`tile-${index}`} />;
16
+ });
17
+ }, []);
18
+
19
+ return <div className={classes.root}>{tiles}</div>;
20
+ };
21
+
22
+ TileListShimmer.defaultProps = {
23
+ classes: {}
24
+ };
25
+
26
+ TileListShimmer.propTypes = {
27
+ classes: shape({
28
+ root: string
29
+ })
30
+ };
31
+
32
+ export default TileListShimmer;
@@ -68,8 +68,6 @@ export const useCustomFilters = props => {
68
68
  return typeMap;
69
69
  }, [introspectionData]);
70
70
 
71
- console.log(category)
72
-
73
71
  useEffect(() => {
74
72
 
75
73
  if (!filterTypeMap.size) {
@@ -1,30 +1,30 @@
1
- import { gql } from '@apollo/client';
2
-
3
- export const ADD_TO_FAVORITE_SELLER_LIST = gql`
4
- mutation AddSellerToFavoriteList(
5
- $sellerId: ID!
6
- ) {
7
- addSellerToFavoritelist(
8
- sellerId: $sellerId
9
- ) {
10
- favorite {
11
- id
12
- customer_id
13
- creation_time
14
- status
15
- }
16
- error
17
- }
18
- }
19
- `;
20
-
21
- export const GET_SELLER_IN_FAVORITE_LISTS = gql`
22
- query GetProductsInWishlistsForGallery {
23
- customerWishlistProducts @client
24
- }
25
- `;
26
-
27
- export default {
28
- addToFavoriteSellerMutation: ADD_TO_FAVORITE_SELLER_LIST,
29
- getSellerInFavoriteListsQuery: GET_SELLER_IN_FAVORITE_LISTS
30
- };
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const ADD_TO_FAVORITE_SELLER_LIST = gql`
4
+ mutation AddSellerToFavoriteList(
5
+ $sellerId: ID!
6
+ ) {
7
+ addSellerToFavoritelist(
8
+ sellerId: $sellerId
9
+ ) {
10
+ favorite {
11
+ id
12
+ customer_id
13
+ creation_time
14
+ status
15
+ }
16
+ error
17
+ }
18
+ }
19
+ `;
20
+
21
+ export const GET_SELLER_IN_FAVORITE_LISTS = gql`
22
+ query GetProductsInWishlistsForGallery {
23
+ customerWishlistProducts @client
24
+ }
25
+ `;
26
+
27
+ export default {
28
+ addToFavoriteSellerMutation: ADD_TO_FAVORITE_SELLER_LIST,
29
+ getSellerInFavoriteListsQuery: GET_SELLER_IN_FAVORITE_LISTS
30
+ };
@@ -39,7 +39,6 @@ export const useAddToFavoriteListButton = props => {
39
39
  const [{ isSignedIn }] = useUserContext();
40
40
 
41
41
  const handleClick = useCallback(async () => {
42
- console.log(item)
43
42
  if (!isSignedIn) {
44
43
  setShowLoginToast(current => ++current);
45
44
  } else {
@@ -51,19 +51,14 @@ export const useLegoSets = props => {
51
51
  }, [introspectionData]);
52
52
  const filters = getFiltersFromSearch(search);
53
53
 
54
- // console.log(search)
55
-
56
54
  // Construct the filter arg object.
57
55
  const newFilters = {};
58
56
  filters.forEach((values, key) => {
59
57
  newFilters[key] = getFilterInput(values, filterTypeMap.get(key));
60
- // console.log(key)
61
- // console.log(values)
62
58
 
63
59
  if (key == "sc_baseball_release") {
64
60
  for(let item of values) {
65
61
  if(item) {
66
- // console.log(item.split(',')[0])
67
62
  const data = search.split('&');
68
63
  data.pop();
69
64
  activeFilters.push(
@@ -68,7 +68,7 @@ export const useSeller = props => {
68
68
 
69
69
  const favoriteSellerOptions = useMemo(() => {
70
70
  const options = {
71
- seller_id: seller.seller_id
71
+ seller_id: seller?.seller_id
72
72
  };
73
73
 
74
74
  return options;
@@ -0,0 +1,70 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const GET_STORE_CONFIG_DATA = gql`
4
+ query getStoreConfigData {
5
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
+ storeConfig {
7
+ store_code
8
+ product_url_suffix
9
+ category_url_suffix
10
+ }
11
+ }
12
+ `;
13
+
14
+ export const GET_SETS_DATA_QUERY = gql`
15
+ query getSetsData($categoryUrlKey: String!, $activeTab: String, $filters: ProductAttributeFilterInput!, $shopby: String, $activeFilter: String) {
16
+ getSetsData(categoryUrlKey: $categoryUrlKey, activeTab: $activeTab, filters: $filters, shopby: $shopby, activeFilter: $activeFilter) {
17
+ attribute {
18
+ attribute_code
19
+ label
20
+ }
21
+ page_info {
22
+ title
23
+ hide_title
24
+ filter_group
25
+ }
26
+ data {
27
+ group
28
+ sets {
29
+ set_name
30
+ option_id
31
+ release_year
32
+ }
33
+ }
34
+ }
35
+ }
36
+ `;
37
+
38
+ export const GET_CATEGORY_CONTENT = gql`
39
+ query getCategoryData($id: String!) {
40
+ categories(filters: { category_uid: { in: [$id] } }) {
41
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
42
+ items {
43
+ uid
44
+ name
45
+ url_key
46
+ url_path
47
+ }
48
+ }
49
+ }
50
+ `;
51
+
52
+ export const GET_FILTER_INPUTS = gql`
53
+ query GetFilterInputsForCategory {
54
+ __type(name: "ProductAttributeFilterInput") {
55
+ inputFields {
56
+ name
57
+ type {
58
+ name
59
+ }
60
+ }
61
+ }
62
+ }
63
+ `;
64
+
65
+ export default {
66
+ getStoreConfigData: GET_STORE_CONFIG_DATA,
67
+ getSetsDataQuery: GET_SETS_DATA_QUERY,
68
+ getCategoryContentQuery: GET_CATEGORY_CONTENT,
69
+ getFilterInputsQuery: GET_FILTER_INPUTS,
70
+ };