@riosst100/pwa-marketplace 3.1.2 → 3.1.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 (76) hide show
  1. package/package.json +1 -1
  2. package/src/components/BrandLandingPage/brandLanding.js +0 -5
  3. package/src/components/CheckoutHeader/accountTrigger.js +104 -0
  4. package/src/components/CheckoutHeader/cartTrigger.js +110 -0
  5. package/src/components/CheckoutHeader/cartTrigger.module.css +47 -0
  6. package/src/components/CheckoutHeader/storeSwitcher.js +119 -0
  7. package/src/components/CheckoutHeader/storeSwitcher.module.css +107 -0
  8. package/src/components/CheckoutHeader/switcherItem.js +47 -0
  9. package/src/components/CheckoutHeader/wishlistTrigger.js +23 -0
  10. package/src/components/FilterListContent/filterListPage.js +0 -25
  11. package/src/components/FilterTop/filterTop.js +1 -1
  12. package/src/components/HelpCenter/helpCenter.js +151 -0
  13. package/src/components/HelpCenter/helpcenter.module.css +225 -0
  14. package/src/components/HelpCenter/index.js +1 -0
  15. package/src/components/HelpCenter/questionDetail.js +89 -0
  16. package/src/components/ProductContent/productContent.js +1 -1
  17. package/src/components/RMAPage/components/productItem.css +15 -0
  18. package/src/components/RMAPage/components/productItem.module.css +15 -0
  19. package/src/components/RelatedProducts/index.js +1 -0
  20. package/src/components/RelatedProducts/relatedProducts.js +44 -0
  21. package/src/components/SellerMegaMenu/__tests__/MegaMenu.spec.js +91 -0
  22. package/src/components/SellerMegaMenu/__tests__/MegaMenuItem.spec.js +123 -0
  23. package/src/components/SellerMegaMenu/__tests__/Submenu.spec.js +61 -0
  24. package/src/components/SellerMegaMenu/__tests__/SubmenuColumn.spec.js +50 -0
  25. package/src/components/SellerMegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +114 -0
  26. package/src/components/SellerMegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +71 -0
  27. package/src/components/SellerMegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +59 -0
  28. package/src/components/SellerMegaMenu/__tests__/__snapshots__/SubmenuColumn.spec.js.snap +34 -0
  29. package/src/components/SellerMegaMenu/customSubmenuColumn.js +75 -0
  30. package/src/components/SellerMegaMenu/customSubmenuColumn.module.css +29 -0
  31. package/src/components/SellerMegaMenu/shopByColumn.js +121 -0
  32. package/src/components/SellerProducts/productContent.js +2 -4
  33. package/src/components/SetsData/setsData.js +0 -25
  34. package/src/components/ShopBy/shopBy.js +3 -78
  35. package/src/components/ShopBySets/shopBySets.js +2 -2
  36. package/src/components/ShowMore/showMore.js +3 -49
  37. package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderHistoryPage.gql.js +1 -15
  38. package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderRow.gql.js +0 -11
  39. package/src/overwrites/peregrine/lib/talons/RelatedProducts/productReview.gql.js +89 -0
  40. package/src/overwrites/peregrine/lib/talons/RelatedProducts/useRelatedProducts.js +833 -0
  41. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +0 -16
  42. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +1 -5
  43. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +118 -62
  44. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +3 -50
  45. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +1 -7
  46. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/editModal.js +41 -0
  47. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/index.js +1 -0
  48. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productDetail.js +80 -0
  49. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productDetail.module.css +33 -0
  50. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productForm.js +153 -0
  51. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/EditModal/productForm.module.css +52 -0
  52. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/errorMessage.js +31 -0
  53. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/errorMessage.module.css +13 -0
  54. package/src/overwrites/venia-ui/lib/components/CartPage/ProductListingBySeller/quantity.js +40 -0
  55. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +21 -92
  56. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +6 -2
  57. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +0 -21
  58. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/Reviews/reviewModal.js +8 -0
  59. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js +3 -3
  60. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +4 -85
  61. package/src/talons/HelpCenter/helpCenter.gql.js +93 -0
  62. package/src/talons/HelpCenter/useHelpCenter.js +59 -0
  63. package/src/talons/ProductContent/productContent.gql.js +0 -16
  64. package/src/talons/ProductContent/useProductContent.js +0 -4
  65. package/src/talons/RelatedProducts/relatedProducts.gql.js +209 -0
  66. package/src/talons/RelatedProducts/useRelatedProducts.js +112 -0
  67. package/src/talons/SellerProducts/productContent.gql.js +1 -17
  68. package/src/talons/SellerProducts/useProductContent.js +1 -36
  69. package/src/components/AttributesBlock/attributesBlock.js +0 -54
  70. package/src/components/AttributesBlock/attributesBlock.module.css +0 -28
  71. package/src/components/ShopBy/shopBy copy.js +0 -172
  72. package/src/components/SubCategory/customSubCategory.js +0 -45
  73. package/src/components/SubCategory/customSubCategory.module.css +0 -22
  74. package/src/talons/AttributesBlock/attributesBlock.gql.js +0 -15
  75. package/src/talons/AttributesBlock/useAttributesBlock.js +0 -38
  76. package/src/talons/SubCategory/useCustomSubCategory.js +0 -50
@@ -39,23 +39,7 @@ export const GET_CATEGORY_CONTENT = gql`
39
39
  value
40
40
  }
41
41
  url_path
42
- hide_filters
43
- allowed_filters {
44
- code
45
- }
46
42
  prefixes
47
- custom_subcategory {
48
- name
49
- path
50
- }
51
- attributes_block {
52
- label
53
- code
54
- items {
55
- label
56
- value
57
- }
58
- }
59
43
  parent {
60
44
  uid
61
45
  name
@@ -268,10 +268,7 @@ export const useCategoryContent = props => {
268
268
 
269
269
  filters.push(newFilter);
270
270
  });
271
-
272
- const attributesBlock = categoryData && categoryData.categories.items.length
273
- ? categoryData.categories.items[0].attributes_block
274
- : null;
271
+
275
272
  const parent =
276
273
  categoryData && categoryData.categories.items.length
277
274
  ? categoryData.categories.items[0].parent
@@ -317,7 +314,6 @@ export const useCategoryContent = props => {
317
314
  totalPagesFromData,
318
315
  children,
319
316
  parent,
320
- attributesBlock,
321
317
  category,
322
318
  virtualCategoryFilters
323
319
  };
@@ -1,4 +1,4 @@
1
- import React, { Fragment } from 'react';
1
+ import React, { Fragment, useMemo } from 'react';
2
2
  import { shape, string } from 'prop-types';
3
3
  import { useCategory } from '@magento/peregrine/lib/talons/RootComponents/Category';
4
4
  import { useStyle } from '@magento/venia-ui/lib/classify';
@@ -41,9 +41,9 @@ const Category = props => {
41
41
 
42
42
  const query = new URLSearchParams(location.search);
43
43
  const shopby = query.get('shopby') || null;
44
- const show_more = query.get('show_more') || null;
45
- const filterby = query.get('filterby') || null;
46
- const showSubcategory = query.get('show_subcategory') || null;
44
+ const showMoreGamesOrCategories = query.get('show_more') || null;
45
+
46
+ const sidebarFilterShowMore = query.get('filterby') || null;
47
47
 
48
48
  const talonProps = useCategory({
49
49
  id: uid,
@@ -84,72 +84,128 @@ const Category = props => {
84
84
  />
85
85
  );
86
86
  }
87
+
88
+ const categoryContent = useMemo(() => {
89
+ if (sidebarFilterShowMore) {
90
+ return (
91
+ <FilterContent
92
+ categoryId={uid}
93
+ classes={classes}
94
+ data={categoryData}
95
+ filterby={sidebarFilterShowMore}
96
+ isLoading={loading}
97
+ pageControl={pageControl}
98
+ sortProps={sortProps}
99
+ pageSize={pageSize}
100
+ />
101
+ );
102
+ }
87
103
 
88
- const allowedShopby = ['card_artist'];
104
+ if (showMoreGamesOrCategories) {
105
+ return (
106
+ <ShowMore
107
+ categoryId={uid}
108
+ shopby={showMoreGamesOrCategories}
109
+ isLoading={loading}
110
+ />
111
+ );
112
+ }
113
+
114
+ if (
115
+ shopby == "release_year"
116
+ || shopby == "secret_lair"
117
+ || shopby == "expansion_sets"
118
+ || shopby == "sets"
119
+ || shopby == "release"
120
+ ) {
121
+ return (
122
+ <SetsData
123
+ categoryId={uid}
124
+ shopby={shopby}
125
+ isLoading={loading}
126
+ />
89
127
 
90
- return (
91
- <Fragment>
92
- <Meta name="description" content={metaDescription} />
93
- {showSubcategory ? (
94
- <SubCategoryPage
95
- categoryId={uid}
96
- isLoading={loading} />
97
- ) : (
98
- filterby ? (
99
- <FilterContent
100
- categoryId={uid}
101
- classes={classes}
102
- data={categoryData}
103
- filterby={filterby}
104
- isLoading={loading}
105
- pageControl={pageControl}
106
- sortProps={sortProps}
107
- pageSize={pageSize}
108
- />
109
- ) : allowedShopby.includes(shopby) ? <ShopBy
110
- categoryId={uid}
111
- shopby={shopby}
112
- isLoading={loading} /> : shopby == "release_year" || shopby == "secret_lair" || shopby == "expansion_sets" || shopby == "sets" || shopby == "release" ? <SetsData
113
- categoryId={uid}
114
- shopby={shopby}
115
- isLoading={loading} /> : shopby == "singles" || shopby == "lego_set_name" && parentCategoryUrlKey == "lego" ? <LegoSets
116
- categoryId={uid}
117
- shopby={shopby}
118
- isLoading={loading} /> : shopby && parentCategoryUrlKey == "non-sports-cards" ? <NonSportCardsSets
119
- categoryId={uid}
120
- shopby={shopby}
121
- isLoading={loading} /> : shopby == "sc_baseball_players" || shopby == "sc_baseball_teams" || shopby == "release" && parentCategoryUrlKey == "sport-cards" ? <SportCardsSets
122
- categoryId={uid}
123
- shopby={shopby}
124
- isLoading={loading} /> : shopby == "release_year" ? <ShopBySets
125
- categoryId={uid}
126
- shopby={shopby}
127
- isLoading={loading} /> : shopby == "card" ? <ShopByCard
128
- categoryId={uid}
129
- shopby={shopby}
130
- isLoading={loading} /> : (show_more ? (
131
- <ShowMore
128
+ );
129
+ }
130
+
131
+ if (
132
+ shopby == "singles"
133
+ || shopby == "lego_set_name"
134
+ && parentCategoryUrlKey == "lego"
135
+ ) {
136
+ return (
137
+ <LegoSets
132
138
  categoryId={uid}
133
- shopby={show_more}
134
- isLoading={loading} />
135
- ) : shopby && shopby != "gauge" ? (
136
- <ShopBy
139
+ shopby={shopby}
140
+ isLoading={loading}
141
+ />
142
+ );
143
+ }
144
+
145
+ if (shopby && parentCategoryUrlKey == "non-sports-cards") {
146
+ return (
147
+ <NonSportCardsSets
137
148
  categoryId={uid}
138
149
  shopby={shopby}
139
- isLoading={loading} />
140
- ) : (
141
- <CategoryContent
150
+ isLoading={loading}
151
+ />
152
+ );
153
+ }
154
+
155
+ if (
156
+ shopby == "sc_baseball_players"
157
+ || shopby == "sc_baseball_teams"
158
+ || shopby == "release"
159
+ && parentCategoryUrlKey == "sport-cards"
160
+ ) {
161
+ return (
162
+ <SportCardsSets
163
+ categoryId={uid}
164
+ shopby={shopby}
165
+ isLoading={loading}
166
+ />
167
+ );
168
+ }
169
+
170
+ if (shopby) {
171
+ return (
172
+ <ShopBy
142
173
  categoryId={uid}
143
- classes={classes}
144
- data={categoryData}
145
174
  shopby={shopby}
146
175
  isLoading={loading}
147
- pageControl={pageControl}
148
- sortProps={sortProps}
149
- pageSize={pageSize}
150
- />
151
- ))
152
- )}
176
+ />
177
+ );
178
+ }
179
+ return (
180
+ <CategoryContent
181
+ categoryId={uid}
182
+ classes={classes}
183
+ data={categoryData}
184
+ shopby={shopby}
185
+ isLoading={loading}
186
+ pageControl={pageControl}
187
+ sortProps={sortProps}
188
+ pageSize={pageSize}
189
+ />
190
+ );
191
+ }, [
192
+ uid,
193
+ classes,
194
+ categoryData,
195
+ shopby,
196
+ loading,
197
+ pageControl,
198
+ sortProps,
199
+ pageSize,
200
+ sidebarFilterShowMore,
201
+ showMoreGamesOrCategories,
202
+ parentCategoryUrlKey
203
+ ]);
204
+
205
+ return (
206
+ <Fragment>
207
+ <Meta name="description" content={metaDescription} />
208
+ {categoryContent}
153
209
  </Fragment>
154
210
  );
155
211
  };
@@ -1,8 +1,7 @@
1
- import React, { useEffect, Fragment, Suspense, useMemo, useRef, useState } from 'react';
1
+ import React, { Fragment, Suspense, useMemo, useRef, useState } from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
3
  import { array, number, shape, string } from 'prop-types';
4
4
 
5
- import { useIsInViewport } from '@magento/peregrine/lib/hooks/useIsInViewport';
6
5
  import { useCategoryContent } from '@magento/peregrine/lib/talons/RootComponents/Category';
7
6
 
8
7
  import { useStyle } from '@magento/venia-ui/lib/classify';
@@ -24,15 +23,8 @@ import defaultClasses from './category.module.css';
24
23
  import NoProductsFound from './NoProductsFound';
25
24
  import cn from 'classnames';
26
25
  import ProductListTab, { ProductListTabShimmer } from '@riosst100/pwa-marketplace/src/components/ProductListTab';
27
- import SubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/subCategory';
28
- import AttributesBlock from '@riosst100/pwa-marketplace/src/components/AttributesBlock/attributesBlock';
29
-
30
- import BrandSlider from '@riosst100/pwa-marketplace/src/components/BrandSlider';
31
- import CollectibleGameSets from '@riosst100/pwa-marketplace/src/components/CollectibleGameSets/collectibleGameSets';
32
26
  import { useLocation, useHistory } from 'react-router-dom';
33
27
  import { getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
34
- import CustomSubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/customSubCategory';
35
- import AlphaFilter from '@riosst100/pwa-marketplace/src/components/AlphaFilter';
36
28
 
37
29
  const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
38
30
  const FilterSidebar = React.lazy(() =>
@@ -73,39 +65,13 @@ const CategoryContent = props => {
73
65
  parent,
74
66
  totalCount,
75
67
  totalPagesFromData,
76
- attributesBlock,
77
68
  category,
78
69
  virtualCategoryFilters
79
70
  } = talonProps;
80
71
 
81
- useEffect(() => {
82
- if (category) {
83
- const urlKey = category.url_key;
84
- if (urlKey == "collectible-game") {
85
- // history.replace('/games/collectible-game/magic-the-gathering.html')
86
- }
87
-
88
- if (urlKey == "sport-cards") {
89
- // history.replace('/cards/sport-cards/baseball.html')
90
- }
91
-
92
- if (urlKey == "non-sports-cards") {
93
- // history.replace('/cards/non-sports-cards/comics.html')
94
- }
95
-
96
- if (urlKey == "lego") {
97
- // history.replace('/lego/lego-sets.html')
98
- }
99
- }
100
- }, [category]);
101
-
102
72
  const [activeLetter, setActiveLetter] = useState('all')
103
73
  const [activeTab, setActiveTab] = useState('all');
104
74
 
105
- const handleActiveLetter = (val) => {
106
- setActiveLetter(val);
107
- }
108
-
109
75
  const galleryItems = [];
110
76
 
111
77
  useMemo(() => {
@@ -142,9 +108,6 @@ const CategoryContent = props => {
142
108
 
143
109
  const sidebarRef = useRef(null);
144
110
  const classes = useStyle(defaultClasses, props.classes);
145
- // const shouldRenderSidebarContent = useIsInViewport({
146
- // elementRef: sidebarRef
147
- // });
148
111
  const shouldRenderSidebarContent = true;
149
112
 
150
113
  const shouldShowFilterButtons = filters && filters.length;
@@ -165,7 +128,7 @@ const CategoryContent = props => {
165
128
  ) : null;
166
129
 
167
130
  const sidebar = shouldShowFilterButtons ? (
168
- <FilterSidebar hideFilters={category && category.hide_filters ? true : false} children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} prefixes={category ? category.prefixes : []} />
131
+ <FilterSidebar children={children} filters={filters} prefixes={category ? category.prefixes : []} />
169
132
  ) : shouldShowFilterShimmer ? (
170
133
  <FilterSidebarShimmer />
171
134
  ) : null;
@@ -310,15 +273,8 @@ const CategoryContent = props => {
310
273
  </h1>
311
274
  {categoryDescriptionElement}
312
275
  </div>
313
- {/* {activeFilters.size <= 0 && category && category.custom_landing_page ? ( */}
314
- <>
315
- {/* {currentFilter && <AlphaFilter isSingles={isSingles} items={items} handleActiveLetter={handleActiveLetter} activeLetter={activeLetter} />} */}
316
- {!currentFilter && <CustomSubCategory categoryName={category ? category.name : null} customSubCategory={category ? category.custom_subcategory : null} />}
317
- {/* {shopby != "gauge" && category?.name != "Collectible Card Games" ? <SubCategory parent={parent} children={children} /> : ''} */}
318
- </>
319
- {/* ) : ( */}
320
276
  <>
321
- <FilterTop shopby={shopby} filters={filters} category={category} children={children} allowedFilters={category ? category.allowed_filters : []} />
277
+ <FilterTop shopby={shopby} filters={filters} category={category} children={children} />
322
278
  <div className={classes.contentWrapper}>
323
279
  <div ref={sidebarRef} className={classes.sidebar}>
324
280
  <Suspense fallback={<FilterSidebarShimmer />}>
@@ -366,9 +322,6 @@ CategoryContent.propTypes = {
366
322
  categoryInfo: string,
367
323
  headerButtons: string
368
324
  }),
369
- // sortProps contains the following structure:
370
- // [{sortDirection: string, sortAttribute: string, sortText: string},
371
- // React.Dispatch<React.SetStateAction<{sortDirection: string, sortAttribute: string, sortText: string}]
372
325
  sortProps: array,
373
326
  pageSize: number
374
327
  };
@@ -42,12 +42,6 @@ const Breadcrumbs = props => {
42
42
  // For all links generate a fragment like "/ Text"
43
43
  const links = useMemo(() => {
44
44
  return normalizedData.map(({ text, path }, index) => {
45
- if (text == "dCollectible Card Games") {
46
- return '';
47
- }
48
-
49
- console.log('index', index);
50
-
51
45
  return (
52
46
  <Fragment key={index}>
53
47
  <span className={classes.divider}>{DELIMITER}</span>
@@ -56,7 +50,7 @@ const Breadcrumbs = props => {
56
50
  to={resourceUrl(path)}
57
51
  onClick={handleClick}
58
52
  >
59
- {text}
53
+ {text}
60
54
  </Link>
61
55
  </Fragment>
62
56
  );
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { useEditModal } from '@magento/peregrine/lib/talons/CartPage/ProductListing/EditModal/useEditModal';
3
+
4
+ import ProductForm from './productForm';
5
+
6
+ /**
7
+ * A child component of the ProductListing component.
8
+ * This component renders an edit modal for a product.
9
+ *
10
+ * @param {Object} props
11
+ * @param {Object} props.item Product to edit.
12
+ * @param {function} props.setActiveEditItem Function for setting the actively editing item
13
+ * See [productListingFragments.js]{@link https://github.com/magento/pwa-studio/blob/develop/packages/venia-ui/lib/components/CartPage/ProductListing/productListingFragments.js}
14
+ * for a list of properties for this object.
15
+ * @param {Function} props.setIsCartUpdating Function for setting the updating state of the cart.
16
+ * @param {Object} props.classes CSS className overrides.
17
+ * See [editModal.module.css]{@link https://github.com/magento/pwa-studio/blob/develop/packages/venia-ui/lib/components/CartPage/ProductListing/EditModal/editModal.module.css}
18
+ * for a list of classes you can override.
19
+ *
20
+ * @returns {React.Element}
21
+ *
22
+ * @example <caption>Importing into your project</caption>
23
+ * import EditModal from "@magento/venia-ui/lib/components/CartPage/ProductListing/EditModal";
24
+ */
25
+ const EditModal = props => {
26
+ const { item, setActiveEditItem, setIsCartUpdating } = props;
27
+ const talonProps = useEditModal();
28
+ const { setVariantPrice, variantPrice } = talonProps;
29
+
30
+ return (
31
+ <ProductForm
32
+ item={item}
33
+ setIsCartUpdating={setIsCartUpdating}
34
+ setVariantPrice={setVariantPrice}
35
+ variantPrice={variantPrice}
36
+ setActiveEditItem={setActiveEditItem}
37
+ />
38
+ );
39
+ };
40
+
41
+ export default EditModal;
@@ -0,0 +1 @@
1
+ export { default } from './editModal';
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { FormattedMessage, useIntl } from 'react-intl';
3
+ import Price from '@magento/venia-ui/lib/components/Price';
4
+ import configuredVariant from '@magento/peregrine/lib/util/configuredVariant';
5
+
6
+ import { useStyle } from '@magento/venia-ui/lib/classify';
7
+ import Image from '@magento/venia-ui/lib/components/Image';
8
+ import defaultClasses from './productDetail.module.css';
9
+
10
+ const IMAGE_SIZE = 240;
11
+
12
+ const ProductDetail = props => {
13
+ const { item, variantPrice, configurableThumbnailSource } = props;
14
+ const { formatMessage } = useIntl();
15
+ const { prices, product } = item;
16
+ const { price } = prices;
17
+ const { currency, value: unitPrice } = variantPrice || price;
18
+ const { name, sku, stock_status: stockStatusValue } = product;
19
+ const stockStatusLabels = new Map([
20
+ [
21
+ 'IN_STOCK',
22
+ formatMessage({
23
+ id: 'productDetail.inStock',
24
+ defaultMessage: 'In stock'
25
+ })
26
+ ],
27
+ [
28
+ 'OUT_OF_STOCK',
29
+ formatMessage({
30
+ id: 'productDetail.outOfStock',
31
+ defaultMessage: 'Out of stock'
32
+ })
33
+ ]
34
+ ]);
35
+ const stockStatus =
36
+ stockStatusLabels.get(stockStatusValue) ||
37
+ formatMessage({
38
+ id: 'productDetail.unknown',
39
+ defaultMessage: 'Unknown'
40
+ });
41
+ const classes = useStyle(defaultClasses, props.classes);
42
+ const configured_variant = configuredVariant(
43
+ item.configurable_options,
44
+ product
45
+ );
46
+ return (
47
+ <div className={classes.root}>
48
+ <Image
49
+ alt={name}
50
+ classes={{
51
+ image: classes.image,
52
+ root: classes.imageContainer
53
+ }}
54
+ width={IMAGE_SIZE}
55
+ resource={
56
+ configurableThumbnailSource === 'itself' &&
57
+ configured_variant
58
+ ? configured_variant.small_image.url
59
+ : product.small_image.url
60
+ }
61
+ />
62
+ <span className={classes.productName}>{name}</span>
63
+ <div className={classes.stockRow}>
64
+ <span>
65
+ <FormattedMessage
66
+ id={'productDetail.skuNumber'}
67
+ defaultMessage={'SKU # {sku}'}
68
+ values={{ sku }}
69
+ />
70
+ </span>
71
+ <span>{stockStatus}</span>
72
+ </div>
73
+ <div className={classes.price}>
74
+ <Price currencyCode={currency} value={unitPrice} />
75
+ </div>
76
+ </div>
77
+ );
78
+ };
79
+
80
+ export default ProductDetail;
@@ -0,0 +1,33 @@
1
+ .root {
2
+ composes: border-b from global;
3
+ composes: border-solid from global;
4
+ composes: border-subtle from global;
5
+ composes: gap-xs from global;
6
+ composes: grid from global;
7
+ composes: pb-xs from global;
8
+ }
9
+
10
+ .imageContainer {
11
+ composes: justify-self-center from global;
12
+ }
13
+
14
+ .image {
15
+ composes: px-md from global;
16
+ composes: py-0 from global;
17
+ }
18
+
19
+ .productName {
20
+ composes: font-medium from global;
21
+ composes: text-xl from global;
22
+ }
23
+
24
+ .stockRow {
25
+ composes: flex from global;
26
+ composes: font-light from global;
27
+ composes: justify-between from global;
28
+ composes: text-sm from global;
29
+ }
30
+
31
+ .price {
32
+ composes: font-medium from global;
33
+ }