yt-uikit 0.7.407 → 0.7.409
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 +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2235,7 +2235,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
2235
2235
|
font-weight: 400;
|
|
2236
2236
|
min-width: 14px;
|
|
2237
2237
|
line-height: 14px;
|
|
2238
|
-
`,Cp=({isOpen:e,setIsOpen:n,backgroundColor:r="white",backgroundSubdued:a="#3947821F",tertiaryColor:i="#067D431A",tertiaryTextColor:d="#000000",exploreCTAColor:s,checkoutFontSize:p,cartTitle:u="My Cart",emptyCartTitle:m,emptyCartDescription:f,emptyCartButtons:g,removeCartItem:x,handleIncrement:h,handleDecrement:y,addCartItem:b,isUserSignedIn:v,showBundle:w,showCouponOptions:C,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:B,discountApplied:z,removeDiscount:I,applyDiscount:D,rewardCoupons:_,userTotalPoints:N,checkoutFunction:P,joinNowFunction:A,guestLoyaltyPercentage:O,isDev:F,recProductsList:M,showMultiStepProgressBar:R,cartCheckpoints:L,redemptionRate:j,pointsRewardRate:V,showCartLevelAltPay:W,guestRewardCoupon:H,showGuestDiscountCoupon:U,applyTemplateDiscount:q,exploreCtaRedirectLink:Q,discountAmountApplied:G,minimumCartValue:Y,discountInCheckoutButton:Z,isStickyCheckout:X,showDiscountsListToGuestUsers:K,showApplyCouponsButtonToGuestUsers:J,handleCheckpointCrossed:ee,customCartProgressBarCriteria:te,checkoutButtonColor:ne="#252E69",ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,productRecsCtaButtonText:le,productRecsTitleText:ce,emptyProductRecsTitleText:de,showProductRecsOnDesktop:se,showProductRecsOnMobile:pe,themeColor:ue,themeTextColor:me,companyName:fe,gstNumber:ge,showGSTOption:xe,applyGSTToCart:he,showMOVForProgressTiers:ye,freeProduct:be,showLoyaltyCta:ve=!1,freeProductAdjustedCartTotal:we,minimumOrderValueToAvailDiscount:Ce,signinCTAButtonVisible:Ee,cartSigninCTAMainText:ke,applyNoteToCart:Te,note:Se,showNoteOption:$e,inlineCartOfferInfoText:Be,inlineCartOfferInfoRedirectLink:ze,cartOfferTermsAndConditionsText:Ie,showEditOptionOnProducts:De,onSetLoading:_e,showVariantSelectionDropdownInProductRecs:Ne,originalCartSubtotal:Pe,freebieProductsInCart:Ae,showFreebieClaim:Oe,addFreebieToCart:Fe,freebiesInCart:Me,effectiveQuantityForProgressBar:Re,productPercentageOffMapping:Le,productTagsMapping:je,removeFreebieFromCart:Ve,postalCodeList:We,enableGeoLocationDeliveryRestriction:He=!1,getProductDetailsByVariantId:Ue,applyPostalCodeAndDeliverySlotToCart:qe,showDeleteOnFreebies:Qe,freebieCouponTemplates:Ge,freebieFlowCheckpoints:Ye,freebieClaimData:Ze,postalCodeBasedItemTrackingParameter:Xe,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:rt,progressBarFreeProductIconType:it,enableCustomCartOnCartPage:lt,isCartPage:ct,showCartTimer:dt,showFreebieMilestone:pt,freebieMilestoneData:mt,cartTimerInMinutes:ft,cartTimerCustomText:gt,productRecsCardLayout:xt,productRecsCardListVariant:ht,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:vt,cartOffersCarousalData:wt,gstSectionCustomizationData:Ct,noteSectionTitle:Et,checkoutSectionMessage:kt,checkoutSectionMessageDisplay:Tt,showVariantSelectionDropdownInProductClaim:St,loyaltyDiscount:$t,brandTokenName:Bt,showDiscountOnMRP:zt,switchWidthVariant:It,prefixMessageText:Dt,suffixMessageText:_t,successMessageText:Nt,toggleDecimal:Pt,cartOffersCarouselHeight:At,disableCheckoutButton:Ot,showEmptyCartRecommendations:Ft=!1,checkoutButtonBottomSpacing:Mt,showPoweredByBadge:Rt,applyCouponCode:Lt,showApplyCoupon:jt,enableConfetti:Vt,checkoutSectionMessageRedirectLink:Wt,showCheckoutButtonPaymentIcons:Ht,shouldCheckInventoryQuantity:qt})=>{const Yt=Ut(Gt),Zt=Ut(nn),[Xt,ln]=c(!1),[cn,dn]=Qt(an),[sn,un]=c(!1),[mn,fn]=c(!0),{setLoading:gn}=rn();t.useEffect((()=>{_e&&_e(gn)}),[_e]),l((()=>{const t=()=>{n(!1)};return e&&(window.history.pushState({ytCustomCartDrawer:"open"},""),window.addEventListener("popstate",t)),()=>{window.removeEventListener("popstate",t),"open"===window.history.state?.ytCustomCartDrawer&&window.history.back()}}),[e,n]);const[xn,hn]=c(!1);l((()=>{const t=document.querySelector("body");if(t)return lt&&ct?(t.classList.remove("drawer-open"),void t.classList.remove("drawer-closed")):void(xn?(t.classList.remove("drawer-open"),t.classList.remove("drawer-closed")):e?(t.classList.add("drawer-open"),t.classList.remove("drawer-closed")):(t.classList.remove("drawer-open"),t.classList.add("drawer-closed")))}),[e,lt,ct,xn]),l((()=>{function e(){const e=window.innerWidth;hn(e>=450)}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const yn=Yt?.items?.reduce(((e,t)=>e+t?.quantity),0),bn=o(null);l((()=>{function e(e){bn.current&&!bn.current.contains(e.target)&&dn(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]),l((()=>{const e=()=>{ln(!0),window.setTimeout((()=>ln(!1)),3e3)};return window.addEventListener("yt:autoFreebieAdded",e),()=>window.removeEventListener("yt:autoFreebieAdded",e)}),[]);const[vn,wn]=c("normal"),[Cn,En]=c("normal"),[kn,Tn]=c("auto");l((()=>{CSS.supports("font-weight","500")?wn("500"):CSS.supports("font-weight","400")?wn("400"):CSS.supports("font-weight","600")&&wn("600"),CSS.supports("font-weight","400")?En("400"):CSS.supports("font-weight","300")?En("300"):CSS.supports("font-weight","200")&&En("200"),CSS.supports("width","-webkit-fill-available")?Tn("-webkit-fill-available"):CSS.supports("width","-moz-available")&&Tn("-moz-available")}),[]),l((()=>{document.documentElement.style.setProperty("--yt-cart-font-weight",vn),document.documentElement.style.setProperty("--yt-cart-product-rec-price-font-weight",Cn),document.documentElement.style.setProperty("--yt-cart-custom-fill-width",kn)}),[vn,Cn]);const[Sn]=Qt(Kt);Ut(Jt);const[$n]=Qt(tn),[Bn]=Qt(en);l((()=>{const e=Yt?.items.some((e=>(je?.get(String(e.product_id))||[]).includes("Delhi-NCR")));un(e)}),[Yt?.items,je]);l((()=>{fn(!("all-products"!==Xe&&("specific-tags"!==Xe||Sn.isPostalCodeValid||Ke)&&("specific-tags"!==Xe||Sn.isPostalCodeValid||$n||!Ke)&&("specific-tags"===Xe&&"standard"===Bn||sn&&(Ke?Sn.isPostalCodeValid&&$n:Sn.isPostalCodeValid))))}),[Sn.isPostalCodeValid,$n,sn,Xe,Ke]),Qt(on);const[zn,In]=c(!0);l((()=>{"true"===localStorage.getItem("cartTimerRanOnce")&&In(!1);const e=localStorage.getItem("cartTimerTimeLeft");e&&parseInt(e,10)<=0&&In(!1)}),[]);const Dn=new Date("2024-11-01");return pn(Yt?.items_subtotal_price,Yt?.currency),t.createElement(vp,{className:"yt-cart-drawer",$isDev:F,$isOpen:e,$backgroundColor:r,$enableCustomCartOnCartPage:lt,$isCartPage:ct,$isLargeScreen:xn,$switchWidthVariant:It},Zt.cartLoading?t.createElement("div",{style:{backgroundColor:"#fff",width:"100%",height:"100%",alignItems:"center",justifyContent:"center",display:"flex",position:"absolute",opacity:0,zIndex:51}},Zt.showLoader&&!Zt.showSkeletonLoader&&t.createElement("div",{className:"loader"},"")):t.createElement(t.Fragment,null),t.createElement(t.Fragment,null,cn&&t.createElement("div",{style:{position:"fixed",inset:0,zIndex:40,backgroundColor:"rgba(128,128,128,0.7)"}},""),t.createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between"}},t.createElement("div",{style:{}},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",margin:"1rem 1rem 0px"}},t.createElement("span",{className:"yt-cart-title-container",style:{fontWeight:"var(--yt-cart-font-weight, bold)",color:ae,fontSize:"16px"}},t.createElement("span",{style:{whiteSpace:"nowrap",flexShrink:0}},u),Yt?.item_count>0&&W&&!(ve&&W)&&V>0&&t.createElement(yp,{pointsRewardRate:V,loyaltyIcon:T,brandTokenName:Bt,themeColor:ue,themeTextColor:me,rewardMultiplier:$}),yn>0&&t.createElement(wp,{$backgroundSubdued:a},yn)),t.createElement("div",{style:{display:"flex",gap:"8px",flexDirection:"row",alignItems:"center"}},!(lt&&ct)&&t.createElement("div",{className:"close-button",style:{backgroundColor:a||"#cacaca30"}},t.createElement(ut,{style:{height:"auto",width:"auto",color:ae},fontSize:24,cursor:"pointer",onClick:()=>n(!e)})))),Zt&&t.createElement(fp,{$themeColor:ue,show:Zt.showLoader}),wt?.enableCartOffersCarousel&&t.createElement(sp,{themeColor:ue,cartOffersCarousalData:wt,cartOffersCarouselHeight:At,cartData:Yt}),dt&&zn&&Yt?.item_count?t.createElement(Ws,{minutes:ft,customText:gt,onTimerComplete:()=>{In(!1),localStorage.setItem("cartTimerRanOnce","true"),localStorage.removeItem("timeLeft"),localStorage.removeItem("lastUpdate")}}):null,Xt&&Vt&&t.createElement(Vr,{particleCount:50,spread:90,origin:{y:.3}}),Be?t.createElement(yl,{inlineCartOfferInfoText:Be,inlineCartOfferInfoRedirectLink:ze,themeColor:ue,tooltipText:Ie,themeTextColor:me}):null),R&&Yt?.items_subtotal_price>0&&Yt?.currency&&!!L&&t.createElement(t.Fragment,null,t.createElement(wo,{customCartProgressBarCriteria:te??"minimum_order_value",handleCheckpointCrossed:ee,checkpoints:L,effectiveQuantityForProgressBar:void 0===Re?Yt?.item_count:Re,currentCartAmount:pn(void 0!==Pe?Pe:Yt?.items_subtotal_price,Yt.currency),themeColor:ue,themeTextColor:me,primaryTextColor:ae,secondaryTextColor:ie,showMOVForProgressTiers:ye,progressBarFreeProductIconType:it,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,prefixMessageText:Dt,suffixMessageText:_t,successMessageText:Nt,enableConfetti:Vt})),Yt?.item_count>0&&t.createElement("div",{style:{display:"flex",height:"12px",background:"#87878717"}}),0===Yt?.items?.length&&0===Yt?.item_count&&!1===Zt?.showSkeletonLoader?t.createElement($o,{showLoyaltyCta:ve,joinNowFunction:A,emptyCartTitle:m,emptyCartDescription:f,exploreCTAColor:s,isUserSignedIn:v,exploreCtaRedirectLink:Q,themeColor:ue,emptyCartButtons:g,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,themeTextColor:me,recProductsList:M,addCartItem:b,productRecsCtaButtonText:le,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,showVariantSelectionDropdownInProductRecs:Ne,emptyProductRecsTitleText:de,backgroundSubdued:a,showEmptyCartRecommendations:Ft,tertiaryColor:i,tertiaryTextColor:d}):t.createElement("div",{style:{display:"flex",flexDirection:"column",overflowY:"auto",flex:1,overflowX:"hidden",height:"100%",scrollbarWidth:"none"}},t.createElement(Za,{isDev:F,themeColor:ue,handleDecrement:y,handleIncrement:h,removeCartItem:x,addCartItem:b,primaryTextColor:ae,secondaryTextColor:ie,freeProduct:be,themeTextColor:me,showEditOptionOnProducts:De,productPercentageOffMapping:Le,productTagsMapping:je,removeFreebieFromCart:Ve,showDeleteOnFreebies:Qe,freebieCouponTemplates:Ge??[],freebieFlowCheckpoints:Ye??[],cartCheckpoints:L,freeProductAdjustedCartTotal:we,imageAspectSelector:yt,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,giftWrapVariantId:rt?.variants?.nodes[0]?.id,giftWrapProductId:nt?.giftProductId,showGiftWrapAsLineItem:nt?.showGiftWrapAsLineItem,backgroundSubdued:a,tertiaryColor:i,tertiaryTextColor:d,backgroundColor:r,showDiscountOnMRP:zt,checkoutSectionMessage:kt,checkoutSectionMessageRedirectLink:Wt,showFreebieMilestone:pt,freebieMilestoneData:mt}),xn&&se&&!!M&&M?.length>0&&Yt?.item_count>0&&b&&t.createElement(gr,{addCartItem:b,products:M,productRecsCtaButtonText:le,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,productRecsTitleText:ce,themeColor:ue,primaryTextColor:ae,secondaryTextColor:ie,showVariantSelectionDropdownInProductRecs:Ne,cardLayout:xt,variant:ht,cartComponentsCornerType:bt,cartComponentsCornerRadius:vt,backgroundSubdued:a,backgroundColor:r,tertiaryColor:i,tertiaryTextColor:d}),!xn&&pe&&!!M&&M?.length>0&&Yt?.item_count>0&&b&&t.createElement(gr,{addCartItem:b,products:M,productRecsCtaButtonText:le,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,productRecsTitleText:ce,themeColor:ue,primaryTextColor:ae,secondaryTextColor:ie,showVariantSelectionDropdownInProductRecs:Ne,cardLayout:xt,variant:ht,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,backgroundSubdued:a,tertiaryColor:i,tertiaryTextColor:d})),t.createElement(Vo,null,Yt?.item_count>0&&w&&E&&t.createElement(Ka,{bundleProducts:E}),xe&&!!he&&Yt?.item_count>0&&t.createElement(pi,{companyName:fe,gstNumber:ge,themeColor:ue,iconColor:Ct?.iconColor,showIcon:Ct?.showIcon,backgroundColor:Ct?.backgroundColor,textColor:Ct?.textColor,title:Ct?.title}),!!Yt&&Yt?.item_count>0&&!!Fe&&!!Ae&&!!Me&&Ae.length>0&&t.createElement(hl,{freebieProductsInCart:Ae,themeColor:ue,themeTextColor:me,primaryTextColor:ae,addFreebieToCart:Fe,freebiesInCart:Me,imageAspectSelector:yt,freebieCouponTemplates:Ge,freebieClaimData:Ze,cartCheckpoints:L,isCartDrawerOpen:e,shouldCheckInventoryQuantity:qt}),He&&(We?.length??0)>0&&!!qe&&Yt?.item_count>0&&t.createElement("div",{className:"form-group"},t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",margin:"6px 1rem 1rem 1rem"},onClick:()=>fn(!mn)},t.createElement("span",{style:{fontSize:"12px",display:"flex",gap:"5px",alignItems:"center"}},"Shipping ",t.createElement(st,null)),t.createElement("div",{className:"icon-transition"},mn?t.createElement(ot,null):t.createElement(at,null))),"all-products"===Xe&&mn?t.createElement(Ds,{postalCodeList:We,themeColor:ue,themeTextColor:me,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,disabledDates:Dn}):mn&&(sn?t.createElement(Ds,{postalCodeList:We,themeColor:ue,themeTextColor:me,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,disabledDates:Dn}):t.createElement(_s,{postalCodeList:We,themeColor:ue,themeTextColor:me,enableSlotPicker:Ke,disabledDates:Dn}))),$e&&!!Te&&Yt?.item_count>0&&t.createElement(ui,{note:Se,noteSectionTitle:Et}),nt?.showGiftWrapOption&&Yt?.item_count>0&&t.createElement(Ls,{themeColor:ue,id:nt?.giftProductId,detail:rt,showPrice:nt?.showPrice,errorText:nt?.errorText,customText:nt?.customText,showGiftIcon:nt?.showGiftIcon,addCartItem:b,removeCartItem:x}),Yt?.item_count>0&&jt&&!ve&&Lt&&t.createElement(bp,{backgroundSubdued:a,themeColor:ue,themeTextColor:me,primaryTextColor:ae,cartComponentsCornerRadius:vt,applyCouponCode:Lt,removeDiscount:I,enableConfetti:Vt}),Yt?.item_count>0&&C&&D&&!$t&&q&&_&&_?.length>0?t.createElement(t.Fragment,null,v||v&&J?t.createElement(pa,{themeColor:ue,showGuestDiscountCoupon:U,guestRewardCoupon:H,ref:bn,discountAmountOff:k,userTotalPoints:N??0,applyDiscount:D,applyTemplateDiscount:q,rewardCoupons:_,isCouponSelectionOpen:cn,setIsCouponSelectionOpen:dn,pointsToBeUsed:S,joinNowFunction:A,guestLoyaltyPercentage:O,isUserSignedIn:v,showDiscountsListToGuestUsers:K}):!!O&&ve&&!!A&&t.createElement(Lo,{cartSigninCTAMainText:ke,signinCTAButtonVisible:Ee,guestLoyaltyPercentage:O,joinNowFunction:A,themeColor:ue,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,showCartLevelAltPay:W})):Yt?.item_count>0&&t.createElement(t.Fragment,null,v||!ve||$t?!$t&&Yt?.item_count>0&&void 0!==k&&void 0!==S&&!!T&&ve&&!!D&&t.createElement(aa,{themeColor:ue,applyDiscount:D,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,minimumOrderValueToAvailDiscount:Ce,brandTokenName:Bt,showCartLevelAltPay:W,redemptionMultiplier:B}):Yt?.item_count>0&&!!O&&!!A&&t.createElement(Lo,{cartSigninCTAMainText:ke,signinCTAButtonVisible:Ee,themeColor:ue,joinNowFunction:A,guestLoyaltyPercentage:O,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,showCartLevelAltPay:W})),Yt?.item_count>0&&!!$t&&!!I&&ve&&$t&&void 0!==S&&t.createElement(ta,{themeColor:ue,removeDiscount:I,loyaltyDiscount:$t,isDev:F,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,pointsToBeUsed:S,brandTokenName:Bt,showCartLevelAltPay:W}),ve&&W&&j&&T&&Yt?.item_count>0&&t.createElement(xp,{loyaltyIcon:T,backgroundSubdued:a,primaryTextColor:ae,pointsRewardRate:V,rewardMultiplier:$}),ve&&Yt&&Yt.item_count>0&&!!Ce&&Ce>1&&t.createElement("span",{className:"yt-cart-loyalty-mov-text",style:{fontSize:"10px",color:ue??"#50D1AA",fontWeight:600,display:"flex",justifyContent:Ee?"space-between":"center"}},"Minimum order value to use ",Bt,":"," ",Ce),Yt&&P&&Yt?.item_count>0&&t.createElement("div",null,t.createElement(Ao,{disableCheckoutButton:!!Ot||Zt.cartLoading,discountApplied:z,checkoutFunction:P,checkoutButtonColor:ne,checkoutFontSize:p,discountInCheckoutButton:Z,isStickyCheckout:X,discountAmountApplied:G,minimumCartValue:Y,themeTextColor:me,applyGSTToCart:he,showGSTOption:xe,applyNoteToCart:Te,showNoteOption:$e,enableGeoLocationDeliveryRestriction:He,applyPostalCodeAndDeliverySlotToCart:qe,enableSlotPicker:Ke,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,checkoutSectionMessage:kt,checkoutSectionMessageDisplay:Tt,checkoutSectionMessageRedirectLink:Wt,showDiscountOnMRP:zt,tertiaryColor:i,tertiaryTextColor:d,cartCheckpoints:L,toggleDecimal:Pt,checkoutButtonBottomSpacing:Mt,showPoweredByBadge:Rt,showCheckoutButtonPaymentIcons:Ht,primaryTextColor:ae}))))))},Ep=h.div`
|
|
2238
|
+
`,Cp=({isOpen:e,setIsOpen:n,backgroundColor:r="white",backgroundSubdued:a="#3947821F",tertiaryColor:i="#067D431A",tertiaryTextColor:d="#000000",exploreCTAColor:s,checkoutFontSize:p,cartTitle:u="My Cart",emptyCartTitle:m,emptyCartDescription:f,emptyCartButtons:g,removeCartItem:x,handleIncrement:h,handleDecrement:y,addCartItem:b,isUserSignedIn:v,showBundle:w,showCouponOptions:C,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:B,discountApplied:z,removeDiscount:I,applyDiscount:D,rewardCoupons:_,userTotalPoints:N,checkoutFunction:P,joinNowFunction:A,guestLoyaltyPercentage:O,isDev:F,recProductsList:M,showMultiStepProgressBar:R,cartCheckpoints:L,redemptionRate:j,pointsRewardRate:V,showCartLevelAltPay:W,guestRewardCoupon:H,showGuestDiscountCoupon:U,applyTemplateDiscount:q,exploreCtaRedirectLink:Q,discountAmountApplied:G,minimumCartValue:Y,discountInCheckoutButton:Z,isStickyCheckout:X,showDiscountsListToGuestUsers:K,showApplyCouponsButtonToGuestUsers:J,handleCheckpointCrossed:ee,customCartProgressBarCriteria:te,checkoutButtonColor:ne="#252E69",ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,productRecsCtaButtonText:le,productRecsTitleText:ce,emptyProductRecsTitleText:de,showProductRecsOnDesktop:se,showProductRecsOnMobile:pe,themeColor:ue,themeTextColor:me,companyName:fe,gstNumber:ge,showGSTOption:xe,applyGSTToCart:he,showMOVForProgressTiers:ye,freeProduct:be,showLoyaltyCta:ve=!1,freeProductAdjustedCartTotal:we,minimumOrderValueToAvailDiscount:Ce,signinCTAButtonVisible:Ee,cartSigninCTAMainText:ke,applyNoteToCart:Te,note:Se,showNoteOption:$e,inlineCartOfferInfoText:Be,inlineCartOfferInfoRedirectLink:ze,cartOfferTermsAndConditionsText:Ie,showEditOptionOnProducts:De,onSetLoading:_e,showVariantSelectionDropdownInProductRecs:Ne,originalCartSubtotal:Pe,freebieProductsInCart:Ae,showFreebieClaim:Oe,addFreebieToCart:Fe,freebiesInCart:Me,effectiveQuantityForProgressBar:Re,productPercentageOffMapping:Le,productTagsMapping:je,removeFreebieFromCart:Ve,postalCodeList:We,enableGeoLocationDeliveryRestriction:He=!1,getProductDetailsByVariantId:Ue,applyPostalCodeAndDeliverySlotToCart:qe,showDeleteOnFreebies:Qe,freebieCouponTemplates:Ge,freebieFlowCheckpoints:Ye,freebieClaimData:Ze,postalCodeBasedItemTrackingParameter:Xe,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:rt,progressBarFreeProductIconType:it,enableCustomCartOnCartPage:lt,isCartPage:ct,showCartTimer:dt,showFreebieMilestone:pt,freebieMilestoneData:mt,cartTimerInMinutes:ft,cartTimerCustomText:gt,productRecsCardLayout:xt,productRecsCardListVariant:ht,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:vt,cartOffersCarousalData:wt,gstSectionCustomizationData:Ct,noteSectionTitle:Et,checkoutSectionMessage:kt,checkoutSectionMessageDisplay:Tt,showVariantSelectionDropdownInProductClaim:St,loyaltyDiscount:$t,brandTokenName:Bt,showDiscountOnMRP:zt,switchWidthVariant:It,prefixMessageText:Dt,suffixMessageText:_t,successMessageText:Nt,toggleDecimal:Pt,cartOffersCarouselHeight:At,disableCheckoutButton:Ot,showEmptyCartRecommendations:Ft=!1,checkoutButtonBottomSpacing:Mt,showPoweredByBadge:Rt,applyCouponCode:Lt,showApplyCoupon:jt,enableConfetti:Vt,checkoutSectionMessageRedirectLink:Wt,showCheckoutButtonPaymentIcons:Ht,shouldCheckInventoryQuantity:qt})=>{const Yt=Ut(Gt),Zt=Ut(nn),[Xt,ln]=c(!1),[cn,dn]=Qt(an),[sn,un]=c(!1),[mn,fn]=c(!0),{setLoading:gn}=rn();t.useEffect((()=>{_e&&_e(gn)}),[_e]),l((()=>{const t=()=>{n(!1)};return e&&(window.history.pushState({ytCustomCartDrawer:"open"},""),window.addEventListener("popstate",t)),()=>{window.removeEventListener("popstate",t),"open"===window.history.state?.ytCustomCartDrawer&&window.history.back()}}),[e,n]);const[xn,hn]=c(!1);l((()=>{function e(){const e=window.innerWidth;hn(e>=450)}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const yn=Yt?.items?.reduce(((e,t)=>e+t?.quantity),0),bn=o(null);l((()=>{function e(e){bn.current&&!bn.current.contains(e.target)&&dn(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]),l((()=>{const e=()=>{ln(!0),window.setTimeout((()=>ln(!1)),3e3)};return window.addEventListener("yt:autoFreebieAdded",e),()=>window.removeEventListener("yt:autoFreebieAdded",e)}),[]);const[vn,wn]=c("normal"),[Cn,En]=c("normal"),[kn,Tn]=c("auto");l((()=>{CSS.supports("font-weight","500")?wn("500"):CSS.supports("font-weight","400")?wn("400"):CSS.supports("font-weight","600")&&wn("600"),CSS.supports("font-weight","400")?En("400"):CSS.supports("font-weight","300")?En("300"):CSS.supports("font-weight","200")&&En("200"),CSS.supports("width","-webkit-fill-available")?Tn("-webkit-fill-available"):CSS.supports("width","-moz-available")&&Tn("-moz-available")}),[]),l((()=>{document.documentElement.style.setProperty("--yt-cart-font-weight",vn),document.documentElement.style.setProperty("--yt-cart-product-rec-price-font-weight",Cn),document.documentElement.style.setProperty("--yt-cart-custom-fill-width",kn)}),[vn,Cn]);const[Sn]=Qt(Kt);Ut(Jt);const[$n]=Qt(tn),[Bn]=Qt(en);l((()=>{const e=Yt?.items.some((e=>(je?.get(String(e.product_id))||[]).includes("Delhi-NCR")));un(e)}),[Yt?.items,je]);l((()=>{fn(!("all-products"!==Xe&&("specific-tags"!==Xe||Sn.isPostalCodeValid||Ke)&&("specific-tags"!==Xe||Sn.isPostalCodeValid||$n||!Ke)&&("specific-tags"===Xe&&"standard"===Bn||sn&&(Ke?Sn.isPostalCodeValid&&$n:Sn.isPostalCodeValid))))}),[Sn.isPostalCodeValid,$n,sn,Xe,Ke]),Qt(on);const[zn,In]=c(!0);l((()=>{"true"===localStorage.getItem("cartTimerRanOnce")&&In(!1);const e=localStorage.getItem("cartTimerTimeLeft");e&&parseInt(e,10)<=0&&In(!1)}),[]);const Dn=new Date("2024-11-01");return pn(Yt?.items_subtotal_price,Yt?.currency),t.createElement(vp,{className:"yt-cart-drawer",$isDev:F,$isOpen:e,$backgroundColor:r,$enableCustomCartOnCartPage:lt,$isCartPage:ct,$isLargeScreen:xn,$switchWidthVariant:It},Zt.cartLoading?t.createElement("div",{style:{backgroundColor:"#fff",width:"100%",height:"100%",alignItems:"center",justifyContent:"center",display:"flex",position:"absolute",opacity:0,zIndex:51}},Zt.showLoader&&!Zt.showSkeletonLoader&&t.createElement("div",{className:"loader"},"")):t.createElement(t.Fragment,null),t.createElement(t.Fragment,null,cn&&t.createElement("div",{style:{position:"fixed",inset:0,zIndex:40,backgroundColor:"rgba(128,128,128,0.7)"}},""),t.createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between"}},t.createElement("div",{style:{}},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",margin:"1rem 1rem 0px"}},t.createElement("span",{className:"yt-cart-title-container",style:{fontWeight:"var(--yt-cart-font-weight, bold)",color:ae,fontSize:"16px"}},t.createElement("span",{style:{whiteSpace:"nowrap",flexShrink:0}},u),Yt?.item_count>0&&W&&!(ve&&W)&&V>0&&t.createElement(yp,{pointsRewardRate:V,loyaltyIcon:T,brandTokenName:Bt,themeColor:ue,themeTextColor:me,rewardMultiplier:$}),yn>0&&t.createElement(wp,{$backgroundSubdued:a},yn)),t.createElement("div",{style:{display:"flex",gap:"8px",flexDirection:"row",alignItems:"center"}},!(lt&&ct)&&t.createElement("div",{className:"close-button",style:{backgroundColor:a||"#cacaca30"}},t.createElement(ut,{style:{height:"auto",width:"auto",color:ae},fontSize:24,cursor:"pointer",onClick:()=>n(!e)})))),Zt&&t.createElement(fp,{$themeColor:ue,show:Zt.showLoader}),wt?.enableCartOffersCarousel&&t.createElement(sp,{themeColor:ue,cartOffersCarousalData:wt,cartOffersCarouselHeight:At,cartData:Yt}),dt&&zn&&Yt?.item_count?t.createElement(Ws,{minutes:ft,customText:gt,onTimerComplete:()=>{In(!1),localStorage.setItem("cartTimerRanOnce","true"),localStorage.removeItem("timeLeft"),localStorage.removeItem("lastUpdate")}}):null,Xt&&Vt&&t.createElement(Vr,{particleCount:50,spread:90,origin:{y:.3}}),Be?t.createElement(yl,{inlineCartOfferInfoText:Be,inlineCartOfferInfoRedirectLink:ze,themeColor:ue,tooltipText:Ie,themeTextColor:me}):null),R&&Yt?.items_subtotal_price>0&&Yt?.currency&&!!L&&t.createElement(t.Fragment,null,t.createElement(wo,{customCartProgressBarCriteria:te??"minimum_order_value",handleCheckpointCrossed:ee,checkpoints:L,effectiveQuantityForProgressBar:void 0===Re?Yt?.item_count:Re,currentCartAmount:pn(void 0!==Pe?Pe:Yt?.items_subtotal_price,Yt.currency),themeColor:ue,themeTextColor:me,primaryTextColor:ae,secondaryTextColor:ie,showMOVForProgressTiers:ye,progressBarFreeProductIconType:it,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,prefixMessageText:Dt,suffixMessageText:_t,successMessageText:Nt,enableConfetti:Vt})),Yt?.item_count>0&&t.createElement("div",{style:{display:"flex",height:"12px",background:"#87878717"}}),0===Yt?.items?.length&&0===Yt?.item_count&&!1===Zt?.showSkeletonLoader?t.createElement($o,{showLoyaltyCta:ve,joinNowFunction:A,emptyCartTitle:m,emptyCartDescription:f,exploreCTAColor:s,isUserSignedIn:v,exploreCtaRedirectLink:Q,themeColor:ue,emptyCartButtons:g,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,themeTextColor:me,recProductsList:M,addCartItem:b,productRecsCtaButtonText:le,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,showVariantSelectionDropdownInProductRecs:Ne,emptyProductRecsTitleText:de,backgroundSubdued:a,showEmptyCartRecommendations:Ft,tertiaryColor:i,tertiaryTextColor:d}):t.createElement("div",{style:{display:"flex",flexDirection:"column",overflowY:"auto",flex:1,overflowX:"hidden",height:"100%",scrollbarWidth:"none"}},t.createElement(Za,{isDev:F,themeColor:ue,handleDecrement:y,handleIncrement:h,removeCartItem:x,addCartItem:b,primaryTextColor:ae,secondaryTextColor:ie,freeProduct:be,themeTextColor:me,showEditOptionOnProducts:De,productPercentageOffMapping:Le,productTagsMapping:je,removeFreebieFromCart:Ve,showDeleteOnFreebies:Qe,freebieCouponTemplates:Ge??[],freebieFlowCheckpoints:Ye??[],cartCheckpoints:L,freeProductAdjustedCartTotal:we,imageAspectSelector:yt,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,giftWrapVariantId:rt?.variants?.nodes[0]?.id,giftWrapProductId:nt?.giftProductId,showGiftWrapAsLineItem:nt?.showGiftWrapAsLineItem,backgroundSubdued:a,tertiaryColor:i,tertiaryTextColor:d,backgroundColor:r,showDiscountOnMRP:zt,checkoutSectionMessage:kt,checkoutSectionMessageRedirectLink:Wt,showFreebieMilestone:pt,freebieMilestoneData:mt}),xn&&se&&!!M&&M?.length>0&&Yt?.item_count>0&&b&&t.createElement(gr,{addCartItem:b,products:M,productRecsCtaButtonText:le,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,productRecsTitleText:ce,themeColor:ue,primaryTextColor:ae,secondaryTextColor:ie,showVariantSelectionDropdownInProductRecs:Ne,cardLayout:xt,variant:ht,cartComponentsCornerType:bt,cartComponentsCornerRadius:vt,backgroundSubdued:a,backgroundColor:r,tertiaryColor:i,tertiaryTextColor:d}),!xn&&pe&&!!M&&M?.length>0&&Yt?.item_count>0&&b&&t.createElement(gr,{addCartItem:b,products:M,productRecsCtaButtonText:le,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,productRecsTitleText:ce,themeColor:ue,primaryTextColor:ae,secondaryTextColor:ie,showVariantSelectionDropdownInProductRecs:Ne,cardLayout:xt,variant:ht,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,backgroundSubdued:a,tertiaryColor:i,tertiaryTextColor:d})),t.createElement(Vo,null,Yt?.item_count>0&&w&&E&&t.createElement(Ka,{bundleProducts:E}),xe&&!!he&&Yt?.item_count>0&&t.createElement(pi,{companyName:fe,gstNumber:ge,themeColor:ue,iconColor:Ct?.iconColor,showIcon:Ct?.showIcon,backgroundColor:Ct?.backgroundColor,textColor:Ct?.textColor,title:Ct?.title}),!!Yt&&Yt?.item_count>0&&!!Fe&&!!Ae&&!!Me&&Ae.length>0&&t.createElement(hl,{freebieProductsInCart:Ae,themeColor:ue,themeTextColor:me,primaryTextColor:ae,addFreebieToCart:Fe,freebiesInCart:Me,imageAspectSelector:yt,freebieCouponTemplates:Ge,freebieClaimData:Ze,cartCheckpoints:L,isCartDrawerOpen:e,shouldCheckInventoryQuantity:qt}),He&&(We?.length??0)>0&&!!qe&&Yt?.item_count>0&&t.createElement("div",{className:"form-group"},t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",margin:"6px 1rem 1rem 1rem"},onClick:()=>fn(!mn)},t.createElement("span",{style:{fontSize:"12px",display:"flex",gap:"5px",alignItems:"center"}},"Shipping ",t.createElement(st,null)),t.createElement("div",{className:"icon-transition"},mn?t.createElement(ot,null):t.createElement(at,null))),"all-products"===Xe&&mn?t.createElement(Ds,{postalCodeList:We,themeColor:ue,themeTextColor:me,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,disabledDates:Dn}):mn&&(sn?t.createElement(Ds,{postalCodeList:We,themeColor:ue,themeTextColor:me,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,disabledDates:Dn}):t.createElement(_s,{postalCodeList:We,themeColor:ue,themeTextColor:me,enableSlotPicker:Ke,disabledDates:Dn}))),$e&&!!Te&&Yt?.item_count>0&&t.createElement(ui,{note:Se,noteSectionTitle:Et}),nt?.showGiftWrapOption&&Yt?.item_count>0&&t.createElement(Ls,{themeColor:ue,id:nt?.giftProductId,detail:rt,showPrice:nt?.showPrice,errorText:nt?.errorText,customText:nt?.customText,showGiftIcon:nt?.showGiftIcon,addCartItem:b,removeCartItem:x}),Yt?.item_count>0&&jt&&!ve&&Lt&&t.createElement(bp,{backgroundSubdued:a,themeColor:ue,themeTextColor:me,primaryTextColor:ae,cartComponentsCornerRadius:vt,applyCouponCode:Lt,removeDiscount:I,enableConfetti:Vt}),Yt?.item_count>0&&C&&D&&!$t&&q&&_&&_?.length>0?t.createElement(t.Fragment,null,v||v&&J?t.createElement(pa,{themeColor:ue,showGuestDiscountCoupon:U,guestRewardCoupon:H,ref:bn,discountAmountOff:k,userTotalPoints:N??0,applyDiscount:D,applyTemplateDiscount:q,rewardCoupons:_,isCouponSelectionOpen:cn,setIsCouponSelectionOpen:dn,pointsToBeUsed:S,joinNowFunction:A,guestLoyaltyPercentage:O,isUserSignedIn:v,showDiscountsListToGuestUsers:K}):!!O&&ve&&!!A&&t.createElement(Lo,{cartSigninCTAMainText:ke,signinCTAButtonVisible:Ee,guestLoyaltyPercentage:O,joinNowFunction:A,themeColor:ue,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,showCartLevelAltPay:W})):Yt?.item_count>0&&t.createElement(t.Fragment,null,v||!ve||$t?!$t&&Yt?.item_count>0&&void 0!==k&&void 0!==S&&!!T&&ve&&!!D&&t.createElement(aa,{themeColor:ue,applyDiscount:D,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,minimumOrderValueToAvailDiscount:Ce,brandTokenName:Bt,showCartLevelAltPay:W,redemptionMultiplier:B}):Yt?.item_count>0&&!!O&&!!A&&t.createElement(Lo,{cartSigninCTAMainText:ke,signinCTAButtonVisible:Ee,themeColor:ue,joinNowFunction:A,guestLoyaltyPercentage:O,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,showCartLevelAltPay:W})),Yt?.item_count>0&&!!$t&&!!I&&ve&&$t&&void 0!==S&&t.createElement(ta,{themeColor:ue,removeDiscount:I,loyaltyDiscount:$t,isDev:F,ctaButtonBackgroundColor:re,ctaButtonTextColor:oe,primaryTextColor:ae,secondaryTextColor:ie,pointsToBeUsed:S,brandTokenName:Bt,showCartLevelAltPay:W}),ve&&W&&j&&T&&Yt?.item_count>0&&t.createElement(xp,{loyaltyIcon:T,backgroundSubdued:a,primaryTextColor:ae,pointsRewardRate:V,rewardMultiplier:$}),ve&&Yt&&Yt.item_count>0&&!!Ce&&Ce>1&&t.createElement("span",{className:"yt-cart-loyalty-mov-text",style:{fontSize:"10px",color:ue??"#50D1AA",fontWeight:600,display:"flex",justifyContent:Ee?"space-between":"center"}},"Minimum order value to use ",Bt,":"," ",Ce),Yt&&P&&Yt?.item_count>0&&t.createElement("div",null,t.createElement(Ao,{disableCheckoutButton:!!Ot||Zt.cartLoading,discountApplied:z,checkoutFunction:P,checkoutButtonColor:ne,checkoutFontSize:p,discountInCheckoutButton:Z,isStickyCheckout:X,discountAmountApplied:G,minimumCartValue:Y,themeTextColor:me,applyGSTToCart:he,showGSTOption:xe,applyNoteToCart:Te,showNoteOption:$e,enableGeoLocationDeliveryRestriction:He,applyPostalCodeAndDeliverySlotToCart:qe,enableSlotPicker:Ke,cartComponentsCornerRadius:vt,cartComponentsCornerType:bt,checkoutSectionMessage:kt,checkoutSectionMessageDisplay:Tt,checkoutSectionMessageRedirectLink:Wt,showDiscountOnMRP:zt,tertiaryColor:i,tertiaryTextColor:d,cartCheckpoints:L,toggleDecimal:Pt,checkoutButtonBottomSpacing:Mt,showPoweredByBadge:Rt,showCheckoutButtonPaymentIcons:Ht,primaryTextColor:ae}))))))},Ep=h.div`
|
|
2239
2239
|
position: relative;
|
|
2240
2240
|
`,kp=h.button`
|
|
2241
2241
|
border: 1px solid #ccc;
|