yt-uikit 0.9.9 → 0.9.10
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 +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -2923,7 +2923,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
|
|
|
2923
2923
|
text-align: center;
|
|
2924
2924
|
display: flex;
|
|
2925
2925
|
flex-shrink: 0;
|
|
2926
|
-
`,Ic=({tiers:t,isMobile:n=!1,selectedProductsByTier:o,selectedProducts:r,themeColor:i,showProductDetailsInTracker:a,handleRemoveItemProductTier:l,cornerRadius:c,currencySymbol:s})=>e.createElement(e.Fragment,null,t.map((i,d)=>{const p=i.minimumQuantity-(o[d]?.length??0),u=r?.filter(e=>e.tierIndex===d);return Math.min(o[d]?.length/i.minimumQuantity*100,100),e.createElement("div",{className:"yt-byob-tracker-product-list-tier-wrapper",style:{display:"flex",width:"100%"}},e.createElement("div",{className:"yt-byob-tracker-product-list-tier-items"},e.createElement("div",{className:"yt-byob-tracker-product-list-items",style:{display:"flex",gap:"5px"}},u?.map?.(t=>{const r=t.product.variants?.edges?.find(e=>e.node.id===t.variantId),p=o[d]?.filter(e=>e===r?.node.id).length||0;return a?e.createElement(zc,{className:"yt-byob-tracker-detailed-product-item",key:t.variantId},e.createElement(uc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.isFree&&e.createElement("div",{style:{position:"absolute",bottom:4,left:"30%",background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"40px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},"FREE",e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),t?.quantity>1&&e.createElement(sc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},t.quantity,"x")),e.createElement(gc,{className:"yt-byob-tracker-info-block"},e.createElement(xc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(fc,{className:"yt-byob-tracker-product-price"},s,_p(r?.node?.price)),e.createElement(dc,{className:"yt-byob-tracker-remove-detailed-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Bc,{className:"yt-byob-tracker-product-list-item",isMobile:n,borderRadius:c,imageUrl:r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url,style:{borderRadius:c||"12px"}},t?.isFree&&e.createElement("div",{style:{position:"absolute",top:4,left:4,background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"8px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},e.createElement(it,null),e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),p>1&&e.createElement(sc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},p,"x"),e.createElement(dc,{className:"yt-byob-tracker-remove-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(J,{fontSize:"12px"}))))}),p>=1&&[...Array(p)].map((t,o)=>e.createElement(bc,{className:"yt-byob-tracker-placeholder-box",isMobile:n,borderRadius:c,key:o},e.createElement(De,{size:40,color:"#A0A0A0"}))))),d<t.length-1&&e.createElement(Nc,{className:"yt-byob-tracker-plus-icon-container"},e.createElement(De,{size:"16px",style:{backgroundColor:"#f2f2f2"}})))})),Fc=({builderTiers:o,handleAddToCart:r,minimumQuantity:i,selectedProducts:a,showProductDetailsInTracker:l,loading:c,handleRemoveItem:s,percentageOff:d,selectedItemsQuantity:p,bundleSubtotal:u,amountOff:m,styles:g,dealAmount:x,isMobile:f=!1,themeColor:y,cornerRadiusType:b,primaryTextColorCta:h,handleRemoveItemProductTier:v,selectedProductsByTier:w,storeCurrencyCode:C,isUploading:E,showNextStep:k})=>{const[T,S]=t(!1),[$,B]=t(0),[z,N]=t([]),[I,F]=t(0),[P,D]=t(0),[A,_]=t(!1),[R,O]=t(null),L=u?.price||0,M=o?.type,V=e=>{if(e<0||!z[e])return L;const t=z[e].discountValue??0;return d?L*(1-t/100):x?t:m?L-t:L};n(()=>{if(o&&"none"!==o.type)if("productTier"===M&&o.productTier){const e=o.productTier||[];N(e);let t=0;o.productTier.map(e=>{t+=e.minimumQuantity}),D(t-p)}else if(z.length)I>0&&p<z[I-1]?.minimumQuantity?(F(I-1),O(I-1)):p<z[I]?.minimumQuantity&&O(I-1),B(V(I));else{const e=o.offerTier||[];N(e),F(0),D(e[0]?.minimumQuantity-p||i-p)}else N([]),D(i-p),F(0)},[o,i,p]),n(()=>{z.length&&"productTier"!=M?(()=>{if(!z?.length)return;let e=-1,t=null,n=0;if("offerTier"===M)for(let o=0;o<z.length&&(n+=z[o].minimumQuantity,p>=n);o++)t=o,e=o+1<z.length?o+1:o;if(F(e),O(t),null!==t){let e=z.slice(0,t+1).reduce((e,t)=>e+t.minimumQuantity,0);_(e===p),S(!0),B(V(t))}else _(!1),S(!1),B(L);const o=e>=0&&e<z.length?z.slice(0,e+1).reduce((e,t)=>e+t.minimumQuantity,0)-p:z[0].minimumQuantity-p;D(o)})():p===i?(S(!0),B(d?L*(1-d/100):x||(m?L-m:L)),_(!0)):(_(!1),S(!1))},[p,z]);const j=T?Math.max(u?.compareAtPrice,u?.price):u?.compareAtPrice>u?.price?u?.compareAtPrice:null,W=T?$.toFixed(2):u?.price?.toFixed(2),H=j&&W?(j-Number(W)).toFixed(2):0,q=o&&"none"!==M&&o.offerTier?"offerTier"===M?Math.min(p/(p+P)*100,100):void 0:p/i*100;n(()=>{if(T&&g.byob.enableConfetti){console.log("remainingItems",P);const e=document.getElementById("checkoutButton");if(!e)return;const t=e.getBoundingClientRect(),n=(t.left+t.width/2)/window.innerWidth,o=(t.top+t.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:n,y:o},zIndex:9999})}},[T,g]),I>=0&&I<z.length&&z[I].tier;const Q=e.useMemo(()=>null!==R&&z[R+1]?z[R+1]?.customText||"":o?.offerTier?.[0]?.customText||"",[R,z,o]),U="number"==typeof R?z[R]?.customText:void 0,Y="string"==typeof U&&""!==U.trim();return e.createElement(ec,{className:"yt-byob-tracker-container bundle-builder-tracker-container "+(f?"yt-byob-tracker-mobile":"yt-byob-tracker-desktop"),isMobile:f,style:{justifyContent:g.byob.selectedProductsVisibility&&!f?"space-between":"center"}},"offerTier"==M&&null!==R&&R>=0&&e.createElement(tc,{className:"yt-byob-tracker-offer-tier-tag"},Y?e.createElement(e.Fragment,null,U," unlocked"):e.createElement(e.Fragment,null,e.createElement(e.Fragment,null,"Buy"," ",z.slice(0,R+1).reduce((e,t)=>e+t.minimumQuantity,0)," ","at",m||x?e.createElement(e.Fragment,null," ",Rp(g.general.currencySymbol,C)):""," ",_p(z[R]?.discountValue),d?e.createElement(e.Fragment,null,"% "):_p(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):""),e.createElement("span",{style:{fontStyle:"italic"}}," applied"))),f&&P>=1&&!A&&"offerTier"!==M?e.createElement(nc,{className:"yt-byob-tracker-mobile-remaining",style:{margin:"0"}},0===z.length?e.createElement(e.Fragment,null,"Select ",P," more item(s)"," ",0!==x||0!==d?"to get the bundle at":"",0!==x&&e.createElement(e.Fragment,null,` ${Rp(g.general.currencySymbol,C)}${x}`),d&&0!==d&&e.createElement(e.Fragment,null," ",` ${d}% Off`)):e.createElement(e.Fragment,null," Select ",P," more item(s)")):e.createElement(e.Fragment,null),"productTier"!==M&&e.createElement(oc,{className:"yt-byob-tracker-tier-progress-container"},e.createElement(rc,{className:"yt-byob-tracker-tier-progress-text"},"offerTier"==M&&z.length>0&&P>0&&e.createElement(e.Fragment,null,Q?e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," more to unlock ",Q):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," More Item(s)",e.createElement("span",{style:{fontWeight:"500"}}," to "),"Buy ",p+P," at"," ",m||x?e.createElement(e.Fragment,null,Rp(g.general.currencySymbol,C)):""," ",_p(z[I>=0?I:0]?.discountValue),d?e.createElement(e.Fragment,null,"% "):_p(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):"")))),e.createElement(ic,{className:"yt-byob-tracker-progress-bar-bg"},e.createElement(ac,{className:"yt-byob-tracker-progress-bar-fill bundle-builder-tracker-progress",progressPercentage:q??0,primaryColor:y??g?.general.primaryColor}," "))),g.byob.selectedProductsVisibility&&e.createElement(lc,{className:"yt-byob-tracker-product-list-wrapper hide-tracker-scrollbar "+(f?"yt-byob-tracker-mobile-product-list":"yt-byob-tracker-desktop-product-list"),tierType:M??"",isMobile:f},"productTier"===M?e.createElement(Ic,{tiers:z,isMobile:f,selectedProductsByTier:w??{},selectedProducts:a,themeColor:g.general.primaryColor,showProductDetailsInTracker:l,handleRemoveItemProductTier:v,cornerRadius:g.byob.borderRadius,currencySymbol:Rp(g.general.currencySymbol,C)}):e.createElement(e.Fragment,null,a?.map?.(t=>{const n=t.product.variants?.edges?.find(e=>e.node.id===t.variantId);return l?e.createElement(pc,{className:"yt-byob-tracker-detailed-item-container",borderRadius:g.byob.borderRadius,key:t.variantId},e.createElement(uc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.quantity>1&&e.createElement(mc,{className:"yt-byob-tracker-badge"},t.quantity,"x")),e.createElement(gc,{className:"yt-byob-tracker-info-block"},e.createElement(xc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(fc,{className:"yt-byob-tracker-product-price"},g.general.currencySymbol,n?.node?.price),e.createElement(yc,{className:"yt-byob-tracker-remove-link",onClick:()=>s(t.variantId)},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement($c,{className:"yt-byob-tracker-item bundle-builder-tracker-item",isMobile:f,borderRadius:g.byob.borderRadius,imageUrl:n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url},t?.quantity>1&&e.createElement(sc,{className:"yt-byob-tracker-quantity-badge",borderRadius:g.byob.borderRadius},t.quantity,"x"),e.createElement(dc,{className:"yt-byob-tracker-remove-btn",onClick:()=>s(t.variantId)},e.createElement(J,{fontSize:"12px"}))))}),P>=1&&[...Array(P)].map((t,n)=>e.createElement(bc,{className:"yt-byob-tracker-placeholder-box",isMobile:f,borderRadius:g.byob.borderRadius,key:n},e.createElement(De,{size:40,color:"#A0A0A0"}))))),(!f||A)&&e.createElement(cc,{className:"yt-byob-tracker-summary-container bundle-summary "+(f?"yt-byob-tracker-mobile-summary":"yt-byob-tracker-desktop-summary"),isMobile:f},Number(W)>0&&e.createElement(hc,{className:"yt-byob-tracker-summary-info summary-info"},e.createElement("div",{className:"yt-byob-tracker-summary-info-content",style:{display:"flex",...window.innerWidth<=600&&{flexDirection:"column"},gap:"5px",justifyContent:"center"}},f?e.createElement("div",{className:"yt-byob-tracker-mobile-subtotal-row",style:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center"}},e.createElement(vc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&e.createElement(wc,{className:"yt-byob-tracker-save-label",style:{}},"Save:"," ",Rp(g.general.currencySymbol,C),_p(H))):e.createElement(e.Fragment,null,e.createElement(vc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&!f&&e.createElement(wc,{className:"yt-byob-tracker-save-label"},"Save:"," ",Rp(g.general.currencySymbol,C),_p(H)))),e.createElement(Cc,{className:"yt-byob-tracker-subtotal-row"},e.createElement(Ec,{className:"yt-byob-tracker-final-price"},Rp(g.general.currencySymbol,C),Number(W)>=0?_p(Number(W).toFixed(2)):0),j&&g.byob.compareAtPriceVisibility&&Number(j)>Number(W)&&e.createElement(kc,{className:"yt-byob-tracker-line-through-price"},Rp(g.general.currencySymbol,C),_p(Number(j).toFixed(2))))),e.createElement(Tc,{className:"yt-byob-tracker-checkout-button yt-tracking-bar-checkout-button",canCheckout:A,progressPercentage:q??0,ctaColors:{ctaBackgroundColor:g.general.ctaBackgroundColor,ctaBorderColor:g.general.ctaBorderColor,ctaHoverBackgroundColor:g.general.ctaHoverBackgroundColor,ctaHoverTextColor:g.general.ctaHoverTextColor},borderRadius:g.general.ctaBorderRadius,disabled:!A&&P>=1||E,onClick:e=>{c||console.log("saving"),r(e.target??e.currentTarget)},id:"checkoutButton"},c?e.createElement(ue,{color:"black",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):P>=1&&!A?e.createElement("div",{className:"yt-byob-tracker-add-more-btn-text yt-tracking-bar-checkout-button-items-text",style:{color:g.general.primaryColor}},"Add ",P," More Item(s)"):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement(Sc,{className:"yt-byob-tracker-checkout-text yt-tracking-bar-checkout-button-text",ctaTextColor:g.general.ctaTextColor,ctaHoverTextColor:h??g.general.ctaHoverTextColor},k?"Next Step":g.byob.checkoutCTAText??"Checkout"),!k&&g?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"})))))))},Pc={8087437412:{position:"fixed",bottom:"10px",zIndex:100,width:"95%",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"50px"}},66134737152:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},83438567714:{zIndex:100,position:"fixed",width:"95%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},72726479068:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px",mobile:{bottom:"70px"}},64800161992:{zIndex:20,mobile:{bottom:"50px"},position:"sticky",bottom:"10px"},53933408435:{zIndex:5,mobile:{bottom:"60px"},position:"sticky",bottom:"10px"},68377018594:{zIndex:5,bottom:"10px",position:"fixed",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"70px"}},84569063743:{zIndex:999,bottom:"0px",width:"100%",position:"fixed",right:"0px",left:"0px"},62022680789:{bottom:"65px",zIndex:999,width:"100%",position:"fixed",right:"0px",left:"0px"},63102222549:{position:"sticky",bottom:"100px",zIndex:999,mobile:{bottom:"60px"}},26666008755:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},67641475285:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},61613179125:{position:"fixed",left:"50%",transform:"translateX(-50%)"},80866345280:{bottom:"10px",mobile:{bottom:"70px"}}},Dc={position:"sticky",bottom:"10px",zIndex:999,width:"96%"},Ac=o=>{const[r,i]=t(!1);n(()=>{const e=()=>{i(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,l=((e,t=!1)=>{const n=e&&Pc[e]?Pc[e]:{},o={...Dc,...n};return t&&n.mobile?{...o,...n.mobile}:o})(String(a),r);o.renderingOnPage||(l.position="static",l.zIndex=0);const c={display:"flex",backgroundColor:"white",borderRadius:"4px",paddingBottom:"5px",justifyContent:"center",margin:"0 auto",transition:"box-shadow 0.3s ease, transform 0.3s ease",border:"1px solid #CBCBCB",boxShadow:"\n 0px 3px 6px 0px #00000040, \n 0px 11px 11px 0px #00000036, \n 0px 24px 14px 0px #00000021, \n 0px 43px 17px 0px #0000000A, \n 0px 68px 19px 0px #00000000\n ",...l};return e.createElement("div",{className:"yt-byob-tracker-bar yt-bundle-builder-tracker-bar "+(r?"yt-byob-tracker-mobile-bar":"yt-byob-tracker-desktop-bar"),style:{...c,width:r?"100%":l.width,...!o.styles.byob.selectedProductsVisibility&&{width:r?"96%":"fit-content",paddingInline:"10px"},...r&&{display:"flex",flexDirection:"row",paadingTop:"0px"}},onMouseEnter:e=>{e.currentTarget.style.boxShadow="\n 0px 8px 16px 0px #00000040, \n 0px 24px 24px 0px #00000036, \n 0px 50px 30px 0px #00000021, \n 0px 90px 36px 0px #0000000A, \n 0px 140px 40px 0px #00000000\n ",e.currentTarget.style.transform="translateX(-50%)"===l.transform?"translate(-50%, -3px)":"translateY(-3px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="\n 0px 5px 12px 0px #00000040, \n 0px 22px 22px 0px #00000036, \n 0px 49px 29px 0px #00000021, \n 0px 87px 35px 0px #0000000A, \n 0px 136px 38px 0px #00000000\n ",e.currentTarget.style.transform=l.transform||"translateY(0)"}},e.createElement(Fc,{...o,isMobile:r}))},_c=re(void 0),Rc=c.div`
|
|
2926
|
+
`,Ic=({tiers:t,isMobile:n=!1,selectedProductsByTier:o,selectedProducts:r,themeColor:i,showProductDetailsInTracker:a,handleRemoveItemProductTier:l,cornerRadius:c,currencySymbol:s})=>e.createElement(e.Fragment,null,t.map((i,d)=>{const p=i.minimumQuantity-(o[d]?.length??0),u=r?.filter(e=>e.tierIndex===d);return Math.min(o[d]?.length/i.minimumQuantity*100,100),e.createElement("div",{className:"yt-byob-tracker-product-list-tier-wrapper",style:{display:"flex",width:"100%"}},e.createElement("div",{className:"yt-byob-tracker-product-list-tier-items"},e.createElement("div",{className:"yt-byob-tracker-product-list-items",style:{display:"flex",gap:"5px"}},u?.map?.(t=>{const r=t.product.variants?.edges?.find(e=>e.node.id===t.variantId),p=o[d]?.filter(e=>e===r?.node.id).length||0;return a?e.createElement(zc,{className:"yt-byob-tracker-detailed-product-item",key:t.variantId},e.createElement(uc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.isFree&&e.createElement("div",{style:{position:"absolute",bottom:4,left:"30%",background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"40px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},"FREE",e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),t?.quantity>1&&e.createElement(sc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},t.quantity,"x")),e.createElement(gc,{className:"yt-byob-tracker-info-block"},e.createElement(xc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(fc,{className:"yt-byob-tracker-product-price"},s,_p(r?.node?.price)),e.createElement(dc,{className:"yt-byob-tracker-remove-detailed-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Bc,{className:"yt-byob-tracker-product-list-item",isMobile:n,borderRadius:c,imageUrl:r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url,style:{borderRadius:c||"12px"}},t?.isFree&&e.createElement("div",{style:{position:"absolute",top:4,left:4,background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"8px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},e.createElement(it,null),e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),p>1&&e.createElement(sc,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},p,"x"),e.createElement(dc,{className:"yt-byob-tracker-remove-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(J,{fontSize:"12px"}))))}),p>=1&&[...Array(p)].map((t,o)=>e.createElement(bc,{className:"yt-byob-tracker-placeholder-box",isMobile:n,borderRadius:c,key:o},e.createElement(De,{size:40,color:"#A0A0A0"}))))),d<t.length-1&&e.createElement(Nc,{className:"yt-byob-tracker-plus-icon-container"},e.createElement(De,{size:"16px",style:{backgroundColor:"#f2f2f2"}})))})),Fc=({builderTiers:o,handleAddToCart:r,minimumQuantity:i,selectedProducts:a,showProductDetailsInTracker:l,loading:c,handleRemoveItem:s,percentageOff:d,selectedItemsQuantity:p,bundleSubtotal:u,amountOff:m,styles:g,dealAmount:x,isMobile:f=!1,themeColor:y,cornerRadiusType:b,primaryTextColorCta:h,handleRemoveItemProductTier:v,selectedProductsByTier:w,storeCurrencyCode:C,isUploading:E,showNextStep:k})=>{const[T,S]=t(!1),[$,B]=t(0),[z,N]=t([]),[I,F]=t(0),[P,D]=t(0),[A,_]=t(!1),[R,O]=t(null),L=u?.price||0,M=o?.type,V=e=>{if(e<0||!z[e])return L;const t=z[e].discountValue??0;return d?L*(1-t/100):x?t:m?L-t:L};n(()=>{if(o&&"none"!==o.type)if("productTier"===M&&o.productTier){const e=o.productTier||[];N(e);let t=0;o.productTier.map(e=>{t+=e.minimumQuantity}),D(t-p)}else if(z.length)I>0&&p<z[I-1]?.minimumQuantity?(F(I-1),O(I-1)):p<z[I]?.minimumQuantity&&O(I-1),B(V(I));else{const e=o.offerTier||[];N(e),F(0),D(e[0]?.minimumQuantity-p||i-p)}else N([]),D(i-p),F(0)},[o,i,p]),n(()=>{z.length&&"productTier"!=M?(()=>{if(!z?.length)return;let e=-1,t=null,n=0;if("offerTier"===M)for(let o=0;o<z.length&&(n+=z[o].minimumQuantity,p>=n);o++)t=o,e=o+1<z.length?o+1:o;if(F(e),O(t),null!==t){let e=z.slice(0,t+1).reduce((e,t)=>e+t.minimumQuantity,0);_(e===p),S(!0),B(V(t))}else _(!1),S(!1),B(L);const o=e>=0&&e<z.length?z.slice(0,e+1).reduce((e,t)=>e+t.minimumQuantity,0)-p:z[0].minimumQuantity-p;D(o)})():p===i?(S(!0),B(d?L*(1-d/100):x||(m?L-m:L)),_(!0)):(_(!1),S(!1))},[p,z]);const j=T?Math.max(u?.compareAtPrice,u?.price):u?.compareAtPrice>u?.price?u?.compareAtPrice:null,W=T?$.toFixed(2):u?.price?.toFixed(2),H=j&&W?(j-Number(W)).toFixed(2):0,q=o&&"none"!==M&&o.offerTier?"offerTier"===M?Math.min(p/(p+P)*100,100):void 0:p/i*100;n(()=>{if(T&&g.byob.enableConfetti){console.log("remainingItems",P);const e=document.getElementById("checkoutButton");if(!e)return;const t=e.getBoundingClientRect(),n=(t.left+t.width/2)/window.innerWidth,o=(t.top+t.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:n,y:o},zIndex:9999})}},[T,g]),I>=0&&I<z.length&&z[I].tier;const Q=e.useMemo(()=>null!==R&&z[R+1]?z[R+1]?.customText||"":o?.offerTier?.[0]?.customText||"",[R,z,o]),U="number"==typeof R?z[R]?.customText:void 0,Y="string"==typeof U&&""!==U.trim();return e.createElement(ec,{className:"yt-byob-tracker-container bundle-builder-tracker-container "+(f?"yt-byob-tracker-mobile":"yt-byob-tracker-desktop"),isMobile:f,style:{justifyContent:g.byob.selectedProductsVisibility&&!f?"space-between":"center"}},"offerTier"==M&&null!==R&&R>=0&&e.createElement(tc,{className:"yt-byob-tracker-offer-tier-tag"},Y?e.createElement(e.Fragment,null,U," unlocked"):e.createElement(e.Fragment,null,e.createElement(e.Fragment,null,"Buy"," ",z.slice(0,R+1).reduce((e,t)=>e+t.minimumQuantity,0)," ","at",m||x?e.createElement(e.Fragment,null," ",Rp(g.general.currencySymbol,C)):""," ",_p(z[R]?.discountValue),d?e.createElement(e.Fragment,null,"% "):_p(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):""),e.createElement("span",{style:{fontStyle:"italic"}}," applied"))),f&&P>=1&&!A&&"offerTier"!==M?e.createElement(nc,{className:"yt-byob-tracker-mobile-remaining",style:{margin:"0"}},0===z.length?e.createElement(e.Fragment,null,"Select ",P," more item(s)"," ",0!==x||0!==d?"to get the bundle at":"",0!==x&&e.createElement(e.Fragment,null,` ${Rp(g.general.currencySymbol,C)}${x}`),!!d&&0!==d&&e.createElement(e.Fragment,null," ",` ${d}% Off`)):e.createElement(e.Fragment,null," Select ",P," more item(s)")):e.createElement(e.Fragment,null),"productTier"!==M&&e.createElement(oc,{className:"yt-byob-tracker-tier-progress-container"},e.createElement(rc,{className:"yt-byob-tracker-tier-progress-text"},"offerTier"==M&&z.length>0&&P>0&&e.createElement(e.Fragment,null,Q?e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," more to unlock ",Q):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," More Item(s)",e.createElement("span",{style:{fontWeight:"500"}}," to "),"Buy ",p+P," at"," ",m||x?e.createElement(e.Fragment,null,Rp(g.general.currencySymbol,C)):""," ",_p(z[I>=0?I:0]?.discountValue),d?e.createElement(e.Fragment,null,"% "):_p(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):"")))),e.createElement(ic,{className:"yt-byob-tracker-progress-bar-bg"},e.createElement(ac,{className:"yt-byob-tracker-progress-bar-fill bundle-builder-tracker-progress",progressPercentage:q??0,primaryColor:y??g?.general.primaryColor}," "))),g.byob.selectedProductsVisibility&&e.createElement(lc,{className:"yt-byob-tracker-product-list-wrapper hide-tracker-scrollbar "+(f?"yt-byob-tracker-mobile-product-list":"yt-byob-tracker-desktop-product-list"),tierType:M??"",isMobile:f},"productTier"===M?e.createElement(Ic,{tiers:z,isMobile:f,selectedProductsByTier:w??{},selectedProducts:a,themeColor:g.general.primaryColor,showProductDetailsInTracker:l,handleRemoveItemProductTier:v,cornerRadius:g.byob.borderRadius,currencySymbol:Rp(g.general.currencySymbol,C)}):e.createElement(e.Fragment,null,a?.map?.(t=>{const n=t.product.variants?.edges?.find(e=>e.node.id===t.variantId);return l?e.createElement(pc,{className:"yt-byob-tracker-detailed-item-container",borderRadius:g.byob.borderRadius,key:t.variantId},e.createElement(uc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.quantity>1&&e.createElement(mc,{className:"yt-byob-tracker-badge"},t.quantity,"x")),e.createElement(gc,{className:"yt-byob-tracker-info-block"},e.createElement(xc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(fc,{className:"yt-byob-tracker-product-price"},g.general.currencySymbol,n?.node?.price),e.createElement(yc,{className:"yt-byob-tracker-remove-link",onClick:()=>s(t.variantId)},e.createElement(lt,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement($c,{className:"yt-byob-tracker-item bundle-builder-tracker-item",isMobile:f,borderRadius:g.byob.borderRadius,imageUrl:n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url},t?.quantity>1&&e.createElement(sc,{className:"yt-byob-tracker-quantity-badge",borderRadius:g.byob.borderRadius},t.quantity,"x"),e.createElement(dc,{className:"yt-byob-tracker-remove-btn",onClick:()=>s(t.variantId)},e.createElement(J,{fontSize:"12px"}))))}),P>=1&&[...Array(P)].map((t,n)=>e.createElement(bc,{className:"yt-byob-tracker-placeholder-box",isMobile:f,borderRadius:g.byob.borderRadius,key:n},e.createElement(De,{size:40,color:"#A0A0A0"}))))),(!f||A)&&e.createElement(cc,{className:"yt-byob-tracker-summary-container bundle-summary "+(f?"yt-byob-tracker-mobile-summary":"yt-byob-tracker-desktop-summary"),isMobile:f},Number(W)>0&&e.createElement(hc,{className:"yt-byob-tracker-summary-info summary-info"},e.createElement("div",{className:"yt-byob-tracker-summary-info-content",style:{display:"flex",...window.innerWidth<=600&&{flexDirection:"column"},gap:"5px",justifyContent:"center"}},f?e.createElement("div",{className:"yt-byob-tracker-mobile-subtotal-row",style:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center"}},e.createElement(vc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&e.createElement(wc,{className:"yt-byob-tracker-save-label",style:{}},"Save:"," ",Rp(g.general.currencySymbol,C),_p(H))):e.createElement(e.Fragment,null,e.createElement(vc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(H)>0&&!f&&e.createElement(wc,{className:"yt-byob-tracker-save-label"},"Save:"," ",Rp(g.general.currencySymbol,C),_p(H)))),e.createElement(Cc,{className:"yt-byob-tracker-subtotal-row"},e.createElement(Ec,{className:"yt-byob-tracker-final-price"},Rp(g.general.currencySymbol,C),Number(W)>=0?_p(Number(W).toFixed(2)):0),j&&g.byob.compareAtPriceVisibility&&Number(j)>Number(W)&&e.createElement(kc,{className:"yt-byob-tracker-line-through-price"},Rp(g.general.currencySymbol,C),_p(Number(j).toFixed(2))))),e.createElement(Tc,{className:"yt-byob-tracker-checkout-button yt-tracking-bar-checkout-button",canCheckout:A,progressPercentage:q??0,ctaColors:{ctaBackgroundColor:g.general.ctaBackgroundColor,ctaBorderColor:g.general.ctaBorderColor,ctaHoverBackgroundColor:g.general.ctaHoverBackgroundColor,ctaHoverTextColor:g.general.ctaHoverTextColor},borderRadius:g.general.ctaBorderRadius,disabled:!A&&P>=1||E,onClick:e=>{c||console.log("saving"),r(e.target??e.currentTarget)},id:"checkoutButton"},c?e.createElement(ue,{color:"black",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):P>=1&&!A?e.createElement("div",{className:"yt-byob-tracker-add-more-btn-text yt-tracking-bar-checkout-button-items-text",style:{color:g.general.primaryColor}},"Add ",P," More Item(s)"):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement(Sc,{className:"yt-byob-tracker-checkout-text yt-tracking-bar-checkout-button-text",ctaTextColor:g.general.ctaTextColor,ctaHoverTextColor:h??g.general.ctaHoverTextColor},k?"Next Step":g.byob.checkoutCTAText??"Checkout"),!k&&g?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"})))))))},Pc={8087437412:{position:"fixed",bottom:"10px",zIndex:100,width:"95%",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"50px"}},66134737152:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},83438567714:{zIndex:100,position:"fixed",width:"95%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},72726479068:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px",mobile:{bottom:"70px"}},64800161992:{zIndex:20,mobile:{bottom:"50px"},position:"sticky",bottom:"10px"},53933408435:{zIndex:5,mobile:{bottom:"60px"},position:"sticky",bottom:"10px"},68377018594:{zIndex:5,bottom:"10px",position:"fixed",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"70px"}},84569063743:{zIndex:999,bottom:"0px",width:"100%",position:"fixed",right:"0px",left:"0px"},62022680789:{bottom:"65px",zIndex:999,width:"100%",position:"fixed",right:"0px",left:"0px"},63102222549:{position:"sticky",bottom:"100px",zIndex:999,mobile:{bottom:"60px"}},26666008755:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},67641475285:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},61613179125:{position:"fixed",left:"50%",transform:"translateX(-50%)"},80866345280:{bottom:"10px",mobile:{bottom:"70px"}}},Dc={position:"sticky",bottom:"10px",zIndex:999,width:"96%"},Ac=o=>{const[r,i]=t(!1);n(()=>{const e=()=>{i(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,l=((e,t=!1)=>{const n=e&&Pc[e]?Pc[e]:{},o={...Dc,...n};return t&&n.mobile?{...o,...n.mobile}:o})(String(a),r);o.renderingOnPage||(l.position="static",l.zIndex=0);const c={display:"flex",backgroundColor:"white",borderRadius:"4px",paddingBottom:"5px",justifyContent:"center",margin:"0 auto",transition:"box-shadow 0.3s ease, transform 0.3s ease",border:"1px solid #CBCBCB",boxShadow:"\n 0px 3px 6px 0px #00000040, \n 0px 11px 11px 0px #00000036, \n 0px 24px 14px 0px #00000021, \n 0px 43px 17px 0px #0000000A, \n 0px 68px 19px 0px #00000000\n ",...l};return e.createElement("div",{className:"yt-byob-tracker-bar yt-bundle-builder-tracker-bar "+(r?"yt-byob-tracker-mobile-bar":"yt-byob-tracker-desktop-bar"),style:{...c,width:r?"100%":l.width,...!o.styles.byob.selectedProductsVisibility&&{width:r?"96%":"fit-content",paddingInline:"10px"},...r&&{display:"flex",flexDirection:"row",paadingTop:"0px"}},onMouseEnter:e=>{e.currentTarget.style.boxShadow="\n 0px 8px 16px 0px #00000040, \n 0px 24px 24px 0px #00000036, \n 0px 50px 30px 0px #00000021, \n 0px 90px 36px 0px #0000000A, \n 0px 140px 40px 0px #00000000\n ",e.currentTarget.style.transform="translateX(-50%)"===l.transform?"translate(-50%, -3px)":"translateY(-3px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="\n 0px 5px 12px 0px #00000040, \n 0px 22px 22px 0px #00000036, \n 0px 49px 29px 0px #00000021, \n 0px 87px 35px 0px #0000000A, \n 0px 136px 38px 0px #00000000\n ",e.currentTarget.style.transform=l.transform||"translateY(0)"}},e.createElement(Fc,{...o,isMobile:r}))},_c=re(void 0),Rc=c.div`
|
|
2927
2927
|
position: absolute;
|
|
2928
2928
|
top: 0px;
|
|
2929
2929
|
right: 0px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yt-uikit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"description": "YourToken UI Kit",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"rollup": "rm -rf dist && tsc && rollup -c",
|
|
@@ -93,4 +93,4 @@
|
|
|
93
93
|
"prettier": "^3.6.2",
|
|
94
94
|
"rollup-plugin-terser": "^7.0.2"
|
|
95
95
|
}
|
|
96
|
-
}
|
|
96
|
+
}
|