PageSourceSearch

https://netwrix.com/_astro/Algolia.Wv_Vfcgp.js

js netwrix.com collected 2026-10-09 21:47:43 UTC 8,749 bytes, 1 lines download raw bytes

1import{a as l}from"./index.BjtuyMK1.js";import{r as h}from"./debounce-throttle.es.CsOco3p3.js";import{g as a,d as c}from"./Layout.astro_astro_type_script_index_0_lang.dQC2wC98.js";import{g as d}from"./GetUserLocation.gxLxuljh.js";import{s as u}from"./sanityClient.e-3wdsnT.js";import{g}from"./getCookie.BYiwWNU2.js";import{c as p,s as f}from"./history.BQkInWUu.js";import"./preload-helper.BlTxHScW.js";class v{constructor(e){this.onComplete=e.onComplete,this.language=g("preferred_lang")||"en",this.inputSearch=document.querySelector(".js--search-webinars"),this.loadMoreBtn=document.querySelector(".js--load-more-webinars"),this.resultsContainer=document.querySelector(".js--webinars-result"),this.noResultsFound=document.querySelector(".js--no-results-found"),this.totalResults=document.querySelector(".js--algolia-total-results"),this.loadMoreContainer=document.querySelector(".js--load-more-container"),this.loadingContainer=document.querySelector(".js--loading"),this.optionType=document.querySelector(".js--option-type")?.value,this.emitter=e.emitter,this.hitsPerPage=12,this.currentPage=0,this.searchTerm="",this.selectedRegions="",this.selectedTypes="",this.selectedTopic="",this.selectedAudience="",this.regionTax=[],this.userInformation=JSON.parse(sessionStorage.getItem("userInformation")),this.filter=!1,this.total=0,this.currentUrl=window.location.href,this.init()}
1async init(){if(await this.getRegionTaxonomies(),this.readFromURL(),fetch(`${window.location.origin}/api/v1/render-content-webinars/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:[],language:this.language,resultsTotal:"0"})}).catch(()=>{}),await this.searchAlgolia(),this.total>this.hitsPerPage){this.currentPage=1;const e=this.fetchAlgoliaData();await this.loadCTA();const{data:i,resultsTotal:t}=await e;if(i.length){const s=await this.renderContent(i,t);this.currentPage>0&&this.resultsContainer.insertAdjacentHTML("beforeend",s),this.total=t,this.totalResults.value=this.total,this.emitter.emit("webinar-card-rendered"),this.total<=(this.currentPage+1)*this.hitsPerPage?a(this.loadMoreContainer,"u--display-none"):c(this.loadMoreContainer,"u--display-none")}}this.events(),this.searchEvent(),this.eventsLoadMore(),this.setURL()}async eventsLoadMore(){document.querySelector(".js--load-more-webinars")?.addEventListener("click",async e=>{e.preventDefault(),window.toggleSpinner({direction:"up"}),this.currentPage=this.currentPage+1,await this.searchAlgolia(),window.toggleSpinner({direction:"down"})})}events(){const e=document.querySelectorAll(".c--filter-a__list-group__item__icon"),i=async()=>{this.currentPage=0,this.filter=!0;const t=Array.from(document.querySelectorAll(".js--type-select .c--filter-a__list-group__item__icon:checked")).map(n=>n.value),s=Array.from(document.querySelectorAll(".js--region-select .c--filter-a__list-group__item__icon:checked")).map(n=>n.value),r=Array.from(document.querySelectorAll(".js--topic-select .c--filter-a__list-group__item__icon:checked")).map(n=>n.value),o=Array.from(document.querySelectorAll(".js--audience-select .c--filter-a__list-group__item__icon:checked")).map(n=>n.value);if(t.length==0&&s.length===0&&r.length===0&&o.length===0){this.filter=!1,this.selectedTypes=this.selectedRegions=this.selectedTopic=this.selectedAudience="",this.total=0,await this.searchAlgolia(),this.total>this.hitsPerPage&&(await this.loadCTA(),this.currentPage=1,await this.searchAlgolia()),this.setURL();return}else this.selectedTypes=t.join(","),this.selectedRegions=s.join(","),this.selectedTopic=r.join(","),this.selectedAudience=o.join(","),await this.searchAlgolia(),this.setURL()};e.forEach(t=>t.addEventListener("change",i))}searchEvent(){this.inputSearch&&(this.debouncedSearch??=h(async()=>{await this.searchAlgolia(),this.setURL()},1e3),this.inputSearch.addEventListener("keyup",e=>{window.toggleSpinner({direction:"up"}),this.currentPage=0,this.total=0,this.filter=!0,e.preventDefault(),this.searchTerm=e.target.value,this.debouncedSearch(),window.toggleSpinner({direction:"down"})}))}async fetchAlgoliaData(){const e=await l.get("/api/v1/Algolia/",{params:{searchTerm:this.searchTerm,selectedTypeswebinars:this.optionType=="podcasts"?this.optionType:this.selectedTypes,selectedRegion:this.selectedRegions,selectedTopics:this.selectedTopic,selectedAudience:this.selectedAudience,language:this.language,currentPage:this.currentPage,hitsPerPage:this.hitsPerPage,isWebinar:this.optionType=="podcasts"?"false":"true"},headers:{"Content-Type":"application/json"}});return{data:e.data.data||[],resultsTotal:e.data.results||0}}async renderContent(e,i){const t=await fetch(`${window.location.origin}/api/v1/render-content-webinars/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,language:this.language,resultsTotal:i,hideTypename:this.optionType=="podcasts"})});if(!t.ok)throw new Error("render-content-webinars failed");return(await t.json()).result||""}async searchAlgolia(){try{const{data:e,resultsTotal:i}=await this.fetchAlgoliaData();if(!e.length&&this.currentPage==0){this.loadMoreContainer&&a(this.loadMoreContainer,"u--display-none"),this.resultsContainer.innerHTML=`<div class="f--col-12"><div class="g--message-01"><p class="g--message-01__item-primary">${this.noResultsFound.value}</p></div></div>`,this.totalResults.textContent="0 ",window.toggleSpinner({direction:"down"}),this.loadMoreBtn&&a(this.loadMoreBtn,"u--display-none"),this.loadingContainer&&a(this.loadingContainer,"u--display-none");return}let t;try{t=await this.renderContent(e,i)}catch(s){console.error("Error en fetch render-content:",s)}this.currentPage===0&&(this.resultsContainer.innerHTML=""),this.loadingContainer&&a(this.loadingContainer,"u--display-none"),this.resultsContainer.insertAdjacentHTML("beforeend",t),this.total=i,this.totalResults.value=this.total,this.currentPage===0&&(this.totalResults.textContent=this.total+" "),window.toggleSpinner({direction:"down"}),this.emitter.emit("webinar-card-rendered"),this.total<=(this.currentPage+1)*this.hitsPerPage?a(this.loadMoreContainer,"u--display-none"):c(this.loadMoreContainer,"u--display-none")}catch(e){console.error("Error in Algolia:",e)}}async loadCTA(){var e=this.resultsContainer.getAttribute("data-title"),i=this.resultsContainer.getAttribute("data-script"),t=this.resultsContainer.getAttribute("data-thank-you");try{const r=await(await fetch(`${window.location.origin}/api/v1/render-content-cta/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e,script:i,thank_you:t,language:this.language,resultsTotal:this.total})})).json();r&&r.result&&(this.resultsContainer.insertAdjacentHTML("beforeend",r.result),typeof this.onComplete=="function"&&this.onComplete())}catch(s){return console.error("Error en fetch render-content:",s),null}}setURL(){this.currentUrl=window.location.href;const e=new URL(window.location.href),i={s:this.searchTerm,region:this.selectedRegions,audience:this.selectedAudience,type:this.selectedTypes,topic:this.selectedTopic};
1Object.entries(i).forEach(([t,s])=>{s||e.searchParams.delete(t)}),Object.entries(i).forEach(([t,s])=>{s&&e.searchParams.set(t,s)}),window.history.pushState({},"",e.toString()),p(e.toString()),f({referrer:this.currentUrl})}async readFromURL(){const e=new URL(window.location.href);this.searchTerm=e.searchParams.get("s")||"",this.selectedRegions=e.searchParams.get("region")||"",this.selectedTypes=e.searchParams.get("type")||"",this.selectedAudience=e.searchParams.get("audience")||"",this.selectedTopic=e.searchParams.get("topics")||"",this.inputSearch&&(this.inputSearch.value=this.searchTerm),!this.selectedRegions&&this.userInformation?.userLocation&&this.regionTax?.some(t=>t==this.userInformation?.userLocation?this.selectedRegions=t:!1),this.selectedRegions&&this.selectedRegions.split(",").forEach(s=>{const r=document.querySelector(`.js--region-select .c--filter-a__list-group__item__icon[value="${s}"]`);r&&(r.checked=!0,r.dispatchEvent(new Event("change")))}),Object.entries({selectedTypes:".js--type-select",selectedRegions:".js--region-select",selectedAudience:".js--audience-select",selectedTopic:".js--topic-select"}).forEach(([t,s])=>{this[t]&&this[t].split(",").forEach(r=>{const o=document.querySelector(`${s} .c--filter-a__list-group__item__icon[value="${r}"]`);o&&(o.checked=!0,o.dispatchEvent(new Event("change")))})})}async getRegionTaxonomies(){this.userInformation||(this.userInformation=await d(),sessionStorage.setItem("userInformation",JSON.stringify(this.userInformation)));const e='*[_type == "webinar_regions" && !(_id in path("drafts.**")) && slug != "all" && _id in *[_type in ["webinars","podcasts"]].repeater[].region._ref].slug';this.regionTax=await u.fetch(e)}}export{v as default};

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.