PageSourceSearch

https://www.mrappliance.com/brand/_assets/js/o2/opus2.testimonial-rocket.e89cd7945befe11c875b.js

js mrappliance.com collected 2026-10-02 16:56:16 UTC 13,719 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkcrownpeak_opus2=self.webpackChunkcrownpeak_opus2||[]).push([["testimonial-rocket"],{"./src/js/opus2/testimonial/testimonial-poc.ts"(t,e,i){i.r(e),i.d(e,{TestimonialRocket:()=>d});var s=i(/*! tslib */"./node_modules/tslib/tslib.es6.mjs"),n=i(/*! ../apiCaching/apiWrapper */"./src/js/opus2/apiCaching/apiWrapper.ts"),l=i(/*! ../config/apiConfig */"./src/js/opus2/config/apiConfig.ts"),o=i(/*! ../config/cachingConfig */"./src/js/opus2/config/cachingConfig.ts"),r=i(/*! ../util/keyGeneration */"./src/js/opus2/util/keyGeneration.ts"),a=i(/*! ../util/virtualDom */"./src/js/opus2/util/virtualDom.ts"),h=i(/*! ./testimonial-common */"./src/js/opus2/testimonial/testimonial-common.ts");class d{static getTestimonialInstance(){var t;return null!==(t=d.instance)&&void 0!==t||(d.instance=new d),d.instance}constructor(){this.conceptId=null,this.countryId=null,this.weblocationId="",this.popoverElement=null,this.upArrow=null,this.downArrow=null,this.resetLink=null,this.skeletonElement=null,this.contentElement=null,this.selector=h.TESTIMONIAL_SELECTOR,this.testimonialsSection=null,this.noReviewSection=null,this.realUl=null,this.skeletonUl=null,this.ratingCache={},this.ratingText=null,this.ratingsInfo=null,this.starsDisplay=null,this.starRatingDrpdwn=null,this.ratingForm=null,this.wrapperElement=null,this.seeMoreButton=null,this.pageNumber=1,this.pageSize=window.innerWidth>=768?30:4,this.selectedStarRating=5,this.overAllRatings="5/5",this.showRatingSkeleton()}domLookup(){var t,e,i,s,n,l,o;if(this.conceptId=null!==(e=null===(t=document.getElementById("conceptId"))||void 0===t?void 0:t.value)&&void 0!==e?e:"",this.resetLink=document.getElementById("resetLink"),this.upArrow=document.getElementById("upArrow"),this.downArrow=document.getElementById("downArrow"),this.popoverElement=document.getElementById("popover"),this.skeletonElement=document.getElementById("ratingskeleton"),this.contentElement=document.getElementById("ratingcontent"),this.testimonialsSection=document.querySelector(this.selector),this.noReviewSection=document.querySelector(".no-review-section"),this.realUl=document.getElementById("realtestimonials"),this.skeletonUl=document.getElementById("testimonialskeletons"),this.ratingText=document.getElementById("ratingText"),this.ratingsInfo=document.getElementById("ratingsInfo"),this.starsDisplay=document.getElementById("starsDisplay"),this.starRatingDrpdwn=document.getElementById("popoverBtn"),this.ratingForm=document.getElementById("ratingForm"),this.wrapperElement=document.querySelector(".testimonials-section .container"),this.weblocationId=null!==(n=null!==(s=null===(i=document.getElementById("weblocationId"))||void 0===i?void 0:i.value)&&void 0!==s?s:localStorage.getItem("franchiseWebLocationId"))&&void 0!==n?n:"",null!=sessionStorage.getItem("countryCode")){const t=null===(l=sessionStorage.getItem("countryCode"))||void 0===l?void 0:l.toLowerCase();this.countryId="us"===t?"1":"2"}else{const t=null===(o=document.getElementById("countryCode"))||void 0===o?void 0:o.value;t?"us"===(null==t?void 0:t.toLowerCase())?this.countryId="1":this.countryId="2":this.countryId="1"}this.setCSSStyling(),this.handleClickEvents(),this.constructSeeMoreButton(),this.resetLink&&(this.resetClickHandler=()=>this.onResetClick(),this.resetLink.addEventListener("click",this.resetClickHandler))}setCSSStyling(){this.starsDisplay&&(this.starsDisplay.style.cursor="pointer"),this.resetLink&&(this.resetLink.style.visibility="hidden",this.resetLink.classList.remove("hidden"),this.resetLink.classList.add("reset-text"))}constructSeeMoreButton(){var t;if(!this.wrapperElement)return;null===(t=this.wrapperElement)||void 0===t||t.insertAdjacentHTML("beforeend",'\n        <div class="testi-btn-wrapper">                \n            <a href="#" class="primary-btn"> See More...</a>                \n        </div>'),this.seeMoreButton=document.querySelector(".testi-btn-wrapper .primary-btn"),this.seeMoreButton&&(this.seeMoreClickHandler=t=>{this.seeMoreData(t)},this.seeMoreButton.addEventListener("click",this.seeMoreClickHandler))}handleClickEvents(){this.starRatingDrpdwn&&(this.starRatingDropdownHandler=()=>
1this.handleDropdownToggle(),this.starRatingDrpdwn.addEventListener("click",this.starRatingDropdownHandler))}onResetClick(){var t,e;if(this.resetLink&&(this.resetLink.style.visibility="hidden"),this.toggleTestimonialsUl(!1),this.updateStarsDisplay(5),this.ratingForm){const t=this.ratingForm.querySelectorAll('input[name="rating"]');null==t||t.forEach(t=>{t.checked=!1})}const i=this.realUl;i&&(i.innerHTML=""),null===(e=null===(t=this.popoverElement)||void 0===t?void 0:t.classList)||void 0===e||e.toggle("hidden"),this.selectedStarRating=5,this.pageNumber=1,this.getData(!1)}handleDropdownToggle(){this.popoverElement&&(this.showHideRatingDrpDwn(),this.handleStarRatingFilter())}showHideRatingDrpDwn(){var t,e,i,s,n,l;null===(e=null===(t=this.popoverElement)||void 0===t?void 0:t.classList)||void 0===e||e.toggle("hidden"),null===(s=null===(i=this.upArrow)||void 0===i?void 0:i.classList)||void 0===s||s.toggle("hidden"),null===(l=null===(n=this.downArrow)||void 0===n?void 0:n.classList)||void 0===l||l.toggle("hidden")}hideShowMoreButton(){this.seeMoreButton&&this.seeMoreButton.classList.add("hidden")}showShowMoreButton(){this.seeMoreButton&&this.seeMoreButton.classList.remove("hidden")}handleStarRatingFilter(){if(this.ratingForm){const t=this.ratingForm,e=t.querySelectorAll('input[name="rating"]');null==e||e.forEach(e=>{e.onclick=()=>{this.toggleTestimonialsUl(!1);const e=t.querySelector('input[name="rating"]:checked');if(e){const t=this.realUl;t&&(t.innerHTML=""),this.selectedStarRating=Number.parseInt(e.value,10),this.pageNumber=1;const i=!1;this.getData(i),this.showHideRatingDrpDwn(),this.updateStarsDisplay(this.selectedStarRating),this.handleRatingDisplayChanges()}}})}}updateStarsDisplay(t){const e=this.starsDisplay;if(e){e.innerHTML="";for(let i=0;i<5;i++){const s=document.createElement("span");s.className=i<t?"star full":"star",s.innerHTML="&#9733;",e.appendChild(s)}}}handleRatingDisplayChanges(){this.resetLink&&(this.resetLink.style.visibility="visible")}getData(){return(0,s.__awaiter)(this,arguments,void 0,function*(t=!0){const e=`${l.apiConfig.TESTIMONIAL_REVIEWS}/${this.conceptId}/${this.weblocationId||0}/${this.countryId}/0/1/${this.pageSize}/${this.selectedStarRating}`,i=(0,r.keyGenerator)(e,this.selector);let s=yield this.getFromCache(i);const n=Array.isArray(s)&&s.length>0;if(n||(s=yield this.getDataFromServer(this.selectedStarRating)),Array.isArray(s)&&0!==s.length){this.hideNoReviewSection(),this.showRatingContent();const t={type:"ul",props:{},children:yield this.createTestimonialLists(s)};this.realUl&&(0,a.updateVDomElement)(this.realUl,t),this.showOverallRatings(s),this.toggleTestimonialsUl(),n||(yield this.storeInCache(i,s))}else this.showNoReviewSection();let o=[5,4,3,2,1];t||(o=[this.selectedStarRating]),this.showShowMoreButton(),this.silentCalls(o)})}showOverallRatings(t){var e,i,s,r;if(!t.length)return;let a,h;if((null===(e=t[0])||void 0===e?void 0:e.overallRating)&&(null===(i=t[0])||void 0===i?void 0:i.grandTotal)){a=null===(s=t[0])||void 0===s?void 0:s.overallRating,h=null===(r=t[0])||void 0===r?void 0:r.grandTotal;const e={or:a,gt:h};sessionStorage.setItem(`rev-${this.weblocationId||"national"}`,JSON.stringify(e))}else{const t=JSON.parse(sessionStorage.getItem(`rev-${this.weblocationId||"national"}`)||"{}");a=null==t?void 0:t.or,h=null==t?void 0:t.gt}if(!a||!h){const t=l.apiConfig.TESTIMONIAL_REVIEWS+`/${this.conceptId}/${this.weblocationId||0}/${this.countryId}/0/1/1/5`;(0,n.cachedAPIWrapper)(t,o.apiCaching.TestimonyAndReview).then(t=>{var e,i;if(t.length){a=null===(e=t[0])||void 0===e?void 0:e.overallRating,h=null===(i=t[0])||void 0===i?void 0:i.grandTotal;const s={or:a,gt:h};this.setHeaderTestimonialValues(a,h),sessionStorage.setItem(`rev-${this.weblocationId||"national"}`,JSON.stringify(s))}}).catch(t=>{console.error("Error fetching data:",t),this.ratingText&&this.ratingsInfo&&(this.ratingText.classList.add("hidden"),this.ratingsInfo.classList.add("hidden"))})}this.setHeaderTestimonialValues(a,h)}setHeaderTestimonialValues(t,e){if(!(this.ratingText&&this.ratingsInfo&&t&&e))return void this.showRatingSkeleton();this.showRatingContent(),this.overAllRatings=`${t}/5`,this.ratingText.textContent=this.overAllRatings;const i=this.ratingsInfo.querySelector("p");i&&(i.textContent=`${e} Ratings`)}silentCalls(t){return(0,s.__awaiter)(this,void 0,void 0,function*(){const e=this.selectedStarRating,i=1===t.length;yield Promise.allSettled(t.map(t=>(0,s.__awaiter)(this,void 0,void 0,function*(){try{const s=t===e?this.pageNumber+1:this.pageNumber,n=`${l.apiConfig.TESTIMONIAL_REVIEWS}/${this.conceptId}/${this.weblocationId||0}/${this.countryId}/0/${s}/${this.pageSize}/${t}`,o=(0,r.keyGenerator)(n,this.selector);let a=yield this.getFromCache(o);if(Array.isArray(a)&&a.length>0)this.ratingCache[t]=a;else{const e=yield this.getDataFromServer(t,s);Array.isArray(e)&&e.length?(yield this.storeInCache(o,e),this.ratingCache[t]=e):!e.length&&i&&this.hideShowMoreButton()}}catch(t){console.warn("Testimonial init failed; will allow retry.",t)}})))})}seeMoreData(t){return(0,s.__awaiter)(this,void 0,void 0,function*(){t.preventDefault(),this.pageNumber++;const e=this.selectedStarRating?this.selectedStarRating:5;try{const t=`${l.apiConfig.TESTIMONIAL_REVIEWS}/${this.conceptId}/${this.weblocationId||0}/${this.countryId}/0/${this.pageNumber}/${this.pageSize}/${e}`,i=(0,r.keyGenerator)(t,this.selector);let s=yield this.getFromCache(i);const n=Array.isArray(s)&&s.length>0;if(n||(s=yield this.getDataFromServer(this.selectedStarRating)),Array.isArray(s)&&0!==s.length){this.hideNoReviewSection(),this.showRatingContent();const t={type:"ul",props:{},children:yield this.createTestimonialLists(s)};this.realUl&&(0,a.updateVDomElement)(this.realUl,t),this.showOverallRatings(s),this.toggleTestimonialsUl(),n||(yield this.storeInCache(i,s))}else this.showNoReviewSection();this.silentCalls([this.selectedStarRating])}catch(t){console.error("Error loading more testimonials:",t),this.showNoReviewSection()}})}getDataFromServer(t,e){const i=h.default.getInstance(),s=null!=e?e:this.pageNumber;return i.getDataFromServer(this.conceptId,this.weblocationId||0,this.countryId,s,this.pageSize,t)}showRatingSkeleton(){var t,e;this.skeletonElement&&(null===(t=this.skeletonElement.classList)||void 0===t||t.remove("hidden")),this.contentElement&&(null===(e=this.contentElement.classList)||void 0===e||e.add("is-hidden"))}showRatingContent(){var t,e,i;this.skeletonElement&&(null===(t=this.skeletonElement.classList)||void 0===t||t.add("hidden")),this.contentElement&&(null===(e=this.contentElement.classList)||void 0===e||e.remove("is-hidden")),this.realUl&&(null===(i=this.realUl.classList)||void 0===i||i.remove("hidden"))}showNoReviewSection(){var t,e;this.testimonialsSection&&(null===(t=this.testimonialsSection)||void 0===t||t.classList.add("hidden")),this.noReviewSection&&(null===(e=this.noReviewSection)||void 0===e||e.classList.remove("hidden"))}hideNoReviewSection(){var t,e;this.testimonialsSection&&(null===(t=this.testimonialsSection)||void 0===t||t.classList.remove("hidden")),this.noReviewSection&&(null===(e=this.noReviewSection)||void 0===e||e.classList.add("hidden"))}toggleTestimonialsUl(t=!0){var e,i,s,n;t?(this.skeletonUl&&(null===(e=this.skeletonUl.classList)||void 0===e||e.add("hidden")),this.realUl&&(null===(i=this.realUl.classList)||void 0===i||i.remove("hidden"))):(this.skeletonUl&&(null===(s=this.skeletonUl.classList)||void 0===s||s.remove("hidden")),this.realUl&&(null===(n=this.realUl.classList)||void 0===n||n.add("hidden")))}generateRatingStars(t){return h.default.getInstance().generateRatingStars(t)}createTestimonialVNode(t){return h.default.getInstance().createTestimonialVNode(t)}storeInCache(t,e){return(0,s.__awaiter)(this,void 0,void 0,function*(){return h.default.getInstance().storeInCache(t,e)})}getFromCache(t){return(0,s.__awaiter)(this,void 0,void 0,function*(){return h.default.getInstance().getFromCache(t,this.selectedStarRating,this.ratingCache)})}handleCacheFailure(){return(0,s.__awaiter)(this,void 0,void 0,function*(){return h.default.getInstance().handleCacheFailure(this.ratingCache)})}createTestimonialLists(t){return(0,s.__awaiter)(this,void 0,void 0,function*(){return h.default.getInstance().createTestimonialLists(t)})}destroy(){this.resetLink&&this.resetClickHandler&&this.resetLink.removeEventListener("click",this.resetClickHandler),this.starRatingDrpdwn&&this.starRatingDropdownHandler&&this.starRatingDrpdwn.removeEventListener("click",this.starRatingDropdownHandler),this.starsDisplay&&this.starsDisplayHandler&&this.starsDisplay.removeEventListener("click",this.starsDisplayHandler),this.seeMoreButton&&this.seeMoreClickHandler&&this.seeMoreButton.removeEventListener("click",this.seeMoreClickHandler);const t=document.querySelector(".testi-btn-wrapper");(null==t?void 0:t.parentElement)&&t.parentElement.removeChild(t),this.popoverElement=null,this.upArrow=null,this.downArrow=null,this.resetLink=null,this.skeletonElement=null,this.contentElement=null,this.testimonialsSection=null,this.noReviewSection=null,this.realUl=null,this.skeletonUl=null,this.ratingText=null,this.ratingsInfo=null,this.starsDisplay=null,this.starRatingDrpdwn=null,this.ratingForm=null,this.wrapperElement=null,this.seeMoreButton=null,this.ratingCache={},this.resetClickHandler=void 0,this.starRatingDropdownHandler=void 0,this.starsDisplayHandler=void 0,this.seeMoreClickHandler=void 0}static destroyInstance(){d.instance&&(d.instance.destroy(),d.instance=null)}}}}]);
2//# sourceMappingURL=opus2.testimonial-rocket.e89cd7945befe11c875b.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.