{"version":3,"file":"single-tips.185ef7.js","mappings":"uFAMA,IAAMA,EAAKC,EAAE,kBAAkBC,KAAK,MAChCC,EAAOF,EAAEG,OAAO,oBAADC,OAAqBL,IAElCM,EAAmBL,EAAE,iCAErBM,EAAUN,EAAE,eAAeO,GAAG,SAAS,WAKzC,IAAIC,EAJJF,EAAQG,YAAY,UAEpBC,EAAUD,YAAY,UAGT,QAATP,GAEAM,GAAQ,EACRN,EAAO,OAEPI,EAAQK,SAAS,UACjBT,EAAO,OAEXF,EAAEY,KAAK,CACHC,IAAK,iCACLC,OAAQ,OACRb,KAAM,CACFF,GAAAA,EACAS,MAAAA,IAGZ,IACME,EAAYV,EAAE,iBAAiBO,GAAG,SAAS,WAI7C,IAAIC,EAHJF,EAAQG,YAAY,UACpBC,EAAUD,YAAY,UAGT,OAATP,GACAM,GAAQ,EACRN,EAAO,OAEPQ,EAAUC,SAAS,UACnBT,EAAO,MAEXF,EAAEY,KAAK,CACHC,IAAK,mCACLC,OAAQ,OACRb,KAAM,CACFF,GAAAA,EACAS,MAAAA,KAIK,OAATN,GAEAG,EAAiBU,MAAM,OAE/B,IAGIb,IAASF,EAAEgB,cAAcd,KACZ,QAATA,EACAI,EAAQK,SAAS,UAEjBD,EAAUC,SAAS,WAK3BX,EAAE,sBAAsBiB,OAGxBjB,EAAE,kBAAkBO,GAAG,SAAS,WAC5BW,OAAOC,SAAWC,kBAAkBC,KAAK,WAC7C,G","sources":["webpack://clorox-intl/./js/src/pages/single-tips.js"],"sourcesContent":["/*\nsingle-tips.js\n    tip detail page support\n    - vote counts\n */\n\nconst id = $('.js-post-block').data('id');\nlet vote = $.cookie(`tip_helpful_vote_${id}`);\n// console.log('cookie vote: ',vote);\nconst $nothelpfulPopup = $('.js-article-not-helpful-popup');\n\nconst $upVote = $('.js-up-vote').on('click', () => {\n    $upVote.removeClass('active');\n    // eslint-disable-next-line no-use-before-define\n    $downVote.removeClass('active');\n\n    let clear;\n    if (vote === 'yes') {\n        // clear vote\n        clear = true;\n        vote = null;\n    } else {\n        $upVote.addClass('active');\n        vote = 'yes';\n    }\n    $.ajax({\n        url: '/wp-json/clorox/v1/tips/upvote',\n        method: 'POST',\n        data: {\n            id,\n            clear,\n        },\n    });\n});\nconst $downVote = $('.js-down-vote').on('click', () => {\n    $upVote.removeClass('active');\n    $downVote.removeClass('active');\n\n    let clear;\n    if (vote === 'no') {\n        clear = true;\n        vote = null;\n    } else {\n        $downVote.addClass('active');\n        vote = 'no';\n    }\n    $.ajax({\n        url: '/wp-json/clorox/v1/tips/downvote',\n        method: 'POST',\n        data: {\n            id,\n            clear,\n        },\n    });\n\n    if (vote === 'no') {\n        // show not helpful popup\n        $nothelpfulPopup.modal('show');\n    }\n});\n\n// set initial state\nif (vote && !$.isEmptyObject(vote)) {\n    if (vote === 'yes') {\n        $upVote.addClass('active');\n    } else {\n        $downVote.addClass('active');\n    }\n}\n\n// lazy loader\n$('.lazy-product-tile').Lazy();\n\n// popup handlers\n$('.js-goto-howto').on('click', () => {\n    window.location = translatedStrings.urls['/how-to/'];\n});\n"],"names":["id","$","data","vote","cookie","concat","$nothelpfulPopup","$upVote","on","clear","removeClass","$downVote","addClass","ajax","url","method","modal","isEmptyObject","Lazy","window","location","translatedStrings","urls"],"sourceRoot":""}