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H;AAGH,SAJD,MAIO;AACH7E,UAAAA,QAAQ,CAACM,aAAT,CAAuB,wBAAvB,EAAiDwE,KAAjD,CAAuDlF,OAAvD,GAAiE,MAAjE;AACH;AACJ,OATD;;AAWA,UAAI6C,OAAO,CAACgC,gBAAR,CAAyB,eAAzB,EAA0CL,MAA1C,GAAmD,CAAvD,EAA0D;AACtDpE,QAAAA,QAAQ,CAACM,aAAT,CAAuB,wBAAvB,EAAiDwE,KAAjD,CAAuDlF,OAAvD,GAAiE,OAAjE;AACAI,QAAAA,QAAQ,CAACM,aAAT,CAAuB,wBAAvB,EAAiDsE,gBAAjD,CAAkE,OAAlE,EAA4EjF,CAAD,IAAO;AAC9E2E,UAAAA,YAAY;AACf,SAFD,EAEG;AAAEO,UAAAA,IAAI,EAAE;AAAR,SAFH;AAGH;AACJ,KAxHL;AAyHA,WAAO,IAAP;AACH;AACJ,CA3ID;;AA6IA,iEAAelG,oBAAf","sources":["webpack:///./Scripts/Components/Lipscore.js","webpack:///./Scripts/Components/LipscoreCustomScript.js"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { translate } from '../Services/translation';\nimport LipscoreCustomScript from './LipscoreCustomScript'; // Import custom script\n\nconst Lipscore = ({ productName, productId, productUrl, variantId, variantName }) => {\n    useEffect(() => {\n        if (typeof window !== 'undefined') {\n            LipscoreCustomScript();  // Invoke the custom script to handle the dynamic elements and API calls\n            \n        }\n    }, [productId]);\n\n    const setSelected = (event) => {\n        event.currentTarget.classList.toggle('expanded');\n    };\n\n    // Prevent accordion from collapsing when clicking inside the reviews\n    const handleReviewClick = (event) => {\n        event.stopPropagation(); // Prevent event bubbling to accordion collapse\n    };\n\n    // Handle Load More Reviews with stopPropagation\n    const handleLoadMoreClick = (event) => {\n        event.stopPropagation(); // Prevents the accordion from closing\n        // Logic to load more reviews (if it's not already handled in LipscoreCustomScript)\n    };\n\n    return (\n        <div className=\"small-12 large-12 columns product-about\">\n            <div className=\"product-about__heading-container\" onClick={(e) => setSelected(e)}>\n                <div className=\"product-about__heading\">\n                    <h2 className=\"product-about__title\">{translate('product.lipscore.title')}</h2>\n                    <div className=\"product-about__icon\"></div>\n                </div>\n                <div className=\"product-about__content\">\n                    <div id=\"lpsc-custom-wrapper\"\n                        lpsc-custom-buyer=\"Kund\"\n                        lpsc-custom-product=\"Produkt\"\n                        lpsc-lang=\"sv\"\n                        lpsc-product-id={variantId}\n                        data-ls-product-name={productName}\n                        data-ls-brand=\"\"\n                        data-ls-product-id={variantId}\n                        data-ls-product-url={productUrl}\n                        data-ls-variant-id={variantId}\n                        data-ls-variant-name={variantName}>\n                        <div className=\"lpsc-custom-badge\" onClick={handleReviewClick}>\n                            <div className=\"custom-badge-score\"></div>\n                            <div className=\"custom-badge-stars\"></div>\n                            <div className=\"custom-badge-text\">Based on 0000 reviews</div>\n                        </div>\n                        <div id=\"lpsc-custom-list\" onClick={handleReviewClick}></div>\n                        <div className=\"lpsc-custom-list-footer\">\n                            <a\n                                id=\"lpsc-custom-load-more\"\n                                style={{ display: 'none' }}\n                                onClick={handleLoadMoreClick}>\n                                Load More Reviews\n                            </a>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    );\n};\n\nexport default Lipscore;\n","\nconst LipscoreCustomScript = () => {\n    var checkInterval = setInterval(verifyLpscCustomDiv, 100);\n\n    function verifyLpscCustomDiv() {\n        if (document.getElementById('lpsc-custom-wrapper')) {\n            apiCall();\n            clearInterval(checkInterval);\n        }\n    }\n\n    function apiCall() {\n        console.log('Lipscore custom script loaded');\n        const productId = document.querySelector('#lpsc-custom-wrapper')?.getAttribute('lpsc-product-id') || undefined;\n        const lang = document.querySelector('#lpsc-custom-wrapper')?.getAttribute('lpsc-lang') || undefined;\n        const types = productId == 'service_review' ? 'srw_b,srw_l' : 'rw_l,r,pa';\n\n        fetch(`https://wapi.lipscore.com/initial_data/products/show?api_key=ecceac903845087ed75b8594&internal_id=${productId}&widgets=${types}&reviews_per_page=999&translate_to_lang=${lang}`)\n            .then(response => response.json())\n            .then(json => {\n                if (document.querySelector('#lpsc-custom-attributes') && productId != 'service_review') {\n                    const votesTranslation = document.querySelector('#lpsc-custom-attributes').getAttribute('lpsc-custom-text-translation')\n                    let innerAttributes = ''\n                    json.product_attributes.forEach((attr) => {\n                        if (attr.votes < 10) {\n                            return;\n                        }\n                        let labels = attr.options_count == 5 ? [attr.labels[1], attr.labels[2], attr.labels[3]] : attr.labels;\n                        let tickPosition = Math.max((attr.summary_value - 1) * 25, 0)\n                        innerAttributes += `<div class=\"custom-attribute-summary-block\">\n        <div class=\"custom-attribute-summary-name\">${attr.caption} - ${votesTranslation.replace('0000', attr.votes)}</div>\n        <div class=\"custom-attribute-summary-wrap\">\n          <div class=\"custom-attribute-summary-labels\">\n            <div class=\"custom-attribute-label\" style=\"text-align: left;\">${labels[0]}</div>\n            <div class=\"custom-attribute-label\" style=\"text-align: center;\">${labels[1]}</div>\n            <div class=\"custom-attribute-label\" style=\"text-align: right;\">${labels[2]}</div>\n          </div>\n          <div class=\"custom-attribute-tick-wrap\">\n            <div class=\"custom-attribute-tick-filler\" style=\"width: ${tickPosition}%;\"></div>\n          </div>\n          <div class=\"custom-attribute-tick-wrap\">\n            <div class=\"custom-attribute-tick\" style=\"left: ${tickPosition}%;\"></div>\n          </div>\n        </div>\n        </div>`;\n                    })\n                    document.querySelector('#lpsc-custom-attributes').innerHTML = innerAttributes\n                }\n                const score = json.lipscore / 2.0\n                document.querySelector('.custom-badge-score').innerHTML = `${score.toFixed(1)}/5`\n                document.querySelector('.custom-badge-text').textContent = document.querySelector('.custom-badge-text').textContent.replace('0000', json.review_count)\n\n                let innerBadge = ''\n                const halfStar = 'https://cdn-icons-png.flaticon.com/512/59/59419.png'\n                const noneStar = 'https://cdn-icons-png.flaticon.com/128/2956/2956792.png'\n                const fullStar = 'https://cdn-icons-png.flaticon.com/128/1828/1828961.png'\n\n                for (let i = 1; i <= 5; i++) {\n                    if (score >= i) {\n                        innerBadge += `<img src=\"${fullStar}\">`\n                    } else if (score <= i - 1) {\n                        innerBadge += `<img src=\"${noneStar}\">`\n                    } else {\n                        innerBadge += `<img src=\"${halfStar}\">`\n                    }\n                }\n\n                document.querySelector('.custom-badge-stars').innerHTML = innerBadge\n\n                let innerList = '';\n                const revList = document.querySelector('#lpsc-custom-list')\n\n                const setReviewStars = (score) => {\n                    let result = '';\n                    if (Number.isInteger(score) && score != 0) {\n                        for (let i = 1; i <= 5; i++) {\n                            result += `<img src=\"${score / 2 >= i ? fullStar : noneStar}\">`\n                        }\n                    }\n                    return result;\n                }\n\n                const formatDate = (dateString) => {\n                    const date = new Date(dateString);\n                    return `${date.getUTCDate()}.${date.getUTCMonth() + 1}.${date.getUTCFullYear()}`;\n                }\n\n                const reviewAttributes = (reviewAttrs) => {\n                    let result = '';\n                    reviewAttrs.forEach(attr => {\n                        result += `<p class=\"custom-review-product-attr\">${attr.caption}: ${attr.labels.options_count === 5 ? attr.labels[attr.value - 1] : attr.labels[Math.floor(attr.value / 2)]}</p>`\n                    });\n                    return result\n                }\n\n                const reviewBadgeBlock = `\n      <div class=\"lipscore-review-purchase\">\n        <div class=\"lipscore-review-purchase-icon\">\n          <div class=\"lipscore-review-purchase-icon-badge\">\n            <span class=\"lipscore-visually-hidden\">Verified</span>\n          </div>\n          <span>&nbsp;${document.querySelector('#lpsc-custom-wrapper').getAttribute('lpsc-custom-buyer')}</span>\n        </div>\n      </div>`\n\n                const reviewProductTranslation = document.querySelector('#lpsc-custom-wrapper').getAttribute('lpsc-custom-product')\n\n                json.reviews.forEach((rev, index) => {\n                    innerList += `<div class=\"custom-review ${index >= 10 ? 'unloaded-rev' : 'loaded-rev'}\">\n        <div class=\"custom-review-stars\">${setReviewStars(rev.lipscore)}</div>\n        <p class=\"custom-review-name\">${rev.user.name}</p>\n        <p class=\"custom-review-text\">${rev.translated_text || rev.text}</p>\n        <p class=\"custom-review-product\">${reviewProductTranslation}: ${rev.product.name}</p>\n        ${rev.attributes.length ? reviewAttributes(rev.attributes) : ''}\n        <div class=\"custom-review-date-badge\">${reviewBadgeBlock}<p class=\"custom-review-date\">${formatDate(rev.created_at)}</p></div>\n        </div>`\n                });\n\n                revList.innerHTML = innerList;\n\n                const loadMoreFunc = () => {\n                    Array.from(document.querySelectorAll('#lpsc-custom-list > .unloaded-rev')).slice(0, 10).forEach(r => r.classList.replace('unloaded-rev', 'loaded-rev'));\n                    if (document.querySelectorAll('#lpsc-custom-list > .unloaded-rev').length > 0) {\n                        document.querySelector('#lpsc-custom-load-more').addEventListener('click', (e) => {\n                            loadMoreFunc()\n                        }, { once: true });\n                    } else {\n                        document.querySelector('#lpsc-custom-load-more').style.display = 'none';\n                    }\n                }\n\n                if (revList.querySelectorAll('.unloaded-rev').length > 0) {\n                    document.querySelector('#lpsc-custom-load-more').style.display = 'block';\n                    document.querySelector('#lpsc-custom-load-more').addEventListener('click', (e) => {\n                        loadMoreFunc()\n                    }, { once: true });\n                }\n            })\n        return null;\n    }\n}\n\nexport default LipscoreCustomScript;\n"],"names":["React","useEffect","translate","LipscoreCustomScript","Lipscore","productName","productId","productUrl","variantId","variantName","window","setSelected","event","currentTarget","classList","toggle","handleReviewClick","stopPropagation","handleLoadMoreClick","e","display","checkInterval","setInterval","verifyLpscCustomDiv","document","getElementById","apiCall","clearInterval","console","log","querySelector","getAttribute","undefined","lang","types","fetch","then","response","json","votesTranslation","innerAttributes","product_attributes","forEach","attr","votes","labels","options_count","tickPosition","Math","max","summary_value","caption","replace","innerHTML","score","lipscore","toFixed","textContent","review_count","innerBadge","halfStar","noneStar","fullStar","i","innerList","revList","setReviewStars","result","Number","isInteger","formatDate","dateString","date","Date","getUTCDate","getUTCMonth","getUTCFullYear","reviewAttributes","reviewAttrs","value","floor","reviewBadgeBlock","reviewProductTranslation","reviews","rev","index","user","name","translated_text","text","product","attributes","length","created_at","loadMoreFunc","Array","from","querySelectorAll","slice","r","addEventListener","once","style"],"sourceRoot":""}