"use strict";(self.webpackChunk_redotech_redo_shopify_extension=self.webpackChunk_redotech_redo_shopify_extension||[]).push([[437],{99237:(t,e,i)=>{i.d(e,{Ay:()=>d,E1:()=>o,Kk:()=>a});var n=i(25433),s=i.n(n),l=i(43618),r=i.n(l)()(s());r.push([t.id,"._c-0 {\n position: relative;\n display: inline-block;\n}\n\n._c-1 {\n display: block;\n}\n",""]);var o="_c-0",a="_c-1";const d=r},79905:(t,e,i)=>{i.d(e,{A:()=>s});var n=i(84352);i(50972);const s=t=>(0,n.jsxs)("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,n.jsxs)("g",{clipPath:"url(#clip0_1232_10)",children:[(0,n.jsx)("path",{d:"M9.53834 1.60996C9.70914 1.19932 10.2909 1.19932 10.4617 1.60996L12.5278 6.57744C12.5998 6.75056 12.7626 6.86885 12.9495 6.88383L18.3123 7.31376C18.7556 7.3493 18.9354 7.90256 18.5976 8.19189L14.5117 11.6919C14.3693 11.8139 14.3071 12.0053 14.3506 12.1876L15.5989 17.4208C15.7021 17.8534 15.2315 18.1954 14.8519 17.9635L10.2606 15.1592C10.1006 15.0615 9.89938 15.0615 9.73937 15.1592L5.14806 17.9635C4.76851 18.1954 4.29788 17.8534 4.40108 17.4208L5.64939 12.1876C5.69289 12.0053 5.6307 11.8139 5.48831 11.6919L1.40241 8.19189C1.06464 7.90256 1.24441 7.3493 1.68773 7.31376L7.05054 6.88383C7.23744 6.86885 7.40024 6.75056 7.47225 6.57744L9.53834 1.60996Z",fill:"currentColor"}),(0,n.jsx)("g",{clipPath:"url(#clip1_1232_10)",children:(0,n.jsx)("path",{d:"M9.53834 1.60996C9.70914 1.19932 10.2909 1.19932 10.4617 1.60996L12.5278 6.57744C12.5998 6.75056 12.7626 6.86885 12.9495 6.88383L18.3123 7.31376C18.7556 7.3493 18.9354 7.90256 18.5976 8.19189L14.5117 11.6919C14.3693 11.8139 14.3071 12.0053 14.3506 12.1876L15.5989 17.4208C15.7021 17.8534 15.2315 18.1954 14.8519 17.9635L10.2606 15.1592C10.1006 15.0615 9.89938 15.0615 9.73937 15.1592L5.14806 17.9635C4.76851 18.1954 4.29788 17.8534 4.40108 17.4208L5.64939 12.1876C5.69289 12.0053 5.6307 11.8139 5.48831 11.6919L1.40241 8.19189C1.06464 7.90256 1.24441 7.3493 1.68773 7.31376L7.05054 6.88383C7.23744 6.86885 7.40024 6.75056 7.47225 6.57744L9.53834 1.60996Z",fill:"currentColor"})})]}),(0,n.jsxs)("defs",{children:[(0,n.jsx)("clipPath",{id:"clip0_1232_10",children:(0,n.jsx)("rect",{width:20,height:20,fill:"white"})}),(0,n.jsx)("clipPath",{id:"clip1_1232_10",children:(0,n.jsx)("rect",{width:20,height:20,fill:"white"})})]})]})},9437:(t,e,i)=>{function n({children:t,productIds:e,autocheck:i}){const n=(0,m.useContext)(x.Q),s=(0,E.Y5)((async()=>{if(!n)return{};try{const t=[...new Set(e)];return(0,v.R)(`Fetching ratings for ${t.length} products`),await n(b,t)}catch(t){return(0,v.R)(`Error fetching ratings: ${t}`),{}}}),[n,e]),l=(0,E.Y5)((async()=>{if(!n)return null;try{const t=i.teamId;return t?((0,v.R)(`Fetching star rating widget settings for team ${t}`),await n(_,{teamId:t})):((0,v.R)("No team ID found in autocheck"),null)}catch(t){return(0,v.R)(`Error fetching star rating widget settings: ${t}`),null}}),[n,i.teamId]);return(0,o.jsx)(L.Provider,{value:s.value,children:(0,o.jsx)(R.Provider,{value:l.value,children:t})})}function s(t,e){if(k.has(t))return;const i=t.getAttribute("product_id");if(!i)return void(0,v.R)("Skipping element without product_id");const s=t,l={};s.style.gridColumn&&(l["grid-column"]=s.style.gridColumn),s.style.textAlign&&(l["text-align"]=s.style.textAlign),s.style.gridRow&&(l["grid-row"]=s.style.gridRow),s.style.justifySelf&&(l["justify-self"]=s.style.justifySelf),s.style.alignSelf&&(l["align-self"]=s.style.alignSelf);const d=Object.keys(l).length>0?O={...l}:{...O};s.style.display&&"none"!==s.style.display||(s.style.display="unset");const c=globalThis.redoStorefront?.storeUrl??globalThis.Shopify?.shop??globalThis.Shopify?.Checkout?.apiHost,u=globalThis.redoStorefront?.env?.REDO_SHOPIFY_SERVER_URL??"https://shopify-server.getredo.com";(0,w.H)(t).render((0,o.jsx)(a.GH,{container:t,styleManager:j.A,children:(0,o.jsx)(S.N,{extensionShopifyClient:void 0,storeUrl:c,children:(0,o.jsx)(x.F,{baseUrl:u,storeUrl:globalThis.Shopify?.shop??globalThis.Shopify?.Checkout?.apiHost,widgetId:globalThis.redoWidgetId,children:(0,o.jsx)(n,{autocheck:e,productIds:[i],children:(0,o.jsx)(r,{productId:i})})})})})),requestAnimationFrame((()=>{for(const[t,e]of Object.entries(d))s.style.setProperty(t,e);s.style.display&&"none"!==s.style.display||(s.style.display="unset")})),k.add(t)}function l(t){const e=document.querySelectorAll("div.redo-review-stars");for(const i of e)s(i,t);new MutationObserver((e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)if(e.nodeType===Node.ELEMENT_NODE){const i=e;i.matches("div.redo-review-stars")&&s(i,t);const n=i.querySelectorAll("div.redo-review-stars");for(const e of n)s(e,t)}})).observe(document.body,{childList:!0,subtree:!0})}function r({productId:t}){const e=(0,m.useContext)(L),i=(0,m.useContext)(R),n=e?.[t]??null;if(!e)return(0,o.jsx)(C.E,{fontSize:"sm",children:"Loading ratings..."});const s=i||p,l=s.starSize,r=s.starPadding,a={filled:s.filledStarColor,empty:s.emptyStarColor},c=s.starOutlineEnabled,u=s.starOutlineColor,h=s.starOutlineWidth,g=s.alignment,w=s.showStarsWhenNoReviews;return n?.numReviews||w?(0,o.jsx)(y.s,{align:"center",dir:"column",gap:"sm",py:"sm",w:"full",children:(0,o.jsx)(y.s,{align:P[g],dir:"column",gap:"sm",w:"full",children:(0,o.jsxs)(y.s,{align:"center",dir:"row",gap:"sm",children:[(0,o.jsx)(f.F,{editable:!1,Icon:d.A,iconColors:a,iconSize:l,rating:n?n.rating:0,starOutlineColor:u,starOutlineEnabled:c,starOutlineWidth:h,starPadding:r}),(0,o.jsx)(C.E,{fontSize:"sm",children:`(${n?n.numReviews:0})`})]})})}):null}i.d(e,{initialize:()=>l});var o=i(84352),a=i(29190),d=i(79905),c=i(23337),u=i(2077),h=i(82502);const g=h.Ikc({_id:u.Tu(),teamId:u.Tu(),alignment:h.fc(c.C1),starPadding:h.aig(),starSize:h.aig(),emptyStarColor:h.YjP(),filledStarColor:h.YjP(),showStarsWhenNoReviews:h.zMY(),starOutlineEnabled:h.zMY(),starOutlineColor:h.YjP(),starOutlineWidth:h.aig(),createdAt:h.p6U(),updatedAt:h.p6U()}),p={alignment:c.C1.LEFT,starPadding:0,starSize:18,emptyStarColor:"#E5E5E5",filledStarColor:"#FEC84B",showStarsWhenNoReviews:!0,starOutlineEnabled:!1,starOutlineColor:"#000",starOutlineWidth:1};var f=i(8100),y=i(50893),C=i(23041),m=i(50972),w=i(6858),x=i(78927),v=i(19515),S=i(17900),j=i(18237),E=i(17995);const b={name:"getProductsReviewsRatings",input:h.YOg(h.YjP()),output:h.g1P(h.YjP(),h.Ikc({rating:h.aig(),numReviews:h.aig()}).nullable())},_={name:"getStarRatingWidgetByTeam",input:h.Ikc({teamId:h.YjP()}),output:h.KCZ([g,h.chJ()])},L=(0,m.createContext)(null),R=(0,m.createContext)(null),k=new WeakSet;let O={};const P={[c.C1.LEFT]:"flex-start",[c.C1.CENTER]:"center",[c.C1.RIGHT]:"flex-end"}},8100:(t,e,i)=>{i.d(e,{F:()=>o});var n=i(84352),s=i(50972),l=i(50893),r=i(45673);const o=(0,s.memo)((function({rating:t,Icon:e,iconSize:i=24,iconColors:o={filled:"#FEC84B",empty:"#E5E5E5"},starPadding:a,starOutlineEnabled:d,starOutlineColor:c,starOutlineWidth:u,editable:h=!1,onRatingChange:g}){const[p,f]=(0,s.useState)(null),[y,C]=(0,s.useState)(null),m=()=>{h&&C(null)},w=d?{stroke:c||"#000",strokeWidth:u||1}:{},x=y??p??t??0;return(0,n.jsx)(l.s,{dir:"row",style:a?{gap:`${a}px`}:{},children:[...Array(5)].map(((t,s)=>{const l=100*Math.min(Math.max(x-s,0),1);return(0,n.jsxs)("div",{className:r.E1,onClick:()=>(t=>{h&&function(t){f(t),g?.(t)}(t+1)})(s),onMouseEnter:()=>(t=>{h&&C(t+1)})(s),onMouseLeave:m,style:{cursor:h?"pointer":"default",position:"relative",width:i,height:i,display:"inline-block"},children:[(0,n.jsx)(e,{className:r.Kk,style:{color:o.empty,width:i,height:i,position:"absolute",top:0,left:0,...w}}),l>0&&(0,n.jsx)("div",{style:{position:"absolute",overflow:"hidden",width:`${l}%`,height:"100%",top:0,left:0},children:(0,n.jsx)(e,{className:r.Kk,style:{color:o.filled,width:i,height:i,...w}})})]},s)}))})}))},45673:(t,e,i)=>{i.d(e,{E1:()=>p.E1,Kk:()=>p.Kk});var n=i(84294),s=i.n(n),l=i(9311),r=i.n(l),o=i(82357),a=i.n(o),d=i(38662),c=i.n(d),u=i(75138),h=i.n(u),g=i(76654),p=i(99237),f={};f.styleTagTransform=g.A,f.setAttributes=c(),f.insert=a().bind(null,"head"),f.domAPI=r(),f.insertStyleElement=h(),s()(p.Ay,f)}}]); //# sourceMappingURL=437-b47f5f0e.js.map