@riosst100/pwa-marketplace 1.3.3 → 1.3.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 (165) hide show
  1. package/.github/workflows/dependabot.yml +28 -28
  2. package/package.json +18 -18
  3. package/src/componentOverrideMapping.js +14 -0
  4. package/src/components/BecomeSellerLink/becomeSellerLink.js +1 -1
  5. package/src/components/BecomeSellerLink/becomeSellerLink.module.css +0 -4
  6. package/src/components/CurrencySwitcher/currencySwitcher.himmer.js +6 -0
  7. package/src/components/CurrencySwitcher/currencySwitcher.module.css +102 -0
  8. package/src/components/CurrencySwitcher/index.js +107 -0
  9. package/src/components/CurrencySwitcher/switcherItem.js +47 -0
  10. package/src/components/CurrencySwitcher/switcherItem.module.css +20 -0
  11. package/src/components/FilterOption/FilterOptionModal.module.css +90 -0
  12. package/src/components/FilterOption/filterOptionModal.js +48 -0
  13. package/src/components/FilterOptionModal/filterOptionModal.js +66 -0
  14. package/src/components/Header/becomeSellerLink.module.css +0 -4
  15. package/src/components/Header/websiteSwitcher.js +0 -1
  16. package/src/components/Header/websiteSwitcher.module.css +107 -111
  17. package/src/components/WebsiteSwitcher/websiteSwitcher.js +18 -6
  18. package/src/components/WebsiteSwitcher/websiteSwitcher.module.css +107 -111
  19. package/src/overwrites/peregrine/lib/talons/FilterModal/useFilterList.js +62 -0
  20. package/src/overwrites/peregrine/lib/talons/MegaMenu/useMegaMenuItem.js +66 -0
  21. package/src/overwrites/peregrine/lib/talons/MegaMenu/useSubMenu.js +20 -0
  22. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +0 -2
  23. package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/index.js +1 -0
  24. package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.js +77 -0
  25. package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.module.css +39 -0
  26. package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.png +0 -0
  27. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.gql.js +17 -0
  28. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +91 -0
  29. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css +76 -0
  30. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +12 -14
  31. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.shimmer.js +74 -0
  32. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/001.jpg +0 -0
  33. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/002.jpg +0 -0
  34. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/003.jpg +0 -0
  35. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/004.jpg +0 -0
  36. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/005.jpg +0 -0
  37. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/006.jpg +0 -0
  38. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/007.jpg +0 -0
  39. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/008.jpg +0 -0
  40. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/009.jpg +0 -0
  41. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/010.jpg +0 -0
  42. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/011.jpg +0 -0
  43. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/012.jpg +0 -0
  44. package/src/overwrites/venia-ui/lib/RootComponents/Category/images/index.js +12 -0
  45. package/src/overwrites/venia-ui/lib/RootComponents/Category/index.js +6 -0
  46. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +112 -0
  47. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.module.css +32 -0
  48. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.shimmer.js +24 -0
  49. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/index.js +2 -0
  50. package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.js +78 -0
  51. package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.module.css +73 -0
  52. package/src/overwrites/venia-ui/lib/components/Checkbox/index.js +1 -0
  53. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.js +60 -0
  54. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.module.css +21 -0
  55. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +65 -0
  56. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.module.css +17 -0
  57. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/index.js +1 -0
  58. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js +18 -18
  59. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.module.css +0 -0
  60. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItem.js +79 -0
  61. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.js +76 -0
  62. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.module.css +0 -0
  63. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +86 -0
  64. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.js +265 -0
  65. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.module.css +20 -0
  66. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/index.js +1 -0
  67. package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.js +135 -0
  68. package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.module.css +25 -0
  69. package/src/overwrites/venia-ui/lib/components/FilterModal/filterFooter.js +49 -0
  70. package/src/overwrites/venia-ui/lib/components/FilterModal/filterFooter.module.css +10 -0
  71. package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.js +166 -0
  72. package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.module.css +87 -0
  73. package/src/overwrites/venia-ui/lib/components/FilterModal/filterSearch.module.css +3 -0
  74. package/src/overwrites/venia-ui/lib/components/FilterModal/index.js +1 -0
  75. package/src/overwrites/venia-ui/lib/components/FilterSidebar/__tests__/filterSidebar.spec.js +246 -0
  76. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +8 -8
  77. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +58 -58
  78. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.shimmer.js +24 -0
  79. package/src/overwrites/venia-ui/lib/components/FilterSidebar/index.js +2 -0
  80. package/src/overwrites/venia-ui/lib/components/Gallery/addToCartButton.js +116 -0
  81. package/src/overwrites/venia-ui/lib/components/Gallery/addToCartButton.module.css +38 -0
  82. package/src/overwrites/venia-ui/lib/components/Gallery/gallery.js +56 -0
  83. package/src/overwrites/venia-ui/lib/components/Gallery/gallery.module.css +28 -0
  84. package/src/overwrites/venia-ui/lib/components/Gallery/gallery.shimmer.js +39 -0
  85. package/src/overwrites/venia-ui/lib/components/Gallery/index.js +3 -0
  86. package/src/overwrites/venia-ui/lib/components/Gallery/item.js +204 -0
  87. package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +109 -0
  88. package/src/overwrites/venia-ui/lib/components/Gallery/item.shimmer.js +38 -0
  89. package/src/overwrites/venia-ui/lib/components/Gallery/star.js +12 -0
  90. package/src/overwrites/venia-ui/lib/components/Header/accountTrigger.js +98 -0
  91. package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.js +116 -0
  92. package/src/overwrites/venia-ui/lib/components/Header/header.js +12 -9
  93. package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +22 -8
  94. package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.module.css +107 -0
  95. package/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger.js +23 -0
  96. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +1 -1
  97. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +0 -1
  98. package/src/overwrites/venia-ui/lib/components/Pagination/index.js +1 -0
  99. package/src/overwrites/venia-ui/lib/components/Pagination/navButton.js +65 -0
  100. package/src/overwrites/venia-ui/lib/components/Pagination/pagination.js +107 -0
  101. package/src/overwrites/venia-ui/lib/components/Pagination/tile.js +41 -0
  102. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.js +74 -0
  103. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.module.css +9 -0
  104. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/index.js +1 -0
  105. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.js +82 -0
  106. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.module.css +9 -0
  107. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/index.js +1 -0
  108. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.js +85 -0
  109. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.module.css +9 -0
  110. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/index.js +1 -0
  111. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/index.js +1 -0
  112. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.js +104 -0
  113. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.module.css +22 -0
  114. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/index.js +1 -0
  115. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.js +74 -0
  116. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.module.css +9 -0
  117. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/index.js +1 -0
  118. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.js +99 -0
  119. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.module.css +13 -0
  120. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/index.js +1 -0
  121. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.js +88 -0
  122. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.module.css +13 -0
  123. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/index.js +1 -0
  124. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.js +94 -0
  125. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.module.css +13 -0
  126. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/attributeType.js +67 -0
  127. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/index.js +1 -0
  128. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +64 -0
  129. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.module.css +9 -0
  130. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/index.js +1 -0
  131. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/index.js +1 -0
  132. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.gql.js +7 -0
  133. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +413 -0
  134. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.module.css +203 -0
  135. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.js +180 -0
  136. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.module.css +102 -0
  137. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.shimmer.js +51 -0
  138. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.shimmer.module.css +7 -0
  139. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/index.js +1 -0
  140. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/thumbnail.js +108 -0
  141. package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/thumbnail.module.css +47 -0
  142. package/src/overwrites/venia-ui/lib/components/ProductSort/index.js +2 -0
  143. package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.js +233 -0
  144. package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.module.css +65 -0
  145. package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.shimmer.js +28 -0
  146. package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.shimmer.module.css +10 -0
  147. package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.js +57 -0
  148. package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.module.css +23 -0
  149. package/src/overwrites/venia-ui/lib/components/QuantityStepper/index.js +1 -0
  150. package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.js +94 -0
  151. package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.module.css +78 -0
  152. package/src/overwrites/venia-ui/lib/components/RichContent/index.js +1 -0
  153. package/src/overwrites/venia-ui/lib/components/RichContent/plainHtmlRenderer.js +17 -0
  154. package/src/overwrites/venia-ui/lib/components/RichContent/richContent.js +59 -0
  155. package/src/overwrites/venia-ui/lib/components/RichContent/richContent.module.css +146 -0
  156. package/src/overwrites/venia-ui/lib/components/RichContent/richContentRenderers.js +7 -0
  157. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +1 -2
  158. package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +3 -2
  159. package/src/overwrites/venia-ui/lib/components/TextInput/field.module.css +50 -0
  160. package/src/overwrites/venia-ui/lib/components/TextInput/index.js +1 -0
  161. package/src/overwrites/venia-ui/lib/components/TextInput/textInput.js +48 -0
  162. package/src/overwrites/venia-ui/lib/components/TextInput/textInput.module.css +21 -0
  163. package/src/talons/FilterOption/useFilterOptionModal.js +11 -0
  164. package/src/talons/FilterOptionModal/useFilterOptionModal.js +11 -0
  165. package/src/theme/vars.js +12 -0
@@ -0,0 +1,413 @@
1
+ import React, { useMemo, Fragment, Suspense } from 'react';
2
+ import { FormattedMessage, useIntl } from 'react-intl';
3
+ import { arrayOf, bool, number, shape, string } from 'prop-types';
4
+ import { Form } from 'informed';
5
+ import { Info } from 'react-feather';
6
+
7
+ import Price from '@magento/venia-ui/lib/components/Price';
8
+ import { useProductFullDetail } from '@magento/peregrine/lib/talons/ProductFullDetail/useProductFullDetail';
9
+ import { isProductConfigurable } from '@magento/peregrine/lib/util/isProductConfigurable';
10
+
11
+ import { useStyle } from '@magento/venia-ui/lib/classify';
12
+ import Breadcrumbs from '../Breadcrumbs';
13
+ import Button from '@magento/venia-ui/lib/components/Button';
14
+ import Carousel from '../ProductImageCarousel';
15
+ import FormError from '@magento/venia-ui/lib/components/FormError';
16
+ import QuantityStepper from '../QuantityStepper';
17
+ import RichContent from '../RichContent/richContent';
18
+ import { ProductOptionsShimmer } from '@magento/venia-ui/lib/components/ProductOptions';
19
+ import CustomAttributes from './CustomAttributes';
20
+ import defaultClasses from './productFullDetail.module.css';
21
+ import cn from 'classnames';
22
+
23
+ const WishlistButton = React.lazy(() => import('@magento/venia-ui/lib/components/Wishlist/AddToListButton'));
24
+ const Options = React.lazy(() => import('@magento/venia-ui/lib/components/ProductOptions'));
25
+
26
+ // Correlate a GQL error message to a field. GQL could return a longer error
27
+ // string but it may contain contextual info such as product id. We can use
28
+ // parts of the string to check for which field to apply the error.
29
+ const ERROR_MESSAGE_TO_FIELD_MAPPING = {
30
+ 'The requested qty is not available': 'quantity',
31
+ 'Product that you are trying to add is not available.': 'quantity',
32
+ "The product that was requested doesn't exist.": 'quantity'
33
+ };
34
+
35
+ // Field level error messages for rendering.
36
+ const ERROR_FIELD_TO_MESSAGE_MAPPING = {
37
+ quantity: 'The requested quantity is not available.'
38
+ };
39
+
40
+ const ProductFullDetail = props => {
41
+ const { product } = props;
42
+
43
+ const talonProps = useProductFullDetail({ product });
44
+
45
+ const {
46
+ breadcrumbCategoryId,
47
+ errorMessage,
48
+ handleAddToCart,
49
+ handleSelectionChange,
50
+ isOutOfStock,
51
+ isEverythingOutOfStock,
52
+ outOfStockVariants,
53
+ isAddToCartDisabled,
54
+ isSupportedProductType,
55
+ mediaGalleryEntries,
56
+ productDetails,
57
+ customAttributes,
58
+ wishlistButtonProps
59
+ } = talonProps;
60
+
61
+ const { formatMessage } = useIntl();
62
+
63
+ const classes = useStyle(defaultClasses, props.classes);
64
+
65
+ const options = isProductConfigurable(product) ? (
66
+ <Suspense fallback={<ProductOptionsShimmer />}>
67
+ <Options
68
+ onSelectionChange={handleSelectionChange}
69
+ options={product.configurable_options}
70
+ isEverythingOutOfStock={isEverythingOutOfStock}
71
+ outOfStockVariants={outOfStockVariants}
72
+ />
73
+ </Suspense>
74
+ ) : null;
75
+
76
+ const breadcrumbs = breadcrumbCategoryId ? (
77
+ <Breadcrumbs
78
+ categoryId={breadcrumbCategoryId}
79
+ currentProduct={productDetails.name}
80
+ />
81
+ ) : null;
82
+
83
+ // Fill a map with field/section -> error.
84
+ const errors = new Map();
85
+ if (errorMessage) {
86
+ Object.keys(ERROR_MESSAGE_TO_FIELD_MAPPING).forEach(key => {
87
+ if (errorMessage.includes(key)) {
88
+ const target = ERROR_MESSAGE_TO_FIELD_MAPPING[key];
89
+ const message = ERROR_FIELD_TO_MESSAGE_MAPPING[target];
90
+ errors.set(target, message);
91
+ }
92
+ });
93
+
94
+ // Handle cases where a user token is invalid or expired. Preferably
95
+ // this would be handled elsewhere with an error code and not a string.
96
+ if (errorMessage.includes('The current user cannot')) {
97
+ errors.set('form', [
98
+ new Error(
99
+ formatMessage({
100
+ id: 'productFullDetail.errorToken',
101
+ defaultMessage:
102
+ 'There was a problem with your cart. Please sign in again and try adding the item once more.'
103
+ })
104
+ )
105
+ ]);
106
+ }
107
+
108
+ // Handle cases where a cart wasn't created properly.
109
+ if (
110
+ errorMessage.includes('Variable "$cartId" got invalid value null')
111
+ ) {
112
+ errors.set('form', [
113
+ new Error(
114
+ formatMessage({
115
+ id: 'productFullDetail.errorCart',
116
+ defaultMessage:
117
+ 'There was a problem with your cart. Please refresh the page and try adding the item once more.'
118
+ })
119
+ )
120
+ ]);
121
+ }
122
+
123
+ // An unknown error should still present a readable message.
124
+ if (!errors.size) {
125
+ errors.set('form', [
126
+ new Error(
127
+ formatMessage({
128
+ id: 'productFullDetail.errorUnknown',
129
+ defaultMessage:
130
+ 'Could not add item to cart. Please check required options and try again.'
131
+ })
132
+ )
133
+ ]);
134
+ }
135
+ }
136
+
137
+ const customAttributesDetails = useMemo(() => {
138
+ const list = [];
139
+ const pagebuilder = [];
140
+ const skuAttribute = {
141
+ attribute_metadata: {
142
+ uid: 'attribute_sku',
143
+ used_in_components: ['PRODUCT_DETAILS_PAGE'],
144
+ ui_input: {
145
+ ui_input_type: 'TEXT'
146
+ },
147
+ label: formatMessage({
148
+ id: 'global.sku',
149
+ defaultMessage: 'SKU'
150
+ })
151
+ },
152
+ entered_attribute_value: {
153
+ value: productDetails.sku
154
+ }
155
+ };
156
+ if (Array.isArray(customAttributes)) {
157
+ customAttributes.forEach(customAttribute => {
158
+ if (
159
+ customAttribute.attribute_metadata.ui_input
160
+ .ui_input_type === 'PAGEBUILDER'
161
+ ) {
162
+ pagebuilder.push(customAttribute);
163
+ } else {
164
+ list.push(customAttribute);
165
+ }
166
+ });
167
+ }
168
+ list.unshift(skuAttribute);
169
+ return {
170
+ list: list,
171
+ pagebuilder: pagebuilder
172
+ };
173
+ }, [customAttributes, productDetails.sku, formatMessage]);
174
+
175
+ const cartCallToActionText =
176
+ !isEverythingOutOfStock || !isOutOfStock ? (
177
+ <FormattedMessage
178
+ id="productFullDetail.addItemToCart"
179
+ defaultMessage="Add to Cart"
180
+ />
181
+ ) : (
182
+ <FormattedMessage
183
+ id="productFullDetail.itemOutOfStock"
184
+ defaultMessage="Out of Stock"
185
+ />
186
+ );
187
+ // Error message for screen reader
188
+ const cartActionContent = isSupportedProductType ? (
189
+ <section className={classes.actButton}>
190
+ <Button
191
+ data-cy="ProductFullDetail-addToCartButton"
192
+ disabled={isAddToCartDisabled}
193
+ aria-disabled={isAddToCartDisabled}
194
+ aria-label={
195
+ isEverythingOutOfStock
196
+ ? formatMessage({
197
+ id: 'productFullDetail.outOfStockProduct',
198
+ defaultMessage:
199
+ 'This item is currently out of stock'
200
+ })
201
+ : ''
202
+ }
203
+ priority="high"
204
+ type="submit"
205
+ >
206
+ {cartCallToActionText}
207
+ </Button>
208
+ </section>
209
+ ) : (
210
+ <div className={classes.unavailableContainer}>
211
+ <Info />
212
+ <p>
213
+ <FormattedMessage
214
+ id={'productFullDetail.unavailableProduct'}
215
+ defaultMessage={
216
+ 'This product is currently unavailable for purchase.'
217
+ }
218
+ />
219
+ </p>
220
+ </div>
221
+ );
222
+
223
+ const shortDescription = productDetails.shortDescription ? (
224
+ <RichContent html={productDetails.shortDescription.html} />
225
+ ) : null;
226
+
227
+ const pageBuilderAttributes = customAttributesDetails.pagebuilder.length ? (
228
+ <section className={classes.detailsPageBuilder}>
229
+ <CustomAttributes
230
+ classes={{ list: classes.detailsPageBuilderList }}
231
+ customAttributes={customAttributesDetails.pagebuilder}
232
+ showLabels={false}
233
+ />
234
+ </section>
235
+ ) : null;
236
+
237
+ const review_count = 0;
238
+ const rating_value = 0;
239
+
240
+ return (
241
+ <Fragment>
242
+ {breadcrumbs}
243
+ <Form
244
+ className={classes.root}
245
+ data-cy="ProductFullDetail-root"
246
+ onSubmit={handleAddToCart}
247
+ >
248
+ <section className={classes.leftContainer}>
249
+ <Carousel images={mediaGalleryEntries} />
250
+ </section>
251
+ <section className={classes.rightContainer}>
252
+ <div
253
+ className={cn(
254
+ classes.title
255
+ )}
256
+ >
257
+ <h1
258
+ aria-live="polite"
259
+ className={cn(
260
+ classes.productName,
261
+ '!font-semibold leading-[normal] mb-4 line-clamp-2'
262
+ )}
263
+ data-cy="ProductFullDetail-productName"
264
+ >
265
+ {productDetails.name}
266
+ </h1>
267
+ <div className='product_review-container flex items-center gap-x-2'>
268
+ <div className='product_rating leading-[14px]'>
269
+ <span className='text-gray-200 text-sm'>
270
+ {rating_value}
271
+ </span>
272
+ </div>
273
+ <div className='before_block before_w-[1px] before_bg-gray-200 before_h-full before_relative w-[1px] h-[14px]'></div>
274
+ <span className='review_count text-gray-200 text-sm leading-[14px]'>
275
+ {review_count} Reviews
276
+ </span>
277
+ </div>
278
+ </div>
279
+ <div
280
+ className={cn(
281
+ 'product_short_description'
282
+ )}
283
+ >
284
+ {shortDescription}
285
+ </div>
286
+ <div
287
+ className={cn(
288
+ 'product_price_container'
289
+ )}
290
+ >
291
+ <p
292
+ data-cy="ProductFullDetail-productPrice"
293
+ className={classes.productPrice}
294
+ >
295
+ <Price
296
+ currencyCode={productDetails.price.currency}
297
+ value={productDetails.price.value}
298
+ />
299
+ </p>
300
+ </div>
301
+ <FormError
302
+ classes={{
303
+ root: classes.formErrors
304
+ }}
305
+ errors={errors.get('form') || []}
306
+ />
307
+ <section className={classes.options}>{options}</section>
308
+ <section className={classes.quantity}>
309
+ <span
310
+ data-cy="ProductFullDetail-quantityTitle"
311
+ className={classes.quantityTitle}
312
+ >
313
+ <FormattedMessage
314
+ id={'global.quantity'}
315
+ defaultMessage={'Quantity'}
316
+ />
317
+ </span>
318
+ <QuantityStepper
319
+ classes={{ root: classes.quantityRoot }}
320
+ min={1}
321
+ message={errors.get('quantity')}
322
+ />
323
+ </section>
324
+ <section className={classes.actions}>
325
+ {cartActionContent}
326
+ <Suspense fallback={null}>
327
+ <WishlistButton {...wishlistButtonProps} />
328
+ </Suspense>
329
+ </section>
330
+ </section>
331
+ <section className={classes.description}>
332
+ <span
333
+ data-cy="ProductFullDetail-descriptionTitle"
334
+ className={classes.descriptionTitle}
335
+ >
336
+ <FormattedMessage
337
+ id={'productFullDetail.description'}
338
+ defaultMessage={'Description'}
339
+ />
340
+ </span>
341
+ <RichContent html={productDetails.description} />
342
+ </section>
343
+ <section className={classes.details}>
344
+ <span
345
+ data-cy="ProductFullDetail-detailsTitle"
346
+ className={classes.detailsTitle}
347
+ >
348
+ <FormattedMessage
349
+ id={'productFullDetail.details'}
350
+ defaultMessage={'Details'}
351
+ />
352
+ </span>
353
+ <CustomAttributes
354
+ customAttributes={customAttributesDetails.list}
355
+ />
356
+ </section>
357
+ {pageBuilderAttributes}
358
+ </Form>
359
+ </Fragment>
360
+ );
361
+ };
362
+
363
+ ProductFullDetail.propTypes = {
364
+ classes: shape({
365
+ cartActions: string,
366
+ description: string,
367
+ descriptionTitle: string,
368
+ details: string,
369
+ detailsPageBuilder: string,
370
+ detailsPageBuilderList: string,
371
+ detailsTitle: string,
372
+ imageCarousel: string,
373
+ options: string,
374
+ productName: string,
375
+ productPrice: string,
376
+ quantity: string,
377
+ quantityTitle: string,
378
+ quantityRoot: string,
379
+ root: string,
380
+ title: string,
381
+ unavailableContainer: string
382
+ }),
383
+ product: shape({
384
+ __typename: string,
385
+ id: number,
386
+ stock_status: string,
387
+ sku: string.isRequired,
388
+ price: shape({
389
+ regularPrice: shape({
390
+ amount: shape({
391
+ currency: string.isRequired,
392
+ value: number.isRequired
393
+ })
394
+ }).isRequired
395
+ }).isRequired,
396
+ media_gallery_entries: arrayOf(
397
+ shape({
398
+ uid: string,
399
+ label: string,
400
+ position: number,
401
+ disabled: bool,
402
+ file: string.isRequired
403
+ })
404
+ ),
405
+ description: string,
406
+ short_description: shape({
407
+ html: string,
408
+ __typename: string
409
+ })
410
+ }).isRequired
411
+ };
412
+
413
+ export default ProductFullDetail;
@@ -0,0 +1,203 @@
1
+ .root {
2
+ composes: lg_grid from global;
3
+ composes: lg_grid-flow-row from global;
4
+ composes: lg_items-start from global;
5
+ composes: gap-x-5 from global;
6
+ }
7
+
8
+ @media (min-width: 1024px) {
9
+ .root {
10
+ grid-template-areas:
11
+ 'left-container right-container';
12
+ grid-template-columns: minmax(0, 495px) minmax(0, 1fr);
13
+ grid-template-rows: repeat(5, min-content) 1fr [fold];
14
+ }
15
+
16
+ .title {
17
+ grid-template-columns: 1fr max-content;
18
+ }
19
+ }
20
+
21
+ .section {
22
+ composes: border-solid from global;
23
+ composes: border-subtle from global;
24
+ composes: border-t-0 from global;
25
+ composes: border-r-0 from global;
26
+ composes: border-b from global;
27
+ composes: border-l-0 from global;
28
+ composes: my-0 from global;
29
+ composes: mx-sm from global;
30
+ composes: px-0 from global;
31
+ composes: py-xs from global;
32
+ }
33
+
34
+ .sectionTitle {
35
+ composes: flex from global;
36
+ composes: font-semibold from global;
37
+ composes: items-center from global;
38
+ composes: leading-normal from global;
39
+ composes: mb-sm from global;
40
+ composes: text-colorDefault from global;
41
+ }
42
+
43
+ .title {
44
+ /* composes: section;
45
+ composes: gap-2 from global;
46
+ composes: grid from global;
47
+ composes: items-center from global;
48
+ composes: leading-normal from global;
49
+ composes: px-sm from global;
50
+ composes: py-xs from global;
51
+ grid-area: title; */
52
+ }
53
+
54
+ .productName {
55
+ composes: font-semibold from global;
56
+ composes: text-colorDefault from global;
57
+
58
+ composes: lg_font-normal from global;
59
+ composes: lg_text-xl from global;
60
+ }
61
+
62
+ .productPrice {
63
+ composes: block from global;
64
+ composes: mb-2 from global;
65
+ }
66
+
67
+ .leftContainer {
68
+ grid-area: left-container;
69
+ grid-column: 1 / 2;
70
+ grid-row: 1 / fold;
71
+ composes: max-w-[495px] from global;
72
+ }
73
+
74
+ .rightContainer {
75
+ grid-area: right-container;
76
+ }
77
+
78
+ .options {
79
+ grid-area: options;
80
+ }
81
+
82
+ .formErrors {
83
+ composes: section;
84
+ grid-area: errors;
85
+ }
86
+
87
+ .quantity {
88
+ composes: section;
89
+ grid-area: quantity;
90
+ }
91
+
92
+ .quantityTitle {
93
+ composes: block from global;
94
+ composes: font-semibold from global;
95
+ composes: leading-normal from global;
96
+ composes: mb-sm from global;
97
+ composes: text-colorDefault from global;
98
+ }
99
+
100
+ .actions {
101
+ composes: gap-y-sm from global;
102
+ composes: grid from global;
103
+ composes: items-center from global;
104
+ composes: justify-items-center from global;
105
+ composes: section;
106
+ grid-area: cart;
107
+
108
+ composes: lg_border-b-0 from global;
109
+ }
110
+
111
+ .description {
112
+ composes: section;
113
+ grid-column: 1 / span 1;
114
+ grid-row: fold / span 1;
115
+
116
+ composes: lg_border-t from global;
117
+ composes: lg_m-0 from global;
118
+ composes: lg_pl-sm from global;
119
+ composes: lg_pr-sm from global;
120
+ composes: lg_self-stretch from global;
121
+ }
122
+
123
+ .descriptionTitle {
124
+ composes: sectionTitle;
125
+ }
126
+
127
+ .details {
128
+ composes: section;
129
+ grid-column: 2 / span 1;
130
+ grid-row: fold / span 1;
131
+
132
+ composes: lg_border-t from global;
133
+ composes: lg_m-0 from global;
134
+ composes: lg_pl-sm from global;
135
+ composes: lg_pr-sm from global;
136
+ composes: lg_self-stretch from global;
137
+ }
138
+
139
+ .detailsPageBuilder {
140
+ composes: my-0 from global;
141
+ composes: mx-sm from global;
142
+ composes: px-0 from global;
143
+ composes: py-sm from global;
144
+ grid-column: 1 / span 2;
145
+ }
146
+
147
+ .detailsPageBuilderList {
148
+ list-style: none;
149
+ }
150
+
151
+ @media (min-width: 1024px) {
152
+ .details {
153
+ align-self: stretch;
154
+ border-top-width: 1px;
155
+ margin: 0;
156
+ padding-left: 1.5rem;
157
+ padding-right: 1.5rem;
158
+ }
159
+ }
160
+
161
+ .detailsTitle {
162
+ composes: sectionTitle;
163
+ }
164
+
165
+ .related {
166
+ composes: border-b-0 from global;
167
+ composes: section;
168
+ grid-column: 1 / span 2;
169
+ }
170
+
171
+ .relatedTitle {
172
+ composes: sectionTitle;
173
+ }
174
+
175
+ .quantityRoot {
176
+ --stroke: var(--venia-global-color-gray-600);
177
+
178
+ composes: gap-x-2xs from global;
179
+ composes: grid from global;
180
+ composes: items-center from global;
181
+ composes: justify-items-center from global;
182
+ composes: text-center from global;
183
+ grid-template-columns: 1fr 4rem 1fr;
184
+ grid-template-columns: auto 4rem auto;
185
+ composes: justify-start from global;
186
+ }
187
+
188
+ .unavailableContainer {
189
+ composes: bg-subtle from global;
190
+ composes: gap-x-2xs from global;
191
+ composes: grid from global;
192
+ composes: grid-flow-col from global;
193
+ composes: italic from global;
194
+ composes: items-center from global;
195
+ composes: justify-start from global;
196
+ composes: p-3 from global;
197
+ composes: text-subtle from global;
198
+ composes: w-full from global;
199
+ }
200
+
201
+ .actButton {
202
+ composes: mt-sm from global;
203
+ }