PageSourceSearch

https://horze.eu/cdn/shop/t/676/assets/product-reviews-BWCsIdp8.js

js horze.eu collected 2026-09-24 11:36:09 UTC 5,627 bytes, 69 lines download raw bytes

1import{i as u,n as p,a as h,t as c}from"./vendor-lit-reactive-element-Cjcwuima.js";import{x as g,b as d,E as f}from"./vendor-lit-html-nFsY_NSA.js";import{r as v}from"./vendor-lit-element-CtcYdrtK.js";import{v as m}from"./main-DqQb9x5n.js";import{getShopLanguage as y}from"./translations-0RZ3PrHk.js";import"./vendor-vue-runtime-dom-Dqgu9pQP.js";import"./vendor-vue-runtime-core-DAnRjgOf.js";import"./vendor-vue-reactivity-Df4oAq-x.js";import"./vendor-vue-shared-D3_Apz_L.js";import"./ds-Bp-orcBC.js";import"./vendor-lit-context-BDzdL6mz.js";var C=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(t,e,i,s)=>{for(var r=s>1?void 0:s?w(e,i):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(r=(s?l(e,i,r):l(r))||r);return s&&r&&C(e,i,r),r};let a=class extends v{constructor(){super(...arguments),this.productTitle=null,this.sku=null,this.store=null,this.ratings=[]}get groupSku(){return(this.sku??"").split(";")[0].trim()}get storeKey(){return"hrzde"}get apiUrl(){return`https://api.reviews.io/product/rating-batch?store=${this.storeKey}&sku=${this.groupSku}&enable_syndication=true&minRating=3&lang=${y()}`}get averageRating(){const t="0.0";if(!Array.isArray(this.ratings)||this.ratings.length===0)return t;let e=0,i=0;for(const{average_rating:s,num_ratings:r}of this.ratings){const n=parseFloat(s);isNaN(n)||r<=0||(e+=n*r,i+=r)}return i===0?t:(e/i).toFixed(1)}get totalRatingCount(){return!Array.isArray(this.ratings)||this.ratings.length===0?0:this.ratings.reduce((t,{num_ratings:e})=>e>0?t+e:t,0)}get svgFillColor(){return parseFloat(this.averageRating)>0?"currentColor":"transparent"}get svgStrokeColor(){return parseFloat(this.averageRating)>0?"transparent":"currentColor"}connectedCallback(){super.connectedCallback(),m(this,{rootMargin:"500px"}).then(()=>{fetch(this.apiUrl).then(t=>t.json()).then(t=>{t&&(this.ratings=t)})})}render(){const t=`Review: ${this.averageRating} of 5`,e={"@context":"https://schema.org","@type":"Product",name:this.productTitle||"",aggregateRating:{"@type":"AggregateRating",ratingValue:parseFloat(this.averageRating),reviewCount:this.totalRatingCount}},i=JSON.stringify(e);return g`
2            ${parseFloat(this.averageRating)>0?g`<span
3                          class="rating"
4                          role="img"
5                          aria-label="${t}"
6                      >
7                          <svg
8                              xmlns="http://www.w3.org/2000/svg"
9                              width="12"
10                              height="12"
11                              viewBox="0 0 12 12"
12                              fill="none"
13                              focusable="false"
14                              aria-hidden="true"
15                          >
16                              <title>${t}</title>
17                              <g
18                                  clip-path="url(#clip0_2824_7128)"
19                              >
20                                  <path
21                                      fill-rule="evenodd"
22                                      clip-rule="evenodd"
23                                      d="M6.27292 0.508162C6.18694 0.230678 5.81264 0.230678 5.72667 0.508162L4.57797 4.21574C4.53952 4.33984 4.42925 4.42386 4.30483 4.42386H0.587548C0.309337 4.42386 0.193663 4.79721 0.41874 4.9687L3.42609 7.26011C3.52674 7.33679 3.56886 7.47275 3.53041 7.59683L2.38171 11.3044C2.29574 11.5819 2.59858 11.8127 2.82366 11.6412L5.83099 9.34973C5.93166 9.27305 6.06796 9.27305 6.16858 9.34973L9.17596 11.6412C9.40102 11.8127 9.70384 11.5819 9.61792 11.3044L8.46922 7.59683C8.43076 7.47275 8.47288 7.33679 8.5735 7.26011L11.5809 4.9687C11.8059 4.79721 11.6903 4.42386 11.412 4.42386H7.6948C7.57036 4.42386 7.46008 4.33984 7.42162 4.21574L6.27292 0.508162Z"
24                                      fill="${this.svgFillColor}"
25                                      stroke="${this.svgStrokeColor}"
26                                  />
27                              </g>
28                              <defs>
29                                  <clipPath id="clip0_2824_7128">
30                                      <rect
31                                          width="12"
32                                          height="12"
33                                          fill="transparent"
34                                      />
35                                  </clipPath>
36                              </defs>
37                          </svg>
38                          <span class="visually-hidden"
39                              >${t}</span
40                          >
41                          <span aria-hidden="true"
42                              >(${this.averageRating})</span
43                          >
44                      </span>
45                      ${d(`<script type="application/ld+json">${i}<\/script>`)}`:f}
46        `}};a.styles=u`
47        :host {
48            display: flex;
49            align-items: center;
50        }
51
52        .rating {
53            display: flex;
54            gap: 4px;
55            align-items: center;
56        }
57
58        .visually-hidden {
59            position: absolute !important;
60            width: 1px;
61            height: 1px;
62            padding: 0;
63            margin: -1px;
64            overflow: hidden;
65            clip: rect(0, 0, 0, 0);
66            white-space: nowrap;
67            border: 0;
68        }
69    `;o([p({type:String,attribute:!0,reflect:!0})],a.prototype,"productTitle",2);o([p({type:String,attribute:!0,reflect:!0})],a.prototype,"sku",2);o([p({type:String,attribute:!0,reflect:!0})],a.prototype,"store",2);o([h()],a.prototype,"ratings",2);a=o([c("product-reviews")],a);export{a as ProductReviews};

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.