PageSourceSearch

https://www.ohpolly.com/cdn/shop/t/1735/assets/autocomplete-api-layer.js?v=20790533021379281161784714320

js ohpolly.com collected 2026-10-03 20:36:47 UTC 2,623 bytes, 2 lines download raw bytes

1class AutocompleteAPILayer{constructor(){this.eventBus=window.theme.nosto.eventBus,this.events=window.theme.autocomplete.events,this.config=window.theme.autocomplete.config,this.setupEventListeners(),this.trackingEvents()}trackingEvents(){this.eventBus.subscribe(this.events.TRACKING.PRODUCT_CLICKED,productData=>{window.Shopify.customerPrivacy?.analyticsProcessingAllowed()&&window.nostojs(api=>{api.recordSearchClick("autocomplete",{productId:productData.productId,url:`${window.theme.shop.url}${productData.productUrl}`})})}),this.eventBus.subscribe(this.events.TRACKING.PRODUCT_ADDED_TO_CART,productData=>{window.Shopify.customerPrivacy?.analyticsProcessingAllowed()&&window.nostojs(api=>{api.recordSearchAddToCart("autocomplete",{productId:productData.hit.productId,url:`${window.theme.shop.url}${productData.hit.productUrl}`})})}),this.eventBus.subscribe(this.events.TRACKING.KEYWORD_CLICKED,searchData=>{if(!window.Shopify.customerPrivacy?.analyticsProcessingAllowed())return;const{request,results}=searchData;window.nostojs(api=>{api.recordSearch("autocomplete",request,results,{isKeyword:!0})})}),this.eventBus.subscribe(this.events.TRACKING.SUBMIT_SEARCH,searchData=>{if(!window.Shopify.customerPrivacy?.analyticsProcessingAllowed())return;const{query}=searchData;window.nostojs(api=>{api.recordSearchSubmit("autocomplete",query)})})}setupEventListeners(){this.eventBus.subscribe(this.events.API.ACTIVE_TERM_UPDATED,term=>{this.fetchResults(term)})}emptySearchQuery(){return{query:"",popularSearches:{size:this.config.popularSearchSize,emptyQueryMatchesAll:!0},categories:{size:this.config.categorySize,emptyQueryMatchesAll:!0},keywords:{size:this.config.keywordSize,emptyQueryMatchesAll:!0}}}populateSearchQuery(term){return{query:term,minQueryLength:3,products:{fields:["url"],size:this.config.productSize},categories:{size:this.config.categorySize},keywords:{fields:["keyword"],size:this.config.keywordSize}}}async fetchResults(term){const searchQuery=term?this.populateSearchQuery(term):this.emptySearchQuery(),track=term.length>2?"autocomplete":void 0;try{window.nostojs(api=>{api.search(searchQuery,{track}).then(response=>{this.eventBus.publish(this.events.API.QUERY_FETCHED,response)}).catch(error=>{console.error("Failed to fetch products from Nosto:",error),this.eventBus.publish(this.events.API.FETCH_FAILED,{})})})}catch(error){console.error("NostoJS API call failed:",error),this.eventBus.publish(this.events.API.FETCH_FAILED,{})}}}window.theme.autocomplete.apiLayer=new AutocompleteAPILayer;
2//# sourceMappingURL=/cdn/shop/t/1735/assets/autocomplete-api-layer.js.map?v=20790533021379281161784714320

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.