{"version":3,"sources":["webpack:///./Scripts/Components/FavouriteButton.js","webpack:///./Scripts/Containers/FavouriteButton.container.js"],"names":["FavouriteButton","props","articleNumber","dispatch","useDispatch","useState","window","__litium","preloadState","wishlist","items","x","length","isActive","setIsActive","className","onClick","quantity","addToWishList","addProduct","FavouriteButtonContainer"],"mappings":"iLAKe,SAASA,EAAgBC,GAAO,MACnCC,EAAkBD,EAAlBC,cACFC,EAAWC,cAF0B,EAGXC,mBAAS,MAAAC,OAAOC,SAASC,aAAaC,SAASC,OAAtC,QAAmD,SAAAC,GAAC,OAAIA,EAAET,eAAiBA,KAAeU,OAAS,GAHjG,WAGpCC,EAHoC,KAG1BC,EAH0B,KAmB3C,OACI,oCACI,yBAAKC,UAAU,aACX,yBAAKA,UAAU,kBACX,uBAAGA,UAAWF,EAAW,kBAAoB,kBAAmBG,QAAS,kBAlBtE,SAACd,GAChB,IAAIe,EAAW,EACXJ,GAIAC,GAAY,GACZG,GAAY,GAJZH,GAAY,GAMhBX,EACIe,YAAc,CAAEhB,gBAAee,cAQwDE,CAAWjB,SCzB/F,SAASkB,EAAyBnB,GAAO,IAC5CC,EAAkBD,EAAlBC,cAER,OACI,oCACI,kBAACF,EAAoB,CAACE,cAAgBA,KARlD","file":"23.8948ff8729ab1291f9ea.js","sourcesContent":["import React, { useState } from 'react';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\nimport { translate } from '../Services/translation';\r\nimport { add as addToWishList } from '../Actions/WishList.action';\r\n\r\nexport default function FavouriteButton(props) {\r\n    const { articleNumber } = props;\r\n    const dispatch = useDispatch();\r\n    const [isActive, setIsActive] = useState(window.__litium.preloadState.wishlist.items.filter(x => x.articleNumber == articleNumber).length > 0);\r\n\r\n    const addProduct = (articleNumber) => {\r\n        let quantity = 1;\r\n        if(!isActive){\r\n            setIsActive(true);\r\n        }\r\n        else{\r\n            setIsActive(false);\r\n            quantity = -1;\r\n        }\r\n        dispatch(\r\n            addToWishList({ articleNumber, quantity })\r\n        )\r\n    }\r\n\r\n    return (\r\n        <>\r\n            <div className=\"favourite\">\r\n                <div className=\"icon-container\">\r\n                    <i className={isActive ? \"fas fa-bookmark\" : \"fal fa-bookmark\"} onClick={() => addProduct(articleNumber)}></i>\r\n                </div>\r\n            </div>\r\n        </>\r\n    )\r\n}","import React, { useState } from 'react';\r\nimport FavouriteButton from '../Components/FavouriteButton';\r\n\r\nexport default function FavouriteButtonContainer(props) {\r\n    const { articleNumber } = props;\r\n\r\n    return (\r\n        <>\r\n            <FavouriteButton {...{articleNumber : articleNumber}}/>\r\n        </>\r\n    )\r\n}"],"sourceRoot":""}