{"version":3,"sources":["webpack:///./React/components/PVWebstore/PVProductCategory/PVSubcategoryList/PVSubCategoryTile.js","webpack:///./React/components/PVWebstore/PVProductCategory/PVSubcategoryList/index.js"],"names":["PVSubCategoryTile","subcategory","categoryName","className","to","Name","ThumbnailImage","width","height","src","alt","DisplayName","onError","e","getFallBackImage","propTypes","PropTypes","shape","string","isRequired","PVSubCategoryList","match","apiGetSubCategories","category","dealerId","history","useHistory","isMounted","useRef","useState","isLoaded","setIsLoaded","Link","setLink","setDisplayName","useEffect","current","Subcategories","params","categoryHasData","isFetching","then","response","payload","catch","push","breadcrumbs","sortOrder","linkTarget","linkText","Fragment","heading","banner","BannerImage","categorypath","webDescription","WebDescription","showViewAllLink","viewAllLink","viewAllDisplayName","map","subcat","index","key","Id","ReactRouterPropTypes","receivedAt","number","bool","arrayOf","func","defaultProps","mapStateToProps","state","ownProps","selectOptions","parent","selectors","selectCategory","selectActiveDealerKey","mapDispatchToProps","dispatch","getSubcategories","connect"],"mappings":"6WAKMA,EAAoB,SAAC,GAAkC,IAAhCC,EAAgC,EAAhCA,YAAaC,EAAmB,EAAnBA,aACtC,OACI,yBAAKC,UAAU,gFACX,yBAAKA,UAAU,kBACX,yBAAKA,UAAU,kBACX,yBAAKA,UAAU,iBACX,kBAAC,OAAD,CAAMC,GAAE,yBAAoBF,EAApB,YAAoCD,EAAYI,OACnDJ,EAAYK,eACT,yBACIC,MAAO,IAAKC,OAAQ,IACpBC,IAAKR,EAAYK,eACjBI,IAAKT,EAAYU,YACjBC,QAAS,SAACC,GAAD,OACLC,YACID,EACA,0EAKZ,KAIZ,yBAAKV,UAAU,4CACX,kBAAC,OAAD,CAAMC,GAAE,yBAAoBF,EAApB,YAAoCD,EAAYI,OACnDJ,EAAYU,kBASzCX,EAAkBe,UAAY,CAC1Bd,YAAae,IAAUC,MAAM,CACzBZ,KAAMW,IAAUE,OAChBZ,eAAgBU,IAAUE,OAC1BP,YAAaK,IAAUE,SACxBC,WACHjB,aAAcc,IAA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,OAAkB+E,EAASC,YAAiBhF,O,EAIpDiF,YAAQX,EAAiBQ,EAAzBG,CAA6C/D,GAA7C,a,6FApKTA,E,gJAsJAoD,E,8IAQAQ,E","file":"bundle.60.6d3c6bfb.js","sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport getFallBackImage from '../../../../helpers/getFallbackImage';\n\nconst PVSubCategoryTile = ({ subcategory, categoryName }) => {\n return (\n
\n
\n
\n
\n \n {subcategory.ThumbnailImage ? (\n \n getFallBackImage(\n e,\n '/WebSupport/PV_React/WebStore/category-thumbs/imageNotAvailable.jpg'\n )\n }\n />\n ) : (\n ''\n )}\n \n
\n
\n \n {subcategory.DisplayName}\n \n
\n
\n
\n
\n );\n};\n\nPVSubCategoryTile.propTypes = {\n subcategory: PropTypes.shape({\n Name: PropTypes.string,\n ThumbnailImage: PropTypes.string,\n DisplayName: PropTypes.string,\n }).isRequired,\n categoryName: PropTypes.string.isRequired,\n};\n\nexport default PVSubCategoryTile;\n","import React, { useState, useEffect, useRef } from 'react';\nimport { Link, useHistory } from 'react-router-dom';\nimport ReactRouterPropTypes from 'react-router-prop-types';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport PVShopWrapper from '../../PVShopWrapper';\nimport PVSubCategoryTile from './PVSubCategoryTile';\nimport { getSubcategories } from '../../../../redux/products/category/actionsAsync';\nimport { selectors } from '../../../../redux/products/category';\nimport { selectActiveDealerKey } from '../../../../redux/userProfile/selectors';\n\nconst PVSubCategoryList = ({ match, apiGetSubCategories, category, dealerId }) => {\n\tconst history = useHistory();\n\tconst isMounted = useRef(null);\n\tconst categoryPath = '';\n\tconst [isLoaded, setIsLoaded] = useState(false);\n\tconst [Link,setLink]=useState([]);\n\tconst [DisplayName,setDisplayName]=useState('');\n\n\tuseEffect(() => {\n\t\tisMounted.current = true;\n\t\treturn () => {\n\t\t\tisMounted.current = false;\n\t\t};\n\t}, []);\n\n\tuseEffect(() => {\n\t\t if (!isLoaded || typeof category.Subcategories ==='undefined' ){\n \n\t\n\t\t\tconst { params } = match;\n\t\t\tconst categoryHasData = category && category.Name;\n\t\t\tif (!categoryHasData && !category.isFetching) {\n\t\t\t\tapiGetSubCategories(params.categoryName)\n\t\t\t\t\t.then((response) => {\n\t\t\t\t \n\t\t\t\t\t\tif (isMounted.current) {\n\t\t\t\t\t\tconst category= response.payload;\n\t\t\t\t\t\t//console.log(\" category =\"+JSON.stringify(category));\n\t\t\t \t\t//console.log(\" categoryName=\"+JSON.stringify(category.categoryName));\n\t\t\t\t\t\t//console.log(\" Subcategories DisplayName=\"+JSON.stringify(category.Subcategories[0].DisplayName));\n\t\t\t\t\t\t setLink (category.categoryName)\n\t\t\t\t\t\t setDisplayName (category.Subcategories[0].DisplayName)\n \t\t\t\t\t\t setIsLoaded(true);\n\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\thistory.push('/Error/404');\n\t\t\t\t\t});\n\t\t\t} else if (categoryHasData) {\n\t\t \n\t\t\t\tsetIsLoaded(true);\n\t\t\t}\n\t\t}\n\t}, [match, category, isLoaded]);\n\n\tuseEffect(() => {\n\t\tif (isMounted.current) {\n\t\t\tsetIsLoaded(false);\n\t\t\tconst { params } = match;\n\t\t\tapiGetSubCategories(params.categoryName)\n\t\t\t\t.then((response) => {\n\t\t\t\t \n\t\t\t\t\tif (isMounted.current) {\n\t\t\t\t\t const category= response.payload;\n\t\t\t\t\t\n\t\t\t\t\t //console.log(\"category.categoryName\"+JSON.stringify(category.categoryName));\n\t\t\t\t\t //console.log(\"category.Subcategories[0].Name\"+JSON.stringify(category.Subcategories[0].DisplayName));\n\t\t\t\t\t setLink (category.categoryName)\n\t\t\t\t\t setDisplayName (category.Subcategories[0].DisplayName)\n \n \n\t\t\t\t\t setIsLoaded(true);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\thistory.push('/Error/404');\n\t\t\t\t});\n\t\t}\n\t}, [dealerId]);\n\n\tconst breadcrumbs = [\n\t\t{\n\t\t\tsortOrder: 18,\n\t\t\tlinkTarget: '/',\n\t\t\tlinkText: 'Home',\n\t\t},\n\t\t{\n\t\t\tsortOrder: 19,\n\t\t\tlinkTarget: `/Shop/Category/${category.categoryName}`,\n\t\t\tlinkText: category.DisplayName,\n\t\t},\n\t];\n\n\treturn (\n\t\t\n\t\t\t{isLoaded ? (\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{!category || !category.Subcategories\n\t\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t\t: category.Subcategories.map((subcat, index) => {\n\t\t\t\t\t\t\t\t\t\t if (index > 0) {\n\t\t\t\t\t\t\t\t\t\t\t return (\n\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t );\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t return null;\n\t\t\t\t\t\t\t\t\t })}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\t
\n\t\t\t)}\n\t\t\n\t);\n};\n\nPVSubCategoryList.propTypes = {\n\tmatch: ReactRouterPropTypes.match.isRequired,\n\tdealerId: PropTypes.string,\n\tcategory: PropTypes.shape({\n\t\treceivedAt: PropTypes.number,\n\t\tisFetching: PropTypes.bool,\n\t\tName: PropTypes.string,\n\t\tcategoryName: PropTypes.string,\n\t\tDisplayName: PropTypes.string,\n\t\tBannerImage: PropTypes.string,\n\t\tSubcategories: PropTypes.arrayOf(\n\t\t\tPropTypes.shape({\n\t\t\t\tName: PropTypes.string,\n\t\t\t\tThumbnailImage: PropTypes.string,\n\t\t\t\tDisplayName: PropTypes.string,\n\t\t\t})\n\t\t),\n\t}).isRequired,\n\tapiGetSubCategories: PropTypes.func.isRequired,\n};\n\nPVSubCategoryList.defaultProps = {\n\tdealerId: '',\n};\n\nconst mapStateToProps = (state, ownProps) => {\n\tconst { match } = ownProps;\n\tconst selectOptions = { parent: match.params.categoryName };\n\treturn {\n\t\tcategory: selectors.selectCategory(state, selectOptions),\n\t\tdealerId: selectActiveDealerKey(state),\n\t};\n};\nconst mapDispatchToProps = (dispatch) => {\n\treturn {\n\t\tapiGetSubCategories: (categoryName) => dispatch(getSubcategories(categoryName)),\n\t};\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(PVSubCategoryList);\n"],"sourceRoot":""}