@riosst100/pwa-marketplace 2.1.6 → 2.1.7

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "2.1.6",
4
+ "version": "2.1.7",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -21,6 +21,7 @@ module.exports = componentOverrideMapping = {
21
21
  [`@magento/venia-ui/lib/components/MegaMenu/megaMenu.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.js',
22
22
  [`@magento/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js',
23
23
  [`@magento/venia-ui/lib/RootComponents/Category/categoryContent.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js',
24
+ [`@magento/venia-ui/lib/RootComponents/Product/product.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Product/product.js',
24
25
  [`@magento/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js',
25
26
  [`@magento/peregrine/lib/talons/RootComponents/Category/useCategory.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategory.js',
26
27
  [`@magento/peregrine/lib/talons/Breadcrumbs/useBreadcrumbs.js`]: '@riosst100/pwa-marketplace/src/overwrites/peregrine/lib/talons/Breadcrumbs/useBreadcrumbs.js',
@@ -0,0 +1,58 @@
1
+ import React, { Fragment } from 'react';
2
+ import { FormattedMessage } from 'react-intl';
3
+ import { string } from 'prop-types';
4
+ import { useProduct } from '@magento/peregrine/lib/talons/RootComponents/Product/useProduct';
5
+
6
+ import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
7
+ import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
8
+ import ProductFullDetail from '@magento/venia-ui/lib/components/ProductFullDetail';
9
+ import mapProduct from '@magento/venia-ui/lib/util/mapProduct';
10
+ import ProductShimmer from './product.shimmer';
11
+
12
+ /*
13
+ * As of this writing, there is no single Product query type in the M2.3 schema.
14
+ * The recommended solution is to use filter criteria on a Products query.
15
+ * However, the `id` argument is not supported. See
16
+ * https://github.com/magento/graphql-ce/issues/86
17
+ * TODO: Replace with a single product query when possible.
18
+ */
19
+
20
+ const Product = props => {
21
+ const { __typename: productType } = props;
22
+ const talonProps = useProduct({
23
+ mapProduct
24
+ });
25
+
26
+ const { error, loading, product } = talonProps;
27
+
28
+ if (loading && !product)
29
+ return <ProductShimmer productType={productType} />;
30
+ if (error && !product) return <ErrorView />;
31
+ if (!product) {
32
+ return <ErrorView />;
33
+ return (
34
+ <h1>
35
+ <FormattedMessage
36
+ id={'product.outOfStockTryAgain'}
37
+ defaultMessage={
38
+ 'This Product is currently out of stock. Please try again later.'
39
+ }
40
+ />
41
+ </h1>
42
+ );
43
+ }
44
+
45
+ return (
46
+ <Fragment>
47
+ <StoreTitle>{product.name}</StoreTitle>
48
+ <Meta name="description" content={product.meta_description} />
49
+ <ProductFullDetail product={product} />
50
+ </Fragment>
51
+ );
52
+ };
53
+
54
+ Product.propTypes = {
55
+ __typename: string.isRequired
56
+ };
57
+
58
+ export default Product;