PageSourceSearch

https://www.neighborly.com/brand/_assets/js/o2/opus2.hero-component-loader.08757f8ccb8dd0f54437.js

js neighborly.com collected 2026-10-01 12:29:25 UTC 5,407 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkcrownpeak_opus2=self.webpackChunkcrownpeak_opus2||[]).push([["hero-component-loader"],{"./src/js/opus2/hero_component/heroComponent.ts"(e,t,o){o.r(t),o.d(t,{HeroComponent:()=>c});var n=o(/*! tslib */"./node_modules/tslib/tslib.es6.mjs"),i=o(/*! ../config/apiConfig */"./src/js/opus2/config/apiConfig.ts"),r=o(/*! ../config/cachingConfig */"./src/js/opus2/config/cachingConfig.ts"),a=o(/*! ../apiCaching/apiWrapper */"./src/js/opus2/apiCaching/apiWrapper.ts"),l=o(/*! ../nbly-brand/helper_functions */"./src/js/opus2/nbly-brand/helper_functions.ts"),s=o(/*! ../util/coupons-event-handling */"./src/js/opus2/util/coupons-event-handling.ts");class c{constructor(e){this.pageNumber=1,this.pageSize=10,document.querySelector(".hero-review")&&this.getData(e)}static create(){return(0,n.__awaiter)(this,void 0,void 0,function*(){var e,t,o,n,s,u;if(!document.querySelector(".hero-review"))return;const d=(0,l.conceptIdForAllBrands)();if(!d)return;let v,g;try{v=null!=sessionStorage.getItem("countryCode")?"us"==(null===(e=sessionStorage.getItem("countryCode"))||void 0===e?void 0:e.toLowerCase())?"1":"2":"us"==(null===(t=document.getElementById("countryCode"))||void 0===t?void 0:t.value.toLowerCase())?"1":"2";let l=document.getElementById("local_weblocationId");const c=document.getElementById("weblocationId");null===l&&null!==c&&(l=c);const m=(null==l?void 0:l.value)||localStorage.getItem("franchiseWebLocationId"),h=i.apiConfig.TESTIMONIAL_REVIEWS+`/${d}/${null!=m?m:0}/${v}/1/1/1`;if(g=yield(0,a.cachedAPIWrapper)(h,r.apiCaching.TestimonyAndReview),g.length&&(null===(o=g[0])||void 0===o?void 0:o.overallRating)&&(null===(n=g[0])||void 0===n?void 0:n.grandTotal)){const e={or:null===(s=g[0])||void 0===s?void 0:s.overallRating,gt:null===(u=g[0])||void 0===u?void 0:u.grandTotal};sessionStorage.setItem(`rev-${m||"national"}`,JSON.stringify(e))}}catch(e){console.error("Review API has failed",e)}return new c(g)})}popularServiceBanner(){const e=document.querySelector(".hero-banner.form-on"),t=document.querySelector(".popular-services-banner");e&&(null==t?void 0:t.previousElementSibling)&&t.classList.add("banner-under-form")}generateRatingStars(e){const t=Math.round(e),o=e%1!=0,n=o?5-t-1:5-t;return'<span class="star full">★</span>'.repeat(t)+(o?'<span class="star half">★</span>':"")+'<span class="star empty">☆</span>'.repeat(n)}hideReviewSection(){const e=document.querySelector(".hero-review");try{e.style.visibility="hidden";const t=document.getElementById("local_weblocationId"),o=(null==t?void 0:t.value)||localStorage.getItem("franchiseWebLocationId");null===o?console.warn("No reviews present for National Site"):console.warn(`No reviews present for ${o} or Invalid Location`)}catch(e){console.warn("'hero-review' class is missing in the DOM")}}showReviewSection(){const e=document.querySelector(".hero-review");e&&(e.style.visibility="visible",this.createReviewClickableWrapper())}createReviewClickableWrapper(){var e;const t=document.querySelector(".hero-review");if(t){const o=t.querySelector(".customer-wrap"),n=t.querySelector(".rating-wrap");if(o&&n){const t=o.querySelector(".customer-data"),i=null==t?void 0:t.querySelector("a"),r=null==i?void 0:i.getAttribute("href");if(i&&r&&""!==r.trim()){const t=document.createElement("a");t.href=r;const a=i.getAttribute("target");a&&t.setAttribute("target",a),null===(e=o.parentNode)||void 0===e||e.insertBefore(t,o),t.appendChild(o),t.appendChild(n)}}}}getData(e){var t,o;const n=document.querySelector(".customer-data .hero-review-heading"),i=document.querySelector(".rating-wrap .hero-review-heading"),r=document.querySelector(".rating-wrap .hero-rating .rating");if(!n||!i||!r)return void this.hideReviewSection();const{minimumReviewCount:a,minimumCustomerRating:l}=this.getHeroConfig();if(e)if(0===(null==e?void 0:e.length)||0===(null===(t=e[0])||void 0===t?void 0:t.overallRating)||0===(null===(o=e[0])||void 0===o?void 0:o.grandTotal))this.hideReviewSection();else if(n&&i&&r){const t=this.checkReviewCount(e,a),o=this.checkCustomerRating(e,l);t&&o?(this.updateReview(e[0],n,i,r),this.showReviewSection()):this.hideReviewSection()}else this.hideReviewSection()}updateReview(e,t,o,n){t.textContent=Number(e.grandTotal).toLocaleStr
1ing(),o.textContent=`${0==(null==e?void 0:e.overallRating)?null==e?void 0:e.reviewStarRating:null==e?void 0:e.overallRating}/5`,n.innerHTML=this.generateRatingStars((null==e?void 0:e.overallRating)?Math.round(null==e?void 0:e.overallRating):0)}getHeroConfig(){var e,t;let o=15,n=4.5;const i=document.getElementById("hero-banner");if(null==i?void 0:i.value)try{const r=JSON.parse(i.value);o=Number(null===(e=null==r?void 0:r.customerreview)||void 0===e?void 0:e.minimumReviewCount)||o,n=Number(null===(t=null==r?void 0:r.customerreview)||void 0===t?void 0:t.minimumCustomerRating)||n}catch(e){console.warn("Error parsing hero-banner configuration")}return{minimumReviewCount:o,minimumCustomerRating:n}}checkReviewCount(e,t){var o;return!(t>0)||(null===(o=e[0])||void 0===o?void 0:o.grandTotal)>t}checkCustomerRating(e,t){var o;return!(t>0)||(null===(o=e[0])||void 0===o?void 0:o.overallRating)>t}}(0,n.__awaiter)(void 0,void 0,void 0,function*(){globalThis.__HeroComponentInitialized||(globalThis.__HeroComponentInitialized=!0,yield c.create(),(0,s.attachEventListenerForHeroBannerClaim)())})}}]);
2//# sourceMappingURL=opus2.hero-component-loader.08757f8ccb8dd0f54437.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.