PageSourceSearch

https://horze.es/cdn/shop/t/648/assets/store-total-reviews.element-CU3ErnOF.js

js horze.es collected 2026-10-07 06:40:20 UTC 1,974 bytes, 20 lines download raw bytes

1import{i as h,n as w,a as p,t as u}from"./vendor-lit-reactive-element-Cjcwuima.js";import{x as l}from"./vendor-lit-html-nFsY_NSA.js";import{r as v}from"./vendor-lit-element-CtcYdrtK.js";import{getShopLanguage as f}from"./translations-0RZ3PrHk.js";var g=Object.defineProperty,d=Object.getOwnPropertyDescriptor,i=(n,r,s,e)=>{for(var o=e>1?void 0:e?d(r,s):r,a=n.length-1,c;a>=0;a--)(c=n[a])&&(o=(e?c(r,s,o):c(o))||o);return e&&o&&g(r,s,o),o};let t=class extends v{constructor(){super(...arguments),this.totalReviews=null,this.loading=!1}async connectedCallback(){super.connectedCallback(),await this.fetchTotalReviews()}async fetchTotalReviews(){const n=this.getStoreKey(),r=`total-reviews-${n}`,s=t.cache.get(r);if(s&&Date.now()-s.timestamp<t.CACHE_DURATION){this.totalReviews=s.data;return}this.loading=!0;try{const e=await fetch(`https://api.reviews.io/reviews?store=${n}&sku=&type=product_review&per_page=0&enable_syndication=true&lang=${f()}`);if(!e.ok)throw new Error(`HTTP ${e.status}`);const o=await e.json(),a=parseInt(o.review_count||"0",10);this.totalReviews=a,t.cache.set(r,{data:a,timestamp:Date.now()})}catch(e){console.error("Error fetching total reviews:",e),this.totalReviews=65714}finally{this.loading=!1}}getStoreKey(){return"hrzde"}render(){return this.loading?l`<span class="count loading">...</span>`:this.totalReviews!==null?l`<span class="count"
2                >${this.totalReviews.toLocaleString()}</span
3            >`:l`<span class="count">...</span>`}};t.styles=h`
4        :host {
5            display: inline;
6        }
7
8        .count {
9            font-weight: inherit;
10            color: inherit;
11        }
12
13        .loading {
14            opacity: 0.6;
15        }
16
17        .error {
18            color: #999;
19        }
20    `;t.cache=new Map;t.CACHE_DURATION=5*60*1e3;i([w({type:String})],t.prototype,"store",2);i([p()],t.prototype,"totalReviews",2);i([p()],t.prototype,"loading",2);t=i([u("store-total-reviews")],t);export{t as StoreTotalReviews};

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.