yt-uikit 0.8.72 → 0.8.74

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
@@ -1398,7 +1398,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
1398
1398
  border-bottom: 0.8px solid rgb(135 135 135 / 50%);
1399
1399
  width: calc(100% + 2rem);
1400
1400
  }
1401
- `,Dr=({addCartItem:t,handleDecrement:n,handleIncrement:o,removeCartItem:r,isDev:i,themeColor:a,primaryTextColor:l,secondaryTextColor:c,freeProduct:d,themeTextColor:s,showEditOptionOnProducts:p,productPercentageOffMapping:u,removeFreebieFromCart:m,showDeleteOnFreebies:g,freeProductAdjustedCartTotal:x,freebieCouponTemplates:f,cartCheckpoints:y,freebieFlowCheckpoints:b,imageAspectSelector:h,cartComponentsCornerType:v,cartComponentsCornerRadius:w,giftWrapProductId:C,giftWrapVariantId:E,showGiftWrapAsLineItem:k=!1,backgroundSubdued:T,tertiaryColor:S,tertiaryTextColor:$,backgroundColor:B,showDiscountOnMRP:I,checkoutSectionMessage:z,checkoutSectionMessageRedirectLink:F,showFreebieMilestone:N,freebieMilestoneData:P,freeLabelText:D})=>{const A=ae(Ut),{cartLoading:_}=Jt(),R=!_.cartLoading&&A?.items,O=(x??Number(A?.items_subtotal_price))/100;let L=!0,M=0;if(A?.items?.length>0)for(const e of A.items)e?.properties?._isYtFreebie&&(M+=e?.quantity);if(M===A?.item_count&&(L=!1),!R&&0===A?.item_count)return e.createElement(Nr,null);if(!(R&&0!==A?.item_count||A?.items))return null;const j=P?.campaignFilter??"all_campaigns";let V=[];"all_campaigns"===j?V=f??[]:"progress_bar_tiers"===j?V=y??[]:"freebie_campaigns"===j&&(V=b??[]);const W=Array.isArray(V)?V.filter(e=>"free_product"===e?.couponType).slice().sort((e,t)=>e.minimumOrderValue-t.minimumOrderValue).find(e=>e.minimumOrderValue>O):void 0,H=on(A,A?.currency);return e.createElement(e.Fragment,null,A.items.filter(e=>!!k||!(String(e?.id)===sn(String(C))||String(e?.id)===sn(String(E)))).map(d=>{const x=u?.[d?.key],y=f?.find(e=>e?._allVariantIds?.includes(String(d.id)));let b=!1;if(y&&O>=y.minimumOrderValue&&0===d?.line_price&&(b=!0),!k&&(String(d?.id)===sn(String(C))||sn(String(E))===String(d?.id)))return null;const z=d.discounts&&d.discounts.length>0;return d.properties?._isYtFreebie&&(x||b)&&z&&L?e.createElement(e.Fragment,null,e.createElement(Pr,{key:d?.key??d?.id},e.createElement(Ir,{product:d,themeColor:a,isDev:i,primaryTextColor:l,secondaryTextColor:c,themeTextColor:s,showQtySelector:!1,showEditOptionOnProducts:p,percentageOff:x,imageAspectSelector:h,showDeleteOnFreebies:g,removeFreebieFromCart:m,backgroundSubdued:T,tertiaryColor:S,tertiaryTextColor:$,backgroundColor:B,showDiscountOnMRP:!0,freeLabelText:D}))):e.createElement(Pr,{key:d?.key??d?.id},e.createElement(Ir,{themeColor:a,handleDecrement:n,handleIncrement:o,removeCartItem:r,addCartItem:t,product:d,isDev:i,primaryTextColor:l,secondaryTextColor:c,showQtySelector:!d.properties?._isYtFreebie,showEditOptionOnProducts:p,removeFreebieFromCart:m,showDeleteOnFreebies:g,imageAspectSelector:h,cartComponentsCornerRadius:w,cartComponentsCornerType:v,backgroundSubdued:T,tertiaryColor:S,tertiaryTextColor:$,backgroundColor:B,showDiscountOnMRP:I,freeLabelText:D}))}),N&&L&&W&&e.createElement(Fr,{name:W.name,minimumOrderValue:W.minimumOrderValue,currency:H,themeColor:a,tertiaryColor:S,imageUrl:P?.milestoneImage?.path}),mn()&&z&&z.length>0?e.createElement("div",{className:"yt-cart-bottom-bar",style:{fontSize:"10px",textAlign:"center",backgroundColor:S,padding:"3px",boxShadow:"1px 2px 4px 0px #00000061",color:$,marginBottom:"4px",cursor:F?"pointer":"default"},onClick:()=>{F&&(window.location.href=F)}},z):e.createElement("div",{style:{display:"list-item",height:"12px",background:"#87878717"}}))};const Ar=({bundleProducts:t})=>{const n=ae(Ut);return e.createElement("div",{className:"flex flex-col gap-y-2"},e.createElement("div",{className:"flex items-center justify-center"},e.createElement("span",{className:"font-semibold"},"Save more with Bundle!")),e.createElement("div",{className:"flex items-center justify-center gap-2 relative"},e.createElement("div",{className:"w-48 h-48 flex flex-col justify-center border-[1px] p-2 border-[#B0B0B0]"},e.createElement("img",{style:{alignSelf:"center"},width:100,height:100,src:t[0].image}),e.createElement("span",{className:"text-[12.5px] text-[#667085] font-semibold"},rn(t[0].title)),e.createElement("div",null,e.createElement("span",{className:"text-[#344054] text-[14px] font-bold"},on(n,n?.currency),t[0].original_price)," ",e.createElement("span",{className:"line-through text-[#667085] text-[12px]"},on(n,n?.currency),t[0].price)),t[0]?.options_with_values?.length>0&&e.createElement("div",{className:"flex flex-col"},t[0]?.options_with_values?.map(t=>{if("Title"!==t.name)return e.createElement("span",{className:"text-[10px] text-[#868E96]"},t.name,": ",t.value)}))),e.createElement("div",{className:"w-48 h-48 flex flex-col justify-center border-[1px] p-2 border-[#B0B0B0]"},e.createElement("img",{style:{alignSelf:"center"},width:100,height:100,src:t[1].image}),e.createElement("span",{className:"text-[12.5px] text-[#667085] font-semibold"},rn(t[0].title)),e.createElement("div",null,e.createElement("span",{className:"text-[#344054] text-[14px] font-bold"},on(n,n?.currency),t[1].original_price)," ",e.createElement("span",{className:"line-through text-[#667085] text-[12px]"},on(n,n?.currency),t[1].price)),t[1]?.options_with_values?.length>0&&e.createElement("div",{className:"flex flex-col"},t[0]?.options_with_values?.map(t=>{if("Title"!==t.name)return e.createElement("span",{className:"text-[10px] text-[#868E96]"},t.name,": ",t.value)}))),e.createElement("div",{className:"absolute",style:{left:"50%",transform:"translateX(-50%)"}},e.createElement("img",{src:'<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">\n<circle cx="17.2797" cy="18.7208" r="15.5219" fill="#3A3A3A" stroke="#767676" stroke-width="1.51433"/>\n<path d="M15.5903 25.9172V12.1037H19.0827V25.9172H15.5903ZM10.4297 20.7566V17.2642H24.2433V20.7566H10.4297Z" fill="white"/>\n</svg>',alt:"Delivery Truck",height:"25px",width:"42px"}))),e.createElement("div",{className:"flex flex-row justify-between items-center"},e.createElement("div",{className:"flex flex-row gap-x-4 items-center"},e.createElement("span",{className:"text-[#667085] text-[13px]"},"Total Price"),e.createElement("span",null,e.createElement("span",{className:"font-bold text-black"},on(n,n?.currency),t[0].price+t[1].price)," ",e.createElement("span",{className:"text-[#868E96] text-[12px] line-through"},on(n,n?.currency),t[0].original_price+t[1].original_price))),e.createElement("span",{className:"text-[#1ADF5D] text-[10px]"},"save extra"," ",e.createElement("span",{className:"font-semibold"},on(n,n?.currency),t[0].original_price-t[0].price+(t[1].original_price-t[1].price)))),e.createElement("button",{className:"flex flex-row items-center bg-[#333333] gap-x-3 justify-center w-full py-1.5"},e.createElement(ct,{color:"white"}),e.createElement("span",{className:"text-white uppercase text-[14px]"},"Buy Bundle at"," ",e.createElement("span",{className:"font-semibold"},on(n,n?.currency),t[0].price+t[1].price))))},_r=({backgroundSubdued:o,themeColor:i,themeTextColor:a,primaryTextColor:l,cartComponentsCornerRadius:c,applyCouponCode:d,removeDiscount:s,enableConfetti:p,hideAppliedCodes:u})=>{const m=ae(Ut),[g,x]=t(""),[f,y]=t(null),[b,h]=t(!1),[v,w]=t(!1),[C,E]=t(!1),{setLoading:k}=Jt(),[T,S]=t(null),[$,B]=t(!1),[I,z]=t(!1),F=r(null);n(()=>{if(T){B(!0);const e=setTimeout(()=>{B(!1)},4e3),t=setTimeout(()=>{S(null)},4500);return()=>{clearTimeout(e),clearTimeout(t)}}B(!1)},[T]),n(()=>{if(m&&m.discount_codes&&f){const e=m.discount_codes.find(e=>e.code===f);e&&(e.applicable?(S({message:"Coupon applied successfully!",type:"success"}),p&&(z(!0),setTimeout(()=>z(!1),5e3))):S({message:"Coupon not applicable",type:"error"}),y(null))}},[m,f]);const N=async()=>{if(d&&g&&!b){S(null),h(!0),y(g);try{await d(g),x("")}catch(e){S({message:"Failed to apply coupon.",type:"error"}),y(null)}finally{h(!1)}}},P=async()=>{if(s&&!C){S(null),E(!0),k&&k(!0,!1,!1,!0);try{await s()}catch(e){S({message:"Failed to remove coupon.",type:"error"})}finally{k&&k(!1,!1,!1,!1),E(!1)}}},D="error"===T?.type,A=m?.discount_codes?.filter(e=>!1!==e?.applicable);return e.createElement("div",{ref:F,style:{marginTop:"10px",padding:"0 16px",marginBottom:"10px"}},I&&p&&e.createElement(vo,{particleCount:100,spread:160,origin:{y:.6},checkpointPosition:.5}),e.createElement("div",{style:{display:"flex",alignItems:"stretch",border:D?"0.5px solid #FF4E4E":v?`1px solid ${i||"#007bff"}`:"1px solid #e0e0e0",borderRadius:c??4,transition:"border-color 0.5s ease-in-out",overflow:"hidden"}},e.createElement("input",{type:"text",placeholder:"Have a Coupon Code?",value:g,disabled:b,onFocus:()=>{w(!0),setTimeout(()=>{F.current&&window.innerWidth<=768&&F.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300)},onBlur:()=>w(!1),onChange:e=>{x(e.target.value),T&&S(null)},onKeyDown:e=>{"Enter"===e.key&&N()},style:{flexGrow:1,border:"none",padding:"10px",outline:"none",fontSize:"14px",fontWeight:"bold",borderTopLeftRadius:c??4,borderBottomLeftRadius:c??4,backgroundColor:o,color:l,boxShadow:"none",cursor:b?"not-allowed":"auto",margin:"0"}}),e.createElement("button",{onClick:N,disabled:!g||b,style:{padding:"10px 15px",border:"none",backgroundColor:D?"#D98181":g?i||"#007bff":"#cccccc",color:g||D?a||"#ffffff":"#666666",cursor:!g||b?"not-allowed":"pointer",fontSize:"14px",fontWeight:"bold",borderTopRightRadius:c??4,borderBottomRightRadius:c??4,transition:"background-color 0.5s ease-in-out, opacity 0.2s ease-in-out",minWidth:"80px",display:"flex",justifyContent:"center",alignItems:"center",opacity:b?.7:1}},b?e.createElement(rt,{color:a||"#ffffff",size:18}):"Apply")),T&&e.createElement("div",{style:{color:"success"===T.type?"#28a745":"#dc3545",fontSize:"12px",marginTop:"4px",fontStyle:"italic",transition:"opacity 0.5s ease-in-out, transform 0.5s ease-in-out, max-height 0.5s ease-in-out",opacity:$?1:0,transform:$?"translateY(0)":"translateY(-10px)",maxHeight:$?"50px":"0",overflow:"hidden"}},T.message),!u&&A&&A.length>0&&e.createElement("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px"}},A.map(t=>e.createElement("div",{key:t.code,style:{display:"flex",alignItems:"center",fontSize:"12px",fontStyle:"italic"}},e.createElement("div",{style:{display:"flex",alignItems:"center",color:"#333333",backgroundColor:o,paddingInlineStart:"6px",gap:"4px"}},e.createElement(Ke,{size:12,color:"#4D4D4D"}),e.createElement("span",{style:{fontWeight:"bold",fontStyle:"normal"}},t.code)," applied!",e.createElement("button",{onClick:P,disabled:C,style:{background:"#E2E2E2",border:"0.5px solid #B5B5B5",cursor:"pointer",marginLeft:"4px",padding:"0",display:"flex",alignItems:"center"}},C?e.createElement(rt,{color:i||"#007bff",size:14}):e.createElement(be,{size:16})))))))},Rr="yt-coupon-selection-animations",Or=({rewardCoupons:o,applyCouponCode:r,removeDiscount:i,enableConfetti:a,backgroundSubdued:l,themeColor:c,themeTextColor:d,primaryTextColor:s,cartComponentsCornerRadius:p})=>{const u=ae(Ut),[m,g]=t(!1),[x,f]=t(!1),[y,b]=t(null),[h,v]=t(null),[w,C]=t(!1),[E,k]=t(null);n(()=>{(()=>{if(document.getElementById(Rr))return;const e=document.createElement("style");e.id=Rr,e.textContent="\n @keyframes ytSlideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n @keyframes ytSlideDown {\n from { transform: translateY(0); }\n to { transform: translateY(100%); }\n }\n @keyframes ytSuccessPulse {\n 0% { box-shadow: 0 0 0 0 rgba(46,125,50,0.4); }\n 50% { box-shadow: 0 0 0 8px rgba(46,125,50,0); }\n 100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }\n }\n @keyframes ytCheckFade {\n 0% { opacity: 0; transform: scale(0.5); }\n 50% { opacity: 1; transform: scale(1.2); }\n 100% { opacity: 1; transform: scale(1); }\n }\n ",document.head.appendChild(e)})()},[]);const T=u?.discount_codes?.filter(e=>!1!==e?.applicable),S=T?.[0],$=h?o.find(e=>e.couponTemplateId===h):null,B=o;n(()=>{const e=u?.discount_codes?.filter(e=>!1!==e?.applicable)??[];if(null!==h){const t=o.find(e=>e.couponTemplateId===h);return void(t&&e.some(e=>e.code?.toLowerCase()===t.name?.toLowerCase())||v(null))}if(e.length>0){const t=o.find(t=>e.some(e=>e.code?.toLowerCase()===t.name?.toLowerCase()));t&&v(t.couponTemplateId)}},[u?.discount_codes,o,h]),n(()=>{if(m){window.history.pushState({couponSelectionOpen:!0},"");const e=()=>z();return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}},[m]);const I=()=>{f(!1),g(!0)},z=()=>{f(!0),setTimeout(()=>{g(!1),f(!1)},280)},F=async()=>{if(i&&!w){C(!0);try{await i(),v(null)}catch(e){console.error("Failed to remove coupon:",e)}finally{C(!1)}}},N=()=>{if($){if("percentage_discount_coupon"===$.couponType&&$.discountPercentage)return`saved extra ${$.discountPercentage}% off`;if("fixed_amount_coupon"===$.couponType&&$.discountValue)return`saved extra ₹${$.discountValue} off`}return""},P=(t,n=!1)=>{const o=y===t.couponTemplateId,i=E===t.couponTemplateId,a=!n&&!1===t.isEligible;return e.createElement("div",{key:t.couponTemplateId,style:{border:n?`1.5px solid ${c||"#4A7C59"}`:"1px solid #E8E8E8",borderRadius:p??8,overflow:"hidden",marginBottom:"12px",backgroundColor:"#FFFFFF",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",animation:i?"ytSuccessPulse 0.6s ease-out":void 0,transition:"border-color 0.3s ease, box-shadow 0.3s ease"}},e.createElement("div",{style:{padding:"14px 16px",background:"linear-gradient(135deg, #FFFFFF 60%, #FFF5F5 100%)",position:"relative"}},i&&e.createElement("div",{style:{position:"absolute",top:"10px",right:"10px",width:24,height:24,borderRadius:"50%",backgroundColor:"#2E7D32",display:"flex",alignItems:"center",justifyContent:"center",animation:"ytCheckFade 0.4s ease-out forwards"}},e.createElement("span",{style:{color:"#fff",fontSize:"14px",fontWeight:700}},"✓")),e.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px"}},e.createElement("div",{style:{width:32,height:32,borderRadius:4,backgroundColor:"#FDE8E8",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(ne,{size:18,color:a?"#6b7280":"#8B0000"})),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:"14px",fontWeight:600,color:s||"#1A1A1A",marginBottom:"2px"}},(e=>"percentage_discount_coupon"===e.couponType&&e.discountPercentage?`Get an additional ${e.discountPercentage}% off`:"fixed_amount_coupon"===e.couponType&&e.discountValue?`Get an additional ₹${e.discountValue} off`:e.name)(t)),e.createElement("div",{style:{fontSize:"12px",color:a?"#6b7280":"#2E7D32",fontWeight:500}},(e=>{if("minimum_quantity"===e.customCartProgressBarCriteria){if(e.quantityThreshold)return`On orders with ${e.quantityThreshold}+ items.`}else if(e.minimumOrderValue)return`On purchases above ₹${e.minimumOrderValue.toLocaleString("en-IN")}.`;return""})(t)))),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"12px",border:"1px solid #E0E0E0",borderRadius:p??6,padding:"8px 12px",backgroundColor:"#FAFAFA"}},e.createElement("span",{style:{fontSize:"14px",fontWeight:700,color:s||"#1A1A1A",letterSpacing:"0.5px"}},t.name),e.createElement("button",{onClick:e=>{e.stopPropagation(),n?F():(async e=>{if(null===y){b(e.couponTemplateId);try{r&&e.name&&await r(e.name),v(e.couponTemplateId),k(e.couponTemplateId),setTimeout(()=>k(null),1200)}catch(e){console.error("Failed to collect coupon:",e)}finally{b(null)}}})(t)},disabled:o||w||a,style:{background:"none",border:"none",color:a?"#6b7280":"#8B0000",fontSize:"14px",fontWeight:600,cursor:o||w||a?"not-allowed":"pointer",padding:0,display:"flex",alignItems:"center",gap:"4px"}},o||n&&w?e.createElement(rt,{color:"#8B0000",size:14}):n?"Remove":"Collect"))),e.createElement("div",{style:{padding:"6px 16px",fontSize:"11px",fontWeight:500,textAlign:"center",backgroundColor:"#FFF0F0",color:a?"#6b7280":"#8B0000",borderTop:"1px solid '#FECACA'"}},(e=>{const t=e.resolvedCollectionNames;return t&&t.length>0?1===t.length?`Applicable on '${t[0]}' collection only.`:`Applicable on '${t.join("', '")}' collections.`:e.allowedCollections?.ids&&e.allowedCollections.ids.length>0?"Applicable on select collections.":"Applicable storewide"})(t)))};return e.createElement(e.Fragment,null,(()=>{const t=!!$||!!S,n=$?.name??S?.code??"",r=$?"#F0FFF4":S?"#F3E8FF":"#FDE8E8",i=$?"#2E7D32":"#C53030",a=$?"#2E7D32":"#666666";return e.createElement("div",{style:{padding:"0 16px",marginTop:"10px",marginBottom:"10px"}},e.createElement("div",{onClick:I,style:{display:"flex",alignItems:"center",padding:"12px 14px",border:"1px solid #E8E8E8",borderRadius:p??8,cursor:"pointer",backgroundColor:"#FFFFFF",transition:"box-shadow 0.2s ease"}},e.createElement("div",{style:{width:36,height:36,borderRadius:6,backgroundColor:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginRight:"12px",transition:"background-color 0.3s ease"}},$?e.createElement(Ke,{size:20,color:i}):e.createElement(ne,{size:20,color:i})),e.createElement("div",{style:{flex:1}},t?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:s||"#1A1A1A"}},e.createElement("span",{style:{fontWeight:600}},n),e.createElement("span",{style:{fontStyle:"italic"}}," applied!")),e.createElement("div",{style:{fontSize:"12px",color:a,marginTop:"1px",fontStyle:$?"italic":"normal"}},(()=>{if($){if("percentage_discount_coupon"===$.couponType&&$.discountPercentage)return`saved additional ${$.discountPercentage}% on your purchase`;if("fixed_amount_coupon"===$.couponType&&$.discountValue)return`saved additional ₹${$.discountValue} on your purchase`}return"coupon applied on your purchase"})())):e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",fontWeight:700,color:s||"#1A1A1A"}},"Coupons and Offers"),e.createElement("div",{style:{fontSize:"12px",color:"#888888",marginTop:"1px"}},"collect and save more"))),e.createElement(L,{size:14,color:"#888888"})),!t&&o.length>0&&e.createElement("div",{style:{textAlign:"center",fontSize:"12px",fontWeight:600,color:"#2E7D32",backgroundColor:"#F0FFF4",padding:"6px 0",borderRadius:`0 0 ${p??8}px ${p??8}px`,marginTop:"-1px",border:"1px solid #C6F6D5",borderTop:"none"}},o.length,"+ coupons eligible for your order"))})(),m&&e.createElement("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"457px",maxWidth:"100vw",backgroundColor:"#FFFFFF",zIndex:2147483645,display:"flex",flexDirection:"column",animation:x?"ytSlideDown 0.28s cubic-bezier(0.4, 0, 1, 1) forwards":"ytSlideUp 0.32s cubic-bezier(0, 0, 0.2, 1) forwards"}},e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"16px",flexShrink:0}},e.createElement("button",{onClick:z,style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",marginRight:"12px"}},e.createElement(M,{size:18,color:s||"#1A1A1A"})),e.createElement("span",{style:{fontSize:"18px",fontWeight:700,color:s||"#1A1A1A"}},"Coupons and Offers")),e.createElement("div",{style:{display:"flex",height:"12px",background:"#87878717"}}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},S&&e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",gap:"8px",flexWrap:"wrap"}},e.createElement(Ke,{size:16,color:"#333333"}),e.createElement("span",{style:{fontWeight:700,fontSize:"14px",color:s||"#1A1A1A"}},S.code),e.createElement("span",{style:{fontStyle:"italic",fontSize:"14px",color:s||"#1A1A1A"}},"applied!"),e.createElement("button",{onClick:F,disabled:w,style:{background:"none",border:"none",cursor:w?"not-allowed":"pointer",padding:"2px",display:"flex",alignItems:"center"}},w?e.createElement(rt,{color:"#666",size:14}):e.createElement(be,{size:18,color:"#666666"})),N()&&e.createElement("span",{style:{fontSize:"14px",color:"#2E7D32",fontStyle:"italic"}},N())),e.createElement(_r,{backgroundSubdued:l,themeColor:c,themeTextColor:d,primaryTextColor:s,cartComponentsCornerRadius:p,applyCouponCode:r,removeDiscount:i,enableConfetti:a,hideAppliedCodes:!0}),e.createElement("div",{style:{display:"flex",height:"12px",background:"#87878717"}}),e.createElement("div",{style:{padding:"16px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:700,color:s||"#1A1A1A",marginBottom:"4px"}},"Collect Coupon"),e.createElement("div",{style:{fontSize:"13px",color:"#888888",marginBottom:"16px"}},"Pick any one coupon deal"),B.map(e=>P(e,e.couponTemplateId===h))))))},Lr=ce("showGSTInput",!1),Mr=c.div`
1401
+ `,Dr=({addCartItem:t,handleDecrement:n,handleIncrement:o,removeCartItem:r,isDev:i,themeColor:a,primaryTextColor:l,secondaryTextColor:c,freeProduct:d,themeTextColor:s,showEditOptionOnProducts:p,productPercentageOffMapping:u,removeFreebieFromCart:m,showDeleteOnFreebies:g,freeProductAdjustedCartTotal:x,freebieCouponTemplates:f,cartCheckpoints:y,freebieFlowCheckpoints:b,imageAspectSelector:h,cartComponentsCornerType:v,cartComponentsCornerRadius:w,giftWrapProductId:C,giftWrapVariantId:E,showGiftWrapAsLineItem:k=!1,backgroundSubdued:T,tertiaryColor:S,tertiaryTextColor:$,backgroundColor:B,showDiscountOnMRP:I,checkoutSectionMessage:z,checkoutSectionMessageRedirectLink:F,showFreebieMilestone:N,freebieMilestoneData:P,freeLabelText:D})=>{const A=ae(Ut),{cartLoading:_}=Jt(),R=!_.cartLoading&&A?.items,O=(x??Number(A?.items_subtotal_price))/100;let L=!0,M=0;if(A?.items?.length>0)for(const e of A.items)e?.properties?._isYtFreebie&&(M+=e?.quantity);if(M===A?.item_count&&(L=!1),!R&&0===A?.item_count)return e.createElement(Nr,null);if(!(R&&0!==A?.item_count||A?.items))return null;const j=P?.campaignFilter??"all_campaigns";let V=[];"all_campaigns"===j?V=f??[]:"progress_bar_tiers"===j?V=y??[]:"freebie_campaigns"===j&&(V=b??[]);const W=Array.isArray(V)?V.filter(e=>"free_product"===e?.couponType).slice().sort((e,t)=>e.minimumOrderValue-t.minimumOrderValue).find(e=>e.minimumOrderValue>O):void 0,H=on(A,A?.currency);return e.createElement(e.Fragment,null,A.items.filter(e=>!!k||!(String(e?.id)===sn(String(C))||String(e?.id)===sn(String(E)))).map(d=>{const x=u?.[d?.key],y=f?.find(e=>e?._allVariantIds?.includes(String(d.id)));let b=!1;if(y&&O>=y.minimumOrderValue&&0===d?.line_price&&(b=!0),!k&&(String(d?.id)===sn(String(C))||sn(String(E))===String(d?.id)))return null;const z=d.discounts&&d.discounts.length>0;return d.properties?._isYtFreebie&&(x||b)&&z&&L?e.createElement(e.Fragment,null,e.createElement(Pr,{key:d?.key??d?.id},e.createElement(Ir,{product:d,themeColor:a,isDev:i,primaryTextColor:l,secondaryTextColor:c,themeTextColor:s,showQtySelector:!1,showEditOptionOnProducts:p,percentageOff:x,imageAspectSelector:h,showDeleteOnFreebies:g,removeFreebieFromCart:m,backgroundSubdued:T,tertiaryColor:S,tertiaryTextColor:$,backgroundColor:B,showDiscountOnMRP:!0,freeLabelText:D}))):e.createElement(Pr,{key:d?.key??d?.id},e.createElement(Ir,{themeColor:a,handleDecrement:n,handleIncrement:o,removeCartItem:r,addCartItem:t,product:d,isDev:i,primaryTextColor:l,secondaryTextColor:c,showQtySelector:!d.properties?._isYtFreebie,showEditOptionOnProducts:p,removeFreebieFromCart:m,showDeleteOnFreebies:g,imageAspectSelector:h,cartComponentsCornerRadius:w,cartComponentsCornerType:v,backgroundSubdued:T,tertiaryColor:S,tertiaryTextColor:$,backgroundColor:B,showDiscountOnMRP:I,freeLabelText:D}))}),N&&L&&W&&e.createElement(Fr,{name:W.name,minimumOrderValue:W.minimumOrderValue,currency:H,themeColor:a,tertiaryColor:S,imageUrl:P?.milestoneImage?.path}),mn()&&z&&z.length>0?e.createElement("div",{className:"yt-cart-bottom-bar",style:{fontSize:"10px",textAlign:"center",backgroundColor:S,padding:"3px",boxShadow:"1px 2px 4px 0px #00000061",color:$,marginBottom:"4px",cursor:F?"pointer":"default"},onClick:()=>{F&&(window.location.href=F)}},z):e.createElement("div",{style:{display:"list-item",height:"12px",background:"#87878717"}}))};const Ar=({bundleProducts:t})=>{const n=ae(Ut);return e.createElement("div",{className:"flex flex-col gap-y-2"},e.createElement("div",{className:"flex items-center justify-center"},e.createElement("span",{className:"font-semibold"},"Save more with Bundle!")),e.createElement("div",{className:"flex items-center justify-center gap-2 relative"},e.createElement("div",{className:"w-48 h-48 flex flex-col justify-center border-[1px] p-2 border-[#B0B0B0]"},e.createElement("img",{style:{alignSelf:"center"},width:100,height:100,src:t[0].image}),e.createElement("span",{className:"text-[12.5px] text-[#667085] font-semibold"},rn(t[0].title)),e.createElement("div",null,e.createElement("span",{className:"text-[#344054] text-[14px] font-bold"},on(n,n?.currency),t[0].original_price)," ",e.createElement("span",{className:"line-through text-[#667085] text-[12px]"},on(n,n?.currency),t[0].price)),t[0]?.options_with_values?.length>0&&e.createElement("div",{className:"flex flex-col"},t[0]?.options_with_values?.map(t=>{if("Title"!==t.name)return e.createElement("span",{className:"text-[10px] text-[#868E96]"},t.name,": ",t.value)}))),e.createElement("div",{className:"w-48 h-48 flex flex-col justify-center border-[1px] p-2 border-[#B0B0B0]"},e.createElement("img",{style:{alignSelf:"center"},width:100,height:100,src:t[1].image}),e.createElement("span",{className:"text-[12.5px] text-[#667085] font-semibold"},rn(t[0].title)),e.createElement("div",null,e.createElement("span",{className:"text-[#344054] text-[14px] font-bold"},on(n,n?.currency),t[1].original_price)," ",e.createElement("span",{className:"line-through text-[#667085] text-[12px]"},on(n,n?.currency),t[1].price)),t[1]?.options_with_values?.length>0&&e.createElement("div",{className:"flex flex-col"},t[0]?.options_with_values?.map(t=>{if("Title"!==t.name)return e.createElement("span",{className:"text-[10px] text-[#868E96]"},t.name,": ",t.value)}))),e.createElement("div",{className:"absolute",style:{left:"50%",transform:"translateX(-50%)"}},e.createElement("img",{src:'<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">\n<circle cx="17.2797" cy="18.7208" r="15.5219" fill="#3A3A3A" stroke="#767676" stroke-width="1.51433"/>\n<path d="M15.5903 25.9172V12.1037H19.0827V25.9172H15.5903ZM10.4297 20.7566V17.2642H24.2433V20.7566H10.4297Z" fill="white"/>\n</svg>',alt:"Delivery Truck",height:"25px",width:"42px"}))),e.createElement("div",{className:"flex flex-row justify-between items-center"},e.createElement("div",{className:"flex flex-row gap-x-4 items-center"},e.createElement("span",{className:"text-[#667085] text-[13px]"},"Total Price"),e.createElement("span",null,e.createElement("span",{className:"font-bold text-black"},on(n,n?.currency),t[0].price+t[1].price)," ",e.createElement("span",{className:"text-[#868E96] text-[12px] line-through"},on(n,n?.currency),t[0].original_price+t[1].original_price))),e.createElement("span",{className:"text-[#1ADF5D] text-[10px]"},"save extra"," ",e.createElement("span",{className:"font-semibold"},on(n,n?.currency),t[0].original_price-t[0].price+(t[1].original_price-t[1].price)))),e.createElement("button",{className:"flex flex-row items-center bg-[#333333] gap-x-3 justify-center w-full py-1.5"},e.createElement(ct,{color:"white"}),e.createElement("span",{className:"text-white uppercase text-[14px]"},"Buy Bundle at"," ",e.createElement("span",{className:"font-semibold"},on(n,n?.currency),t[0].price+t[1].price))))},_r=({backgroundSubdued:o,themeColor:i,themeTextColor:a,primaryTextColor:l,cartComponentsCornerRadius:c,applyCouponCode:d,removeDiscount:s,enableConfetti:p,hideAppliedCodes:u})=>{const m=ae(Ut),[g,x]=t(""),[f,y]=t(null),[b,h]=t(!1),[v,w]=t(!1),[C,E]=t(!1),{setLoading:k}=Jt(),[T,S]=t(null),[$,B]=t(!1),[I,z]=t(!1),F=r(null);n(()=>{if(T){B(!0);const e=setTimeout(()=>{B(!1)},4e3),t=setTimeout(()=>{S(null)},4500);return()=>{clearTimeout(e),clearTimeout(t)}}B(!1)},[T]),n(()=>{if(m&&m.discount_codes&&f){const e=m.discount_codes.find(e=>e.code===f);e&&(e.applicable?(S({message:"Coupon applied successfully!",type:"success"}),p&&(z(!0),setTimeout(()=>z(!1),5e3))):S({message:"Coupon not applicable",type:"error"}),y(null))}},[m,f]);const N=async()=>{if(d&&g&&!b){S(null),h(!0),y(g);try{await d(g),x("")}catch(e){S({message:"Failed to apply coupon.",type:"error"}),y(null)}finally{h(!1)}}},P=async()=>{if(s&&!C){S(null),E(!0),k&&k(!0,!1,!1,!0);try{await s()}catch(e){S({message:"Failed to remove coupon.",type:"error"})}finally{k&&k(!1,!1,!1,!1),E(!1)}}},D="error"===T?.type,A=m?.discount_codes?.filter(e=>!1!==e?.applicable);return e.createElement("div",{ref:F,style:{marginTop:"10px",padding:"0 16px",marginBottom:"10px"}},I&&p&&e.createElement(vo,{particleCount:100,spread:160,origin:{y:.6},checkpointPosition:.5}),e.createElement("div",{style:{display:"flex",alignItems:"stretch",border:D?"0.5px solid #FF4E4E":v?`1px solid ${i||"#007bff"}`:"1px solid #e0e0e0",borderRadius:c??4,transition:"border-color 0.5s ease-in-out",overflow:"hidden"}},e.createElement("input",{type:"text",placeholder:"Have a Coupon Code?",value:g,disabled:b,onFocus:()=>{w(!0),setTimeout(()=>{F.current&&window.innerWidth<=768&&F.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300)},onBlur:()=>w(!1),onChange:e=>{x(e.target.value),T&&S(null)},onKeyDown:e=>{"Enter"===e.key&&N()},style:{flexGrow:1,border:"none",padding:"10px",outline:"none",fontSize:"14px",fontWeight:"bold",borderTopLeftRadius:c??4,borderBottomLeftRadius:c??4,backgroundColor:o,color:l,boxShadow:"none",cursor:b?"not-allowed":"auto",margin:"0"}}),e.createElement("button",{onClick:N,disabled:!g||b,style:{padding:"10px 15px",border:"none",backgroundColor:D?"#D98181":g?i||"#007bff":"#cccccc",color:g||D?a||"#ffffff":"#666666",cursor:!g||b?"not-allowed":"pointer",fontSize:"14px",fontWeight:"bold",borderTopRightRadius:c??4,borderBottomRightRadius:c??4,transition:"background-color 0.5s ease-in-out, opacity 0.2s ease-in-out",minWidth:"80px",display:"flex",justifyContent:"center",alignItems:"center",opacity:b?.7:1}},b?e.createElement(rt,{color:a||"#ffffff",size:18}):"Apply")),T&&e.createElement("div",{style:{color:"success"===T.type?"#28a745":"#dc3545",fontSize:"12px",marginTop:"4px",fontStyle:"italic",transition:"opacity 0.5s ease-in-out, transform 0.5s ease-in-out, max-height 0.5s ease-in-out",opacity:$?1:0,transform:$?"translateY(0)":"translateY(-10px)",maxHeight:$?"50px":"0",overflow:"hidden"}},T.message),!u&&A&&A.length>0&&e.createElement("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px"}},A.map(t=>e.createElement("div",{key:t.code,style:{display:"flex",alignItems:"center",fontSize:"12px",fontStyle:"italic"}},e.createElement("div",{style:{display:"flex",alignItems:"center",color:"#333333",backgroundColor:o,paddingInlineStart:"6px",gap:"4px"}},e.createElement(Ke,{size:12,color:"#4D4D4D"}),e.createElement("span",{style:{fontWeight:"bold",fontStyle:"normal"}},t.code)," applied!",e.createElement("button",{onClick:P,disabled:C,style:{background:"#E2E2E2",border:"0.5px solid #B5B5B5",cursor:"pointer",marginLeft:"4px",padding:"0",display:"flex",alignItems:"center"}},C?e.createElement(rt,{color:i||"#007bff",size:14}):e.createElement(be,{size:16})))))))},Rr="yt-coupon-selection-animations",Or=({rewardCoupons:o,applyCouponCode:r,removeDiscount:i,enableConfetti:a,backgroundSubdued:l,themeColor:c,themeTextColor:d,primaryTextColor:s,cartComponentsCornerRadius:p})=>{const u=ae(Ut),[m,g]=t(!1),[x,f]=t(!1),[y,b]=t(null),[h,v]=t(null),[w,C]=t(!1),[E,k]=t(null);n(()=>{(()=>{if(document.getElementById(Rr))return;const e=document.createElement("style");e.id=Rr,e.textContent="\n @keyframes ytSlideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n @keyframes ytSlideDown {\n from { transform: translateY(0); }\n to { transform: translateY(100%); }\n }\n @keyframes ytSuccessPulse {\n 0% { box-shadow: 0 0 0 0 rgba(46,125,50,0.4); }\n 50% { box-shadow: 0 0 0 8px rgba(46,125,50,0); }\n 100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }\n }\n @keyframes ytCheckFade {\n 0% { opacity: 0; transform: scale(0.5); }\n 50% { opacity: 1; transform: scale(1.2); }\n 100% { opacity: 1; transform: scale(1); }\n }\n ",document.head.appendChild(e)})()},[]);const T=u?.discount_codes?.filter(e=>!1!==e?.applicable),S=T?.[0],$=h?o.find(e=>e.couponTemplateId===h):null,B=o;n(()=>{const e=u?.discount_codes?.filter(e=>!1!==e?.applicable)??[];if(null!==h){const t=o.find(e=>e.couponTemplateId===h);return void(t&&e.some(e=>e.code?.toLowerCase()===t.name?.toLowerCase())||v(null))}if(e.length>0){const t=o.find(t=>e.some(e=>e.code?.toLowerCase()===t.name?.toLowerCase()));t&&v(t.couponTemplateId)}},[u?.discount_codes,o,h]),n(()=>{if(m){window.history.pushState({couponSelectionOpen:!0},"");const e=()=>z();return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}},[m]);const I=()=>{f(!1),g(!0)},z=()=>{f(!0),setTimeout(()=>{g(!1),f(!1)},280)},F=async()=>{if(i&&!w){C(!0);try{await i(),v(null)}catch(e){console.error("Failed to remove coupon:",e)}finally{C(!1)}}},N=()=>{if($){if("percentage_discount_coupon"===$.couponType&&$.discountPercentage)return`saved extra ${$.discountPercentage}% off`;if("fixed_amount_coupon"===$.couponType&&$.discountValue)return`saved extra ₹${$.discountValue} off`}return""},P=(t,n=!1)=>{const o=y===t.couponTemplateId,i=E===t.couponTemplateId,a=!n&&!1===t.isEligible;return e.createElement("div",{key:t.couponTemplateId,style:{border:n?`1.5px solid ${c||"#4A7C59"}`:"1px solid #E8E8E8",borderRadius:p??8,overflow:"hidden",marginBottom:"12px",backgroundColor:"#FFFFFF",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",animation:i?"ytSuccessPulse 0.6s ease-out":void 0,transition:"border-color 0.3s ease, box-shadow 0.3s ease"}},e.createElement("div",{style:{padding:"14px 16px",background:"linear-gradient(135deg, #FFFFFF 60%, #FFF5F5 100%)",position:"relative"}},i&&e.createElement("div",{style:{position:"absolute",top:"10px",right:"10px",width:24,height:24,borderRadius:"50%",backgroundColor:"#2E7D32",display:"flex",alignItems:"center",justifyContent:"center",animation:"ytCheckFade 0.4s ease-out forwards"}},e.createElement("span",{style:{color:"#fff",fontSize:"14px",fontWeight:700}},"✓")),e.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px"}},e.createElement("div",{style:{width:32,height:32,borderRadius:4,backgroundColor:"#FDE8E8",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(ne,{size:18,color:a?"#6b7280":"#8B0000"})),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:"14px",fontWeight:600,color:s||"#1A1A1A",marginBottom:"2px"}},(e=>"percentage_discount_coupon"===e.couponType&&e.discountPercentage?`Get an additional ${e.discountPercentage}% off`:"fixed_amount_coupon"===e.couponType&&e.discountValue?`Get an additional ₹${e.discountValue} off`:e.name)(t)),e.createElement("div",{style:{fontSize:"12px",color:a?"#6b7280":"#2E7D32",fontWeight:500}},(e=>{if("minimum_quantity"===e.customCartProgressBarCriteria){if(e.quantityThreshold)return`On orders with ${e.quantityThreshold}+ items.`}else if(e.minimumOrderValue)return`On purchases above ₹${e.minimumOrderValue.toLocaleString("en-IN")}.`;return""})(t)))),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"12px",border:"1px solid #E0E0E0",borderRadius:p??6,padding:"8px 12px",backgroundColor:"#FAFAFA"}},e.createElement("span",{style:{fontSize:"14px",fontWeight:700,color:s||"#1A1A1A",letterSpacing:"0.5px"}},t.name),e.createElement("button",{onClick:e=>{e.stopPropagation(),n?F():(async e=>{if(null===y){b(e.couponTemplateId);try{r&&e.name&&await r(e.name),v(e.couponTemplateId),k(e.couponTemplateId),setTimeout(()=>{k(null),z()},1200)}catch(e){console.error("Failed to collect coupon:",e)}finally{b(null)}}})(t)},disabled:o||w||a,style:{background:"none",border:"none",color:a?"#6b7280":"#8B0000",fontSize:"14px",fontWeight:600,cursor:o||w||a?"not-allowed":"pointer",padding:0,display:"flex",alignItems:"center",gap:"4px"}},o||n&&w?e.createElement(rt,{color:"#8B0000",size:14}):n?"Remove":"Collect"))),e.createElement("div",{style:{padding:"6px 16px",fontSize:"11px",fontWeight:500,textAlign:"center",backgroundColor:"#FFF0F0",color:a?"#6b7280":"#8B0000",borderTop:"1px solid '#FECACA'"}},(e=>{const t=e.resolvedCollectionNames;return t&&t.length>0?1===t.length?`Applicable on '${t[0]}' collection only.`:`Applicable on '${t.join("', '")}' collections.`:e.allowedCollections?.ids&&e.allowedCollections.ids.length>0?"Applicable on select collections.":"Applicable storewide"})(t)))};return e.createElement(e.Fragment,null,(()=>{const t=!!$||!!S,n=$?.name??S?.code??"",r=$?"#F0FFF4":S?"#F3E8FF":"#FDE8E8",i=$?"#2E7D32":"#C53030",a=$?"#2E7D32":"#666666";return e.createElement("div",{style:{padding:"0 16px",marginTop:"10px",marginBottom:"10px"}},e.createElement("div",{onClick:I,style:{display:"flex",alignItems:"center",padding:"12px 14px",border:"1px solid #E8E8E8",borderRadius:p??8,cursor:"pointer",backgroundColor:"#FFFFFF",transition:"box-shadow 0.2s ease"}},e.createElement("div",{style:{width:36,height:36,borderRadius:6,backgroundColor:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginRight:"12px",transition:"background-color 0.3s ease"}},$?e.createElement(Ke,{size:20,color:i}):e.createElement(ne,{size:20,color:i})),e.createElement("div",{style:{flex:1}},t?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:s||"#1A1A1A"}},e.createElement("span",{style:{fontWeight:600}},n),e.createElement("span",{style:{fontStyle:"italic"}}," applied!")),e.createElement("div",{style:{fontSize:"12px",color:a,marginTop:"1px",fontStyle:$?"italic":"normal"}},(()=>{if($){if("percentage_discount_coupon"===$.couponType&&$.discountPercentage)return`saved additional ${$.discountPercentage}% on your purchase`;if("fixed_amount_coupon"===$.couponType&&$.discountValue)return`saved additional ₹${$.discountValue} on your purchase`}return"coupon applied on your purchase"})())):e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",fontWeight:700,color:s||"#1A1A1A"}},"Coupons and Offers"),e.createElement("div",{style:{fontSize:"12px",color:"#888888",marginTop:"1px"}},"collect and save more"))),e.createElement(L,{size:14,color:"#888888"})),!t&&o.length>0&&e.createElement("div",{style:{textAlign:"center",fontSize:"12px",fontWeight:600,color:"#2E7D32",backgroundColor:"#F0FFF4",padding:"6px 0",borderRadius:`0 0 ${p??8}px ${p??8}px`,marginTop:"-1px",border:"1px solid #C6F6D5",borderTop:"none"}},o.length,"+ coupons eligible for your order"))})(),m&&e.createElement("div",{style:{position:"absolute",top:0,right:0,bottom:0,left:0,width:"100%",backgroundColor:"#FFFFFF",zIndex:2147483645,display:"flex",flexDirection:"column",animation:x?"ytSlideDown 0.28s cubic-bezier(0.4, 0, 1, 1) forwards":"ytSlideUp 0.32s cubic-bezier(0, 0, 0.2, 1) forwards"}},e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"16px",flexShrink:0}},e.createElement("button",{onClick:z,style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",marginRight:"12px"}},e.createElement(M,{size:18,color:s||"#1A1A1A"})),e.createElement("span",{style:{fontSize:"18px",fontWeight:700,color:s||"#1A1A1A"}},"Coupons and Offers")),e.createElement("div",{style:{display:"flex",height:"12px",background:"#87878717"}}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},S&&e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",gap:"8px",flexWrap:"wrap"}},e.createElement(Ke,{size:16,color:"#333333"}),e.createElement("span",{style:{fontWeight:700,fontSize:"14px",color:s||"#1A1A1A"}},S.code),e.createElement("span",{style:{fontStyle:"italic",fontSize:"14px",color:s||"#1A1A1A"}},"applied!"),e.createElement("button",{onClick:F,disabled:w,style:{background:"none",border:"none",cursor:w?"not-allowed":"pointer",padding:"2px",display:"flex",alignItems:"center"}},w?e.createElement(rt,{color:"#666",size:14}):e.createElement(be,{size:18,color:"#666666"})),N()&&e.createElement("span",{style:{fontSize:"14px",color:"#2E7D32",fontStyle:"italic"}},N())),e.createElement(_r,{backgroundSubdued:l,themeColor:c,themeTextColor:d,primaryTextColor:s,cartComponentsCornerRadius:p,applyCouponCode:r,removeDiscount:i,enableConfetti:a,hideAppliedCodes:!0}),e.createElement("div",{style:{display:"flex",height:"12px",background:"#87878717"}}),e.createElement("div",{style:{padding:"16px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:700,color:s||"#1A1A1A",marginBottom:"4px"}},"Collect Coupon"),e.createElement("div",{style:{fontSize:"13px",color:"#888888",marginBottom:"16px"}},"Pick any one coupon deal"),B.map(e=>P(e,e.couponTemplateId===h))))))},Lr=ce("showGSTInput",!1),Mr=c.div`
1402
1402
  width: 95%;
1403
1403
  background: white;
1404
1404
  border-radius: 2px;
@@ -2433,7 +2433,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
2433
2433
  &:hover {
2434
2434
  opacity: ${e=>e.$locked?.5:.85};
2435
2435
  }
2436
- `,kl=(e,t)=>e.find(e=>(e?.variants?.edges??e?.variants?.nodes??[]).some(e=>{const n=e?.node??e,o=String(n?.id??"");return o.includes(t)||o.split("/").pop()===t})),Tl=(e,t)=>{const n=(e?.variants?.edges??e?.variants?.nodes??[]).find(e=>{const n=e?.node??e,o=String(n?.id??"");return o.includes(t)||o.split("/").pop()===t});return n?.node??n},Sl=({stealDealCheckpoints:i,stealDealProducts:a,freeProductAdjustedCartTotal:l,effectiveQuantityForProgressBar:c,addFreebieToCart:d,freebiesInCart:s,primaryTextColor:p})=>{const u=ae(Ut),{setLoading:m}=Jt(),f=le(en),y=i?.[0],[b,h]=t(0),[v,w]=t(0),C=r(null),E=r(null),k=r(null),T=o(()=>(l||Number(u?.items_subtotal_price))/100,[l,u?.items_subtotal_price]),S=on(u,u?.currency),$=o(()=>{if(!y)return!1;return"minimum_order_value"===(y.customCartProgressBarCriteria??"minimum_order_value")?T>=y.minimumOrderValue:(u?.item_count??0)>=y.quantityThreshold},[y,T,u?.item_count]),B=y?.maxFreebiesInTier??1,I=o(()=>{if(!y)return 0;return(y.customerGetsProductIds?.ids??[]).filter(e=>s.includes(e)).length},[y,s])>=B,z=o(()=>{if(!y||!a?.length)return[];const e=y.customerGetsProductIds?.ids??[],t=[];for(const n of e){const e=kl(a,n);if(!e)continue;const o=Tl(e,n),r=Number(o?.price?.amount?o.price.amount:o?.price??0);let i,l;"no_discount"===y.freebieType?(i=r,l=0):"percentage_off"===y.freebieType&&y.discountPercentage?(l=y.discountPercentage,i=r*(1-l/100)):(i=y.discountValue??r,l=r>0?Math.round((r-i)/r*100):0);const c=s.includes(n),d=e?._claim_allowed_variants??[n];t.push({product:e,variantId:n,isUnlocked:$,isClaimed:c,discountPercent:l,dealPrice:i,originalPrice:r,allowedVariantIds:d})}return t},[y,a,s,$]);n(()=>{if(C.current){const e=C.current.offsetWidth,t=window.innerWidth<=768;w(t?Math.min(.95*e,280):Math.min(.8*e,320))}},[z.length]);const F=Math.max(0,z.length-1);n(()=>{b>F&&h(F)},[F,b]);const N=()=>{h(e=>0===e?F:e-1)},P=()=>{h(e=>e===F?0:e+1)};if(!y||!z.length)return null;return e.createElement(Za,null,e.createElement(Ka,null,e.createElement(Ja,{style:{color:p}},e.createElement(el,null,"STEAL"),e.createElement(tl,null,"DEALS")),I?e.createElement(il,null,"Max ",B," claims reached"):$?e.createElement(rl,null,e.createElement(Q,{size:10}),"UNLOCKED"):e.createElement(nl,null,e.createElement(ol,null),"minimum_order_value"===(y.customCartProgressBarCriteria??"minimum_order_value")?e.createElement(e.Fragment,null,"UNLOCK AT ",S,y.minimumOrderValue):e.createElement(e.Fragment,null,"UNLOCK AT ",y.quantityThreshold," ITEMS"))),e.createElement(al,{ref:C,onTouchStart:e=>{E.current=e.touches[0].clientX,k.current=e.touches[0].clientY},onTouchMove:e=>{if(null===E.current||null===k.current)return;const t=e.touches[0].clientX-E.current,n=e.touches[0].clientY-k.current;Math.abs(t)>10&&Math.abs(t)>Math.abs(n)&&e.preventDefault()},onTouchEnd:e=>{if(null===E.current)return;const t=e.changedTouches[0].clientX-E.current;Math.abs(t)>50&&(t<0?P():N()),E.current=null,k.current=null}},z.length>1&&e.createElement(pl,{onClick:N},e.createElement(g,{size:30,color:"#4D4D4D"})),e.createElement(dl,{position:"left",style:{display:"flex"}}),e.createElement(dl,{position:"right",style:{display:"flex"}}),e.createElement(ll,{$cardWidth:v},e.createElement(cl,{$translate:b*(v+10)},z.map(t=>{return e.createElement("div",{key:t.variantId,style:{width:`${v}px`,flexShrink:0}},e.createElement(ml,null,e.createElement(gl,null,e.createElement(xl,{src:(n=t.product,n?.featuredMedia?.preview?.image?.url??n?.featuredImage?.url??n?.images?.edges?.[0]?.node?.url??n?.image?.src??""),alt:t.product?.title??""}),t.discountPercent>0&&e.createElement(fl,null,"-",t.discountPercent,"% OFF")),e.createElement(yl,null,e.createElement(bl,null,t.product?.title??""),e.createElement(Cl,null,e.createElement(hl,null,e.createElement(vl,null,S,t.dealPrice.toLocaleString()),t.originalPrice>t.dealPrice&&e.createElement(wl,null,S,t.originalPrice.toLocaleString())),e.createElement(El,{$locked:!t.isUnlocked||t.isClaimed||I,onClick:()=>(async e=>{if(e.isUnlocked&&!e.isClaimed&&!I&&d){if(e.allowedVariantIds.length>1){const t=e.product?.variants?.edges??e.product?.variants?.nodes??[];if(e.allowedVariantIds.some(n=>t.some(t=>{const o=t?.node??t;return(String(o?.id??"").split("/").pop()===n||String(o?.id??"").includes(n))&&Jr(e.product,o)}))){const t=e.product?.id?.split("/").pop();return void f({open:!0,variantId:e.variantId,handle:e.product?.handle,freebieSelection:!0,stealDealSelection:!0,productId:t,allowedVariantIds:e.allowedVariantIds})}}m(!0,!0);try{await d(e.variantId,e.allowedVariantIds),window.dispatchEvent(new CustomEvent("yt:autoFreebieAdded"))}catch(e){}finally{m(!1,!1)}}})(t),disabled:!t.isUnlocked||t.isClaimed||I},t.isUnlocked?e.createElement(U,{size:12}):e.createElement(Y,{size:12}))))));var n}))),z.length>1&&e.createElement(ul,{onClick:P},e.createElement(x,{size:30,color:"#4D4D4D"}))))},$l=c.div`
2436
+ `,kl=(e,t)=>e.find(e=>(e?.variants?.edges??e?.variants?.nodes??[]).some(e=>{const n=e?.node??e,o=String(n?.id??"");return o.includes(t)||o.split("/").pop()===t})),Tl=(e,t)=>{const n=(e?.variants?.edges??e?.variants?.nodes??[]).find(e=>{const n=e?.node??e,o=String(n?.id??"");return o.includes(t)||o.split("/").pop()===t});return n?.node??n},Sl=({stealDealCheckpoints:i,stealDealProducts:a,freeProductAdjustedCartTotal:l,effectiveQuantityForProgressBar:c,addFreebieToCart:d,freebiesInCart:s,primaryTextColor:p})=>{const u=ae(Ut),{setLoading:m}=Jt(),f=le(en),y=i?.[0],[b,h]=t(0),[v,w]=t(0),C=r(null),E=r(null),k=r(null),T=o(()=>(l||Number(u?.items_subtotal_price))/100,[l,u?.items_subtotal_price]),S=on(u,u?.currency),$=o(()=>{if(!y)return!1;return"minimum_order_value"===(y.customCartProgressBarCriteria??"minimum_order_value")?T>=y.minimumOrderValue:(u?.item_count??0)>=y.quantityThreshold},[y,T,u?.item_count]),B=y?.maxFreebiesInTier??1,I=o(()=>{if(!y)return 0;return(y.customerGetsProductIds?.ids??[]).filter(e=>s.includes(e)).length},[y,s])>=B,z=o(()=>{if(!y||!a?.length)return[];const e=y.customerGetsProductIds?.ids??[],t=[];for(const n of e){const e=kl(a,n);if(!e)continue;const o=Tl(e,n),r=Number(o?.price?.amount?o.price.amount:o?.price??0);let i,l;"no_discount"===y.freebieType?(i=r,l=0):"percentage_off"===y.freebieType&&y.discountPercentage?(l=y.discountPercentage,i=r*(1-l/100)):(i=y.discountValue??r,l=r>0?Math.round((r-i)/r*100):0);const c=s.includes(n),d=e?._claim_allowed_variants??[n];t.push({product:e,variantId:n,isUnlocked:$,isClaimed:c,discountPercent:l,dealPrice:i,originalPrice:r,allowedVariantIds:d})}return t},[y,a,s,$]);n(()=>{if(C.current){const e=C.current.offsetWidth,t=window.innerWidth<=768;w(t?Math.min(.95*e,280):Math.min(.8*e,320))}},[z.length]);const F=Math.max(0,z.length-1);n(()=>{b>F&&h(F)},[F,b]);const N=()=>{h(e=>0===e?F:e-1)},P=()=>{h(e=>e===F?0:e+1)};if(!y||!z.length)return null;return e.createElement(Za,null,e.createElement(Ka,null,e.createElement(Ja,{style:{color:p}},e.createElement(el,null,"STEAL"),e.createElement(tl,null,"DEALS")),I?e.createElement(il,null,"Max ",B," claims reached"):$?e.createElement(rl,null,e.createElement(Q,{size:10}),"UNLOCKED"):e.createElement(nl,null,e.createElement(ol,null),"minimum_order_value"===(y.customCartProgressBarCriteria??"minimum_order_value")?e.createElement(e.Fragment,null,"UNLOCK AT ",S,y.minimumOrderValue):e.createElement(e.Fragment,null,"UNLOCK AT ",y.quantityThreshold," ITEMS"))),e.createElement(al,{ref:C,onTouchStart:e=>{E.current=e.touches[0].clientX,k.current=e.touches[0].clientY},onTouchMove:e=>{if(null===E.current||null===k.current)return;const t=e.touches[0].clientX-E.current,n=e.touches[0].clientY-k.current;Math.abs(t)>10&&Math.abs(t)>Math.abs(n)&&e.preventDefault()},onTouchEnd:e=>{if(null===E.current)return;const t=e.changedTouches[0].clientX-E.current;Math.abs(t)>50&&(t<0?P():N()),E.current=null,k.current=null}},z.length>1&&e.createElement(pl,{onClick:N},e.createElement(g,{size:30,color:"#4D4D4D"})),e.createElement(dl,{position:"left",style:{display:"flex"}}),e.createElement(dl,{position:"right",style:{display:"flex"}}),e.createElement(ll,{$cardWidth:v},e.createElement(cl,{$translate:b*(v+10)},z.map(t=>{return e.createElement("div",{key:t.variantId,style:{width:`${v}px`,flexShrink:0},className:"yt-steal-deal-card"},e.createElement(ml,null,e.createElement(gl,null,e.createElement(xl,{src:(n=t.product,n?.featuredMedia?.preview?.image?.url??n?.featuredImage?.url??n?.images?.edges?.[0]?.node?.url??n?.image?.src??""),alt:t.product?.title??""}),t.discountPercent>0&&e.createElement(fl,null,"-",t.discountPercent,"% OFF")),e.createElement(yl,null,e.createElement(bl,null,t.product?.title??""),e.createElement(Cl,null,e.createElement(hl,null,e.createElement(vl,null,S,t.dealPrice.toLocaleString()),t.originalPrice>t.dealPrice&&e.createElement(wl,null,S,t.originalPrice.toLocaleString())),e.createElement(El,{$locked:!t.isUnlocked||t.isClaimed||I,onClick:()=>(async e=>{if(e.isUnlocked&&!e.isClaimed&&!I&&d){if(e.allowedVariantIds.length>1){const t=e.product?.variants?.edges??e.product?.variants?.nodes??[];if(e.allowedVariantIds.some(n=>t.some(t=>{const o=t?.node??t;return(String(o?.id??"").split("/").pop()===n||String(o?.id??"").includes(n))&&Jr(e.product,o)}))){const t=e.product?.id?.split("/").pop();return void f({open:!0,variantId:e.variantId,handle:e.product?.handle,freebieSelection:!0,stealDealSelection:!0,productId:t,allowedVariantIds:e.allowedVariantIds})}}m(!0,!0);try{await d(e.variantId,e.allowedVariantIds),window.dispatchEvent(new CustomEvent("yt:autoFreebieAdded"))}catch(e){}finally{m(!1,!1)}}})(t),disabled:!t.isUnlocked||t.isClaimed||I},t.isUnlocked?e.createElement(U,{size:12}):e.createElement(Y,{size:12}))))));var n}))),z.length>1&&e.createElement(ul,{onClick:P},e.createElement(x,{size:30,color:"#4D4D4D"}))))},$l=c.div`
2437
2437
  line-height: normal;
2438
2438
  position: ${e=>e.$enableCustomCartOnCartPage&&e.$isCartPage?"relative":"fixed"};
2439
2439
  top: ${e=>e.$enableCustomCartOnCartPage&&e.$isCartPage?"auto":"0"};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.8.72",
3
+ "version": "0.8.74",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",