{"version":3,"sources":["webpack:///./Scripts/Components/WishList.add.js","webpack:///./Scripts/Components/WishListButton.js","webpack:///./Scripts/Components/WishListButton.container.js"],"names":["WishListAdd","Component","constructor","props","super","this","state","showCreateWishlist","wishlistName","wishlists","edit","editWishlistCurrentName","editWishlistNewName","setWrapperRef","bind","handleClickOutside","componentDidMount","setState","getAllWishlists","document","addEventListener","componentWillUnmount","removeEventListener","handleEdit","name","addWishlistName","evt","val","target","value","updateEditWishlist","articleNumber","addToWishlist","onClose","addNewWishlist","updateWishlistName","node","wrapperRef","event","contains","render","wishList","payload","Fragment","className","ref","onClick","translate","type","message","id","placeholder","onChange","handleAddWishlist","handleUpdateWishlistName","lists","map","list","index","key","handleAddToWishlist","title","connect","dispatch","add","previousName","newName","updateWishListName","onError","ex","catchError","error","loadError","label","href","cssClass","BuyButtonContainer","showInfo","onToggle","prevState","onSuccess","cart","withReactiveStyleBuyButton"],"mappings":"2KAUA,MAAMA,UAAoBC,YACtBC,YAAYC,GACRC,MAAMD,GACNE,KAAKC,MAAQ,CACTC,oBAAoB,EACpBC,aAAc,GACdC,UAAW,KACXC,MAAM,EACNC,wBAAyB,GACzBC,oBAAqB,IAEzBP,KAAKQ,cAAgBR,KAAKQ,cAAcC,KAAKT,MAC7CA,KAAKU,mBAAqBV,KAAKU,mBAAmBD,KAAKT,MAG3DW,oBACIX,KAAKY,SAASR,UAAYJ,KAAKF,MAAMe,kBACrCC,SAASC,iBAAiB,YAAaf,KAAKU,oBAGhDM,uBACIF,SAASG,oBAAoB,YAAajB,KAAKU,oBAGnDQ,WAAWC,GACPnB,KAAKY,SAAS,CACVP,MAAM,EACNC,wBAAyBa,EACzBZ,oBAAqBY,IAI7BC,gBAAgBC,GACZ,MAAMC,EAAMD,EAAIE,OAAOC,MACvBxB,KAAKY,SAAS,CACVT,aAAcmB,IAItBG,mBAAmBJ,GACf,MAAMC,EAAMD,EAAIE,OAAOC,MACvBxB,KAAKY,SAAS,CACVL,oBAAqBe,IAIJ,0B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MO,GAClDI,mBAAoB,CAAC8B,EAAcC,IAC/BH,GAASI,QAAmBF,EAAcC,IAC9ChC,eAAgB,CAAC1B,EAAcuB,KAC3BiC,QAAIxD,EAAcuB,EAAe,GACrCqC,QAAUC,IACNN,GAASO,OAAWD,GAAKE,GAtBlBA,KAAD,CACdvB,KAAM,sBACNN,QAAS,CACL6B,WAmBuCC,CAAUD,UAKzD,CAA4DvE,I,kFClS5D,MAMA,EANuB,EAAGyE,QAAO1C,gBAAe2C,OAAMC,WAAU7B,aAC5D,qBAAGF,UAAW+B,EAAU7B,QAAS,IAAMA,KAClC2B,G,iPCGT,MAAMG,UAA2B3E,YAC7BC,YAAYC,GACRC,MAAMD,GACNE,KAAKC,MAAQ,CACTuE,UAAU,GAIlBrC,SACI,MAAMsC,EAAW,KACbzE,KAAKY,UAAU8D,IAAD,CACVF,UAAWE,EAAUF,cAI7B,OACI,2BAC4B,GAAvBxE,KAAKC,MAAMuE,UACR,gBAAC,UAAD,CACI5C,QAAS,IAAM6C,IACf/C,cAAe1B,KAAKF,MAAM4B,gBAGlC,gBAAC,EAAD,KAAoB1B,KAAKF,MAAzB,CAAgC2C,QAAS,IAAMgC,SAM/D,MAeMN,EAAaD,IAAD,CACdvB,KAAM,sBACNN,QAAS,CACL6B,WAIR,GAAeT,SAtBUxD,IACd,MAGiByD,IACjB,CACHiB,UAAYC,MAGZb,QAAUC,IACNN,GAASO,OAAWD,GAAKE,GAAUC,EAAUD,UAYzD,EAGEW,OAA2BN,EAAoB","file":"954.71d520a0f40959da1bc7.js","sourcesContent":["import React, { Component, Fragment } from 'react';\nimport { connect } from 'react-redux';\nimport {\n    getAllWishlists,\n    add,\n    updateWishListName,\n} from '../Services/WishList.service';\nimport { translate } from '../Services/translation';\nimport { catchError } from '../Actions/Error.action';\n\nclass WishListAdd extends Component {\n    constructor(props) {\n        super(props);\n        this.state = {\n            showCreateWishlist: false,\n            wishlistName: '',\n            wishlists: null,\n            edit: false,\n            editWishlistCurrentName: '',\n            editWishlistNewName: '',\n        };\n        this.setWrapperRef = this.setWrapperRef.bind(this);\n        this.handleClickOutside = this.handleClickOutside.bind(this);\n    }\n\n    componentDidMount() {\n        this.setState.wishlists = this.props.getAllWishlists();\n        document.addEventListener('mousedown', this.handleClickOutside);\n    }\n\n    componentWillUnmount() {\n        document.removeEventListener('mousedown', this.handleClickOutside);\n    }\n\n    handleEdit(name) {\n        this.setState({\n            edit: true,\n            editWishlistCurrentName: name,\n            editWishlistNewName: name,\n        });\n    }\n\n    addWishlistName(evt) {\n        const val = evt.target.value;\n        this.setState({\n            wishlistName: val,\n        });\n    }\n\n    updateEditWishlist(evt) {\n        const val = evt.target.value;\n        this.setState({\n            editWishlistNewName: val,\n        });\n    }\n\n    async handleAddToWishlist(wishlistName, articleNumber) {\n        await this.props.addToWishlist(wishlistName, articleNumber);\n        this.props.getAllWishlists();\n        this.props.onClose();\n    }\n\n    async handleAddWishlist(wishlistName) {\n        await this.props.addNewWishlist(wishlistName, this.props.articleNumber);\n        this.setState({\n            showCreateWishlist: false,\n        });\n        this.props.getAllWishlists();\n        this.props.onClose();\n    }\n\n    async handleUpdateWishlistName() {\n        await this.props.updateWishlistName(\n            this.state.editWishlistCurrentName,\n            this.state.editWishlistNewName\n        );\n        this.props.getAllWishlists();\n    }\n\n    setWrapperRef(node) {\n        this.wrapperRef = node;\n    }\n\n    handleClickOutside(event) {\n        if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {\n            this.props.onClose();\n        }\n    }\n\n    render() {\n        const { wishList } = this.props;\n        const { payload } = wishList;\n\n        return (\n            <Fragment>\n                <div className=\"wishlist-add\">\n                    <div className=\"wishlist-add__info\">\n                        <div\n                            className=\"wishlist-add__content\"\n                            ref={this.setWrapperRef}\n                        >\n                            <div className=\"wishlist-add__content__close\">\n                                <span\n                                    className=\"wishlist-add__content__close__close-button\"\n                                    onClick={() => this.props.onClose()}\n                                ></span>\n                            </div>\n                            <div className=\"wishlist-add__content__top\">\n                                <p className=\"wishlist-add__content__top__title\">\n                                    {this.state.edit\n                                        ? translate('wishlist.add.edit.title')\n                                        : this.state.showCreateWishlist\n                                        ? translate('wishlist.add.create.title')\n                                        : translate('wishlist.add.title')}\n                                </p>\n                                <button\n                                    type=\"submit\"\n                                    className=\"button wishlist-add__content__top__button\"\n                                    onClick={() =>\n                                        this.setState(() => ({\n                                            showCreateWishlist: true,\n                                            edit: false,\n                                        }))\n                                    }\n                                >\n                                    {translate('wishlist.add.addnew')}\n                                </button>\n                            </div>\n\n                            {payload && payload.updateWishlistName && (\n                                <div>{payload.updateWishlistName.message}</div>\n                            )}\n                            {payload && payload.addNewWishlist && (\n                                <div>{payload.addNewWishlist.message}</div>\n                            )}\n\n                            {this.state.showCreateWishlist && (\n                                <div className=\"wishlist-add__content__edit\">\n                                    <input\n                                        className=\"wishlist-add__form-input\"\n                                        id=\"wishlist-name\"\n                                        name=\"name\"\n                                        type=\"text\"\n                                        placeholder={translate(\n                                            'wishlist.add.inputplaceholder'\n                                        )}\n                                        value={this.state.wishlistName}\n                                        onChange={(evt) =>\n                                            this.addWishlistName(evt)\n                                        }\n                                    />\n                                    <div className=\"wishlist-add__content__edit__button-wrapper\">\n                                        <button\n                                            type=\"submit\"\n                                            className=\"button button--cancel\"\n                                            onClick={() =>\n                                                this.setState(() => ({\n                                                    showCreateWishlist: false,\n                                                }))\n                                            }\n                                        >\n                                            {translate('wishlist.cancel')}\n                                        </button>\n                                        <button\n                                            type=\"submit\"\n                                            className=\"button button--submit\"\n                                            onClick={() => {\n                                                this.handleAddWishlist(\n                                                    this.state.wishlistName,\n                                                    this.props.articleNumber\n                                                );\n                                            }}\n                                        >\n                                            {translate('wishlist.save')}\n                                        </button>\n                                    </div>\n                                </div>\n                            )}\n\n                            {this.state.edit && (\n                                <div className=\"wishlist-add__content__edit\">\n                                    <input\n                                        className=\"wishlist-add__form-input\"\n                                        id=\"wishlist-name\"\n                                        name=\"name\"\n                                        type=\"text\"\n                                        value={this.state.editWishlistNewName}\n                                        onChange={(evt) =>\n                                            this.updateEditWishlist(evt)\n                                        }\n                                    />\n                                    <div className=\"wishlist-add__content__edit__button-wrapper\">\n                                        <button\n                                            type=\"submit\"\n                                            className=\"button button--cancel\"\n                                            onClick={() =>\n                                                this.setState({\n                                                    edit: false,\n                                                })\n                                            }\n                                        >\n                                            {translate('wishlist.cancel')}\n                                        </button>\n                                        <button\n                                            type=\"submit\"\n                                            className=\"button button--submit\"\n                                            onClick={() => {\n                                                this.handleUpdateWishlistName();\n                                                this.setState({\n                                                    edit: false,\n                                                });\n                                            }}\n                                        >\n                                            {translate('wishlist.save')}\n                                        </button>\n                                    </div>\n                                </div>\n                            )}\n                            {wishList &&\n                                !this.state.showCreateWishlist &&\n                                !this.state.edit && (\n                                    <div className=\"wishlist-add__content__lists__container\">\n                                        {wishList.lists &&\n                                            wishList.lists.map(\n                                                (list, index) => (\n                                                    <div\n                                                        key={`wishlist-list-item-${index}`}\n                                                        className=\"wishlist-add__content__lists__item\"\n                                                    >\n                                                        <p\n                                                            className=\"wishlist-add__content__lists__item__text\"\n                                                            onClick={() =>\n                                                                this.handleAddToWishlist(\n                                                                    list.name,\n                                                                    this.props\n                                                                        .articleNumber\n                                                                )\n                                                            }\n                                                        >\n                                                            {list.name}\n                                                        </p>\n                                                        <button\n                                                            className=\"wishlist-add__content__lists__item__edit\"\n                                                            onClick={() => {\n                                                                this.handleEdit(\n                                                                    list.name\n                                                                );\n                                                            }}\n                                                            title={translate(\n                                                                'wishlist.add.edit'\n                                                            )}\n                                                        ></button>\n                                                    </div>\n                                                )\n                                            )}\n                                    </div>\n                                )}\n                        </div>\n                    </div>\n                </div>\n            </Fragment>\n        );\n    }\n}\n\nconst loadError = (error) => ({\n    type: 'WISHLIST_LOAD_ERROR',\n    payload: {\n        error,\n    },\n});\n\nconst mapStateToProps = (state) => {\n    return {\n        wishList: state.wishList,\n    };\n};\n\nconst mapDispatchToProps = (dispatch) => {\n    return {\n        getAllWishlists: () => dispatch(getAllWishlists()),\n        addToWishlist: (name, articleNumber) => add(name, articleNumber),\n        updateWishlistName: (previousName, newName) =>\n            dispatch(updateWishListName(previousName, newName)),\n        addNewWishlist: (wishlistName, articleNumber) =>\n            add(wishlistName, articleNumber, 1),\n        onError: (ex) => {\n            dispatch(catchError(ex, (error) => loadError(error)));\n        },\n    };\n};\n\nexport default connect(mapStateToProps, mapDispatchToProps)(WishListAdd);\n","import React from 'react';\n\nconst WishListButton = ({ label, articleNumber, href, cssClass, onClick }) => (\n    <a className={cssClass} onClick={() => onClick()}>\n        {label}\n    </a>\n);\n\nexport default WishListButton;\n","import React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport WishlistButton from '../Components/WishListButton';\nimport { catchError } from '../Actions/Error.action';\nimport withReactiveStyleBuyButton from './withReactiveStyleBuyButton';\nimport WishlistAdd from './WishList.add';\n\nclass BuyButtonContainer extends Component {\n    constructor(props) {\n        super(props);\n        this.state = {\n            showInfo: false,\n        };\n    }\n\n    render() {\n        const onToggle = () => {\n            this.setState((prevState) => ({\n                showInfo: !prevState.showInfo,\n            }));\n        };\n\n        return (\n            <div>\n                {this.state.showInfo == true && (\n                    <WishlistAdd\n                        onClose={() => onToggle()}\n                        articleNumber={this.props.articleNumber}\n                    />\n                )}\n                <WishlistButton {...this.props} onClick={() => onToggle()} />\n            </div>\n        );\n    }\n}\n\nconst mapStateToProps = (state) => {\n    return {};\n};\n\nconst mapDispatchToProps = (dispatch) => {\n    return {\n        onSuccess: (cart) => {\n            //todo\n        },\n        onError: (ex) => {\n            dispatch(catchError(ex, (error) => loadError(error)));\n        },\n    };\n};\n\nconst loadError = (error) => ({\n    type: 'WISHLIST_LOAD_ERROR',\n    payload: {\n        error,\n    },\n});\n\nexport default connect(\n    mapStateToProps,\n    mapDispatchToProps\n)(withReactiveStyleBuyButton(BuyButtonContainer, 'buy-button-container'));\n"],"sourceRoot":""}