yt-uikit 0.7.376 → 0.7.377

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
@@ -4845,9 +4845,12 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4845
4845
  padding: 10px;
4846
4846
  `,ch=x.img`
4847
4847
  width: 70px;
4848
+ min-width: 70px;
4848
4849
  height: 70px;
4850
+ max-width: 70px;
4849
4851
  border-radius: 8px;
4850
4852
  object-fit: cover;
4853
+ object-position: top;
4851
4854
  `,sh=x.div`
4852
4855
  display: flex;
4853
4856
  flex-direction: column;
@@ -4929,4 +4932,4 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4929
4932
  }
4930
4933
  `,xh=x.span`
4931
4934
  font-size: 12px;
4932
- `,yh=({products:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:s,primaryProductId:d,variantId:p})=>{const[u,m]=c((()=>{const t={};return e.forEach((({productId:e,productDetails:n})=>{let r=n.options.map((e=>e.values[0]??""));if(e===d&&p){const e=n.variants.edges.find((e=>e.node.id.includes(p)))?.node;e&&(r=e.title.split(" / "))}t[e]=r})),t}));l((()=>{if(!d||!p)return;const t=e.find((e=>e.productId===d));if(!t)return;const n=t.productDetails.variants.edges.find((e=>e.node.id.includes(p)))?.node;if(n){const e=n.title.split(" / ");m((t=>({...t,[d]:e}))),g((e=>({...e,[d]:{node:n}}))),i(d,n.id)}}),[p,d]);const[f,g]=c({}),h=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const a=e.find((e=>e.productId===t));if(!a?.productDetails)return;const l=a.productDetails.variants.edges.find((e=>e.node.title===o[t].join(" / ")))?.node;l&&(i(t,l.id),g((e=>({...e,[t]:{node:l}}))))};if(!n)return null;const x=t.createElement(rh,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(oh,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(ah,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map(((n,r)=>t.createElement(t.Fragment,null,t.createElement(lh,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(ch,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n.productId]?.node?.image.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(sh,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(dh,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(uh,{className:"yt-fixedBundle-variant-modal_selected-value"},u[n.productId].join(" / "))),n.productDetails.options.map(((e,r)=>{const o=a&&a?.options?.find((t=>t.name===e.name));return e.values.length<=1?t.createElement(t.Fragment,null):o&&"color"===o?.type?t.createElement(mh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(xh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," : "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o.values.find((t=>t.name===e))?.value?t.createElement(fh,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},t.createElement("span",null)):t.createElement(gh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},e))))):o&&"image"===o?.type?t.createElement(mh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(xh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," : "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o.values.find((t=>t.name===e))?.value?t.createElement(hh,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(gh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},e))))):t.createElement(mh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(xh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," : "),e.values.map(((e,o)=>t.createElement(gh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},e))))})))),r<e.length-1&&t.createElement(ph,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(ih,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:s},"Add bundle to cart")));return v.createPortal(x,document.body)},bh=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,s]=c(!1),d=o(null);l((()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(Yg,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(qg,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(jg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},t.createElement(Vg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!i)},t.createElement(Hg,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(Wg,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Ug,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(Qg,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),s(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(Gg,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},vh=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:s="dropdown"})=>{const[d,p]=c(r||[]);l((()=>{if(a&&e.variants.edges.some((e=>e.node.id.includes(a)))){const t=e.variants.edges.find((e=>e.node.id.includes(a)))?.node;if(t){const e=t.title.split(" / ");p(e)}}}),[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find((t=>t.name===e));return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map((e=>({name:e,value:e})));const r=n.options.find((t=>t.name===e.name));return e.values.map((e=>{const t=r?.values?.find((t=>t.name===e));return{name:e,value:t?.value||e}}))},f=(e,t)=>{const n=d[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(Zg,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(Kg,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(bh,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...d];r[t]=n.name,p(r);const a=e.variants.edges.find((n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t])))?.node.id;o(a||"")})(r,t)},type:u(n.name)})))))},wh=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:s,isMobile:d,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:h,primaryProductId:x,variantId:y})=>{const[b,v]=c(e.variants.edges.find((e=>e.node.id===n))?.node),[w]=c(e.options?.map((e=>e.values[0]))||[]),C=e.id===x;l((()=>{if(y&&e.id===x){const t=e.variants.edges.find((e=>e.node.id.includes(y)))?.node;t&&(v(t),i(t.id))}else{const t=e.variants.edges.find((e=>e.node.id===n))?.node;v(t)}}),[e,x,n,y]);const k="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,E=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===x?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(th,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(Jg,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}`,defaultChecked:r,onChange:e=>s(e.target.checked),disabled:C}),t.createElement(eh,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(mg,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(fg,{className:"yt-fixedBundle-product-card-horizontal_image",src:E,alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(gg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(hg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(xg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(yg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Th(a.general.currencySymbol,h)," ",Eh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(bg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Th(a.general.currencySymbol,h),Eh(b?.compareAtPrice))),t.createElement(vh,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:x})))):t.createElement(t.Fragment,null,t.createElement(Bg,{className:""+(e.id===x?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...k&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(nh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:k},t.createElement(Jg,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}`,defaultChecked:r,onChange:e=>s(e.target.checked),disabled:C}),t.createElement(eh,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(zg,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(Dg,{className:"yt-fixedBundle-product-card_image--vertical",src:E,style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Ig,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(_g,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Og,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(Pg,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(Ag,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Ng,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Mg,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Fg,{className:"yt-fixedBundle-product-card-vertical_price--new"},Th(a.general.currencySymbol,h),Eh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(bg,{className:"yt-fixedBundle-product-card-vertical_price--old"},Th(a.general.currencySymbol,h),Eh(b?.compareAtPrice))))),(f<=3||!d)&&u<f-1&&t.createElement(Rg,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(Lg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Ch=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,s]=c(window.innerWidth<786),[d,p]=c(null),u="undefined"!=typeof window?window.location.href:null,m=e?.products?.find((e=>e.productDetails?.handle===u?.split("/").pop()?.split("?")[0])),f=m?.productId,[g,h]=c(Object.fromEntries(e?.products?.map((e=>[e.productId,e.productDetails?.variants?.edges?.find((e=>e.node.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),[x,y]=c(!1),b="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),v=e?.showIndividualProductSelector||!0,[w,C]=c(new Set(e.products.filter((e=>!b||(e.productId===f||v))).map((e=>e.productId))));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");p(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}}),[]),l((()=>{if(d&&f){const t=e?.products?.find((e=>e.productId===f));if(t){const e=t.productDetails?.variants?.edges?.some((e=>e.node.id.includes(d)));e&&h((e=>({...e,[f]:d})))}}}),[d,f,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=(e,t)=>{h((n=>({...n,[e]:t})))},E=(e,t)=>{b&&v&&t===f||C((n=>{const r=new Set(n);return e?r.add(t):r.delete(t),r}))},T=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),S=i((()=>e.products.some((e=>w.has(e.productId)&&e.productDetails.variants.edges.length>1))),[e.products,w]),{originalPrice:$,dealPrice:B,offerValue:z}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t)=>{if(!w.has(t.productId))return e;const n=t.productDetails.variants.edges?.find((e=>e.node.id===g[t.productId]))?.node,r=parseFloat(n?.price??"0"),o=parseFloat(n?.compareAtPrice||r.toString());return e.price+=r,e.compareAtPrice+=o,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);w.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[e.products,g,w,e.percentageOff,e.dealAmount,e.amountOff]),D=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),y(!1);try{const e=Object.entries(g).filter((([e])=>w.has(e))).map((([e,t])=>t));n&&await n(Number($),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)};if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!T)return t.createElement(t.Fragment,null);const I=e.customizations,_=I.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===_||"auto"===_&&a,P=()=>{y(!0)},A="bundles"==e.appName?e.pageHeader?.title:e?.title,N="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(sg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:I.fixedBundle.sectionBackgroundColor,..."transparent"!==I.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(dg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:I.fixedBundle?.titleBackgroundColor||"none",color:I.fixedBundle?.titleTextColor||"black",textAlign:I.fixedBundle.infoAlignment??"center",fontSize:I.fixedBundle?.titleFontSize,..."transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===I.fixedBundle.infoAlignment&&"transparent"===I.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),N&&t.createElement(pg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:I.fixedBundle?.subtitleFontSize,textAlign:I.fixedBundle.infoAlignment??"center",..."left"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===I.fixedBundle.infoAlignment&&"transparent"===I.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},N),O?t.createElement(ug,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:n.productId},t.createElement(wh,{isChecked:w.has(n.productId),product:n.productDetails,selectedVariantId:g[n.productId],canCustomize:e?.canCustomizeFixedBundle||!1,styles:I,onVariantChange:e=>k(n.productId,e),onCheckChange:e=>{E(e,n.productId)},isMobile:a,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:f,variantId:d||void 0}))))):t.createElement(Sg,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement($g,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===I.fixedBundle.infoAlignment?"flex-start":"right"===I.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement(wh,{isChecked:w.has(n.productId),product:n.productDetails,selectedVariantId:g[n.productId],canCustomize:e?.canCustomizeFixedBundle||!1,styles:I,onVariantChange:e=>k(n.productId,e),onCheckChange:e=>E(e,n.productId),isMobile:a,index:r,isHorizontal:O,productsLength:e.products.length,handleOpenModal:P,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:f,variantId:d||void 0}))),S&&t.createElement(yh,{products:e.products.filter((e=>w.has(e.productId))),isOpen:x,onClose:()=>y(!1),variantOptions:e.variantOptions,cta:{textColor:I.general.ctaTextColor,backgroundColor:I.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:D,primaryProductId:f,variantId:d||void 0}))),t.createElement(vg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===I.fixedBundle.infoAlignment?"flex-start":"right"===I.fixedBundle.infoAlignment?"flex-end":"center"}},Number($)>0&&Number(z)>0&&I.fixedBundle.compareAtPriceVisibility&&t.createElement(wg,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(kg,{className:"yt-fixedBundle-summary_price"},Th(I.general.currencySymbol,e?.storeCurrencyCode),Eh($))),0!==w.size&&t.createElement(Cg,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(kg,{className:"yt-fixedBundle-summary_price"},Th(I.general.currencySymbol,e?.storeCurrencyCode),Eh(B))," ",Number(z)>0&&t.createElement(Eg,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Th(I.general.currencySymbol,e?.storeCurrencyCode),Eh(z)))),t.createElement(Tg,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!S?D(e):y(!0)},disabled:w.size<1||r,style:{backgroundColor:I.general?.ctaBackgroundColor||"#121212",color:I.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${I.general?.ctaBackgroundColor||"#121212"}`,boxShadow:I.general.ctaShadowType,paddingTop:I.general?.ctaPadding,paddingBottom:I.general?.ctaPadding,borderRadius:I.general.ctaBorderRadius,width:I.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{I.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=I.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=I.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{I.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=I.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=I.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(Uo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,I.fixedBundle?.ctaTitle??"Add Bundle to cart")))},kh=window?.Shopify?.currency||{rate:1,active:"INR"},Eh=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*kh.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Th=(e,t)=>t==kh.active?e:sn(kh.active)||kh.active,Sh=(e,t,n,r,o)=>{const a=r.findIndex((t=>t.variantId===e));o(0===n?e=>e.filter(((e,t)=>t!==a)):-1===a?r=>[...r,{product:t,variantId:e,quantity:n}]:e=>e.map(((e,t)=>t===a?{...e,quantity:e.quantity+n}:e)))},$h=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(qm,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(Km,{bundle:e,addToCartFunction:r}):"mixnmatch"===e.type?t.createElement(cg,{bundle:e,addToCartFunction:r}):t.createElement(zf,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Ch,{addToCartFunction:r,bundle:e});L(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Bh=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},"‎"),t.createElement("div",{className:"side back"},"‎"),t.createElement("div",{className:"side left"},"‎"),t.createElement("div",{className:"side right"},"‎"),t.createElement("div",{className:"side bottom"},"‎"),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},"‎"),t.createElement("div",{className:"flap south"},"‎"),t.createElement("div",{className:"flap east"},"‎"),t.createElement("div",{className:"flap west"},"‎")))));export{$h as Bundle,Bh as BundleLoader,nu as Cart,ra as CouponFrame,Qe as Nudge,Je as SpinnerWheel};
4935
+ `,yh=({products:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:s,primaryProductId:d,variantId:p})=>{const[u,m]=c((()=>{const t={};return e.forEach((({productId:e,productDetails:n})=>{let r=n.options.map((e=>e.values[0]??""));if(e===d&&p){const e=n.variants.edges.find((e=>e.node.id.includes(p)))?.node;e&&(r=e.title.split(" / "))}t[e]=r})),t}));l((()=>{if(!d||!p)return;const t=e.find((e=>e.productId===d));if(!t)return;const n=t.productDetails.variants.edges.find((e=>e.node.id.includes(p)))?.node;if(n){const e=n.title.split(" / ");m((t=>({...t,[d]:e}))),g((e=>({...e,[d]:{node:n}}))),i(d,n.id)}}),[p,d]);const[f,g]=c({}),h=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const a=e.find((e=>e.productId===t));if(!a?.productDetails)return;const l=a.productDetails.variants.edges.find((e=>e.node.title===o[t].join(" / ")))?.node;l&&(i(t,l.id),g((e=>({...e,[t]:{node:l}}))))};if(!n)return null;const x=t.createElement(rh,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(oh,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(ah,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map(((n,r)=>t.createElement(t.Fragment,null,t.createElement(lh,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(ch,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n.productId]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(sh,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(dh,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(uh,{className:"yt-fixedBundle-variant-modal_selected-value"},u[n.productId].join(" / "))),n.productDetails.options.map(((e,r)=>{const o=a&&a?.options?.find((t=>t.name===e.name));return e.values.length<=1?t.createElement(t.Fragment,null):o&&"color"===o?.type?t.createElement(mh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(xh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o.values.find((t=>t.name===e))?.value?t.createElement(fh,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},t.createElement("span",null)):t.createElement(gh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},e))))):o&&"image"===o?.type?t.createElement(mh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(xh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o?.values.find((t=>t.name===e))?.value?t.createElement(hh,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(gh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},e))))):t.createElement(mh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(xh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,o)=>t.createElement(gh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[n.productId][r]==e,onClick:()=>{h(n.productId,e,r)}},e))))})))),r<e.length-1&&t.createElement(ph,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(ih,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:s},"Add bundle to cart")));return v.createPortal(x,document.body)},bh=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,s]=c(!1),d=o(null);l((()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(Yg,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(qg,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(jg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},t.createElement(Vg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!i)},t.createElement(Hg,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(Wg,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Ug,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(Qg,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),s(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(Gg,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},vh=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:s="dropdown"})=>{const[d,p]=c(r||[]);l((()=>{if(a&&e.variants.edges.some((e=>e.node.id.includes(a)))){const t=e.variants.edges.find((e=>e.node.id.includes(a)))?.node;if(t){const e=t.title.split(" / ");p(e)}}}),[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find((t=>t.name===e));return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map((e=>({name:e,value:e})));const r=n.options.find((t=>t.name===e.name));return e.values.map((e=>{const t=r?.values?.find((t=>t.name===e));return{name:e,value:t?.value||e}}))},f=(e,t)=>{const n=d[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(Zg,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(Kg,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(bh,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...d];r[t]=n.name,p(r);const a=e.variants.edges.find((n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t])))?.node.id;o(a||"")})(r,t)},type:u(n.name)})))))},wh=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:s,isMobile:d,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:h,primaryProductId:x,variantId:y})=>{const[b,v]=c(e.variants.edges.find((e=>e.node.id===n))?.node),[w]=c(e.options?.map((e=>e.values[0]))||[]),C=e.id===x;l((()=>{if(y&&e.id===x){const t=e.variants.edges.find((e=>e.node.id.includes(y)))?.node;t&&(v(t),i(t.id))}else{const t=e.variants.edges.find((e=>e.node.id===n))?.node;v(t)}}),[e,x,n,y]);const k="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,E=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===x?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(th,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(Jg,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}`,defaultChecked:r,onChange:e=>s(e.target.checked),disabled:C}),t.createElement(eh,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(mg,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(fg,{className:"yt-fixedBundle-product-card-horizontal_image",src:E,alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(gg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(hg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(xg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(yg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Th(a.general.currencySymbol,h)," ",Eh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(bg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Th(a.general.currencySymbol,h),Eh(b?.compareAtPrice))),t.createElement(vh,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:x})))):t.createElement(t.Fragment,null,t.createElement(Bg,{className:""+(e.id===x?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...k&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(nh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:k},t.createElement(Jg,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}`,defaultChecked:r,onChange:e=>s(e.target.checked),disabled:C}),t.createElement(eh,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(zg,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(Dg,{className:"yt-fixedBundle-product-card_image--vertical",src:E,style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Ig,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(_g,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Og,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(Pg,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(Ag,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Ng,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Mg,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Fg,{className:"yt-fixedBundle-product-card-vertical_price--new"},Th(a.general.currencySymbol,h),Eh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(bg,{className:"yt-fixedBundle-product-card-vertical_price--old"},Th(a.general.currencySymbol,h),Eh(b?.compareAtPrice))))),(f<=3||!d)&&u<f-1&&t.createElement(Rg,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(Lg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Ch=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,s]=c(window.innerWidth<786),[d,p]=c(null),u="undefined"!=typeof window?window.location.href:null,m=e?.products?.find((e=>e.productDetails?.handle===u?.split("/").pop()?.split("?")[0])),f=m?.productId,[g,h]=c(Object.fromEntries(e?.products?.map((e=>[e.productId,e.productDetails?.variants?.edges?.find((e=>e.node.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),[x,y]=c(!1),b="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),v=e?.showIndividualProductSelector||!0,[w,C]=c(new Set(e.products.filter((e=>!b||(e.productId===f||v))).map((e=>e.productId))));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");p(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}}),[]),l((()=>{if(d&&f){const t=e?.products?.find((e=>e.productId===f));if(t){const e=t.productDetails?.variants?.edges?.some((e=>e.node.id.includes(d)));e&&h((e=>({...e,[f]:d})))}}}),[d,f,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=(e,t)=>{h((n=>({...n,[e]:t})))},E=(e,t)=>{b&&v&&t===f||C((n=>{const r=new Set(n);return e?r.add(t):r.delete(t),r}))},T=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),S=i((()=>e.products.some((e=>w.has(e.productId)&&e.productDetails.variants.edges.length>1))),[e.products,w]),{originalPrice:$,dealPrice:B,offerValue:z}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t)=>{if(!w.has(t.productId))return e;const n=t.productDetails.variants.edges?.find((e=>e.node.id===g[t.productId]))?.node,r=parseFloat(n?.price??"0"),o=parseFloat(n?.compareAtPrice||r.toString());return e.price+=r,e.compareAtPrice+=o,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);w.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[e.products,g,w,e.percentageOff,e.dealAmount,e.amountOff]),D=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),y(!1);try{const e=Object.entries(g).filter((([e])=>w.has(e))).map((([e,t])=>t));n&&await n(Number($),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)};if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!T)return t.createElement(t.Fragment,null);const I=e.customizations,_=I.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===_||"auto"===_&&a,P=()=>{y(!0)},A="bundles"==e.appName?e.pageHeader?.title:e?.title,N="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(sg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:I.fixedBundle.sectionBackgroundColor,..."transparent"!==I.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(dg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:I.fixedBundle?.titleBackgroundColor||"none",color:I.fixedBundle?.titleTextColor||"black",textAlign:I.fixedBundle.infoAlignment??"center",fontSize:I.fixedBundle?.titleFontSize,..."transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===I.fixedBundle.infoAlignment&&"transparent"===I.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),N&&t.createElement(pg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:I.fixedBundle?.subtitleFontSize,textAlign:I.fixedBundle.infoAlignment??"center",..."left"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===I.fixedBundle.infoAlignment&&"transparent"!==I.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===I.fixedBundle.infoAlignment&&"transparent"===I.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},N),O?t.createElement(ug,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:n.productId},t.createElement(wh,{isChecked:w.has(n.productId),product:n.productDetails,selectedVariantId:g[n.productId],canCustomize:e?.canCustomizeFixedBundle||!1,styles:I,onVariantChange:e=>k(n.productId,e),onCheckChange:e=>{E(e,n.productId)},isMobile:a,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:f,variantId:d||void 0}))))):t.createElement(Sg,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement($g,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===I.fixedBundle.infoAlignment?"flex-start":"right"===I.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement(wh,{isChecked:w.has(n.productId),product:n.productDetails,selectedVariantId:g[n.productId],canCustomize:e?.canCustomizeFixedBundle||!1,styles:I,onVariantChange:e=>k(n.productId,e),onCheckChange:e=>E(e,n.productId),isMobile:a,index:r,isHorizontal:O,productsLength:e.products.length,handleOpenModal:P,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:f,variantId:d||void 0}))),S&&t.createElement(yh,{products:e.products.filter((e=>w.has(e.productId))),isOpen:x,onClose:()=>y(!1),variantOptions:e.variantOptions,cta:{textColor:I.general.ctaTextColor,backgroundColor:I.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:D,primaryProductId:f,variantId:d||void 0}))),t.createElement(vg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===I.fixedBundle.infoAlignment?"flex-start":"right"===I.fixedBundle.infoAlignment?"flex-end":"center"}},Number($)>0&&Number(z)>0&&I.fixedBundle.compareAtPriceVisibility&&t.createElement(wg,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(kg,{className:"yt-fixedBundle-summary_price"},Th(I.general.currencySymbol,e?.storeCurrencyCode),Eh($))),0!==w.size&&t.createElement(Cg,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(kg,{className:"yt-fixedBundle-summary_price"},Th(I.general.currencySymbol,e?.storeCurrencyCode),Eh(B))," ",Number(z)>0&&t.createElement(Eg,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Th(I.general.currencySymbol,e?.storeCurrencyCode),Eh(z)))),t.createElement(Tg,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!S?D(e):y(!0)},disabled:w.size<1||r,style:{backgroundColor:I.general?.ctaBackgroundColor||"#121212",color:I.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${I.general?.ctaBackgroundColor||"#121212"}`,boxShadow:I.general.ctaShadowType,paddingTop:I.general?.ctaPadding,paddingBottom:I.general?.ctaPadding,borderRadius:I.general.ctaBorderRadius,width:I.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{I.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=I.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=I.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{I.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=I.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=I.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(Uo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,I.fixedBundle?.ctaTitle??"Add Bundle to cart")))},kh=window?.Shopify?.currency||{rate:1,active:"INR"},Eh=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*kh.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Th=(e,t)=>t==kh.active?e:sn(kh.active)||kh.active,Sh=(e,t,n,r,o)=>{const a=r.findIndex((t=>t.variantId===e));o(0===n?e=>e.filter(((e,t)=>t!==a)):-1===a?r=>[...r,{product:t,variantId:e,quantity:n}]:e=>e.map(((e,t)=>t===a?{...e,quantity:e.quantity+n}:e)))},$h=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(qm,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(Km,{bundle:e,addToCartFunction:r}):"mixnmatch"===e.type?t.createElement(cg,{bundle:e,addToCartFunction:r}):t.createElement(zf,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Ch,{addToCartFunction:r,bundle:e});L(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Bh=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},"‎"),t.createElement("div",{className:"side back"},"‎"),t.createElement("div",{className:"side left"},"‎"),t.createElement("div",{className:"side right"},"‎"),t.createElement("div",{className:"side bottom"},"‎"),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},"‎"),t.createElement("div",{className:"flap south"},"‎"),t.createElement("div",{className:"flap east"},"‎"),t.createElement("div",{className:"flap west"},"‎")))));export{$h as Bundle,Bh as BundleLoader,nu as Cart,ra as CouponFrame,Qe as Nudge,Je as SpinnerWheel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.7.376",
3
+ "version": "0.7.377",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "tsc && rollup -c",