yt-uikit 0.9.19-collection-bundle-updates.1 → 0.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -381,7 +381,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
381
381
  width: 50px;
382
382
  height: 50px;
383
383
  }
384
- `,Gt=({buttonColor:t,children:n,onClick:o})=>e.createElement(qt,{onClick:o,buttonColor:t},n),Xt=({segments:n,setWinningSegment:o,brandGameDefaultThemeColor:r,brandThemeColor:i,ctaButtonText:a,wheelSectionColor1:l,wheelSectionColor2:c,wheelCenterLogo:s,isStatic:d})=>{const[p,u]=t(!1),[m,g]=t(0),[x,f]=t(!1),[y,b]=t(!1);return e.createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"15px",height:"100%",overflow:"hidden"}},e.createElement("div",{style:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement("div",{style:{borderRadius:"full",transform:"rotate(180deg)"}}),e.createElement(Ut,null),e.createElement(Qt,null,e.createElement(Yt,{$isDisabled:x,$brandThemeColor:i,$brandGameDefaultThemeColor:r},e.createElement("img",{src:s??"https://i.imgur.com/nZIyqNu.png",style:{height:"45px",width:"55px"},alt:"YourToken LOGO"})))),e.createElement("div",{style:{display:"flex",width:"100%",justifyContent:"center",alignItems:"center"}},!d&&e.createElement(Gt,{buttonColor:i??r??"black",onClick:()=>!(d&&!0===d)&&(()=>{if(!x&&!y){b(!0),u(!p),f(!0);let e=0,t=[];if(n.forEach(t=>{t?.probability&&t.probability>0&&(e+=t.probability)}),0===e)t=Array.from({length:n.length},()=>0);else{let o=0;n.forEach(n=>{n?.probability&&n.probability>0?(o+=n.probability/e*100,t.push(o)):t.push(o)})}const o=100*Math.random();let r;for(let e=0;e<t.length;e++)if(o<=t[e]){r=e;break}const i=360/n.length;if(void 0===r){let e=0,t=0;n.forEach((n,o)=>{n?.probability&&n.probability>t&&(t=n.probability,e=o)}),r=e}const a=(r+.5)*i,l=360*Math.floor(5*Math.random()+5);g(l-a)}})()},a??"Spin Now!")))},Zt=ae(void 0),Kt=de("deliveryOptionStateValidity",{isPostalCodeValid:!1,isDateValid:!1}),Jt=ae(e=>{const t=e(Kt);return t.isPostalCodeValid&&t.isDateValid}),en=de("deliveryType","standard"),tn=de("deliverySlotDate",null),nn=ae({cartLoading:!1,showLoader:!1,showSkeletonLoader:!1,showLoyaltyCtaLoading:!1});function on(){const[e,t]=le(nn);return{cartLoading:e,setLoading:(e,n,o,r)=>{t({cartLoading:e,showLoader:n,showSkeletonLoader:void 0!==o&&o,showLoyaltyCtaLoading:void 0!==r&&r})}}}const rn=ae({open:!1,variantId:void 0,quantity:void 0,handle:void 0,freebieSelection:!1,stealDealSelection:!1,lineItemKey:void 0,productId:void 0,allowedVariantIds:void 0,productRec:!1}),an=(e,t)=>"INR"===t||"₹"===t||"Rs"===t||"Rs."===t||"rs"===t||"rs."===t||"RS."===t?Number((e/100).toFixed(2)):e,ln={79:"Rs. "},cn=(e,t)=>{const n=t??e?.currency??"INR";return"undefined"!=typeof window&&window.ytapp?.brandId?ln[window.ytapp.brandId]??pe(n)??"₹":pe(n)??"₹"},sn=(e,t=15)=>e.length>t?e.substring(0,t)+"...":e,dn=(e,t,n,o="",r="16px")=>{const i=document.createElement("canvas").getContext("2d"),a=e.replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/&amp;/g,"&");if(i){const e=o?`${r} ${o}`:r;i.font=e;const l=t/100*n;if(i.measureText(a).width>l){let e=a;for(let t=e.length-1;t>=0;t--){const n=e.slice(0,t)+"...";if(i.measureText(n).width<l)return n}return"..."}}return a};function pn(e,t){t=Math.max(0,Math.min(1,t));let n=Math.round(255*t).toString(16);return 1===n.length&&(n="0"+n),e+n}function un(e,t){e=e.replace(/^#/,"");return`rgba(${parseInt(e.substring(0,2),16)}, ${parseInt(e.substring(2,4),16)}, ${parseInt(e.substring(4,6),16)}, ${t})`}const mn=e=>e?.split("/")?.pop();const gn=e=>{if("string"!=typeof e)return e;const t=e.match(/^gid:\/\/shopify\/\w+\/(\d+)$/);return t?t[1]:e};function xn(e,t="#FFFFFF",n="#000000",o=.5){if(!e)return;const r=window.getComputedStyle(e).backgroundColor;let i=0,a=0,l=0;if("transparent"===r||"rgba(0, 0, 0, 0)"===r)return void(e.style.color=n);const c=r.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/);if(c)i=parseInt(c[1],10),a=parseInt(c[2],10),l=parseInt(c[3],10);else{const t=document.createElement("div");t.style.color=r,document.body.appendChild(t);const o=window.getComputedStyle(t).color;document.body.removeChild(t);const c=o.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/);if(!c)return console.warn("setContrastTextColor: Could not parse background color:",r,"Resolved to:",o),void(e.style.color=n);i=parseInt(c[1],10),a=parseInt(c[2],10),l=parseInt(c[3],10)}const s=[i/255,a/255,l/255].map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)),d=.2126*s[0]+.7152*s[1]+.0722*s[2];e.style.color=d>o?n:t}const fn=e=>{if(null==e)return"";const t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},yn=()=>{const e=window.ytapp?.storeDomain;return!!e&&["veeba-sauces.myshopify.com"].includes(e)},bn=(e,t=150,n=85,o="webp")=>{if(!e||"string"!=typeof e)return"/placeholder.svg";if(""===e.trim()||"/placeholder.svg"===e)return"/placeholder.svg";try{if(!(e.includes("cdn.shopify.com")||e.includes("shopify.com")||e.includes(".myshopify.com")))return e;let r=e.split("?")[0];const i=r.lastIndexOf(".");if(-1===i)return e;const a=r.substring(i),l=r.substring(0,i).replace(/_\d+x\d*$|_x\d+$|_\d+x$/,""),c=`${l}${`_${t}x${t}`}${a}`,s=new URLSearchParams;"auto"!==o&&s.append("format",o),85!==n&&s.append("quality",n.toString());const d=s.toString();return d?`${c}?${d}`:c}catch(t){return console.warn("Failed to optimize Shopify image URL:",t),e}},hn=e=>{if(!e||"string"!=typeof e)return e;const t=e.match(/^bundle-[^-]+-(.+)-([A-Za-z0-9]{5,8})$/);if(t&&t[1])return t[1].trim();const n=e.match(/^vol-(.+?)-([A-Za-z0-9\s-]{3,})$/i);if(n&&n[1])return n[1].trim();const o=e.match(/^(YTA-|YTP-|YT-)(.+)$/);return o&&o[2]?o[2].trim():e},vn=c.div`
384
+ `,Gt=({buttonColor:t,children:n,onClick:o})=>e.createElement(qt,{onClick:o,buttonColor:t},n),Xt=({segments:n,setWinningSegment:o,brandGameDefaultThemeColor:r,brandThemeColor:i,ctaButtonText:a,wheelSectionColor1:l,wheelSectionColor2:c,wheelCenterLogo:s,isStatic:d})=>{const[p,u]=t(!1),[m,g]=t(0),[x,f]=t(!1),[y,b]=t(!1);return e.createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"15px",height:"100%",overflow:"hidden"}},e.createElement("div",{style:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement("div",{style:{borderRadius:"full",transform:"rotate(180deg)"}}),e.createElement(Ut,null),e.createElement(Qt,null,e.createElement(Yt,{$isDisabled:x,$brandThemeColor:i,$brandGameDefaultThemeColor:r},e.createElement("img",{src:s??"https://i.imgur.com/nZIyqNu.png",style:{height:"45px",width:"55px"},alt:"YourToken LOGO"})))),e.createElement("div",{style:{display:"flex",width:"100%",justifyContent:"center",alignItems:"center"}},!d&&e.createElement(Gt,{buttonColor:i??r??"black",onClick:()=>!(d&&!0===d)&&(()=>{if(!x&&!y){b(!0),u(!p),f(!0);let e=0,t=[];if(n.forEach(t=>{t?.probability&&t.probability>0&&(e+=t.probability)}),0===e)t=Array.from({length:n.length},()=>0);else{let o=0;n.forEach(n=>{n?.probability&&n.probability>0?(o+=n.probability/e*100,t.push(o)):t.push(o)})}const o=100*Math.random();let r;for(let e=0;e<t.length;e++)if(o<=t[e]){r=e;break}const i=360/n.length;if(void 0===r){let e=0,t=0;n.forEach((n,o)=>{n?.probability&&n.probability>t&&(t=n.probability,e=o)}),r=e}const a=(r+.5)*i,l=360*Math.floor(5*Math.random()+5);g(l-a)}})()},a??"Spin Now!")))},Zt=ae(void 0),Kt=de("deliveryOptionStateValidity",{isPostalCodeValid:!1,isDateValid:!1}),Jt=ae(e=>{const t=e(Kt);return t.isPostalCodeValid&&t.isDateValid}),en=de("deliveryType","standard"),tn=de("deliverySlotDate",null),nn=ae({cartLoading:!1,showLoader:!1,showSkeletonLoader:!1,showLoyaltyCtaLoading:!1});function on(){const[e,t]=le(nn);return{cartLoading:e,setLoading:(e,n,o,r)=>{t({cartLoading:e,showLoader:n,showSkeletonLoader:void 0!==o&&o,showLoyaltyCtaLoading:void 0!==r&&r})}}}const rn=ae({open:!1,variantId:void 0,quantity:void 0,handle:void 0,freebieSelection:!1,stealDealSelection:!1,lineItemKey:void 0,productId:void 0,allowedVariantIds:void 0,productRec:!1}),an=(e,t)=>"INR"===t||"₹"===t||"Rs"===t||"Rs."===t||"rs"===t||"rs."===t||"RS."===t?Number((e/100).toFixed(2)):e,ln={79:"Rs. "},cn=(e,t)=>{const n=t??e?.currency??"INR";return"undefined"!=typeof window&&window.ytapp?.brandId?ln[window.ytapp.brandId]??pe(n)??"₹":pe(n)??"₹"},sn=(e,t=15)=>e.length>t?e.substring(0,t)+"...":e,dn=(e,t,n,o="",r="16px")=>{const i=document.createElement("canvas").getContext("2d"),a=e.replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/&amp;/g,"&");if(i){const e=o?`${r} ${o}`:r;i.font=e;const l=t/100*n;if(i.measureText(a).width>l){let e=a;for(let t=e.length-1;t>=0;t--){const n=e.slice(0,t)+"...";if(i.measureText(n).width<l)return n}return"..."}}return a};function pn(e,t){t=Math.max(0,Math.min(1,t));let n=Math.round(255*t).toString(16);return 1===n.length&&(n="0"+n),e+n}function un(e,t){e=e.replace(/^#/,"");return`rgba(${parseInt(e.substring(0,2),16)}, ${parseInt(e.substring(2,4),16)}, ${parseInt(e.substring(4,6),16)}, ${t})`}const mn=e=>e?.split("/")?.pop(),gn=e=>{if("string"!=typeof e)return e;const t=e.match(/^gid:\/\/shopify\/\w+\/(\d+)$/);return t?t[1]:e};function xn(e,t="#FFFFFF",n="#000000",o=.5){if(!e)return;const r=window.getComputedStyle(e).backgroundColor;let i=0,a=0,l=0;if("transparent"===r||"rgba(0, 0, 0, 0)"===r)return void(e.style.color=n);const c=r.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/);if(c)i=parseInt(c[1],10),a=parseInt(c[2],10),l=parseInt(c[3],10);else{const t=document.createElement("div");t.style.color=r,document.body.appendChild(t);const o=window.getComputedStyle(t).color;document.body.removeChild(t);const c=o.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/);if(!c)return console.warn("setContrastTextColor: Could not parse background color:",r,"Resolved to:",o),void(e.style.color=n);i=parseInt(c[1],10),a=parseInt(c[2],10),l=parseInt(c[3],10)}const s=[i/255,a/255,l/255].map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)),d=.2126*s[0]+.7152*s[1]+.0722*s[2];e.style.color=d>o?n:t}const fn=e=>{if(null==e)return"";const t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},yn=()=>{const e=window.ytapp?.storeDomain;return!!e&&["veeba-sauces.myshopify.com"].includes(e)},bn=(e,t=150,n=85,o="webp")=>{if(!e||"string"!=typeof e)return"/placeholder.svg";if(""===e.trim()||"/placeholder.svg"===e)return"/placeholder.svg";try{if(!(e.includes("cdn.shopify.com")||e.includes("shopify.com")||e.includes(".myshopify.com")))return e;let r=e.split("?")[0];const i=r.lastIndexOf(".");if(-1===i)return e;const a=r.substring(i),l=r.substring(0,i).replace(/_\d+x\d*$|_x\d+$|_\d+x$/,""),c=`${l}${`_${t}x${t}`}${a}`,s=new URLSearchParams;"auto"!==o&&s.append("format",o),85!==n&&s.append("quality",n.toString());const d=s.toString();return d?`${c}?${d}`:c}catch(t){return console.warn("Failed to optimize Shopify image URL:",t),e}},hn=e=>{if(!e||"string"!=typeof e)return e;const t=e.match(/^bundle-[^-]+-(.+)-([A-Za-z0-9]{5,8})$/);if(t&&t[1])return t[1].trim();const n=e.match(/^vol-(.+?)-([A-Za-z0-9\s-]{3,})$/i);if(n&&n[1])return n[1].trim();const o=e.match(/^(YTA-|YTP-|YT-)(.+)$/);return o&&o[2]?o[2].trim():e},vn=c.div`
385
385
  min-width: 145px !important;
386
386
  padding: ${e=>"vertical"===e.$variant?"3px":"10px 30px"};
387
387
  background-color: ${e=>e.$backgroundColor};
@@ -1029,7 +1029,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
1029
1029
  `,Qo=c(Ho)`
1030
1030
  font-size: 10px;
1031
1031
  color: ${e=>e.color||"#868E96"};
1032
- `,Uo=({cartSigninCTAMainText:t,signinCTAButtonVisible:n=!0,guestLoyaltyPercentage:o,joinNowFunction:r,themeColor:i,ctaButtonBackgroundColor:a,ctaButtonTextColor:l,primaryTextColor:c,secondaryTextColor:s,cartComponentsCornerType:d,cartComponentsCornerRadius:p,showCartLevelAltPay:u})=>e.createElement("div",{className:"yt-cart-guest-loyalty-container",style:{display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"10px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:u?"0px":"10px",borderBottomRightRadius:u?"0px":"10px",margin:"10px 1rem 6px",border:"1px solid #E8EBED",background:"#00000005"}},e.createElement("div",{className:"yt-cart-guest-loyalty-content",style:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"}},e.createElement(qo,{className:"yt-cart-guest-loyalty-text",color:c},t??"Sign-in to avail Reward Points"),e.createElement(Qo,{className:"yt-cart-guest-loyalty-text",color:s},"Get"," ",e.createElement("span",{style:{fontWeight:"bold"}},"upto ",o,"% Off")," ","on all orders")),e.createElement(Wo,{className:"yt-cart-guest-loyalty-signin-button",$ctaButtonBackgroundColor:a,$ctaButtonTextColor:l,$cartComponentsCornerType:d,$cartComponentsCornerRadius:p,onClick:r},"Sign in Now"));class Yo extends e.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("FooterSections error:",e,t)}render(){return this.state.hasError?e.createElement("div",{style:{textAlign:"center",marginBottom:"10px",textDecorationLine:"underline",color:"blue",cursor:"pointer"},onClick:()=>window.location.reload()},"Something went wrong. Click here to reload the page"):this.props.children}}const Go=({children:o})=>{const[r,i]=t("0px");return n(()=>{const e=navigator.userAgent.toLowerCase(),t=e.indexOf("brave")>-1,n=/iphone|ipad|ipod/.test(e)&&!window.MSStream,o=e.includes("safari")&&!e.includes("chrome"),r=/android/.test(e);t?i("56px"):n?i(o?"44px":"34px"):r&&i("24px")},[]),e.createElement(Yo,null,e.createElement("div",{className:"yt-cart-footer-container",style:{display:"flex",flexDirection:"column",paddingBottom:"env(safe-area-inset-bottom, 0px)",background:"white",zIndex:999,width:"100%",boxShadow:"rgb(135 135 135 / 45%) 0px -2px 0px 0px",borderRadius:"17px 17px 0px 0px",gap:"10px"}},o))},Xo=()=>{const[o,r]=t(0);return n(()=>{const e=setTimeout(()=>{r(100)},1e3);return()=>clearTimeout(e)},[]),e.createElement("div",{className:"yt-loyalty-cta-progress-bar-container"},e.createElement("div",{className:"yt-loyalty-cta-progress-bar",style:{width:`${o}%`}},"‎"))},Zo=({removeDiscount:n,isDev:o,themeColor:r,ctaButtonBackgroundColor:i,ctaButtonTextColor:a,primaryTextColor:l,secondaryTextColor:c,loyaltyDiscount:s,pointsToBeUsed:d,brandTokenName:p,showCartLevelAltPay:u})=>{const m=ce(Zt),{cartLoading:g,setLoading:x}=on(),[f,y]=t(!1),b=g.showLoyaltyCtaLoading,h=an(s?.total_allocated_amount??0,m?.currency);return b?e.createElement("div",{className:"yt-loyalty-apply-cta-loading-container",style:{marginBottom:u?"0":"1rem"}},e.createElement("span",{style:{fontSize:"13px"}},"Processing points..."),e.createElement(ge,{color:"black",loading:b,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}),e.createElement(Xo,null)):e.createElement("div",{className:"yt-loyalty-cta-applied-container",style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"#FAFAFA",border:"1px solid #E5E7E8",borderRadius:"10px",padding:"12px 16px",margin:"10px 1rem",boxShadow:"0px 3px 3.8px 0px rgba(1, 1, 1, 0.231372549)",zIndex:100}},e.createElement("div",{className:"yt-cart-loyalty-applied-content",style:{display:"flex",flexDirection:"row",gap:"10px",alignItems:"center"}},e.createElement("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.3716 9.64475C16.2849 9.50135 16.239 9.33692 16.239 9.1693C16.239 9.00167 16.2849 8.83724 16.3716 8.69384L16.67 8.20819C16.821 7.96172 16.9167 7.68543 16.9507 7.39837C16.9847 7.1113 16.9561 6.82027 16.8669 6.54532C16.7777 6.27038 16.63 6.01805 16.4339 5.80572C16.2379 5.59339 15.9982 5.42611 15.7313 5.31539L15.2044 5.09696C15.0488 5.03308 14.914 4.92711 14.8152 4.79093C14.7164 4.65474 14.6574 4.49372 14.6448 4.32588L14.6012 3.75431C14.5775 3.46646 14.4919 3.18711 14.3505 2.93534C14.209 2.68358 14.0149 2.46533 13.7814 2.2955C13.5479 2.12567 13.2805 2.00826 12.9975 1.95128C12.7145 1.8943 12.4226 1.89909 12.1416 1.96534L11.5857 2.09713C11.4226 2.13644 11.2518 2.13007 11.0922 2.07869C10.9325 2.02731 10.79 1.93293 10.6804 1.80588L10.3122 1.36901C10.1245 1.14887 9.89139 0.972091 9.62882 0.850869C9.36625 0.729647 9.08052 0.66687 8.79134 0.66687C8.50217 0.66687 8.21644 0.729647 7.95387 0.850869C7.6913 0.972091 7.45814 1.14887 7.27048 1.36901L6.89863 1.80588C6.78907 1.93319 6.64649 2.02775 6.48663 2.07914C6.32677 2.13053 6.15584 2.13675 5.99267 2.09713L5.43671 1.96534C5.15574 1.89909 4.8638 1.8943 4.5808 1.95128C4.29781 2.00826 4.03044 2.12567 3.79695 2.2955C3.56346 2.46533 3.36934 2.68358 3.22786 2.93534C3.08637 3.18711 3.00085 3.46646 2.97714 3.75431L2.93348 4.32588C2.92053 4.49352 2.86128 4.65426 2.76233 4.79015C2.66339 4.92605 2.52866 5.03177 2.37316 5.0955L1.84631 5.31393C1.57905 5.4243 1.33887 5.59134 1.14236 5.80354C0.945839 6.01575 0.79765 6.26807 0.708004 6.54312C0.618359 6.81817 0.58939 7.10939 0.623094 7.39672C0.656799 7.68406 0.752375 7.96066 0.903234 8.20746L1.20158 8.69311C1.28834 8.83651 1.3342 9.00094 1.3342 9.16857C1.3342 9.3362 1.28834 9.50062 1.20158 9.64403L0.903234 10.1355C0.752508 10.3821 0.656925 10.6584 0.623055 10.9455C0.589185 11.2325 0.61783 11.5235 0.707022 11.7984C0.796215 12.0734 0.943839 12.3257 1.13975 12.5381C1.33566 12.7506 1.57521 12.918 1.84195 13.029L2.36879 13.2475C2.52387 13.3107 2.65833 13.4158 2.75715 13.551C2.85597 13.6863 2.91525 13.8464 2.92838 14.0134L2.97204 14.585C2.99511 14.8731 3.08023 15.1527 3.22156 15.4047C3.3629 15.6567 3.55709 15.8751 3.79079 16.0449C4.02449 16.2147 4.29217 16.3318 4.57541 16.3882C4.85865 16.4447 5.15075 16.4391 5.43162 16.3718L5.98757 16.24C6.15078 16.2015 6.32137 16.2083 6.48101 16.2596C6.64064 16.311 6.78327 16.4049 6.89354 16.5313L7.26539 16.9681C7.45339 17.1876 7.68662 17.3638 7.94908 17.4846C8.21153 17.6053 8.497 17.6679 8.78589 17.6679C9.07477 17.6679 9.36024 17.6053 9.62269 17.4846C9.88515 17.3638 10.1184 17.1876 10.3064 16.9681L10.6746 16.5313C10.7848 16.405 10.9273 16.3112 11.0868 16.2599C11.2463 16.2085 11.4167 16.2017 11.5798 16.24L12.1358 16.3718C12.4167 16.4391 12.7088 16.4447 12.992 16.3882C13.2752 16.3318 13.5429 16.2147 13.7766 16.0449C14.0103 15.8751 14.2045 15.6567 14.3458 15.4047C14.4872 15.1527 14.5723 14.8731 14.5954 14.585L14.639 14.0134C14.6523 13.8465 14.7116 13.6866 14.8104 13.5515C14.9093 13.4163 15.0436 13.3113 15.1986 13.2482L15.7255 13.0298C15.8212 12.99 15.9136 12.9428 16.002 12.8885C16.2266 12.7517 16.4221 12.572 16.5772 12.3595C16.7323 12.1471 16.8441 11.9061 16.9061 11.6504C16.968 11.3947 16.979 11.1293 16.9384 10.8694C16.8978 10.6094 16.8063 10.3601 16.6693 10.1355L16.3716 9.64475ZM5.98393 7.35411C5.98393 7.2101 6.02661 7.06933 6.10657 6.94959C6.18653 6.82985 6.30018 6.73653 6.43315 6.68142C6.56611 6.62631 6.71243 6.61189 6.85358 6.63999C6.99474 6.66808 7.1244 6.73743 7.22617 6.83925C7.32794 6.94108 7.39724 7.07082 7.42532 7.21206C7.4534 7.3533 7.43899 7.4997 7.38391 7.63275C7.32884 7.76579 7.23557 7.87951 7.1159 7.95951C6.99623 8.03952 6.85554 8.08222 6.71162 8.08222C6.51862 8.08222 6.33354 8.00551 6.19707 7.86896C6.0606 7.73241 5.98393 7.54722 5.98393 7.35411ZM6.98959 11.7374C6.9397 11.7884 6.88002 11.8288 6.81412 11.8562C6.74822 11.8837 6.67746 11.8974 6.6061 11.8968C6.49941 11.8968 6.39509 11.8653 6.30613 11.8064C6.21718 11.7474 6.14753 11.6636 6.10587 11.5653C6.06421 11.467 6.05237 11.3586 6.07184 11.2537C6.0913 11.1487 6.14121 11.0518 6.21534 10.975L10.5814 6.60634C10.682 6.50598 10.8177 6.44884 10.9596 6.44708C11.1016 6.44531 11.2387 6.49906 11.3417 6.59688C11.4447 6.6947 11.5054 6.82888 11.511 6.97084C11.5166 7.11281 11.4667 7.25137 11.3717 7.35702L11.3513 7.37741L6.98959 11.7374ZM11.0806 11.7148C10.8887 11.7148 10.7044 11.6389 10.5681 11.5036C10.4318 11.3683 10.3545 11.1846 10.353 10.9925V10.9874C10.353 10.8434 10.3956 10.7026 10.4756 10.5829C10.5556 10.4631 10.6692 10.3698 10.8022 10.3147C10.9351 10.2596 11.0814 10.2452 11.2226 10.2733C11.3638 10.3014 11.4934 10.3707 11.5952 10.4725C11.697 10.5744 11.7663 10.7041 11.7943 10.8453C11.8224 10.9866 11.808 11.133 11.7529 11.266C11.6979 11.3991 11.6046 11.5128 11.4849 11.5928C11.3653 11.6728 11.2246 11.7155 11.0806 11.7155",fill:r})),e.createElement("div",{className:"yt-cart-loyalty-applied-details",style:{display:"flex",flexDirection:"column",gap:"4px"}},e.createElement("span",{className:"yt-loyalty-cta-applied-text",style:{fontSize:"13px",fontWeight:"bold",color:l??"#000"}},cn(m,m?.currency),Number(h?.toFixed(1))??0," Off Coupon Applied!"),e.createElement("span",{className:"yt-loyalty-cta-applied-code-text",style:{fontSize:"9px",color:r??"#EF4444"}},"Code: ",function(e){try{const t=e+"=",n=(()=>{try{return decodeURIComponent(document.cookie)}catch(e){return console.warn("Cookie decode failed, using raw cookie string"),document.cookie}})().split(";");for(let o=0;o<n.length;o++){let r=n[o].trim();if(0===r.indexOf(t)){const n=r.substring(t.length);try{return decodeURIComponent(n)}catch(t){return console.warn(`Failed to decode cookie value for ${e}`),n}}}return""}catch(t){return console.error(`Cookie parsing error for ${e}:`,t),""}}("discount_code")))),e.createElement("div",{className:"yt-cart-loyalty-applied-remove",style:{display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"},onClick:async()=>{x&&x(!0,!1,!1,!0);try{await n()}catch(e){}x&&x(!1,!1,!1,!1)},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)}," ",f?e.createElement(ye,{className:"yt-loyalty-cta-applied-delete-btn",color:"#9CA3AF",fontSize:"16px"}):e.createElement(be,{className:"yt-loyalty-cta-applied-delete-btn",color:"#9CA3AF",fontSize:"16px"}),e.createElement("span",{className:"yt-loyalty-cta-applied-text",style:{fontSize:"8px",color:c??"#6B7280",fontWeight:"600"}},"REMOVE")))},Ko=c.span`
1032
+ `,Uo=({cartSigninCTAMainText:t,signinCTAButtonVisible:n=!0,guestLoyaltyPercentage:o,joinNowFunction:r,themeColor:i,ctaButtonBackgroundColor:a,ctaButtonTextColor:l,primaryTextColor:c,secondaryTextColor:s,cartComponentsCornerType:d,cartComponentsCornerRadius:p,showCartLevelAltPay:u})=>e.createElement("div",{className:"yt-cart-guest-loyalty-container",style:{display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"10px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:u?"0px":"10px",borderBottomRightRadius:u?"0px":"10px",margin:"10px 1rem 6px",border:"1px solid #E8EBED",background:"#00000005"}},e.createElement("div",{className:"yt-cart-guest-loyalty-content",style:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:"4px"}},e.createElement(qo,{className:"yt-cart-guest-loyalty-text",color:c},t??"Sign-in to avail Reward Points"),e.createElement(Qo,{className:"yt-cart-guest-loyalty-text",color:s},"Get"," ",e.createElement("span",{style:{fontWeight:"bold"}},"upto ",o,"% Off")," ","on all orders")),e.createElement(Wo,{className:"yt-cart-guest-loyalty-signin-button",$ctaButtonBackgroundColor:a,$ctaButtonTextColor:l,$cartComponentsCornerType:d,$cartComponentsCornerRadius:p,onClick:r},"Sign in Now"));class Yo extends e.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("FooterSections error:",e,t)}render(){return this.state.hasError?e.createElement("div",{style:{textAlign:"center",marginBottom:"10px",textDecorationLine:"underline",color:"blue",cursor:"pointer"},onClick:()=>window.location.reload()},"Something went wrong. Click here to reload the page"):this.props.children}}const Go=({children:o})=>{const[r,i]=t("0px");return n(()=>{const e=navigator.userAgent.toLowerCase(),t=e.indexOf("brave")>-1,n=/iphone|ipad|ipod/.test(e)&&!window.MSStream,o=e.includes("safari")&&!e.includes("chrome"),r=/android/.test(e);t?i("56px"):n?i(o?"44px":"34px"):r&&i("24px")},[]),e.createElement(Yo,null,e.createElement("div",{className:"yt-cart-footer-container",style:{display:"flex",flexDirection:"column",paddingBottom:"env(safe-area-inset-bottom, 0px)",background:"white",zIndex:999,width:"100%",boxShadow:"rgb(135 135 135 / 45%) 0px -2px 0px 0px",borderRadius:"17px 17px 0px 0px",gap:"10px"}},o))},Xo=()=>{const[o,r]=t(0);return n(()=>{const e=setTimeout(()=>{r(100)},1e3);return()=>clearTimeout(e)},[]),e.createElement("div",{className:"yt-loyalty-cta-progress-bar-container"},e.createElement("div",{className:"yt-loyalty-cta-progress-bar",style:{width:`${o}%`}},"‎"))},Zo=({removeDiscount:n,isDev:o,themeColor:r,ctaButtonBackgroundColor:i,ctaButtonTextColor:a,primaryTextColor:l,secondaryTextColor:c,loyaltyDiscount:s,pointsToBeUsed:d,brandTokenName:p,showCartLevelAltPay:u})=>{const m=ce(Zt),{cartLoading:g,setLoading:x}=on(),[f,y]=t(!1),b=g.showLoyaltyCtaLoading,h=an(s?.total_allocated_amount??0,m?.currency),v=m?.discount_codes?.find(e=>!0===e?.applicable)?.code;return b?e.createElement("div",{className:"yt-loyalty-apply-cta-loading-container",style:{marginBottom:u?"0":"1rem"}},e.createElement("span",{style:{fontSize:"13px"}},"Processing points..."),e.createElement(ge,{color:"black",loading:b,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}),e.createElement(Xo,null)):e.createElement("div",{className:"yt-loyalty-cta-applied-container",style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"#FAFAFA",border:"1px solid #E5E7E8",borderRadius:"10px",padding:"12px 16px",margin:"10px 1rem",boxShadow:"0px 3px 3.8px 0px rgba(1, 1, 1, 0.231372549)",zIndex:100}},e.createElement("div",{className:"yt-cart-loyalty-applied-content",style:{display:"flex",flexDirection:"row",gap:"10px",alignItems:"center"}},e.createElement("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.3716 9.64475C16.2849 9.50135 16.239 9.33692 16.239 9.1693C16.239 9.00167 16.2849 8.83724 16.3716 8.69384L16.67 8.20819C16.821 7.96172 16.9167 7.68543 16.9507 7.39837C16.9847 7.1113 16.9561 6.82027 16.8669 6.54532C16.7777 6.27038 16.63 6.01805 16.4339 5.80572C16.2379 5.59339 15.9982 5.42611 15.7313 5.31539L15.2044 5.09696C15.0488 5.03308 14.914 4.92711 14.8152 4.79093C14.7164 4.65474 14.6574 4.49372 14.6448 4.32588L14.6012 3.75431C14.5775 3.46646 14.4919 3.18711 14.3505 2.93534C14.209 2.68358 14.0149 2.46533 13.7814 2.2955C13.5479 2.12567 13.2805 2.00826 12.9975 1.95128C12.7145 1.8943 12.4226 1.89909 12.1416 1.96534L11.5857 2.09713C11.4226 2.13644 11.2518 2.13007 11.0922 2.07869C10.9325 2.02731 10.79 1.93293 10.6804 1.80588L10.3122 1.36901C10.1245 1.14887 9.89139 0.972091 9.62882 0.850869C9.36625 0.729647 9.08052 0.66687 8.79134 0.66687C8.50217 0.66687 8.21644 0.729647 7.95387 0.850869C7.6913 0.972091 7.45814 1.14887 7.27048 1.36901L6.89863 1.80588C6.78907 1.93319 6.64649 2.02775 6.48663 2.07914C6.32677 2.13053 6.15584 2.13675 5.99267 2.09713L5.43671 1.96534C5.15574 1.89909 4.8638 1.8943 4.5808 1.95128C4.29781 2.00826 4.03044 2.12567 3.79695 2.2955C3.56346 2.46533 3.36934 2.68358 3.22786 2.93534C3.08637 3.18711 3.00085 3.46646 2.97714 3.75431L2.93348 4.32588C2.92053 4.49352 2.86128 4.65426 2.76233 4.79015C2.66339 4.92605 2.52866 5.03177 2.37316 5.0955L1.84631 5.31393C1.57905 5.4243 1.33887 5.59134 1.14236 5.80354C0.945839 6.01575 0.79765 6.26807 0.708004 6.54312C0.618359 6.81817 0.58939 7.10939 0.623094 7.39672C0.656799 7.68406 0.752375 7.96066 0.903234 8.20746L1.20158 8.69311C1.28834 8.83651 1.3342 9.00094 1.3342 9.16857C1.3342 9.3362 1.28834 9.50062 1.20158 9.64403L0.903234 10.1355C0.752508 10.3821 0.656925 10.6584 0.623055 10.9455C0.589185 11.2325 0.61783 11.5235 0.707022 11.7984C0.796215 12.0734 0.943839 12.3257 1.13975 12.5381C1.33566 12.7506 1.57521 12.918 1.84195 13.029L2.36879 13.2475C2.52387 13.3107 2.65833 13.4158 2.75715 13.551C2.85597 13.6863 2.91525 13.8464 2.92838 14.0134L2.97204 14.585C2.99511 14.8731 3.08023 15.1527 3.22156 15.4047C3.3629 15.6567 3.55709 15.8751 3.79079 16.0449C4.02449 16.2147 4.29217 16.3318 4.57541 16.3882C4.85865 16.4447 5.15075 16.4391 5.43162 16.3718L5.98757 16.24C6.15078 16.2015 6.32137 16.2083 6.48101 16.2596C6.64064 16.311 6.78327 16.4049 6.89354 16.5313L7.26539 16.9681C7.45339 17.1876 7.68662 17.3638 7.94908 17.4846C8.21153 17.6053 8.497 17.6679 8.78589 17.6679C9.07477 17.6679 9.36024 17.6053 9.62269 17.4846C9.88515 17.3638 10.1184 17.1876 10.3064 16.9681L10.6746 16.5313C10.7848 16.405 10.9273 16.3112 11.0868 16.2599C11.2463 16.2085 11.4167 16.2017 11.5798 16.24L12.1358 16.3718C12.4167 16.4391 12.7088 16.4447 12.992 16.3882C13.2752 16.3318 13.5429 16.2147 13.7766 16.0449C14.0103 15.8751 14.2045 15.6567 14.3458 15.4047C14.4872 15.1527 14.5723 14.8731 14.5954 14.585L14.639 14.0134C14.6523 13.8465 14.7116 13.6866 14.8104 13.5515C14.9093 13.4163 15.0436 13.3113 15.1986 13.2482L15.7255 13.0298C15.8212 12.99 15.9136 12.9428 16.002 12.8885C16.2266 12.7517 16.4221 12.572 16.5772 12.3595C16.7323 12.1471 16.8441 11.9061 16.9061 11.6504C16.968 11.3947 16.979 11.1293 16.9384 10.8694C16.8978 10.6094 16.8063 10.3601 16.6693 10.1355L16.3716 9.64475ZM5.98393 7.35411C5.98393 7.2101 6.02661 7.06933 6.10657 6.94959C6.18653 6.82985 6.30018 6.73653 6.43315 6.68142C6.56611 6.62631 6.71243 6.61189 6.85358 6.63999C6.99474 6.66808 7.1244 6.73743 7.22617 6.83925C7.32794 6.94108 7.39724 7.07082 7.42532 7.21206C7.4534 7.3533 7.43899 7.4997 7.38391 7.63275C7.32884 7.76579 7.23557 7.87951 7.1159 7.95951C6.99623 8.03952 6.85554 8.08222 6.71162 8.08222C6.51862 8.08222 6.33354 8.00551 6.19707 7.86896C6.0606 7.73241 5.98393 7.54722 5.98393 7.35411ZM6.98959 11.7374C6.9397 11.7884 6.88002 11.8288 6.81412 11.8562C6.74822 11.8837 6.67746 11.8974 6.6061 11.8968C6.49941 11.8968 6.39509 11.8653 6.30613 11.8064C6.21718 11.7474 6.14753 11.6636 6.10587 11.5653C6.06421 11.467 6.05237 11.3586 6.07184 11.2537C6.0913 11.1487 6.14121 11.0518 6.21534 10.975L10.5814 6.60634C10.682 6.50598 10.8177 6.44884 10.9596 6.44708C11.1016 6.44531 11.2387 6.49906 11.3417 6.59688C11.4447 6.6947 11.5054 6.82888 11.511 6.97084C11.5166 7.11281 11.4667 7.25137 11.3717 7.35702L11.3513 7.37741L6.98959 11.7374ZM11.0806 11.7148C10.8887 11.7148 10.7044 11.6389 10.5681 11.5036C10.4318 11.3683 10.3545 11.1846 10.353 10.9925V10.9874C10.353 10.8434 10.3956 10.7026 10.4756 10.5829C10.5556 10.4631 10.6692 10.3698 10.8022 10.3147C10.9351 10.2596 11.0814 10.2452 11.2226 10.2733C11.3638 10.3014 11.4934 10.3707 11.5952 10.4725C11.697 10.5744 11.7663 10.7041 11.7943 10.8453C11.8224 10.9866 11.808 11.133 11.7529 11.266C11.6979 11.3991 11.6046 11.5128 11.4849 11.5928C11.3653 11.6728 11.2246 11.7155 11.0806 11.7155",fill:r})),e.createElement("div",{className:"yt-cart-loyalty-applied-details",style:{display:"flex",flexDirection:"column",gap:"4px"}},e.createElement("span",{className:"yt-loyalty-cta-applied-text",style:{fontSize:"13px",fontWeight:"bold",color:l??"#000"}},cn(m,m?.currency),Number(h?.toFixed(1))??0," Off Coupon Applied!"),e.createElement("span",{className:"yt-loyalty-cta-applied-code-text",style:{fontSize:"9px",color:r??"#EF4444"}},"Code: ",v??""))),e.createElement("div",{className:"yt-cart-loyalty-applied-remove",style:{display:"flex",alignItems:"center",gap:"4px",cursor:"pointer"},onClick:async()=>{x&&x(!0,!1,!1,!0);try{await n()}catch(e){}x&&x(!1,!1,!1,!1)},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)}," ",f?e.createElement(ye,{className:"yt-loyalty-cta-applied-delete-btn",color:"#9CA3AF",fontSize:"16px"}):e.createElement(be,{className:"yt-loyalty-cta-applied-delete-btn",color:"#9CA3AF",fontSize:"16px"}),e.createElement("span",{className:"yt-loyalty-cta-applied-text",style:{fontSize:"8px",color:c??"#6B7280",fontWeight:"600"}},"REMOVE")))},Ko=c.span`
1033
1033
  display: flex !important;
1034
1034
  flex-direction: row;
1035
1035
  align-items: center;
@@ -1352,7 +1352,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
1352
1352
  padding: 2px 0px 4px 0px;
1353
1353
  border-bottom-left-radius: 8px;
1354
1354
  border-bottom-right-radius: 8px;
1355
- `,Fr=({imageUrl:t,overlayText:n,themeColor:o,themeTextColor:r})=>e.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},e.createElement("img",{src:t,alt:"Free Gift",style:{width:"100%",height:"100%",objectFit:"fill",borderRadius:"8px"}}),e.createElement(Ir,{className:"yt-cart-product-freebie-overlay-text",$themeColor:o,$themeTextColor:r},n)),Pr=({product:o,handleDecrement:i,handleIncrement:a,removeCartItem:l,addCartItem:c,isDev:s,themeColor:d,primaryTextColor:p,secondaryTextColor:u,tertiaryColor:m,tertiaryTextColor:g,showQtySelector:x=!0,themeTextColor:f,showEditOptionOnProducts:y,percentageOff:b,removeFreebieFromCart:h,showDeleteOnFreebies:v,imageAspectSelector:w,cartComponentsCornerType:C,cartComponentsCornerRadius:E,backgroundSubdued:k,backgroundColor:T,showDiscountOnMRP:S,freeLabelText:$})=>{const{setLoading:B}=on(),z=ce(Zt),[N,I]=le(or),[F,P]=t(!1),D=se(rn),A=sr(),_=!!o.properties?._isYtFreebie,L=!!o.properties?._isStealDeal,M=_&&"number"==typeof o.final_line_price&&o.final_line_price>0&&"number"==typeof o.original_line_price&&o.original_line_price>o.final_line_price;n(()=>{function e(){const e=window.innerWidth;P(e>=450)}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const V=r(null),[j,W]=t(0);n(()=>{let e=null;return V.current&&(e=new ResizeObserver(e=>{e[0]&&W(e[0].contentRect.width)}),e.observe(V.current)),()=>{e&&e.disconnect()}},[]),n(()=>{const e=setTimeout(()=>{V.current&&W(V.current.offsetWidth)},100);return()=>clearTimeout(e)},[]);const H=dn(o.product_title,j<200?100:120,j,"","16px"),q=()=>{if(o.line_level_discount_allocations&&o.line_level_discount_allocations.length>0&&o.line_level_discount_allocations[0].discount_application){const e=o.line_level_discount_allocations[0].discount_application.title,t=hn(e);switch(o.line_level_discount_allocations[0].discount_application.value_type){case"amount":return`${t})`;case"percentage":case"fixed_amount":return t;default:return""}}};let Q=cn(z,z?.currency);const U=["__Added with Frequently Bought Together button","_has_gpo","_y"],Y=o?.options_with_values&&o.options_with_values.filter(e=>"Title"!==e.name).length>0||o?.properties&&Object.keys(o.properties).filter(e=>!U.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).length>0||y,G=j?70/j*100:100,X=q(),Z=X&&(X.length>25||!F)?dn(X,G,j,"","10px"):X,K=(()=>{const e=o?.properties?._bundleImage;if(!e||"string"!=typeof e)return;const t=e.trim();return t.length>0?t:void 0})(),J=!!K,ee=(()=>{const e=o?.properties?.itemsInBundle;return"string"!=typeof e?[]:e.split(/,\s*/).map(e=>e.trim()).filter(e=>e.length>0)})(),te=(()=>{const e=o?.properties?._bundleItems;if("string"==typeof e&&e.trim().length>0)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.reduce((e,t)=>{const n=Number(t?.quantity);return e+(isNaN(n)?0:n)},0);if(e>0)return e}}catch(e){}let t=0;for(const e of ee){const n=e.match(/^(\d+)\s*x\s*/i);t+=n?parseInt(n[1],10)||0:1}return t})(),re=(()=>{try{const e=Number(o?.compare_at_price),t=Number(o?.quantity)||1;if(Number.isFinite(e)&&e>0)return e*t}catch(e){}return null})(),[ie,ae]=t(!0),de=F?"250px":"190px";return e.createElement(fr,{className:"yt-cart-product-card",$hasVariantInfo:Y||J,$backgroundColor:T,style:{display:"flex",flexDirection:"row",alignItems:"center",margin:"0 1rem"}},e.createElement("a",{href:`${window.location.origin}${o.url}`,style:{textDecoration:"none",display:"contents"}},e.createElement(br,{className:"yt-cart-product-image-wrapper",$isBundle:J},e.createElement(yr,{className:"yt-cart-product-image",$imageAspectSelector:w,$isBundle:J},x?e.createElement("img",{style:{height:"100%",width:"100%",opacity:0===o.quantity?.5:1},src:bn(K??o.image,200,85,"webp"),alt:(e=>e.title?`Product image - ${e.title}`:"Product image")(o),loading:"lazy"}):e.createElement(Fr,{imageUrl:bn(K??o.image??o?.featuredImage?.url??"/placeholder.svg",200,85,"webp"),overlayText:L?"Steal Deal":M||b?"Special Offer":"Free Gift",themeColor:d,themeTextColor:f})),(x||o?.quantity>1)&&e.createElement(hr,{className:"yt-cart-product-quantity-badge"},o.quantity))),e.createElement("div",{className:"yt-cart-product-details",style:{display:"flex",flexDirection:"column",flex:1,padding:"4px 0"}},e.createElement("div",{className:"yt-cart-product-header",style:{display:"flex",flexDirection:"row",alignItems:"flex-start"}},e.createElement(xr,{className:"yt-cart-product-title",$themeColor:d,$primaryTextColor:p,href:`${window.location.origin}${o.url}`,ref:V},H),e.createElement("div",{className:"yt-cart-product-actions",style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{marginLeft:"3px",display:"flex",alignItems:"center",justifyContent:"center"}},(x||v)&&e.createElement(Cr,{onClick:x?async()=>{B&&B(!0,!0);try{l&&await l(o.key)}catch(e){}B&&B(!1,!1)}:async()=>{B&&B(!0,!0);try{h&&await h(o.key)}catch(e){}B&&B(!1,!1)}},e.createElement(vr,null,e.createElement(ne,{className:"outline"}),e.createElement(oe,{className:"filled"})))))),J?e.createElement("div",{className:"yt-cart-product-bundle-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement("div",{className:"yt-cart-product-bundle-toggle",role:"button",onClick:()=>ae(!ie),style:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"4px 6px",width:"fit-content",cursor:"pointer",userSelect:"none",fontSize:"12px",fontWeight:600,color:u??"#1a1a1a"}},e.createElement("span",null,`Contain ${te} Items`),ie?e.createElement(R,null):e.createElement(O,null)),ie&&ee.length>0&&e.createElement("div",{style:{marginTop:"4px",backgroundColor:"#F8F9FA",borderRadius:"8px",padding:"8px 10px",border:"1px solid rgba(0,0,0,0.06)",maxWidth:de,width:"fit-content"}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",maxWidth:de}},ee.map((t,n)=>e.createElement("div",{key:`${t}-${n}`,style:{color:u??"#1a1a1a",fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:de},title:t},t))))):Y&&e.createElement("div",{className:"yt-cart-product-variant-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement(dr,{className:"yt-cart-product-variant-container"},o?.options_with_values?.filter(e=>"Title"!==e.name).map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),o=cr(n,t.value);return"color"===n?.type?.toLowerCase()&&o?e.createElement(pr,{key:t.name,$colorValue:o.value,style:{display:"block"}}):"image"===n?.type?.toLowerCase()&&o?e.createElement(ur,{key:t.name,src:bn(o.value,36,85,"webp"),alt:t.value}):t.value.length>15||t.value.includes("#")?null:e.createElement(wr,{className:"yt-cart-variant-text",key:t.name,$secondaryTextColor:u,style:{display:"flex",alignItems:"center",borderRadius:"6px",border:"1px solid rgb(117 117 117 / 50%)",padding:"1px 3px"}},t.value)}),o?.properties&&Object.entries(o.properties).filter(([e])=>!U.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).map(([t,n])=>{const o=String(n);return o.includes("#")||(A?.options??[]).some(e=>e.name.trim().toLowerCase()===t.trim().toLowerCase()&&e.values.some(e=>e.name.trim().toLowerCase()===o.trim().toLowerCase()))?null:e.createElement(wr,{key:t,$secondaryTextColor:u,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px"}},o)}),y&&!o?.product_has_only_default_variant&&e.createElement(Cr,{onClick:()=>{const e=!!o.properties?._isYtFreebie;let t;if(e){const e=o.properties?._yt_allowed_variants;if(e&&"string"==typeof e)try{t=JSON.parse(e)}catch(n){console.error(`ProductCard: Failed to parse _yt_allowed_variants for ${o.key}:`,e,n),t=[String(o.variant_id)]}else console.warn(`ProductCard: No allowed variants property found for freebie ${o.key}. Defaulting to current variant.`),t=[String(o.variant_id)]}D({open:!0,variantId:String(o.variant_id),quantity:o.quantity,handle:o.handle,lineItemKey:o.key,freebieSelection:e,productId:String(o.product_id),allowedVariantIds:t})},style:{display:"flex",alignItems:"center"}},e.createElement(Pe,null))),o?.options_with_values?.filter(e=>"Title"!==e.name&&e.value.length>15).map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());if(cr(n,t.value)&&["color","image"].includes((n?.type??"").toLowerCase()))return null;if(t.value.includes("#"))return null;const o=F?t.value:dn(t.value,j?120/j*100:100,j,"","10px");return e.createElement(wr,{key:t.name,$secondaryTextColor:u,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px",width:"fit-content"}},o)})),e.createElement(Er,{className:"yt-cart-product-bottom-row"},e.createElement("div",{className:"yt-cart-product-pricing-row",style:{display:"flex",flexDirection:F?"row":"column",alignItems:F?"center":"flex-start",gap:F?"0px":"4px"}},e.createElement(kr,{className:"yt-cart-product-price-container"},J?e.createElement(e.Fragment,null,e.createElement(Tr,{$primaryTextColor:p},Q,fn(an(o.final_line_price,z?.currency))),re&&re>Number(o.final_line_price)&&S&&e.createElement(Sr,null,Q,fn(an(re,z?.currency)))):e.createElement(Tr,{$primaryTextColor:p},0===an(o.final_line_price,z?.currency)?e.createElement(Nr,{$primaryColor:p,$themeColor:d,$backgroundSubdued:k},$||"FREE"):e.createElement(e.Fragment,null,Q,fn(an(o.final_line_price,z?.currency)))),!J&&(o.compare_at_price&&Number(o.compare_at_price)*o.quantity>Number(o.final_line_price)||!o.compare_at_price&&q()&&o.original_line_price)&&S&&e.createElement(Sr,null,Q,o.compare_at_price?fn(an(Number(o.compare_at_price)*o.quantity,z?.currency)):fn(an(o.original_line_price,z?.currency))),F&&(x||M)&&q()&&e.createElement(Br,{className:"yt-cart-product-discount",$tertiaryColor:m},e.createElement($e,{size:14,color:g}),e.createElement(zr,{$tertiaryTextColor:g},Z))),!F&&(x||M)&&q()&&e.createElement(Br,{className:"yt-cart-product-discount",$tertiaryColor:m},e.createElement($e,{size:12,color:g}),e.createElement(zr,{$tertiaryTextColor:g},Z))),e.createElement($r,{className:"yt-cart-product-quantity-controls"},x?e.createElement(nr,{handleItemQuantityDecrement:async()=>{B&&B(!0,!0);try{i&&await i(o.key,o.quantity-1)}catch(e){}B&&B(!1,!1)},handleItemQuantityIncrement:async()=>{B&&B(!0,!0);try{if(a){-1===await a(o.key,o.quantity+1,o.properties)&&(I(o?.key),setTimeout(()=>I(void 0),3e3))}}catch(e){}B&&B(!1,!1)},value:o.quantity,isDev:s,themeColor:d,cartComponentsCornerType:C,cartComponentsCornerRadius:E,backgroundSubdued:k}):!L||M||b?e.createElement("span",{className:"yt-cart-line-item-freebie-badge",style:{padding:"2px 8px",fontSize:"10px",backgroundColor:m,color:g??"#000",borderRadius:"4px"}},M&&o.original_line_price?`${((o.original_line_price-o.final_line_price)/o.original_line_price*100).toFixed(0)}% off`:b&&o?.properties?._isYtFreebie?`${b}% Off`:"Freebie"):null)),N&&N===o?.key&&e.createElement("span",{style:{fontSize:"10px",color:"red",marginTop:"4px"}},"⚠️You've reached the maximum quantity for this item")))},Dr=c.div`
1355
+ `,Fr=({imageUrl:t,overlayText:n,themeColor:o,themeTextColor:r})=>e.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},e.createElement("img",{src:t,alt:"Free Gift",style:{width:"100%",height:"100%",objectFit:"fill",borderRadius:"8px"}}),e.createElement(Ir,{className:"yt-cart-product-freebie-overlay-text",$themeColor:o,$themeTextColor:r},n)),Pr=({product:o,handleDecrement:i,handleIncrement:a,removeCartItem:l,addCartItem:c,isDev:s,themeColor:d,primaryTextColor:p,secondaryTextColor:u,tertiaryColor:m,tertiaryTextColor:g,showQtySelector:x=!0,themeTextColor:f,showEditOptionOnProducts:y,percentageOff:b,removeFreebieFromCart:h,showDeleteOnFreebies:v,imageAspectSelector:w,cartComponentsCornerType:C,cartComponentsCornerRadius:E,backgroundSubdued:k,backgroundColor:T,showDiscountOnMRP:S,freeLabelText:$})=>{const{setLoading:B}=on(),z=ce(Zt),[N,I]=le(or),[F,P]=t(!1),D=se(rn),A=sr(),_=!!o.properties?._isYtFreebie,L=!!o.properties?._isStealDeal,M=_&&"number"==typeof o.final_line_price&&o.final_line_price>0&&"number"==typeof o.original_line_price&&o.original_line_price>o.final_line_price;n(()=>{function e(){const e=window.innerWidth;P(e>=450)}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const V=r(null),[j,W]=t(0);n(()=>{let e=null;return V.current&&(e=new ResizeObserver(e=>{e[0]&&W(e[0].contentRect.width)}),e.observe(V.current)),()=>{e&&e.disconnect()}},[]),n(()=>{const e=setTimeout(()=>{V.current&&W(V.current.offsetWidth)},100);return()=>clearTimeout(e)},[]);const H=dn(o.product_title,j<200?100:120,j,"","16px"),q=()=>{if(o.line_level_discount_allocations&&o.line_level_discount_allocations.length>0&&o.line_level_discount_allocations[0].discount_application){const e=o.line_level_discount_allocations[0].discount_application.title,t=hn(e);switch(o.line_level_discount_allocations[0].discount_application.value_type){case"amount":return`${t})`;case"percentage":case"fixed_amount":return t;default:return""}}};let Q=cn(z,z?.currency);const U=["__Added with Frequently Bought Together button","_has_gpo","_y"],Y=o?.options_with_values&&o.options_with_values.filter(e=>"Title"!==e.name).length>0||o?.properties&&Object.keys(o.properties).filter(e=>!U.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).length>0||y,G=j?70/j*100:100,X=q(),Z=X&&(X.length>25||!F)?dn(X,G,j,"","10px"):X,K=(()=>{const e=o?.properties?._bundleImage;if(!e||"string"!=typeof e)return;const t=e.trim();return t.length>0?t:void 0})(),J=!!K,ee=(()=>{const e=o?.properties?.itemsInBundle;return"string"!=typeof e?[]:e.split(/,\s*/).map(e=>e.trim()).filter(e=>e.length>0)})(),te=(()=>{const e=o?.properties?._bundleItems;if("string"==typeof e&&e.trim().length>0)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.reduce((e,t)=>{const n=Number(t?.quantity);return e+(isNaN(n)?0:n)},0);if(e>0)return e}}catch(e){}let t=0;for(const e of ee){const n=e.match(/^(\d+)\s*x\s*/i);t+=n?parseInt(n[1],10)||0:1}return t})(),re=(()=>{try{const e=Number(o?.compare_at_price),t=Number(o?.quantity)||1;if(Number.isFinite(e)&&e>0)return e*t}catch(e){}return null})(),[ie,ae]=t(!0),de=F?"250px":"190px";return e.createElement(fr,{className:"yt-cart-product-card",$hasVariantInfo:Y||J,$backgroundColor:T,style:{display:"flex",flexDirection:"row",alignItems:"center",margin:"0 1rem"}},e.createElement("a",{href:`${window.location.origin}${o.url}`,style:{textDecoration:"none",display:"contents"}},e.createElement(br,{className:"yt-cart-product-image-wrapper",$isBundle:J},e.createElement(yr,{className:"yt-cart-product-image",$imageAspectSelector:w,$isBundle:J},x?e.createElement("img",{style:{height:"100%",width:"100%",opacity:0===o.quantity?.5:1},src:bn(K??o.image,200,85,"webp"),alt:(e=>e.title?`Product image - ${e.title}`:"Product image")(o),loading:"lazy"}):e.createElement(Fr,{imageUrl:bn(K??o.image??o?.featuredImage?.url??"/placeholder.svg",200,85,"webp"),overlayText:L?"Steal Deal":M||b?"Special Offer":"Free Gift",themeColor:d,themeTextColor:f})),(x||o?.quantity>1)&&e.createElement(hr,{className:"yt-cart-product-quantity-badge"},o.quantity))),e.createElement("div",{className:"yt-cart-product-details",style:{display:"flex",flexDirection:"column",flex:1,padding:"4px 0"}},e.createElement("div",{className:"yt-cart-product-header",style:{display:"flex",flexDirection:"row",alignItems:"flex-start"}},e.createElement(xr,{className:"yt-cart-product-title",$themeColor:d,$primaryTextColor:p,href:`${window.location.origin}${o.url}`,ref:V},H),e.createElement("div",{className:"yt-cart-product-actions",style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{marginLeft:"3px",display:"flex",alignItems:"center",justifyContent:"center"}},(x||v)&&e.createElement(Cr,{onClick:x?async()=>{B&&B(!0,!0);try{l&&await l(o.key)}catch(e){}B&&B(!1,!1)}:async()=>{B&&B(!0,!0);try{h&&await h(o.key)}catch(e){}B&&B(!1,!1)}},e.createElement(vr,null,e.createElement(ne,{className:"outline"}),e.createElement(oe,{className:"filled"})))))),J?e.createElement("div",{className:"yt-cart-product-bundle-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement("div",{className:"yt-cart-product-bundle-toggle",role:"button",onClick:()=>ae(!ie),style:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"4px 6px",width:"fit-content",cursor:"pointer",userSelect:"none",fontSize:"12px",fontWeight:600,color:u??"#1a1a1a"}},e.createElement("span",null,`Contain ${te} Items`),ie?e.createElement(R,null):e.createElement(O,null)),ie&&ee.length>0&&e.createElement("div",{style:{marginTop:"4px",backgroundColor:"#F8F9FA",borderRadius:"8px",padding:"8px 10px",border:"1px solid rgba(0,0,0,0.06)",maxWidth:de,width:"fit-content"}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",maxWidth:de}},ee.map((t,n)=>e.createElement("div",{key:`${t}-${n}`,style:{color:u??"#1a1a1a",fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:de},title:t},t))))):Y&&e.createElement("div",{className:"yt-cart-product-variant-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement(dr,{className:"yt-cart-product-variant-container"},o?.options_with_values?.filter(e=>"Title"!==e.name).map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),o=cr(n,t.value);return"color"===n?.type?.toLowerCase()&&o?e.createElement(pr,{key:t.name,$colorValue:o.value,style:{display:"block"}}):"image"===n?.type?.toLowerCase()&&o?e.createElement(ur,{key:t.name,src:bn(o.value,36,85,"webp"),alt:t.value}):t.value.length>15||t.value.includes("#")?null:e.createElement(wr,{className:"yt-cart-variant-text",key:t.name,$secondaryTextColor:u,style:{display:"flex",alignItems:"center",borderRadius:"6px",border:"1px solid rgb(117 117 117 / 50%)",padding:"1px 3px"}},t.value)}),o?.properties&&Object.entries(o.properties).filter(([e])=>!U.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).map(([t,n])=>{const o=String(n);return o.includes("#")||(A?.options??[]).some(e=>e.name.trim().toLowerCase()===t.trim().toLowerCase()&&e.values.some(e=>e.name.trim().toLowerCase()===o.trim().toLowerCase()))?null:e.createElement(wr,{key:t,$secondaryTextColor:u,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px"}},o)}),y&&!o?.product_has_only_default_variant&&e.createElement(Cr,{onClick:()=>{const e=!!o.properties?._isYtFreebie;let t;if(e){const e=o.properties?._yt_allowed_variants;if(e&&"string"==typeof e)try{t=JSON.parse(e)}catch(n){console.error(`ProductCard: Failed to parse _yt_allowed_variants for ${o.key}:`,e,n),t=[String(o.variant_id)]}else console.warn(`ProductCard: No allowed variants property found for freebie ${o.key}. Defaulting to current variant.`),t=[String(o.variant_id)]}D({open:!0,variantId:String(o.variant_id),quantity:o.quantity,handle:o.handle,lineItemKey:o.key,freebieSelection:e,productId:String(o.product_id),allowedVariantIds:t})},style:{display:"flex",alignItems:"center"}},e.createElement(Pe,null))),o?.options_with_values?.filter(e=>"Title"!==e.name&&e.value.length>15).map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());if(cr(n,t.value)&&["color","image"].includes((n?.type??"").toLowerCase()))return null;if(t.value.includes("#"))return null;const o=F?t.value:dn(t.value,j?120/j*100:100,j,"","10px");return e.createElement(wr,{key:t.name,$secondaryTextColor:u,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px",width:"fit-content"}},o)})),e.createElement(Er,{className:"yt-cart-product-bottom-row"},e.createElement("div",{className:"yt-cart-product-pricing-row",style:{display:"flex",flexDirection:F?"row":"column",alignItems:F?"center":"flex-start",gap:F?"0px":"4px"}},e.createElement(kr,{className:"yt-cart-product-price-container"},J?e.createElement(e.Fragment,null,e.createElement(Tr,{$primaryTextColor:p},0===an(o.final_line_price,z?.currency)?e.createElement(Nr,{$primaryColor:p,$themeColor:d,$backgroundSubdued:k},$||"FREE"):e.createElement(e.Fragment,null,Q,fn(an(o.final_line_price,z?.currency)))),re&&re>Number(o.final_line_price)&&S&&e.createElement(Sr,null,Q,fn(an(re,z?.currency)))):e.createElement(Tr,{$primaryTextColor:p},0===an(o.final_line_price,z?.currency)?e.createElement(Nr,{$primaryColor:p,$themeColor:d,$backgroundSubdued:k},$||"FREE"):e.createElement(e.Fragment,null,Q,fn(an(o.final_line_price,z?.currency)))),!J&&(o.compare_at_price&&Number(o.compare_at_price)*o.quantity>Number(o.final_line_price)||!o.compare_at_price&&q()&&o.original_line_price)&&S&&e.createElement(Sr,null,Q,o.compare_at_price?fn(an(Number(o.compare_at_price)*o.quantity,z?.currency)):fn(an(o.original_line_price,z?.currency))),F&&(x||M)&&q()&&e.createElement(Br,{className:"yt-cart-product-discount",$tertiaryColor:m},e.createElement($e,{size:14,color:g}),e.createElement(zr,{$tertiaryTextColor:g},Z))),!F&&(x||M)&&q()&&e.createElement(Br,{className:"yt-cart-product-discount",$tertiaryColor:m},e.createElement($e,{size:12,color:g}),e.createElement(zr,{$tertiaryTextColor:g},Z))),e.createElement($r,{className:"yt-cart-product-quantity-controls"},x?e.createElement(nr,{handleItemQuantityDecrement:async()=>{B&&B(!0,!0);try{i&&await i(o.key,o.quantity-1)}catch(e){}B&&B(!1,!1)},handleItemQuantityIncrement:async()=>{B&&B(!0,!0);try{if(a){-1===await a(o.key,o.quantity+1,o.properties)&&(I(o?.key),setTimeout(()=>I(void 0),3e3))}}catch(e){}B&&B(!1,!1)},value:o.quantity,isDev:s,themeColor:d,cartComponentsCornerType:C,cartComponentsCornerRadius:E,backgroundSubdued:k}):!L||M||b?e.createElement("span",{className:"yt-cart-line-item-freebie-badge",style:{padding:"2px 8px",fontSize:"10px",backgroundColor:m,color:g??"#000",borderRadius:"4px"}},M&&o.original_line_price?`${((o.original_line_price-o.final_line_price)/o.original_line_price*100).toFixed(0)}% off`:b&&o?.properties?._isYtFreebie?`${b}% Off`:"Freebie"):null)),N&&N===o?.key&&e.createElement("span",{style:{fontSize:"10px",color:"red",marginTop:"4px"}},"⚠️You've reached the maximum quantity for this item")))},Dr=c.div`
1356
1356
  margin: 8px 0 6px 0;
1357
1357
  padding: 12px;
1358
1358
  background: ${e=>e.$backgroundColor??"rgba(0,0,0,0.04)"};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.9.19-collection-bundle-updates.1",
3
+ "version": "0.9.19",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",