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_E/./components/BookmarkButton/index.js","webpack://_N_E/./components/FeedbackModal/FeedbackModal.js","webpack://_N_E/./components/FeedbackModal/index.js","webpack://_N_E/./utils/feedback.js","webpack://_N_E/./components/FeedbackButtons/FeedbackButtons.js","webpack://_N_E/./components/FeedbackButtons/index.js","webpack://_N_E/./components/ShareFeedbackSegment/ShareFeedbackSegment.js","webpack://_N_E/./components/ShareFeedbackSegment/index.js","webpack://_N_E/./containers/CampaignPage/CampaignPage.js","webpack://_N_E/./containers/CampaignPage/index.js","webpack://_N_E/./components/BookmarkButton/BookmarkButton.module.scss","webpack://_N_E/./components/FeedbackButtons/FeedbackButtons.module.scss","webpack://_N_E/./components/FeedbackModal/FeedbackModal.module.scss","webpack://_N_E/./components/ShareFeedbackSegment/ShareFeedbackSegment.module.scss","webpack://_N_E/./containers/CampaignPage/CampaignPage.module.scss"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'next-i18next';\n\nimport Button from '../Button';\n\nimport * as bookmarks from '../../utils/bookmarks';\n\nimport styles from './BookmarkButton.module.scss';\n\nconst BookmarkButton = ({\n    id,\n    url,\n    isNextToShare,\n    untranslatedModifiers = [],\n    untranslatedButtonModifiers,\n}) => {\n    const { t } = useTranslation('common');\n    const [bookmarked, setBookmarked] = useState(false);\n\n    const handleBookmarkToggle = () => {\n        if (bookmarked) {\n            bookmarks.removeBookmark(id);\n            setBookmarked(false);\n        } else {\n            bookmarks.addBookmark({\n                id,\n                url,\n            });\n            setBookmarked(true);\n        }\n    };\n\n    useEffect(() => {\n        setBookmarked(bookmarks.isBookmarked(id));\n    }, [id]);\n\n    const icon = bookmarked ? 'Bookmarked' : 'Bookmark';\n\n    const text = bookmarked\n        ? t('bookmarkbutton.saved')\n        : t('bookmarkbutton.save');\n\n    const classes = classNames(\n        styles['BookmarkButton'],\n        untranslatedModifiers.map((x) => styles[x])\n    );\n\n    return (\n        <div className={classes}>\n            <div className={styles['BookmarkButton__Container']}>\n                <Button\n                    onClick={handleBookmarkToggle}\n                    text={text}\n                    type={isNextToShare ? 'SecondarySmall' : 'PrimarySmall'}\n                    minWidth=\"150px\"\n                    icon={icon}\n                    untranslatedModifiers={untranslatedButtonModifiers}\n                />\n            </div>\n        </div>\n    );\n};\n\nBookmarkButton.propTypes = {\n    id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n    url: PropTypes.string,\n    isNextToShare: PropTypes.bool,\n    untranslatedModifiers: PropTypes.arrayOf(PropTypes.string),\n    untranslatedButtonModifiers: PropTypes.arrayOf(PropTypes.string),\n};\n\nBookmarkButton.defaultProps = {\n    id: '',\n    url: '',\n    isNextToShare: false,\n    untranslatedModifiers: [],\n    untranslatedButtonModifiers: [],\n};\n\nexport default BookmarkButton;\n","import BookmarkButton from './BookmarkButton';\n\nexport default BookmarkButton;\n","import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'next-i18next';\n\nimport Modal from '../Modal';\nimport HingeFadeInFromTop from '../../transitions/HingeFadeInFromTop';\n\nimport { sendArticleFeedbackComment } from '../../utils/api';\n\nimport styles from './FeedbackModal.module.scss';\n\nconst FeedbackModal = ({ feedbackId, visible, toggleVisible }) => {\n    const { t } = useTranslation('common');\n    const [modalContentVisible, setModalContentVisible] = useState(false);\n    const [feedbackComment, setFeedbackComment] = useState('');\n\n    const handleChange = (e) => setFeedbackComment(e.target.value);\n\n    const handleSubmit = (e) => {\n        e.preventDefault();\n        sendArticleFeedbackComment(feedbackId, feedbackComment);\n        toggleVisible();\n    };\n\n    // trigger hinge in animation of modal content\n    useEffect(() => {\n        setModalContentVisible(visible);\n    }, [visible]);\n\n    return (\n        <div className={styles['FeedbackModal']}>\n            <Modal open={visible} handleClose={toggleVisible}>\n                <div>\n                    <HingeFadeInFromTop visible={modalContentVisible}>\n                        <form className={styles['FeedbackModal__Content']}>\n                            <label\n                                className={styles['FeedbackModal__Title']}\n                                htmlFor=\"comment\">\n                                {t('feedbackmodal.thanks')}\n                            </label>\n                            <textarea\n                                name=\"comment\"\n                                className={styles['FeedbackModal__Textarea']}\n                                placeholder={t('feedbackmodal.placeholder')}\n                                value={feedbackComment}\n                                onChange={handleChange}\n                            />\n                            <button\n                                className={\n                                    styles['FeedbackModal__SubmitButton']\n                                }\n                                onClick={handleSubmit}>\n                                {t('feedbackmodal.submit')}\n                            </button>\n                        </form>\n                    </HingeFadeInFromTop>\n                </div>\n            </Modal>\n        </div>\n    );\n};\n\nFeedbackModal.propTypes = {\n    feedbackId: PropTypes.number,\n    visible: PropTypes.bool,\n    toggleVisible: PropTypes.func,\n};\n\nFeedbackModal.defaultProps = {\n    visible: false,\n};\n\nexport default FeedbackModal;\n","import FeedbackModal from './FeedbackModal';\n\nexport default FeedbackModal;\n","import storage from './localStorage';\n\n// init\n\nif (storage.getItem('feedbackedArticleIds') === null) {\n    storage.setItem('feedbackedArticleIds', JSON.stringify([]));\n}\n\nconst getFeedbackedArticleIds = () =>\n    JSON.parse(storage.getItem('feedbackedArticleIds'));\n\nconst getFeedbackByArticleId = (id) => {\n    const feedback = getFeedbackedArticleIds().filter((f) => f.id === id);\n\n    return feedback ? feedback[0] : null;\n};\n\nconst hasFeedbackedArticleId = (id) =>\n    getFeedbackedArticleIds()\n        .map((f) => f.id)\n        .indexOf(id) > -1;\n\nconst addFeedbackedArticleId = (id, rating) => {\n    let feedbackedIds = getFeedbackedArticleIds();\n\n    storage.setItem(\n        'feedbackedArticleIds',\n        JSON.stringify([\n            ...feedbackedIds,\n            {\n                id,\n                rating,\n            },\n        ])\n    );\n};\n\nexport {\n    getFeedbackedArticleIds,\n    getFeedbackByArticleId,\n    addFeedbackedArticleId,\n    hasFeedbackedArticleId,\n};\n","import React, { useCallback, useState, useEffect } from 'react';\n\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'next-i18next';\n\nimport FeedbackModal from '../FeedbackModal';\n\nimport { addFeedbackedArticleId } from '../../utils/feedback';\n\nimport { sendArticleFeedback } from '../../utils/api';\n\nimport styles from './FeedbackButtons.module.scss';\nimport { getFeedbackByArticleId } from '../../utils/feedback';\n\nconst FeedbackButton = ({ type, handleClick, hasVoted, disabled }) => {\n    const { t } = useTranslation('common');\n    const rating = type === 'up-vote' ? 1 : 0;\n\n    const buttonClasses = classNames(styles['FeedbackButtons__Button'], {\n        [styles['FeedbackButtons__Button--DownVote']]: type === 'down-vote',\n        [styles['FeedbackButtons__Button--HasVoted']]: hasVoted,\n    });\n\n    const handleClickWithRating = useCallback(\n        () => handleClick(rating),\n        [rating, handleClick]\n    );\n\n    return (\n        <button\n            className={buttonClasses}\n            onClick={handleClickWithRating}\n            disabled={disabled}>\n            <span className=\"sr-only\">\n                {type === 'up-vote'\n                    ? t('feedbackbuttons.giveupvote')\n                    : t('feedbackbuttons.givedownvote')}\n            </span>\n        </button>\n    );\n};\n\nFeedbackButton.propTypes = {\n    type: PropTypes.oneOf(['up-vote', 'down-vote']),\n    handleClick: PropTypes.func,\n    disabled: PropTypes.bool,\n    hasVoted: PropTypes.bool,\n};\n\nFeedbackButton.defaultProps = {\n    type: 'up-vote',\n    disabled: false,\n    hasVoted: false,\n};\n\nconst FeedbackButtons = ({ articleId }) => {\n    const { t } = useTranslation('common');\n    const [feedbackModalOpen, setFeedbackModalOpen] = useState(false);\n    const [feedbackId, setFeedbackId] = useState(null);\n    const [feedbackSubmitted, setFeedbackSubmitted] = useState({\n        submitted: false,\n        rating: -1,\n    });\n\n    const toggleFeedbackModal = () => setFeedbackModalOpen(!feedbackModalOpen);\n\n    const handleButtonClick = async (rating) => {\n        setFeedbackSubmitted({ submitted: true, rating });\n\n        try {\n            const result = await sendArticleFeedback(articleId, rating);\n            if (result.id) {\n                // set id passed to feedback comment modal\n                setFeedbackId(result.id);\n                // save feedback state to storage\n                addFeedbackedArticleId(articleId, rating);\n            }\n        } catch (e) {\n            console.error('Error - could not submit feedback: ', e);\n        }\n\n        toggleFeedbackModal();\n    };\n\n    // check if user already has feedbacked article\n    useEffect(() => {\n        const feedback = getFeedbackByArticleId(articleId);\n        if (feedback) {\n            setFeedbackSubmitted({\n                submitted: true,\n                rating: feedback.rating,\n            });\n        }\n    }, [articleId]);\n\n    return (\n        <div className={styles['FeedbackButtons']}>\n            <span className={styles['FeedbackButtons__Label']}>\n                {feedbackSubmitted.submitted\n                    ? t('feedbackbuttons.thanksforfeedback')\n                    : t('feedbackbuttons.giveusfeedback')}\n            </span>\n            <div className={styles['FeedbackButtons__ButtonWrapper']}>\n                <FeedbackButton\n                    type=\"up-vote\"\n                    handleClick={handleButtonClick}\n                    hasVoted={feedbackSubmitted.rating === 1}\n                    disabled={feedbackSubmitted.submitted}\n                />\n                <FeedbackButton\n                    type=\"down-vote\"\n                    handleClick={handleButtonClick}\n                    hasVoted={feedbackSubmitted.rating === 0}\n                    disabled={feedbackSubmitted.submitted}\n                />\n            </div>\n\n            <FeedbackModal\n                feedbackId={feedbackId}\n                visible={feedbackModalOpen}\n                toggleVisible={toggleFeedbackModal}\n            />\n        </div>\n    );\n};\n\nFeedbackButtons.propTypes = {\n    articleId: PropTypes.number,\n};\n\nFeedbackButtons.defaultProps = {};\n\nexport default FeedbackButtons;\n","import FeedbackButtons from './FeedbackButtons';\n\nexport default FeedbackButtons;\n","import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport ShareButton from '../ShareButton';\nimport FeedbackButtons from '../FeedbackButtons';\nimport BookmarkButton from '../BookmarkButton';\nimport { CookieStateContext } from '../../containers/BasePage/state';\n\nimport styles from './ShareFeedbackSegment.module.scss';\n\nconst ShareFeedbackSegment = ({ articleId, bookmark, modifier }) => {\n    const { state } = useContext(CookieStateContext) || {};\n    const cookieConsent = state?.categories?.includes('functionality');\n\n    const classes = classNames(styles['ShareFeedbackSegment'], {\n        [styles[`ShareFeedbackSegment--${modifier}`]]: modifier,\n    });\n\n    return (\n        <div className={classes}>\n            <div\n                className={\n                    styles['ShareFeedbackSegment__Container'] +\n                    ' ' +\n                    styles['ShareFeedbackSegment__Container--Share']\n                }>\n                {cookieConsent && (\n                    <BookmarkButton\n                        {...bookmark}\n                        untranslatedModifiers={[\n                            'BookmarkButton--InsideShareFeedbackSegment',\n                        ]}\n                        untranslatedButtonModifiers={[\n                            'Button--InsideShareFeedbackSegment',\n                        ]}\n                        isNextToShare={true}\n                    />\n                )}\n                <div className={styles['ShareFeedbackSegment__ShareWrapper']}>\n                    <ShareButton\n                        untranslatedButtonModifiers={[\n                            'Button--InsideShareFeedbackSegment',\n                        ]}\n                    />\n                </div>\n            </div>\n            <div\n                className={\n                    styles['ShareFeedbackSegment__Container'] +\n                    ' ' +\n                    styles['ShareFeedbackSegment__Container--Feedback']\n                }>\n                <FeedbackButtons articleId={articleId} />\n            </div>\n        </div>\n    );\n};\n\nShareFeedbackSegment.propTypes = {\n    articleId: PropTypes.number,\n    bookmark: PropTypes.object,\n};\n\nShareFeedbackSegment.defaultProps = {};\n\nexport default ShareFeedbackSegment;\n","import ShareFeedbackSegment from './ShareFeedbackSegment';\n\nexport default ShareFeedbackSegment;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { basePageWrap } from '../BasePage';\nimport styles from './CampaignPage.module.scss';\n\nimport Hero from '../../components/Hero';\nimport ShareFeedbackSegment from '../../components/ShareFeedbackSegment';\nimport StreamField from '../../components/StreamField';\n\nconst CampaignPage = ({ id, url, hideNavigation, hero, contentBlocks }) => {\n    const bookmark = {\n        id,\n        url,\n    };\n\n    return (\n        <div className={styles['CampaignPage']}>\n            <Hero {...hero} hideNavigation={hideNavigation} />\n\n            <div id=\"main-content\" />\n\n            <StreamField items={contentBlocks} />\n\n            <ShareFeedbackSegment\n                bookmark={bookmark}\n                articleId={id}\n                modifier={'Campaign'}\n            />\n        </div>\n    );\n};\n\nCampaignPage.defaultProps = {\n    id: 0,\n    url: '',\n    hideNavigation: false,\n    hero: {},\n    contentBlocks: [],\n};\n\nCampaignPage.propTypes = {\n    id: PropTypes.number.isRequired,\n    url: PropTypes.string.isRequired,\n    hideNavigation: PropTypes.bool,\n    hero: PropTypes.object,\n    contentBlocks: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),\n};\n\nexport default basePageWrap(CampaignPage);\n","import CampaignPage from './CampaignPage';\n\nexport default CampaignPage;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"BookmarkButton--InsideShareFeedbackSegment\":\"BookmarkButton_BookmarkButton--InsideShareFeedbackSegment__JSFM_\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"FeedbackButtons\":\"FeedbackButtons_FeedbackButtons__bcF6F\",\"FeedbackButtons__Label\":\"FeedbackButtons_FeedbackButtons__Label__dxvoP\",\"FeedbackButtons__ButtonWrapper\":\"FeedbackButtons_FeedbackButtons__ButtonWrapper__fgdWM\",\"FeedbackButtons__Button\":\"FeedbackButtons_FeedbackButtons__Button__EJnjx\",\"FeedbackButtons__Button--DownVote\":\"FeedbackButtons_FeedbackButtons__Button--DownVote__YZlpp\",\"FeedbackButtons__Button--HasVoted\":\"FeedbackButtons_FeedbackButtons__Button--HasVoted__JF6P3\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"FeedbackModal\":\"FeedbackModal_FeedbackModal__K7uT_\",\"FeedbackModal__Title\":\"FeedbackModal_FeedbackModal__Title__bJ_AF\",\"FeedbackModal__Textarea\":\"FeedbackModal_FeedbackModal__Textarea__qtx_O\",\"FeedbackModal__SubmitButton\":\"FeedbackModal_FeedbackModal__SubmitButton__7Vf0R\",\"FeedbackModal__Content\":\"FeedbackModal_FeedbackModal__Content__Ugxre\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"ShareFeedbackSegment\":\"ShareFeedbackSegment_ShareFeedbackSegment__GUGhn\",\"ShareFeedbackSegment--Campaign\":\"ShareFeedbackSegment_ShareFeedbackSegment--Campaign__f7ta6\",\"BookmarkButton\":\"ShareFeedbackSegment_BookmarkButton___svtu\",\"ShareFeedbackSegment__Container\":\"ShareFeedbackSegment_ShareFeedbackSegment__Container__l0kT2\",\"ShareFeedbackSegment__Container--Share\":\"ShareFeedbackSegment_ShareFeedbackSegment__Container--Share__ZsrlN\",\"ShareFeedbackSegment__Container--Feedback\":\"ShareFeedbackSegment_ShareFeedbackSegment__Container--Feedback__2VGbg\",\"ShareFeedbackSegment__ShareWrapper\":\"ShareFeedbackSegment_ShareFeedbackSegment__ShareWrapper__43Lq2\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"CampaignPage\":\"CampaignPage_CampaignPage__NKq5R\"};"],"names":["BookmarkButton","id","url","isNextToShare","untranslatedModifiers","untranslatedButtonModifiers","param","t","useTranslation","bookmarked","setBookmarked","useState","useEffect","bookmarks","text","classes","classNames","styles","map","x","jsx_runtime","jsx","div","className","Button","onClick","type","minWidth","icon","propTypes","PropTypes","defaultProps","components_BookmarkButton","FeedbackModal","feedbackId","visible","toggleVisible","modalContentVisible","setModalContentVisible","feedbackComment","setFeedbackComment","Modal","open","handleClose","HingeFadeInFromTop","jsxs","form","label","htmlFor","textarea","name","placeholder","value","onChange","e","target","button","preventDefault","sendArticleFeedbackComment","storage","getItem","setItem","JSON","stringify","getFeedbackedArticleIds","parse","getFeedbackByArticleId","feedback","filter","f","addFeedbackedArticleId","rating","feedbackedIds","FeedbackButton","handleClick","hasVoted","disabled","buttonClasses","handleClickWithRating","useCallback","span","FeedbackButtons","articleId","feedbackModalOpen","setFeedbackModalOpen","setFeedbackId","feedbackSubmitted","setFeedbackSubmitted","submitted","toggleFeedbackModal","handleButtonClick","result","sendArticleFeedback","console","error","ShareFeedbackSegment","state","bookmark","modifier","useContext","CookieStateContext","cookieConsent","categories","includes","concat","ShareButton","components_ShareFeedbackSegment","CampaignPage","hideNavigation","hero","contentBlocks","Hero","StreamField","items","isRequired","containers_CampaignPage","basePageWrap","module","exports"],"sourceRoot":""}