yt-uikit 0.9.32 → 0.9.34

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
@@ -2121,10 +2121,11 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
2121
2121
  }
2122
2122
 
2123
2123
  .marquee-content {
2124
- display: flex;
2124
+ display: inline-flex;
2125
2125
  flex: 0 0 auto;
2126
- width: max-content;
2126
+ width: auto;
2127
2127
  height: ${e=>e.$cartOffersCarouselHeight?`${e.$cartOffersCarouselHeight}px`:"auto"};
2128
+ line-height: 0;
2128
2129
  }
2129
2130
 
2130
2131
  .marquee-wrapper {
@@ -2140,9 +2141,9 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
2140
2141
 
2141
2142
  img {
2142
2143
  width: auto;
2144
+ height: ${e=>e.$cartOffersCarouselHeight?`${e.$cartOffersCarouselHeight}px`:"auto"};
2145
+ max-width: none;
2143
2146
  flex: 0 0 auto;
2144
- // height: 100%;
2145
- // min-height: 49px;
2146
2147
  object-fit: cover;
2147
2148
  display: block;
2148
2149
  }
@@ -2157,7 +2158,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
2157
2158
  object-fit: cover;
2158
2159
  display: block;
2159
2160
  }
2160
- `,ll=({imageUrls:o,redirectionLink:a,cartOffersCarouselHeight:l,enableMarquee:c=!0})=>{const s=r(null),d=r(null),p=r(null),[m,u]=t({containerWidth:0,trackWidth:0}),g=o.join("\n"),x=()=>{a&&(window.location.href=a)},f=i(()=>{const e=s.current?.getBoundingClientRect().width??0,t=d.current?.getBoundingClientRect().width??0;u(n=>n.containerWidth===e&&n.trackWidth===t?n:{containerWidth:e,trackWidth:t})},[]),y=i(()=>{null!==p.current&&window.cancelAnimationFrame(p.current),p.current=window.requestAnimationFrame(()=>{p.current=null,f()})},[f]);n(()=>{if(!c||!o||0===o.length)return;y();const e=s.current,t=d.current;if(!e||!t)return()=>{null!==p.current&&window.cancelAnimationFrame(p.current)};if("undefined"==typeof ResizeObserver)return window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),null!==p.current&&window.cancelAnimationFrame(p.current)};const n=new ResizeObserver(y);return n.observe(e),n.observe(t),()=>{n.disconnect(),null!==p.current&&window.cancelAnimationFrame(p.current)}},[c,g,l,y]);const b=()=>{y()};if(!o||0===o.length)return null;if(!c)return e.createElement(al,{onClick:x,style:{cursor:a?"pointer":"default"},$cartOffersCarouselHeight:l},e.createElement("img",{src:o[0],alt:"banner"}));const h=m.trackWidth,v=h>0?Math.max(2,Math.ceil((m.containerWidth+h)/h)):2;return e.createElement(il,{ref:s,onClick:x,style:{cursor:a?"pointer":"default"},$cartOffersCarouselHeight:l,$marqueeTrackWidth:h,$isMarqueeReady:h>0},e.createElement("div",{className:"marquee-wrapper"},e.createElement("div",{className:"marquee-content",ref:d},o.map((t,n)=>e.createElement("img",{key:`marquee-img-primary-${n}`,src:t,alt:`banner ${n+1}`,onLoad:b,onError:b}))),Array.from({length:v-1}).map((t,n)=>e.createElement("div",{className:"marquee-content","aria-hidden":"true",key:`marquee-repeat-${n}`},o.map((t,o)=>e.createElement("img",{key:`marquee-img-repeat-${n}-${o}`,src:t,alt:""}))))))},cl=({backgroundColor:o,titleText:r,descriptionText:i,criteria:a=[],pauseTimer:l,textAlignment:c="center",redirectionUrl:s,enableCustomCriteria:d=!0,cartData:p})=>{const[m,u]=t(0),g=e.useRef(null),x=e.useRef([]),f=d?a.filter(e=>{if(!p)return!1;if("mov"===e.type){return rn(p?.items_subtotal_price??0,p?.currency??"INR")>=e.value}if("moq"===e.type){return p.items.filter(e=>!e.properties?._isYtFreebie).reduce((e,t)=>e+(t.quantity||1),0)>=e.value}return!1}):[],y=Boolean(r&&r.trim()||i&&i.trim()),b=[...y?[{type:"default",titleText:r,descriptionText:i}]:[],...f.map(e=>({type:"criteria",titleText:e.message,descriptionText:"",redirectionUrl:e.redirectionUrl}))],h=b.length,v=h>0,w=h>1,C=e=>{"criteria"===e.type&&e.redirectionUrl?window.location.href=e.redirectionUrl:"default"===e.type&&s&&(window.location.href=s)};let E,k=!1;h>0&&(E=b[m]??b[0],k="criteria"===E.type&&Boolean(E.redirectionUrl)||"default"===E.type&&Boolean(s)),n(()=>{const e=f.filter(e=>!x.current.some(t=>t.id===e.id));if(e.length>0){const t=e[0],n=f.findIndex(e=>e.id===t.id);if(-1!==n){const e=(y?1:0)+n;e<b.length&&u(e)}}x.current=f},[f,b,y]),n(()=>{h>0&&m>=h&&u(h-1)},[m,h]),n(()=>{g.current&&gn(g.current)},[o,b,m]),n(()=>{if(!w)return void u(0);const e=setInterval(()=>{u(e=>(e+1)%h)},1e3*l);return()=>clearInterval(e)},[w,h,l]);return v?e.createElement(Qa,{ref:g,$backgroundColor:o},e.createElement(Ya,null,w?e.createElement(el,null,e.createElement(ol,{$position:"left",onClick:()=>{u(e=>0===e?h-1:e-1)}},e.createElement($e,null)),e.createElement(tl,{$currentIndex:m},b.map((t,n)=>e.createElement(nl,{key:n,onClick:()=>C(t),style:{cursor:"criteria"===t.type&&t.redirectionUrl||"default"===t.type&&s?"pointer":"default"}},e.createElement(Xa,null,e.createElement(Za,{style:{textAlign:"center"}},t.titleText),t.descriptionText&&e.createElement(Ka,{style:{textAlign:"center"}},t.descriptionText))))),e.createElement(ol,{$position:"right",onClick:()=>{u(e=>(e+1)%h)}},e.createElement(Ne,null))):e.createElement(Xa,{onClick:()=>E&&C(E),style:{cursor:k?"pointer":"default"}},(()=>{const t=b[m]??b[0];return e.createElement(e.Fragment,null,e.createElement(Za,{style:{textAlign:"center"}},t.titleText),t.descriptionText&&e.createElement(Ka,{style:{textAlign:"center"}},t.descriptionText))})()))):null},sl=({backgroundColor:t,imageUrl:o,titleText:r,descriptionText:i,textAlignment:a,redirectionUrl:l})=>{const c=e.useRef(null);n(()=>{c.current&&gn(c.current)},[t]);return e.createElement(qa,{ref:c,$backgroundColor:t,onClick:()=>{l&&(window.location.href=l)},style:{cursor:l?"pointer":"default"}},e.createElement(Ua,null,e.createElement(Ga,{$imageUrl:o}),e.createElement(Xa,null,e.createElement(Za,{style:{textAlign:"center"}},r),e.createElement(Ka,{style:{textAlign:"center"}},i))))},dl=({backgroundColor:t,couponCode:o,copySuccess:r,setCopySuccess:i,titleText:a,descriptionText:l,textAlignment:c="center"})=>{const s=e.useRef(null);n(()=>{s.current&&gn(s.current)},[t]);return e.createElement(qa,{ref:s,$backgroundColor:t,style:{position:"relative"}},e.createElement(Ua,{style:{filter:r?"blur(5px)":"none",zIndex:1}},e.createElement(Xa,{style:{borderRight:"1px solid #d9d9d9",paddingRight:"5px"}},e.createElement(Za,{style:{textAlign:"center"}},a),e.createElement(Ka,{style:{textAlign:"center"}},l)),e.createElement(Ja,null,e.createElement(me,{className:"copy-icon",size:24,onClick:()=>(e=>{navigator.clipboard.writeText(e).then(()=>{i(!0)},e=>{i(!1)}),setTimeout(()=>{i(!1)},3e3)})(o),style:{height:"24px",width:"24px"}}))))},pl=({children:o,autoSlide:r=!0,autoSlideInterval:i,copySuccess:a,themeColor:l})=>{const[c,s]=t(0),d=e.Children.count(o),[p,m]=t(!1),[u,g]=t(r),x=()=>{s(e=>e===d-1?0:e+1)};return n(()=>{if(!u)return;const e=setInterval(x,i);return()=>clearInterval(e)},[u,i]),e.createElement(rl,null,a&&e.createElement("div",{className:"coupon-code-copied",style:{position:"absolute",top:"20%",left:"50%",transform:"translate(-50%, -20%)",backgroundColor:l,display:"flex",alignItems:"center",justifyContent:"center",gap:"9px",borderRadius:"9px",padding:"12px 30px",color:"#FFF",fontFamily:"Poppins",fontSize:"12px",fontWeight:"400",lineHeight:"118%",zIndex:2,minWidth:"70%"}},e.createElement(H,{size:20,color:"white",style:{height:"24px",width:"24px"}}),"Coupon Code Copied"),e.createElement("div",{onMouseEnter:()=>{m(!0),g(!1)},onMouseLeave:()=>{m(!1),g(!0)},style:{display:"flex",transition:p?"none":"transform 0.5s ease",transform:`translateX(-${100*c}%)`,cursor:"pointer"}},e.Children.toArray(o)))};function ml({cartOffersCarousalData:n,themeColor:o,cartOffersCarouselHeight:r,cartData:i}){const[a,l]=t(!1),{enableCartOffersCarousel:c,pauseTimer:s,backgroundColor:d,slides:p}=n,m=p.filter(e=>"ImageOnly"===e.slideType).map(e=>e.imageUrl).filter(e=>!!e),u=p.findIndex(e=>"ImageOnly"===e.slideType),g=[];let x=!1;return p.forEach((t,n)=>{if("ImageOnly"===t.slideType)n===u&&m.length>0&&!x&&(g.push(e.createElement(ll,{key:`image-only-marquee-${t.slideNumber}`,imageUrls:m,redirectionLink:t.redirectionUrl||t.carouselRedirectionLink,cartOffersCarouselHeight:r,enableMarquee:!1!==t.enableMarquee})),x=!0);else switch(t.slideType){case"TextFieldOnly":g.push(e.createElement(cl,{key:t.slideNumber,backgroundColor:d,titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",criteria:t.criteria,pauseTimer:s,textAlignment:t.textAlignment,redirectionUrl:t.redirectionUrl||t.carouselRedirectionLink,enableCustomCriteria:t.enableCustomCriteria,cartData:i}));break;case"TextImage":g.push(e.createElement(sl,{key:t.slideNumber,backgroundColor:d,titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",imageUrl:t.imageUrl||"",textAlignment:t.textAlignment,redirectionUrl:t.redirectionUrl||t.carouselRedirectionLink}));break;case"TextCode":g.push(e.createElement(dl,{key:t.slideNumber,backgroundColor:d,couponCode:t.campaignCode??"",titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",copySuccess:a,setCopySuccess:l,textAlignment:t.textAlignment}))}}),c&&0!==g.length?e.createElement(pl,{copySuccess:a,autoSlideInterval:1e3*s,themeColor:o},g):null}const ul=s`
2161
+ `,ll=({imageUrls:o,redirectionLink:a,cartOffersCarouselHeight:l,enableMarquee:c=!0})=>{const s=r(null),d=r(null),p=r(null),[m,u]=t({containerWidth:0,trackWidth:0}),g=o.join("\n"),x=()=>{a&&(window.location.href=a)},f=i(()=>{const e=s.current?.getBoundingClientRect().width??0,t=d.current?(n=d.current,Array.from(n.children).reduce((e,t)=>e+t.getBoundingClientRect().width,0)||n.scrollWidth||n.getBoundingClientRect().width):0;var n;u(n=>n.containerWidth===e&&n.trackWidth===t?n:{containerWidth:e,trackWidth:t})},[]),y=i(()=>{null!==p.current&&window.cancelAnimationFrame(p.current),p.current=window.requestAnimationFrame(()=>{p.current=null,f()})},[f]);n(()=>{if(!c||!o||0===o.length)return;y();const e=s.current,t=d.current;if(!e||!t)return()=>{null!==p.current&&window.cancelAnimationFrame(p.current)};if("undefined"==typeof ResizeObserver)return window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),null!==p.current&&window.cancelAnimationFrame(p.current)};const n=new ResizeObserver(y);return n.observe(e),n.observe(t),()=>{n.disconnect(),null!==p.current&&window.cancelAnimationFrame(p.current)}},[c,g,l,y]);const b=()=>{y()};if(!o||0===o.length)return null;if(!c)return e.createElement(al,{onClick:x,style:{cursor:a?"pointer":"default"},$cartOffersCarouselHeight:l},e.createElement("img",{src:o[0],alt:"banner"}));const h=m.trackWidth,v=h>0?Math.max(2,Math.ceil((m.containerWidth+h)/h)):2;return e.createElement(il,{ref:s,onClick:x,style:{cursor:a?"pointer":"default"},$cartOffersCarouselHeight:l,$marqueeTrackWidth:h,$isMarqueeReady:h>0},e.createElement("div",{className:"marquee-wrapper"},e.createElement("div",{className:"marquee-content",ref:d},o.map((t,n)=>e.createElement("img",{key:`marquee-img-primary-${n}`,src:t,alt:`banner ${n+1}`,onLoad:b,onError:b}))),Array.from({length:v-1}).map((t,n)=>e.createElement("div",{className:"marquee-content","aria-hidden":"true",key:`marquee-repeat-${n}`},o.map((t,o)=>e.createElement("img",{key:`marquee-img-repeat-${n}-${o}`,src:t,alt:""}))))))},cl=({backgroundColor:o,titleText:r,descriptionText:i,criteria:a=[],pauseTimer:l,textAlignment:c="center",redirectionUrl:s,enableCustomCriteria:d=!0,cartData:p})=>{const[m,u]=t(0),g=e.useRef(null),x=e.useRef([]),f=d?a.filter(e=>{if(!p)return!1;if("mov"===e.type){return rn(p?.items_subtotal_price??0,p?.currency??"INR")>=e.value}if("moq"===e.type){return p.items.filter(e=>!e.properties?._isYtFreebie).reduce((e,t)=>e+(t.quantity||1),0)>=e.value}return!1}):[],y=Boolean(r&&r.trim()||i&&i.trim()),b=[...y?[{type:"default",titleText:r,descriptionText:i}]:[],...f.map(e=>({type:"criteria",titleText:e.message,descriptionText:"",redirectionUrl:e.redirectionUrl}))],h=b.length,v=h>0,w=h>1,C=e=>{"criteria"===e.type&&e.redirectionUrl?window.location.href=e.redirectionUrl:"default"===e.type&&s&&(window.location.href=s)};let E,k=!1;h>0&&(E=b[m]??b[0],k="criteria"===E.type&&Boolean(E.redirectionUrl)||"default"===E.type&&Boolean(s)),n(()=>{const e=f.filter(e=>!x.current.some(t=>t.id===e.id));if(e.length>0){const t=e[0],n=f.findIndex(e=>e.id===t.id);if(-1!==n){const e=(y?1:0)+n;e<b.length&&u(e)}}x.current=f},[f,b,y]),n(()=>{h>0&&m>=h&&u(h-1)},[m,h]),n(()=>{g.current&&gn(g.current)},[o,b,m]),n(()=>{if(!w)return void u(0);const e=setInterval(()=>{u(e=>(e+1)%h)},1e3*l);return()=>clearInterval(e)},[w,h,l]);return v?e.createElement(Qa,{ref:g,$backgroundColor:o},e.createElement(Ya,null,w?e.createElement(el,null,e.createElement(ol,{$position:"left",onClick:()=>{u(e=>0===e?h-1:e-1)}},e.createElement($e,null)),e.createElement(tl,{$currentIndex:m},b.map((t,n)=>e.createElement(nl,{key:n,onClick:()=>C(t),style:{cursor:"criteria"===t.type&&t.redirectionUrl||"default"===t.type&&s?"pointer":"default"}},e.createElement(Xa,null,e.createElement(Za,{style:{textAlign:"center"}},t.titleText),t.descriptionText&&e.createElement(Ka,{style:{textAlign:"center"}},t.descriptionText))))),e.createElement(ol,{$position:"right",onClick:()=>{u(e=>(e+1)%h)}},e.createElement(Ne,null))):e.createElement(Xa,{onClick:()=>E&&C(E),style:{cursor:k?"pointer":"default"}},(()=>{const t=b[m]??b[0];return e.createElement(e.Fragment,null,e.createElement(Za,{style:{textAlign:"center"}},t.titleText),t.descriptionText&&e.createElement(Ka,{style:{textAlign:"center"}},t.descriptionText))})()))):null},sl=({backgroundColor:t,imageUrl:o,titleText:r,descriptionText:i,textAlignment:a,redirectionUrl:l})=>{const c=e.useRef(null);n(()=>{c.current&&gn(c.current)},[t]);return e.createElement(qa,{ref:c,$backgroundColor:t,onClick:()=>{l&&(window.location.href=l)},style:{cursor:l?"pointer":"default"}},e.createElement(Ua,null,e.createElement(Ga,{$imageUrl:o}),e.createElement(Xa,null,e.createElement(Za,{style:{textAlign:"center"}},r),e.createElement(Ka,{style:{textAlign:"center"}},i))))},dl=({backgroundColor:t,couponCode:o,copySuccess:r,setCopySuccess:i,titleText:a,descriptionText:l,textAlignment:c="center"})=>{const s=e.useRef(null);n(()=>{s.current&&gn(s.current)},[t]);return e.createElement(qa,{ref:s,$backgroundColor:t,style:{position:"relative"}},e.createElement(Ua,{style:{filter:r?"blur(5px)":"none",zIndex:1}},e.createElement(Xa,{style:{borderRight:"1px solid #d9d9d9",paddingRight:"5px"}},e.createElement(Za,{style:{textAlign:"center"}},a),e.createElement(Ka,{style:{textAlign:"center"}},l)),e.createElement(Ja,null,e.createElement(me,{className:"copy-icon",size:24,onClick:()=>(e=>{navigator.clipboard.writeText(e).then(()=>{i(!0)},e=>{i(!1)}),setTimeout(()=>{i(!1)},3e3)})(o),style:{height:"24px",width:"24px"}}))))},pl=({children:o,autoSlide:r=!0,autoSlideInterval:i,copySuccess:a,themeColor:l})=>{const[c,s]=t(0),d=e.Children.count(o),[p,m]=t(!1),[u,g]=t(r),x=()=>{s(e=>e===d-1?0:e+1)};return n(()=>{if(!u)return;const e=setInterval(x,i);return()=>clearInterval(e)},[u,i]),e.createElement(rl,null,a&&e.createElement("div",{className:"coupon-code-copied",style:{position:"absolute",top:"20%",left:"50%",transform:"translate(-50%, -20%)",backgroundColor:l,display:"flex",alignItems:"center",justifyContent:"center",gap:"9px",borderRadius:"9px",padding:"12px 30px",color:"#FFF",fontFamily:"Poppins",fontSize:"12px",fontWeight:"400",lineHeight:"118%",zIndex:2,minWidth:"70%"}},e.createElement(H,{size:20,color:"white",style:{height:"24px",width:"24px"}}),"Coupon Code Copied"),e.createElement("div",{onMouseEnter:()=>{m(!0),g(!1)},onMouseLeave:()=>{m(!1),g(!0)},style:{display:"flex",transition:p?"none":"transform 0.5s ease",transform:`translateX(-${100*c}%)`,cursor:"pointer"}},e.Children.toArray(o)))};function ml({cartOffersCarousalData:n,themeColor:o,cartOffersCarouselHeight:r,cartData:i}){const[a,l]=t(!1),{enableCartOffersCarousel:c,pauseTimer:s,backgroundColor:d,slides:p}=n,m=p.filter(e=>"ImageOnly"===e.slideType).map(e=>e.imageUrl).filter(e=>!!e),u=p.findIndex(e=>"ImageOnly"===e.slideType),g=[];let x=!1;return p.forEach((t,n)=>{if("ImageOnly"===t.slideType)n===u&&m.length>0&&!x&&(g.push(e.createElement(ll,{key:`image-only-marquee-${t.slideNumber}`,imageUrls:m,redirectionLink:t.redirectionUrl||t.carouselRedirectionLink,cartOffersCarouselHeight:r,enableMarquee:!1!==t.enableMarquee})),x=!0);else switch(t.slideType){case"TextFieldOnly":g.push(e.createElement(cl,{key:t.slideNumber,backgroundColor:d,titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",criteria:t.criteria,pauseTimer:s,textAlignment:t.textAlignment,redirectionUrl:t.redirectionUrl||t.carouselRedirectionLink,enableCustomCriteria:t.enableCustomCriteria,cartData:i}));break;case"TextImage":g.push(e.createElement(sl,{key:t.slideNumber,backgroundColor:d,titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",imageUrl:t.imageUrl||"",textAlignment:t.textAlignment,redirectionUrl:t.redirectionUrl||t.carouselRedirectionLink}));break;case"TextCode":g.push(e.createElement(dl,{key:t.slideNumber,backgroundColor:d,couponCode:t.campaignCode??"",titleText:t.titleTextField??"",descriptionText:t.descriptionTextField??"",copySuccess:a,setCopySuccess:l,textAlignment:t.textAlignment}))}}),c&&0!==g.length?e.createElement(pl,{copySuccess:a,autoSlideInterval:1e3*s,themeColor:o},g):null}const ul=s`
2161
2162
  0% {
2162
2163
  background-position: 200% 0;
2163
2164
  }
@@ -4874,7 +4875,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4874
4875
  transform: scale(1.01);
4875
4876
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
4876
4877
  }
4877
- `,Sm={showPrice:!0,productImage:{id:"",path:""},buyNowCtaTitle:"BUY NOW",desktopBarType:"stretch",showProductName:!0,showBuyNowButton:!1,showProductImage:!0,addToCartCtaTitle:"ADD TO CART",showAddToCartButton:!0,showVariantSelector:!1,productInfoVisibility:!0,excludeProducts:[],showBarOnDesktop:!0,ctaButtonFontSize:18,startsAppearingAtHeight:200,fullyAppearsAtHeight:400,alwaysPersistent:!1},$m=({showStickyCart:o,product:a,addCartItem:l,onSetLoading:c,themeColor:s,cartData:d,isCartOpen:p,setIsCartOpen:m,ctaButtonBackgroundColor:u,ctaButtonTextColor:g,addToStickyCart:x,cartComponentsCornerType:f,cartComponentsCornerRadius:y,themeTextColor:b,stickyCartCustomizationData:h,checkoutFunction:v,backgroundColor:w,primaryTextColor:C,comboBundleData:E,comboBundleAddToCartFunction:k,volumeBundleCurrentTier:T,volumeBundleData:S,volumeBundleAddToCartFunction:$})=>{const[N,B]=t(""),[F,z]=t(null),[I,D]=t({}),P=cr(),[A,_]=t(null),R=r(null);n(()=>{const e=e=>{R.current&&!R.current.contains(e.target)&&_(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const L=i((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),O=i(()=>E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>L(E.products[0].productDetails,e?.node?.id)>0)?.node:a?.variants?.find(e=>e?.available),[E,a,L]),[M,W]=t(()=>{if(!E||"combo"!==E.type)return{};const e={};return E?.products?.forEach((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>L(t.productDetails,e?.node?.id)>0)?.node;o?e[n]=o.id:t?.productDetails?.variants?.edges?.length>0&&(e[n]=t.productDetails.variants.edges[0].node.id)}),e}),V=i(e=>{if(!E||"combo"!==E.type)return;const t={};E?.products?.forEach((n,o)=>{const r=n?.productDetails?.variants?.edges?.find(t=>{const o=t?.node;return n?.productDetails?.options?.every((t,n)=>{const r=e?.[t?.name],i=o?.title?.split(" / ")?.at(n);return!(!r||!i)&&r.trim().toLowerCase()===i.trim().toLowerCase()})});r?.node?.id&&(t[o]=r.node.id)}),Object.keys(t).length>0&&W(e=>({...e,...t}))},[E]);n(()=>{const e=O();if(e){B(String(e.id)),z(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),D(t)}else if(a?.variants?.length>0){const e=a.variants[0];B(String(e.id)),z(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),D(t)}},[a,O]);const j=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]),H=()=>{const e=j();if(e){const t=a?.variants?.find(t=>String(t?.id)===String(e));if(t&&t?.available){B(String(t.id)),z(t);const e={};a?.options?.forEach((n,o)=>{const r=`option${o+1}`;t?.[r]&&(e[n?.name]=t[r])}),D(e)}else{const e=O();e?(B(String(e.id)),z(e)):a?.variants?.length>0&&(B(String(a.variants[0].id)),z(a.variants[0]))}}};n(()=>{H();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",H),()=>{t=!1,window.removeEventListener("urlChange",H),window.history.pushState=n,window.history.replaceState=o}},[j,a,O]);const q=r(null),[Q,U]=t(1),Y=ln(d,d?.currency),G=e.useMemo(()=>{if(!E||"combo"!==E.type)return null;const{price:e,compareAtPrice:t}=Object.entries(M).reduce((e,[t,n])=>{const o=E.products?.[Number(t)],r=o?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node,i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);return E?.percentageOff?o=e*(1-E.percentageOff/100):E?.dealAmount?o=E.dealAmount:E?.amountOff&&(o=e-E.amountOff),{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),savings:(n-o).toFixed(2),hasSavings:n>o}},[E,M]),X=e.useMemo(()=>{if(!T||!F)return null;const e=parseFloat(F.price??"0"),t=parseFloat(F.compare_at_price||e.toString()),n=rn(e,d?.currency),o=rn(t,d?.currency),r=T.minimumQuantity,i=Math.max(n,o)*r;let a=n*r;const l=S?.discountType||T.discountType;"percentOff"===l?a*=1-T.discountValue/100:"amountOff"===l&&(a-=T.discountValue);const c=Math.max(0,a);return{originalPrice:i.toFixed(2),dealPrice:c.toFixed(2),savings:(i-c).toFixed(2),hasSavings:i>c&&void 0!==l}},[T,S,F,d]);n(()=>{(async()=>{try{if(E&&"combo"===E.type)return;a&&N&&z(a?.variants?.filter(e=>String(e?.id)===String(N))[0])}catch(e){console.error("Error getting selected product variant id")}})()},[a,N,E]),n(()=>{const e=e=>{const t=e;t.detail?.selectedVariants&&W(t.detail.selectedVariants)};return window.addEventListener("yt-combo-bundle-updated",e),()=>{window.removeEventListener("yt-combo-bundle-updated",e)}},[]);const{cartLoading:Z}=nn(),K=r(null),[J,ee]=t(0);n(()=>{K.current&&ee(K.current.offsetWidth)},[]);const te=a?.options?.find(e=>e?.name?.toLowerCase()?.includes("color"))?.name,ne=te?I?.[te]:null,oe=h&&(re=h,0!==Object.keys(re).length||re.constructor!==Object)?h:Sm;var re;const{showProductName:ie,showPrice:ae,showVariantSelector:le,showBuyNowButton:ce,showAddToCartButton:se,desktopBarType:de,showProductImage:pe,buyNowCtaTitle:me,addToCartCtaTitle:ge,productInfoVisibility:xe,showBarOnDesktop:fe,ctaButtonFontSize:ye,startsAppearingAtHeight:be,fullyAppearsAtHeight:he,topRibbonText:ve,alwaysPersistent:we}=oe,[Ce,Ee]=t(we?1:0),[ke,Te]=t(we?0:100),[Se,$e]=t(!1);if(n(()=>{if(we)return Ee(1),void Te(0);const e=()=>{const e=window.scrollY;document.documentElement.scrollHeight;const t=be||200,n=he||400;if(e>t){const o=Math.min((e-t)/(n-t),1);Ee(o),Te(100-100*o)}else Ee(0),Te(100)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[we,be,he]),n(()=>{const e=()=>{const e=window.innerWidth<768;$e(e||!1!==fe)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[fe]),a?.variants?.length<1)return null;const Ne=a?.available??!0,Be=O(),Fe=E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>e?.node?.id===M?.[0])?.node?.price:F?.price??Be?.price??a?.variants?.[0]?.price;if(0===Number(Fe)&&(!E||"combo"!==E.type))return null;if(!o||!Se)return null;if(h?.excludeProducts?.includes(a?.handle))return null;const ze=E&&"combo"===E.type?E.products?.every((e,t)=>{const n=M[t];return!!n&&L(e.productDetails,n)>0})??!1:F?.available??!0;return e.createElement(bm,{className:"yt-sticky-bar-container",$opacity:Ce,$translateY:ke,$desktopBarType:de||"stretch"},e.createElement(hm,{className:"yt-sticky-bar-inner-container",$desktopBarType:de||"stretch",$themeColor:s,$cornerType:f??"sharp",$cornerRadius:y??20,$themeTextColor:b,$productInfoVisibility:xe,$topRibbonText:ve,$backgroundColor:w},xe&&e.createElement(vm,null,pe&&e.createElement(wm,{className:"yt-sticky-bar-product-image",src:((e,t)=>"string"==typeof e?.featured_image?e.featured_image:e?.featured_image?.src?e.featured_image.src:t?.featured_image)(F,a),alt:F?.name}),e.createElement(Cm,{ref:K,className:"yt-sticky-bar-product-details"},ie&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{style:{fontSize:"20px",fontWeight:"500",color:C,display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",lineHeight:"normal"}},`${a?.title}`),ne&&e.createElement("span",{style:{fontSize:"11px",color:"#666",backgroundColor:"#f1f1f1",padding:"2px 6px",borderRadius:"10px",border:"1px solid #ddd"}},ne)),a?.variants?.length>1&&le&&e.createElement(fm,{className:"yt-sticky-bar-option-container",ref:R},a?.options?.map(t=>{const n=P?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),o=I[t.name],r=A===t.name,i=e=>{((e,t)=>{const n={...I,[e]:t};D(n);const o=a?.variants?.find(e=>a?.options?.every((t,o)=>{const r=n?.[t?.name],i=e?.[`option${o+1}`];return"string"==typeof r&&"string"==typeof i?r.trim().toLowerCase()===i.trim().toLowerCase():r===i}));o&&(B(String(o.id)),z(o)),E&&"combo"===E?.type&&V(n)})(t.name,e),_(null)},l=lr(n,o);return e.createElement("div",{key:t.name,style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement(ym,null,t.name),e.createElement(sm,null,e.createElement(dm,{onClick:()=>{_(r?null:t.name)},className:"yt-sticky-bar-dropdown-button"},"color"===n?.type&&l?.value?e.createElement(um,{$colorValue:l.value}):"image"===n?.type&&l?.value?e.createElement(gm,{src:l.value}):null,o,e.createElement(xm,{size:8,$isOpen:r})),r&&e.createElement(pm,{$backgroundColor:w,className:"yt-sticky-bar-dropdown-panel"},t.values.map(t=>{const o=lr(n,t);return e.createElement(mm,{className:"yt-sticky-bar-dropdown-item",key:t,onClick:()=>i(t)},"color"===n?.type&&o?.value?e.createElement(um,{$colorValue:o.value}):"image"===n?.type&&o?.value?e.createElement(gm,{src:o.value}):null,t)}))))})),ae&&e.createElement(e.Fragment,null,G?G.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(G.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,rm(G.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,rm(G.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(G.dealPrice)):X?X.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(X.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,rm(X.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,rm(X.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(X.dealPrice)):F?.compare_at_price&&F?.compare_at_price>F?.price?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rn(F?.price,d?.currency)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,rn(F?.compare_at_price,d?.currency)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,rn(F?.compare_at_price-F?.price,d?.currency))):e.createElement(e.Fragment,null,e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rn(F?.price,d?.currency)))),e.createElement("span",{style:{color:"#6E747B",fontSize:10},className:"yt-sticky-bar-product-tax-inclusion"},"Inclusive of all taxes"))),Ne&&e.createElement(Em,{className:"yt-sticky-bar-product-line-item-control",$flexDirection:xe?"row":"column"},se&&e.createElement(Tm,{ref:q,onClick:async()=>{if(E&&"combo"===E.type){if(!k)return void console.error("[StickyCart.tsx] comboBundleAddToCartFunction is undefined");const e=Object.entries(M);if(0===e.length)return;const t=e.map(([,e])=>e),n=e.map(([e,t])=>{const n=E?.products?.[Number(e)],o=n?.productDetails?.variants?.edges?.find(e=>e?.node?.id===t)?.node;return o?{variantId:t,price:Number(o?.price),compareAtPrice:Number(o?.compareAtPrice||o?.price)}:null}).filter(e=>null!==e),o=n.reduce((e,t)=>e+Math.max(t.compareAtPrice,t.price),0),r=n.reduce((e,t)=>e+t.price,0);let i=Math.min(o,r);E?.percentageOff?i=r*(1-E.percentageOff/100):E?.dealAmount?i=E.dealAmount:E?.amountOff&&(i=r-E.amountOff);const a=n.map(({variantId:e,price:t})=>({variantId:e,price:t}));try{await k(Number(o.toFixed(2)),t,Number(i.toFixed(2)),a)}catch(e){console.error("[StickyCart.tsx] Error adding combo bundle to cart:",e)}return}if(T&&T.minimumQuantity>1){if(!$)return void console.error("[StickyCart.tsx] volumeBundleAddToCartFunction is undefined");const e=String(N)??String(a?.variants[0]?.id),t=Array(T.minimumQuantity).fill(e),n=X?Number(X.originalPrice):0;try{await $(n,t)}catch(e){console.error("[StickyCart.tsx] Error adding volume bundle to cart:",e)}return}x&&await x(String(N)??String(a?.variants[0]?.id),Q)},disabled:Z.cartLoading||!ze,$bgColor:ze?u:"#d1d5db",$textColor:ze?g:"#6b7280",className:"yt-sticky-add-to-cart-button",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:ze?"pointer":"not-allowed",opacity:ze?1:.6}},Z.cartLoading?e.createElement(ue,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,ze?ge??"Add to Cart":"Out of Stock")),ce&&e.createElement(km,{onClick:async()=>{try{v&&await v(String(N)??String(a?.variants[0]?.id),Q)}catch(e){console.error("Error checking out from sticky bar")}},id:"yt-checkout-button",className:"yt-checkout-button",disabled:Z.cartLoading||!ze,$bgColor:ze?s:"#d1d5db",$textColor:ze?b:"#6b7280",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:ze?"pointer":"not-allowed",opacity:ze?1:.6}},Z.cartLoading?e.createElement(ue,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,ze?me??"Buy Now":"Out of Stock")))))},Nm=c.div`
4878
+ `,Sm={showPrice:!0,productImage:{id:"",path:""},buyNowCtaTitle:"BUY NOW",desktopBarType:"stretch",showProductName:!0,showBuyNowButton:!1,showProductImage:!0,addToCartCtaTitle:"ADD TO CART",showAddToCartButton:!0,showVariantSelector:!1,productInfoVisibility:!0,excludeProducts:[],showBarOnDesktop:!0,ctaButtonFontSize:18,startsAppearingAtHeight:200,fullyAppearsAtHeight:400,alwaysPersistent:!1},$m=({showStickyCart:o,product:a,addCartItem:l,onSetLoading:c,themeColor:s,cartData:d,isCartOpen:p,setIsCartOpen:m,ctaButtonBackgroundColor:u,ctaButtonTextColor:g,addToStickyCart:x,cartComponentsCornerType:f,cartComponentsCornerRadius:y,themeTextColor:b,stickyCartCustomizationData:h,checkoutFunction:v,backgroundColor:w,primaryTextColor:C,comboBundleData:E,comboBundleAddToCartFunction:k,volumeBundleCurrentTier:T,volumeBundleData:S,volumeBundleAddToCartFunction:$})=>{const[N,B]=t(""),[F,z]=t(null),[I,D]=t({}),P=cr(),[A,_]=t(null),R=r(null);n(()=>{const e=e=>{R.current&&!R.current.contains(e.target)&&_(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const L=i((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),O=i(()=>E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>L(E.products[0].productDetails,e?.node?.id)>0)?.node:a?.variants?.find(e=>e?.available),[E,a,L]),[M,W]=t(()=>{if(!E||"combo"!==E.type)return{};const e={};return E?.products?.forEach((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>L(t.productDetails,e?.node?.id)>0)?.node;o?e[n]=o.id:t?.productDetails?.variants?.edges?.length>0&&(e[n]=t.productDetails.variants.edges[0].node.id)}),e}),V=i(e=>{if(!E||"combo"!==E.type)return;const t={};E?.products?.forEach((n,o)=>{const r=n?.productDetails?.variants?.edges?.find(t=>{const o=t?.node;return n?.productDetails?.options?.every((t,n)=>{const r=e?.[t?.name],i=o?.title?.split(" / ")?.at(n);return!(!r||!i)&&r.trim().toLowerCase()===i.trim().toLowerCase()})});r?.node?.id&&(t[o]=r.node.id)}),Object.keys(t).length>0&&W(e=>({...e,...t}))},[E]);n(()=>{const e=O();if(e){B(String(e.id)),z(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),D(t)}else if(a?.variants?.length>0){const e=a.variants[0];B(String(e.id)),z(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),D(t)}},[a,O]);const j=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]),H=()=>{const e=j();if(e){const t=a?.variants?.find(t=>String(t?.id)===String(e));if(t&&t?.available){B(String(t.id)),z(t);const e={};a?.options?.forEach((n,o)=>{const r=`option${o+1}`;t?.[r]&&(e[n?.name]=t[r])}),D(e)}else{const e=O();e?(B(String(e.id)),z(e)):a?.variants?.length>0&&(B(String(a.variants[0].id)),z(a.variants[0]))}}};n(()=>{H();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",H),()=>{t=!1,window.removeEventListener("urlChange",H),window.history.pushState=n,window.history.replaceState=o}},[j,a,O]);const q=r(null),[Q,U]=t(1),Y=ln(d,d?.currency),G=e.useMemo(()=>{if(!E||"combo"!==E.type)return null;const{price:e,compareAtPrice:t}=Object.entries(M).reduce((e,[t,n])=>{const o=E.products?.[Number(t)],r=o?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node,i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);return E?.percentageOff?o=e*(1-E.percentageOff/100):E?.dealAmount?o=E.dealAmount:E?.amountOff&&(o=e-E.amountOff),{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),savings:(n-o).toFixed(2),hasSavings:n>o}},[E,M]),X=e.useMemo(()=>{if(!T||!F)return null;const e=parseFloat(F.price??"0"),t=parseFloat(F.compare_at_price||e.toString()),n=rn(e,d?.currency),o=rn(t,d?.currency),r=T.minimumQuantity,i=Math.max(n,o)*r;let a=n*r;const l=S?.discountType||T.discountType;"percentOff"===l?a*=1-T.discountValue/100:"amountOff"===l&&(a-=T.discountValue);const c=Math.max(0,a);return{originalPrice:i.toFixed(2),dealPrice:c.toFixed(2),savings:(i-c).toFixed(2),hasSavings:i>c&&void 0!==l}},[T,S,F,d]);n(()=>{(async()=>{try{if(E&&"combo"===E.type)return;a&&N&&z(a?.variants?.filter(e=>String(e?.id)===String(N))[0])}catch(e){console.error("Error getting selected product variant id")}})()},[a,N,E]),n(()=>{const e=e=>{const t=e;t.detail?.selectedVariants&&W(t.detail.selectedVariants)};return window.addEventListener("yt-combo-bundle-updated",e),()=>{window.removeEventListener("yt-combo-bundle-updated",e)}},[]);const{cartLoading:Z}=nn(),K=r(null),[J,ee]=t(0);n(()=>{K.current&&ee(K.current.offsetWidth)},[]);const te=a?.options?.find(e=>e?.name?.toLowerCase()?.includes("color"))?.name,ne=te?I?.[te]:null,oe=h&&(re=h,0!==Object.keys(re).length||re.constructor!==Object)?h:Sm;var re;const{showProductName:ie,showPrice:ae,showVariantSelector:le,showBuyNowButton:ce,showAddToCartButton:se,desktopBarType:de,showProductImage:pe,buyNowCtaTitle:me,addToCartCtaTitle:ge,productInfoVisibility:xe,showBarOnDesktop:fe,ctaButtonFontSize:ye,startsAppearingAtHeight:be,fullyAppearsAtHeight:he,topRibbonText:ve,alwaysPersistent:we}=oe,[Ce,Ee]=t(we?1:0),[ke,Te]=t(we?0:100),[Se,$e]=t(!1);if(n(()=>{if(we)return Ee(1),void Te(0);const e=()=>{const e=window.scrollY;document.documentElement.scrollHeight;const t=be||200,n=he||400;if(e>t){const o=Math.min((e-t)/(n-t),1);Ee(o),Te(100-100*o)}else Ee(0),Te(100)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[we,be,he]),n(()=>{const e=()=>{const e=window.innerWidth<768;$e(e||!1!==fe)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[fe]),a?.variants?.length<1)return null;const Ne=O(),Be=E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>e?.node?.id===M?.[0])?.node?.price:F?.price??Ne?.price??a?.variants?.[0]?.price;if(0===Number(Be)&&(!E||"combo"!==E.type))return null;if(!o||!Se)return null;if(h?.excludeProducts?.includes(a?.handle))return null;const Fe=E&&"combo"===E.type?E.products?.every((e,t)=>{const n=M[t];return!!n&&L(e.productDetails,n)>0})??!1:F?.available??!0;return e.createElement(bm,{className:"yt-sticky-bar-container",$opacity:Ce,$translateY:ke,$desktopBarType:de||"stretch"},e.createElement(hm,{className:"yt-sticky-bar-inner-container",$desktopBarType:de||"stretch",$themeColor:s,$cornerType:f??"sharp",$cornerRadius:y??20,$themeTextColor:b,$productInfoVisibility:xe,$topRibbonText:ve,$backgroundColor:w},xe&&e.createElement(vm,null,pe&&e.createElement(wm,{className:"yt-sticky-bar-product-image",src:((e,t)=>"string"==typeof e?.featured_image?e.featured_image:e?.featured_image?.src?e.featured_image.src:t?.featured_image)(F,a),alt:F?.name}),e.createElement(Cm,{ref:K,className:"yt-sticky-bar-product-details"},ie&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{style:{fontSize:"20px",fontWeight:"500",color:C,display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",lineHeight:"normal"}},`${a?.title}`),ne&&e.createElement("span",{style:{fontSize:"11px",color:"#666",backgroundColor:"#f1f1f1",padding:"2px 6px",borderRadius:"10px",border:"1px solid #ddd"}},ne)),a?.variants?.length>1&&le&&e.createElement(fm,{className:"yt-sticky-bar-option-container",ref:R},a?.options?.map(t=>{const n=P?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),o=I[t.name],r=A===t.name,i=e=>{((e,t)=>{const n={...I,[e]:t};D(n);const o=a?.variants?.find(e=>a?.options?.every((t,o)=>{const r=n?.[t?.name],i=e?.[`option${o+1}`];return"string"==typeof r&&"string"==typeof i?r.trim().toLowerCase()===i.trim().toLowerCase():r===i}));o&&(B(String(o.id)),z(o)),E&&"combo"===E?.type&&V(n)})(t.name,e),_(null)},l=lr(n,o);return e.createElement("div",{key:t.name,style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement(ym,null,t.name),e.createElement(sm,null,e.createElement(dm,{onClick:()=>{_(r?null:t.name)},className:"yt-sticky-bar-dropdown-button"},"color"===n?.type&&l?.value?e.createElement(um,{$colorValue:l.value}):"image"===n?.type&&l?.value?e.createElement(gm,{src:l.value}):null,o,e.createElement(xm,{size:8,$isOpen:r})),r&&e.createElement(pm,{$backgroundColor:w,className:"yt-sticky-bar-dropdown-panel"},t.values.map(t=>{const o=lr(n,t);return e.createElement(mm,{className:"yt-sticky-bar-dropdown-item",key:t,onClick:()=>i(t)},"color"===n?.type&&o?.value?e.createElement(um,{$colorValue:o.value}):"image"===n?.type&&o?.value?e.createElement(gm,{src:o.value}):null,t)}))))})),ae&&e.createElement(e.Fragment,null,G?G.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(G.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,rm(G.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,rm(G.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(G.dealPrice)):X?X.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(X.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,rm(X.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,rm(X.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rm(X.dealPrice)):F?.compare_at_price&&F?.compare_at_price>F?.price?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rn(F?.price,d?.currency)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,rn(F?.compare_at_price,d?.currency)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,rn(F?.compare_at_price-F?.price,d?.currency))):e.createElement(e.Fragment,null,e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,rn(F?.price,d?.currency)))),e.createElement("span",{style:{color:"#6E747B",fontSize:10},className:"yt-sticky-bar-product-tax-inclusion"},"Inclusive of all taxes"))),e.createElement(Em,{className:"yt-sticky-bar-product-line-item-control",$flexDirection:xe?"row":"column"},se&&e.createElement(Tm,{ref:q,onClick:async()=>{if(E&&"combo"===E.type){if(!k)return void console.error("[StickyCart.tsx] comboBundleAddToCartFunction is undefined");const e=Object.entries(M);if(0===e.length)return;const t=e.map(([,e])=>e),n=e.map(([e,t])=>{const n=E?.products?.[Number(e)],o=n?.productDetails?.variants?.edges?.find(e=>e?.node?.id===t)?.node;return o?{variantId:t,price:Number(o?.price),compareAtPrice:Number(o?.compareAtPrice||o?.price)}:null}).filter(e=>null!==e),o=n.reduce((e,t)=>e+Math.max(t.compareAtPrice,t.price),0),r=n.reduce((e,t)=>e+t.price,0);let i=Math.min(o,r);E?.percentageOff?i=r*(1-E.percentageOff/100):E?.dealAmount?i=E.dealAmount:E?.amountOff&&(i=r-E.amountOff);const a=n.map(({variantId:e,price:t})=>({variantId:e,price:t}));try{await k(Number(o.toFixed(2)),t,Number(i.toFixed(2)),a)}catch(e){console.error("[StickyCart.tsx] Error adding combo bundle to cart:",e)}return}if(T&&T.minimumQuantity>1){if(!$)return void console.error("[StickyCart.tsx] volumeBundleAddToCartFunction is undefined");const e=String(N)??String(a?.variants[0]?.id),t=Array(T.minimumQuantity).fill(e),n=X?Number(X.originalPrice):0;try{await $(n,t)}catch(e){console.error("[StickyCart.tsx] Error adding volume bundle to cart:",e)}return}x&&await x(String(N)??String(a?.variants[0]?.id),Q)},disabled:Z.cartLoading||!Fe,$bgColor:Fe?u:"#d1d5db",$textColor:Fe?g:"#6b7280",className:"yt-sticky-add-to-cart-button",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:Fe?"pointer":"not-allowed",opacity:Fe?1:.6}},Z.cartLoading?e.createElement(ue,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,Fe?ge??"Add to Cart":"Out of Stock")),ce&&e.createElement(km,{onClick:async()=>{try{v&&await v(String(N)??String(a?.variants[0]?.id),Q)}catch(e){console.error("Error checking out from sticky bar")}},id:"yt-checkout-button",className:"yt-checkout-button",disabled:Z.cartLoading||!Fe,$bgColor:Fe?s:"#d1d5db",$textColor:Fe?b:"#6b7280",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:Fe?"pointer":"not-allowed",opacity:Fe?1:.6}},Z.cartLoading?e.createElement(ue,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,Fe?me??"Buy Now":"Out of Stock")))))},Nm=c.div`
4878
4879
  width: 100%;
4879
4880
  height: 100%;
4880
4881
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.9.32",
3
+ "version": "0.9.34",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",