yt-uikit 0.7.397-collection-bundle.3 → 0.7.397-collection-bundle.5

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.
@@ -83,7 +83,7 @@ export type BundleConfig = {
83
83
  };
84
84
  declare const CollectionBundle: React.FC<{
85
85
  config: BundleConfig;
86
- setSelectedItems: (items: any) => void;
86
+ addCustomBundleToCart: (items: any) => void;
87
87
  bundleAddToCartLoading: boolean;
88
88
  }>;
89
89
  export default CollectionBundle;
package/dist/esm/index.js CHANGED
@@ -4933,4 +4933,4 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4933
4933
  }
4934
4934
  `,Ex=h.span`
4935
4935
  font-size: 12px;
4936
- `,kx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:d,primaryProductId:s,variantId:p})=>{const[u,m]=c((()=>{const t={};return e?.forEach((({product:e,index:n})=>{let r=e?.productDetails?.options?.map((e=>e.values[0]??""));if(e.productId===s&&p){const t=e?.productDetails?.variants?.edges.find((e=>e?.node?.id?.includes(p)))?.node;t&&(r=t.title.split(" / "))}t[n]=r})),t}));l((()=>{if(!s||!p)return;const t=e?.find((({product:e})=>e?.productId===s));if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find((e=>e.node.id.includes(p)))?.node;if(o){const e=o.title.split(" / ");m((t=>({...t,[r]:e}))),g((e=>({...e,[r]:{node:o}}))),i(r,o.id)}}),[p,s,e,i]);const[f,g]=c({}),x=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const{product:a}=e?.find((e=>e.index===t))||{product:{productDetails:{variants:{edges:[]}}}};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 h=t.createElement(dx,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(sx,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(px,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map((({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(mx,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(fx,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(gx,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(xx,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(yx,{className:"yt-fixedBundle-variant-modal_selected-value"},u[r].join(" / "))),n.productDetails.options.map(((e,n)=>{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(bx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Ex,{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(vx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},t.createElement("span",null)):t.createElement(wx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):o&&"image"===o?.type?t.createElement(bx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Ex,{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(Cx,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(wx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):t.createElement(bx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Ex,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,o)=>t.createElement(wx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))})))),o<e.length-1&&t.createElement(hx,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(ux,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(h,document.body)},Tx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,d]=c(!1),s=o(null);l((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(ex,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(tx,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Gg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},t.createElement(Qg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!i)},t.createElement(Yg,{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(Zg,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Kg,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(Xg,{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),d(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(Jg,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},Sx=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:d="dropdown"})=>{const[s,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=s[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(nx,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(rx,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Tx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...s];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)})))))},$x=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:d,isMobile:s,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:x,primaryProductId:h,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===h;l((()=>{if(y&&e.id===h){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,h,n,y,i]);const E="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,k=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===h?"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(lx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(ax,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(bg,{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(vg,{className:"yt-fixedBundle-product-card-horizontal_image",src:k,alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(wg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(Cg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Eg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(kg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},_x(a.general.currencySymbol,x)," ",Ix(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Tg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},_x(a.general.currencySymbol,x),Ix(b?.compareAtPrice))),t.createElement(Sx,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:h})))):t.createElement(t.Fragment,null,t.createElement(Pg,{className:""+(e.id===h?"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"},...E&&{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(cx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:E},t.createElement(ax,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${u}`,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(Og,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(Ag,{className:"yt-fixedBundle-product-card_image--vertical",src:k,style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Fg,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(Mg,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Rg,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(Lg,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(jg,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Vg,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Hg,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Wg,{className:"yt-fixedBundle-product-card-vertical_price--new"},_x(a.general.currencySymbol,x),Ix(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Tg,{className:"yt-fixedBundle-product-card-vertical_price--old"},_x(a.general.currencySymbol,x),Ix(b?.compareAtPrice))))),(f<=3||!s)&&u<f-1&&t.createElement(Ug,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(qg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Bx=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[d,s]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,x=e?.products?.find((e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0])),h=x?.productId,[y,b]=c(Object.fromEntries(e?.products?.map(((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),v="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),w=e?.showIndividualProductSelector||!0,[C,E]=c(new Set(e.products.reduce(((e,t,n)=>(v&&t?.productId!==h&&!w||e.push(n),e)),[])));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(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((()=>{p&&h&&b((t=>{const n={...t};return e?.products?.forEach(((e,t)=>{e.productId===h&&(n[t.toString()]=p)})),n}))}),[p,h,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=a(((e,t)=>{b((n=>({...n,[e.toString()]:t})))}),[]),T=(t,n)=>{const r=e.products[n].productId;v&&w&&r===h||E((e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r}))},S=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),$=i((()=>e.products.some(((e,t)=>C.has(t)&&e.productDetails.variants.edges.length>1))),[e.products,C]),{originalPrice:B,dealPrice:z,offerValue:D}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t,n)=>{if(!C.has(n))return e;const r=y[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find((e=>e.node.id===r))?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);C.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,y,C,e.percentageOff,e.dealAmount,e.amountOff]),I=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(y).map((([e,t])=>{const n=parseInt(e);return isNaN(n)||!C.has(n)?null:t})).filter(Boolean);n&&await n(Number(B),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)},_=i((()=>e.products.map(((e,t)=>({product:e,index:t}))).filter((({index:e})=>C.has(e)))),[e.products,C]);if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!S)return t.createElement(t.Fragment,null);const N=e.customizations,P=N.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===P||"auto"===P&&d,A="bundles"==e.appName?e.pageHeader?.title:e?.title,F="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(gg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:N.fixedBundle.sectionBackgroundColor,..."transparent"!==N.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(xg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:N.fixedBundle?.titleBackgroundColor||"none",color:N.fixedBundle?.titleTextColor||"black",textAlign:N.fixedBundle.infoAlignment??"center",fontSize:N.fixedBundle?.titleFontSize,..."transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),F&&t.createElement(hg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:N.fixedBundle?.subtitleFontSize,textAlign:N.fixedBundle.infoAlignment??"center",..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},F),O?t.createElement(yg,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement($x,{isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>{T(e,r)},isMobile:d,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))))):t.createElement(_g,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Ng,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement($x,{key:`${n.productId}-${r}`,isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>T(e,r),isMobile:d,index:r,isHorizontal:O,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))),$&&t.createElement(kx,{productsWithIndices:_,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:N.general.ctaTextColor,backgroundColor:N.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:I,primaryProductId:h,variantId:p||void 0}))),t.createElement(Sg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},Number(B)>0&&Number(D)>0&&N.fixedBundle.compareAtPriceVisibility&&t.createElement($g,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(zg,{className:"yt-fixedBundle-summary_price"},_x(N.general.currencySymbol,e?.storeCurrencyCode),Ix(B))),0!==C.size&&t.createElement(Bg,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(zg,{className:"yt-fixedBundle-summary_price"},_x(N.general.currencySymbol,e?.storeCurrencyCode),Ix(z))," ",Number(D)>0&&t.createElement(Dg,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",_x(N.general.currencySymbol,e?.storeCurrencyCode),Ix(D)))),t.createElement(Ig,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!$?I(e):f(!0)},disabled:C.size<1||r,style:{backgroundColor:N.general?.ctaBackgroundColor||"#121212",color:N.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${N.general?.ctaBackgroundColor||"#121212"}`,boxShadow:N.general.ctaShadowType,paddingTop:N.general?.ctaPadding,paddingBottom:N.general?.ctaPadding,borderRadius:N.general.ctaBorderRadius,width:N.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=N.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=N.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,N.fixedBundle?.ctaTitle??"Add Bundle to cart")))},zx=({config:e,setSelectedItems:n,bundleAddToCartLoading:r})=>{const[a,i]=c(1),[d,s]=c([]),[p,u]=c(""),[m,f]=c({}),[g,x]=c(null),h=o(null),y=o(null),b=o(),v=o(null),[w,C]=c(window.innerWidth<640);l((()=>{const e=()=>C(window.innerWidth<640);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]);const{config:E,customizations:k,products:T,giftboxes:S=[]}=e,$=d.reduce(((e,t)=>e+t.quantity),0),B=d.some((e=>!e.isGiftBox)),z=d.some((e=>e.isGiftBox)),D=d.reduce(((e,t)=>e+t.price*t.quantity),0)/100,I=d.reduce(((e,t)=>{const n=[...T,...S].find((e=>e.id.toString()===t.productId)),r=n?.variants.find((e=>e.id.toString()===t.variantId));return e+(r?.compare_at_price??t.price)*t.quantity}),0)/100,_=e=>2!==e||B?3!==e||z?(i(e),void window.scrollTo(0,0)):alert("Select a gift box first"):alert("Add at least one product first"),N=(e,t=!1)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());t?s((t=>t.filter((e=>!e.isGiftBox)).concat({productId:e.id.toString(),variantId:r,price:o,quantity:1,isGiftBox:!0}))):E.allowMultipleQty?s((t=>{const n=t.find((t=>t.productId===e.id.toString()&&t.variantId===r));return n?t.map((e=>e===n?{...e,quantity:e.quantity+1}:e)):[...t,{productId:e.id.toString(),variantId:r,price:o,quantity:1}]})):s((t=>{const n=t.find((t=>t.productId===e.id.toString()&&t.variantId===r));return n?t.filter((e=>e!==n)):[...t,{productId:e.id.toString(),variantId:r,price:o,quantity:1}]}))},P=async()=>{if(3!==a||!d.length)return;const e=d.map((e=>({variantId:e.variantId,quantity:1,properties:{...p&&{Message:p}}})));n(e)},O=async(e,t)=>{const n=e.target.files?.[0];if(!n)return;if(n.size>5242880)return alert("File too large. Max 5MB.");if(!n.type.match(/^image\/(jpeg|png|jpg)$/i))return alert("Only JPEG/PNG.");(new FormData).append("file",n)};return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"20px auto",maxWidth:"1400px"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:w?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:w?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:w?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},[1,2,3].map((e=>t.createElement("div",{key:e,className:"yt-collection-bundle-step-item "+(a===e?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:a===e?1:.5,transition:"opacity 0.2s"},onClick:()=>_(e)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(a===e?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:a===e?k?.stepActiveBg||"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},1===e?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:1===a?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:a===e?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600"}},1===e?"Products":2===e?"Select Gift Box":"Customize Gift Details"))))),t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:w?"14px":"16px",marginBottom:w?"0":"14px",fontWeight:"400",color:"#000"}},"Selected a personalized product? Upload your message, photos & greeting card text. If not, just share your greeting card message here.")),t.createElement("div",{className:"yt-collection-bundle-step-content "+(1===a?"yt-collection-bundle-step-content-active":""),style:{display:1===a?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:w?"grid":"flex",gridTemplateColumns:w?"repeat(2,1fr)":"",flexWrap:w?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:"100px"}},T.map((e=>{const n=e.variants.find((t=>t.id.toString()===document.querySelector(`[data-product-id="${e.id}"]`)?.dataset.selectedVariant))||e.variants[0],r=d.filter((t=>t.productId===e.id.toString()&&t.variantId===n.id.toString())).reduce(((e,t)=>e+t.quantity),0),o=g===e.id;return t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":n.id,"data-current-price":n.price,style:{display:"flex",flexDirection:"column",border:k?.productCardBorder||"1px solid #ddd",background:k?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:w?0:"250px",maxWidth:w?"none":"250px",borderRadius:k?.borderRadius||"8px",boxShadow:"spread"===k?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===k?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:w?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:k?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onMouseEnter:()=>x(e.id),onMouseLeave:()=>x(null)},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:o?0:1,transform:o?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:e.images[1]||e.images[0],style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:o?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"10px",fontSize:"12px",zIndex:2},onChange:t=>((e,t)=>{const n=e.variants.find((e=>e.id===parseInt(t)));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())})(e,t.target.value),defaultValue:n.id},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("a",{href:"#",style:{textDecoration:"none",color:"inherit"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:w?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title)),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:w?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0}},"₹",(n.price/100).toFixed(0)),n.compare_at_price&&n.compare_at_price>n.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0}},"₹",(n.compare_at_price/100).toFixed(0)))),E.allowMultipleQty&&r>0?t.createElement("div",{style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{style:{width:"40%",height:"38px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer"},onClick:()=>{s((t=>t.map((t=>t.productId===e.id.toString()&&t.variantId===n.id.toString()?{...t,quantity:t.quantity-1}:t)).filter((e=>e.quantity>0))))}},"-"),t.createElement("span",{style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%"}},r),t.createElement("button",{style:{width:"40%",height:"38px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer"},onClick:()=>{s((t=>t.map((t=>t.productId===e.id.toString()&&t.variantId===n.id.toString()?{...t,quantity:t.quantity+1}:t))))}},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(r>0?"yt-collection-bundle-add-btn-added":""),style:{background:r>0?"#28a745":k?.atcBg||"#007bff",color:k?.atcText||"#fff",border:"none",padding:w?"6px":"12px",fontSize:w?"12px":"14px",fontWeight:600,cursor:n.available?"pointer":"not-allowed",transition:"background 0.2s"},onClick:()=>N(e),disabled:!n.available},r>0?"Added":n.available?"ADD TO BOX":"Out of Stock"))})))),t.createElement("div",{className:"yt-collection-bundle-step-content "+(2===a?"yt-collection-bundle-step-content-active":""),style:{display:2===a?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:w?"grid":"flex",gridTemplateColumns:w?"repeat(2,1fr)":"",flexWrap:w?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:"100px"}},S.map((e=>{const n=e.variants[0],r=d.some((t=>t.productId===e.id.toString()&&t.isGiftBox));return t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":n.id,"data-current-price":n.price,style:{display:"flex",flexDirection:"column",border:k?.productCardBorder||"1px solid #ddd",background:k?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:w?0:"250px",maxWidth:w?"none":"250px",borderRadius:k?.borderRadius||"8px",boxShadow:"spread"===k?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===k?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:w?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:k?.productImageRatio||"1/1",overflow:"hidden",background:"#f9f9f9"}},t.createElement("a",{href:e.handle||"#"},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png",style:{width:"100%",height:"100%",objectFit:"cover"},alt:e.title}))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:w?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title)),t.createElement("button",{className:"yt-collection-bundle-add-btn "+(r?"yt-collection-bundle-add-btn-added":""),style:{background:r?"#28a745":k?.atcBg||"#007bff",color:k?.atcText||"#fff",border:"none",padding:w?"6px":"12px",fontSize:w?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"background 0.2s"},onClick:()=>N(e,!0)},r?"Selected":"Select this box"))})))),t.createElement("div",{className:"yt-collection-bundle-step-content "+(3===a?"yt-collection-bundle-step-content-active":""),style:{display:3===a?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem"}},t.createElement("div",{className:"yt-collection-bundle-form-group",style:{marginBottom:"24px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"6px",color:"#333"}},"Message"),t.createElement("textarea",{className:"yt-collection-bundle-textarea",placeholder:"Enter a message here...",rows:4,maxLength:200,onChange:e=>u(e.target.value),style:{width:"100%",padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical"}})),t.createElement("div",{className:"yt-collection-bundle-form-group",style:{marginBottom:"24px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"6px",color:"#333"}},"Upload Images"),t.createElement("sub",{style:{display:"block",color:"#666",fontSize:"12px",marginTop:"4px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),t.createElement("div",{className:"yt-collection-bundle-attachment-box",ref:b,style:{marginTop:"16px",padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa",position:"relative"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},"Attachment 1"),t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png/img (max size: 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",backgroundColor:"white",cursor:"pointer"},onClick:()=>h.current?.click()},"Upload Image"),t.createElement("input",{ref:h,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>O(e)})),Object.keys(m).length<2&&t.createElement("button",{type:"button",style:{marginTop:"12px",background:"transparent",border:"none",color:"#007bff",fontSize:"14px",cursor:"pointer",textDecoration:"underline"},onClick:()=>v.current&&(v.current.style.display="block")},"+ Add another image"),t.createElement("div",{className:"yt-collection-bundle-attachment-box",ref:v,style:{marginTop:"16px",padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa",position:"relative",display:"none"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},"Attachment 2"),t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png/img (max size: 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",backgroundColor:"white",cursor:"pointer"},onClick:()=>y.current?.click()},"Upload Image"),t.createElement("input",{ref:y,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>O(e)}))))),t.createElement("div",{className:"yt-collection-bundle-bar",style:{background:k?.bundleBg||"#fff",color:k?.bundleText||"#333",border:k?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"600px",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:k?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:e?.config?.hideSelectedProducts&&0!==d.length?"0":"8px 8px 0",background:"#fff",position:"relative",borderRadius:k?.borderRadius||"8px"}},d.length>0?t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:e?.config?.hideSelectedProducts?"0":"4px 0",margin:"0 0 0 20px"}},!e?.config?.hideSelectedProducts&&d.reduce(((e,t)=>{const n=e.find((e=>e.productId===t.productId&&e.variantId===t.variantId));return n?n.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e}),[]).map(((e,n)=>{const r=[...T,...S].find((t=>t.id.toString()===e.productId));if(!r)return null;const o=(l=e.productId,T.some((e=>e.id.toString()===l))?1:S?.some((e=>e.id.toString()===l))?2:1);var l;const c=a===o;return t.createElement("div",{key:n,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"65px",height:"65px",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:c?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!c&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!c&&i(o)},t.createElement("img",{src:r.images[0],className:"yt-collection-bundle-bundle-img",style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600}},"x",e.quantity),c&&t.createElement("button",{className:"yt-collection-bundle-remove-item",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},onClick:t=>{var n,r;t.stopPropagation(),n=e.productId,r=e.variantId,s((e=>{const t=e.find((e=>e.productId===n&&e.variantId===r));return t?E.allowMultipleQty&&t.quantity>1?e.map((e=>e===t?{...e,quantity:e.quantity-1}:e)):e.filter((e=>e!==t)):e}))}},"x")))}))):t.createElement("div",{className:"yt-collection-bundle-items-ctx",style:{textAlign:"center",fontSize:"16px",color:"#555",zIndex:1,padding:"6px 60px",width:"100%"}},"add upto ",t.createElement("span",null,"8 items"))),w?t.createElement("div",{style:{display:"flex",flexDirection:"column",padding:"4px",gap:"10px"}},t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},$," Gifts Selected"),$>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",D.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",I.toLocaleString()))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s"},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>x(-1),onMouseLeave:()=>x(null)},"Back"),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(3===a&&0===$?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:3===a&&0===$?.6:1},onClick:3===a?P:()=>_(a+1),disabled:3===a&&0===$,onMouseEnter:()=>x(-2),onMouseLeave:()=>x(null)},r?"Loading...":3===a?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:k?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"background 0.2s"},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>x(-1),onMouseLeave:()=>x(null)},"Back"),t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},$," Gifts Selected"),$>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",D.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",I.toLocaleString()))),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(3===a&&0===$?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"background 0.2s",opacity:3===a&&0===$?.6:1},onClick:3===a?P:()=>_(a+1),disabled:3===a&&0===$,onMouseEnter:()=>x(-2),onMouseLeave:()=>x(null)},r?"Loading...":3===a?"Checkout":"Next"))))},Dx=window?.Shopify?.currency||{rate:1,active:"INR"},Ix=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Dx.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},_x=(e,t)=>t==Dx.active?e:dn(Dx.active)||Dx.active,Nx=(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)))},Px=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p})=>(console.log("bundle : ",e),"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(tf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(rf,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(fg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(zx,{config:e,setSelectedItems:e=>i?.(e),bundleAddToCartLoading:l}):t.createElement(Of,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Bx,{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 Ox=()=>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{Px as Bundle,Ox as BundleLoader,cu as Cart,ra as CouponFrame,qe as Nudge,Je as SpinnerWheel};
4936
+ `,kx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:d,primaryProductId:s,variantId:p})=>{const[u,m]=c((()=>{const t={};return e?.forEach((({product:e,index:n})=>{let r=e?.productDetails?.options?.map((e=>e.values[0]??""));if(e.productId===s&&p){const t=e?.productDetails?.variants?.edges.find((e=>e?.node?.id?.includes(p)))?.node;t&&(r=t.title.split(" / "))}t[n]=r})),t}));l((()=>{if(!s||!p)return;const t=e?.find((({product:e})=>e?.productId===s));if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find((e=>e.node.id.includes(p)))?.node;if(o){const e=o.title.split(" / ");m((t=>({...t,[r]:e}))),g((e=>({...e,[r]:{node:o}}))),i(r,o.id)}}),[p,s,e,i]);const[f,g]=c({}),x=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const{product:a}=e?.find((e=>e.index===t))||{product:{productDetails:{variants:{edges:[]}}}};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 h=t.createElement(dx,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(sx,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(px,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map((({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(mx,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(fx,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(gx,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(xx,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(yx,{className:"yt-fixedBundle-variant-modal_selected-value"},u[r].join(" / "))),n.productDetails.options.map(((e,n)=>{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(bx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Ex,{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(vx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},t.createElement("span",null)):t.createElement(wx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):o&&"image"===o?.type?t.createElement(bx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Ex,{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(Cx,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(wx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):t.createElement(bx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Ex,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,o)=>t.createElement(wx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))})))),o<e.length-1&&t.createElement(hx,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(ux,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(h,document.body)},Tx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,d]=c(!1),s=o(null);l((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(ex,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(tx,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Gg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},t.createElement(Qg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!i)},t.createElement(Yg,{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(Zg,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Kg,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(Xg,{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),d(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(Jg,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},Sx=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:d="dropdown"})=>{const[s,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=s[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(nx,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(rx,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Tx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...s];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)})))))},$x=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:d,isMobile:s,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:x,primaryProductId:h,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===h;l((()=>{if(y&&e.id===h){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,h,n,y,i]);const E="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,k=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===h?"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(lx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(ax,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(bg,{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(vg,{className:"yt-fixedBundle-product-card-horizontal_image",src:k,alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(wg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(Cg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Eg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(kg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},_x(a.general.currencySymbol,x)," ",Ix(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Tg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},_x(a.general.currencySymbol,x),Ix(b?.compareAtPrice))),t.createElement(Sx,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:h})))):t.createElement(t.Fragment,null,t.createElement(Pg,{className:""+(e.id===h?"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"},...E&&{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(cx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:E},t.createElement(ax,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${u}`,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(Og,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(Ag,{className:"yt-fixedBundle-product-card_image--vertical",src:k,style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Fg,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(Mg,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Rg,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(Lg,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(jg,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Vg,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Hg,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Wg,{className:"yt-fixedBundle-product-card-vertical_price--new"},_x(a.general.currencySymbol,x),Ix(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Tg,{className:"yt-fixedBundle-product-card-vertical_price--old"},_x(a.general.currencySymbol,x),Ix(b?.compareAtPrice))))),(f<=3||!s)&&u<f-1&&t.createElement(Ug,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(qg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Bx=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[d,s]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,x=e?.products?.find((e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0])),h=x?.productId,[y,b]=c(Object.fromEntries(e?.products?.map(((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),v="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),w=e?.showIndividualProductSelector||!0,[C,E]=c(new Set(e.products.reduce(((e,t,n)=>(v&&t?.productId!==h&&!w||e.push(n),e)),[])));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(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((()=>{p&&h&&b((t=>{const n={...t};return e?.products?.forEach(((e,t)=>{e.productId===h&&(n[t.toString()]=p)})),n}))}),[p,h,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=a(((e,t)=>{b((n=>({...n,[e.toString()]:t})))}),[]),T=(t,n)=>{const r=e.products[n].productId;v&&w&&r===h||E((e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r}))},S=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),$=i((()=>e.products.some(((e,t)=>C.has(t)&&e.productDetails.variants.edges.length>1))),[e.products,C]),{originalPrice:B,dealPrice:z,offerValue:D}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t,n)=>{if(!C.has(n))return e;const r=y[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find((e=>e.node.id===r))?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);C.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,y,C,e.percentageOff,e.dealAmount,e.amountOff]),I=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(y).map((([e,t])=>{const n=parseInt(e);return isNaN(n)||!C.has(n)?null:t})).filter(Boolean);n&&await n(Number(B),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)},_=i((()=>e.products.map(((e,t)=>({product:e,index:t}))).filter((({index:e})=>C.has(e)))),[e.products,C]);if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!S)return t.createElement(t.Fragment,null);const N=e.customizations,P=N.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===P||"auto"===P&&d,A="bundles"==e.appName?e.pageHeader?.title:e?.title,F="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(gg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:N.fixedBundle.sectionBackgroundColor,..."transparent"!==N.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(xg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:N.fixedBundle?.titleBackgroundColor||"none",color:N.fixedBundle?.titleTextColor||"black",textAlign:N.fixedBundle.infoAlignment??"center",fontSize:N.fixedBundle?.titleFontSize,..."transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),F&&t.createElement(hg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:N.fixedBundle?.subtitleFontSize,textAlign:N.fixedBundle.infoAlignment??"center",..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},F),O?t.createElement(yg,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement($x,{isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>{T(e,r)},isMobile:d,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))))):t.createElement(_g,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Ng,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement($x,{key:`${n.productId}-${r}`,isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>T(e,r),isMobile:d,index:r,isHorizontal:O,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))),$&&t.createElement(kx,{productsWithIndices:_,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:N.general.ctaTextColor,backgroundColor:N.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:I,primaryProductId:h,variantId:p||void 0}))),t.createElement(Sg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},Number(B)>0&&Number(D)>0&&N.fixedBundle.compareAtPriceVisibility&&t.createElement($g,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(zg,{className:"yt-fixedBundle-summary_price"},_x(N.general.currencySymbol,e?.storeCurrencyCode),Ix(B))),0!==C.size&&t.createElement(Bg,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(zg,{className:"yt-fixedBundle-summary_price"},_x(N.general.currencySymbol,e?.storeCurrencyCode),Ix(z))," ",Number(D)>0&&t.createElement(Dg,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",_x(N.general.currencySymbol,e?.storeCurrencyCode),Ix(D)))),t.createElement(Ig,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!$?I(e):f(!0)},disabled:C.size<1||r,style:{backgroundColor:N.general?.ctaBackgroundColor||"#121212",color:N.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${N.general?.ctaBackgroundColor||"#121212"}`,boxShadow:N.general.ctaShadowType,paddingTop:N.general?.ctaPadding,paddingBottom:N.general?.ctaPadding,borderRadius:N.general.ctaBorderRadius,width:N.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=N.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=N.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,N.fixedBundle?.ctaTitle??"Add Bundle to cart")))},zx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[a,i]=c(1),[d,s]=c([]),[p,u]=c(""),[m,f]=c({}),[g,x]=c(null),h=o(null),y=o(null),b=o(),v=o(null),[w,C]=c(window.innerWidth<640);l((()=>{const e=()=>C(window.innerWidth<640);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]);const{config:E,customizations:k,products:T,giftboxes:S=[]}=e,$=d.reduce(((e,t)=>e+t.quantity),0),B=d.some((e=>!e.isGiftBox)),z=d.some((e=>e.isGiftBox)),D=d.reduce(((e,t)=>e+t.price*t.quantity),0)/100,I=d.reduce(((e,t)=>{const n=[...T,...S].find((e=>e.id.toString()===t.productId)),r=n?.variants.find((e=>e.id.toString()===t.variantId));return e+(r?.compare_at_price??t.price)*t.quantity}),0)/100,_=e=>2!==e||B?3!==e||z?(i(e),void window.scrollTo(0,0)):alert("Select a gift box first"):alert("Add at least one product first"),N=async()=>{if(3!==a||!d.length)return;const e=d.map((e=>({variantId:e.variantId,quantity:1,properties:{...p&&{Message:p}}})));r(e)},P=async(e,t)=>{const n=e.target.files?.[0];if(!n)return;if(n.size>5242880)return alert("File too large. Max 5MB.");if(!n.type.match(/^image\/(jpeg|png|jpg)$/i))return alert("Only JPEG/PNG.");(new FormData).append("file",n)};return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"20px auto",maxWidth:"1400px"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:w?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:w?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:w?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},[1,2,3].map((e=>t.createElement("div",{key:e,className:"yt-collection-bundle-step-item "+(a===e?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:a===e?1:.5,transition:"opacity 0.2s"},onClick:()=>_(e)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(a===e?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:a===e?k?.stepActiveBg||"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},1===e?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:1===a?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:a===e?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600"}},1===e?"Products":2===e?"Select Gift Box":"Customize Gift Details"))))),t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:w?"14px":"16px",marginBottom:w?"0":"14px",fontWeight:"400",color:"#000"}},"Selected a personalized product? Upload your message, photos & greeting card text. If not, just share your greeting card message here.")),t.createElement("div",{className:"yt-collection-bundle-step-content "+(1===a?"yt-collection-bundle-step-content-active":""),style:{display:1===a?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:w?"grid":"flex",gridTemplateColumns:w?"repeat(2,1fr)":"",flexWrap:w?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:"100px"}},(e?.config?.hideOutOfStockProducts?T.filter((e=>e.available)):T).map((e=>{const n=e.variants.find((t=>t.id.toString()===document.querySelector(`[data-product-id="${e.id}"]`)?.dataset.selectedVariant))||e.variants[0],r=d.filter((t=>t.productId===e.id.toString()&&t.variantId===n.id.toString())).reduce(((e,t)=>e+t.quantity),0),o=g===e.id;return t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":n.id,"data-current-price":n.price,style:{display:"flex",flexDirection:"column",border:k?.productCardBorder||"1px solid #ddd",background:k?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:w?0:"250px",maxWidth:w?"none":"250px",borderRadius:k?.borderRadius||"8px",boxShadow:"spread"===k?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===k?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:w?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:k?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onMouseEnter:()=>x(e.id),onMouseLeave:()=>x(null)},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:o?0:1,transform:o?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:e.images[1]||e.images[0],style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:o?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"10px",fontSize:"12px",zIndex:2},onChange:t=>((e,t)=>{const n=e.variants.find((e=>e.id===parseInt(t)));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())})(e,t.target.value),defaultValue:n.id},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("a",{href:"#",style:{textDecoration:"none",color:"inherit"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:w?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title)),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:w?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0}},"₹",(n.price/100).toFixed(0)),n.compare_at_price&&n.compare_at_price>n.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0}},"₹",(n.compare_at_price/100).toFixed(0)))),E.allowMultipleQty&&r>0?t.createElement("div",{style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{style:{width:"40%",height:n.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:w?"6px":"12px",fontSize:w?"12px":"14px"},onClick:()=>{s((t=>t.map((t=>t.productId===e.id.toString()&&t.variantId===n.id.toString()?{...t,quantity:t.quantity-1}:t)).filter((e=>e.quantity>0))))}},"-"),t.createElement("span",{style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%"}},r),t.createElement("button",{style:{width:"40%",height:n.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:w?"6px":"12px",fontSize:w?"12px":"14px"},onClick:()=>{s((t=>t.map((t=>t.productId===e.id.toString()&&t.variantId===n.id.toString()?{...t,quantity:t.quantity+1}:t))))}},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(r>0?"yt-collection-bundle-add-btn-added":""),style:{background:r>0?"#28a745":k?.atcBg||"#007bff",color:k?.atcText||"#fff",border:"none",padding:w?"6px":"12px",fontSize:w?"12px":"14px",fontWeight:600,cursor:n.available?"pointer":"not-allowed",transition:"all 0.2s",...!n.available&&{opacity:"0.5"},...g=="atb"+e.id&&{filter:"brightness(90%)"}},onMouseEnter:()=>x("atb"+e.id),onMouseLeave:()=>x(null),onClick:()=>((e,t=!1)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());t?s((t=>t.filter((e=>!e.isGiftBox)).concat({productId:e.id.toString(),variantId:r,price:o,quantity:1,isGiftBox:!0}))):E.allowMultipleQty?s((t=>{const n=t.find((t=>t.productId===e.id.toString()&&t.variantId===r));return n?t.map((e=>e===n?{...e,quantity:e.quantity+1}:e)):[...t,{productId:e.id.toString(),variantId:r,price:o,quantity:1}]})):s((t=>{const n=t.find((t=>t.productId===e.id.toString()&&t.variantId===r));return n?t.filter((e=>e!==n)):[...t,{productId:e.id.toString(),variantId:r,price:o,quantity:1}]}))})(e),disabled:!n.available},r>0?"Added":n.available?"ADD TO BOX":"Out of Stock"))})))),t.createElement("div",{className:"yt-collection-bundle-step-content "+(2===a?"yt-collection-bundle-step-content-active":""),style:{display:2===a?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:w?"grid":"flex",gridTemplateColumns:w?"repeat(2,1fr)":"",flexWrap:w?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:"100px"}},(e?.config?.hideOutOfStockProducts?S.filter((e=>e.available)):S).map((e=>{const n=e.variants[0],r=d.some((t=>t.productId===e.id.toString()&&t.isGiftBox));return t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":n.id,"data-current-price":n.price,style:{display:"flex",flexDirection:"column",border:k?.productCardBorder||"1px solid #ddd",background:k?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:w?0:"250px",maxWidth:w?"none":"250px",borderRadius:k?.borderRadius||"8px",boxShadow:"spread"===k?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===k?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:w?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:k?.productImageRatio||"1/1",overflow:"hidden",background:"#f9f9f9"}},t.createElement("a",{href:e.handle||"#"},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png",style:{width:"100%",height:"100%",objectFit:"cover"},alt:e.title}))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:w?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title)),t.createElement("button",{className:"yt-collection-bundle-add-btn "+(r?"yt-collection-bundle-add-btn-added":""),style:{background:r?"#28a745":k?.atcBg||"#007bff",color:k?.atcText||"#fff",border:"none",padding:w?"6px":"12px",fontSize:w?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",...!n.available&&{opacity:"0.5"},...g=="atb"+e.id&&{filter:"brightness(90%)"}},onMouseEnter:()=>x("atb"+e.id),onMouseLeave:()=>x(null)},r?"Selected":"Select this box"))})))),t.createElement("div",{className:"yt-collection-bundle-step-content "+(3===a?"yt-collection-bundle-step-content-active":""),style:{display:3===a?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem"}},t.createElement("div",{className:"yt-collection-bundle-form-group",style:{marginBottom:"24px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"6px",color:"#333"}},"Message"),t.createElement("textarea",{className:"yt-collection-bundle-textarea",placeholder:"Enter a message here...",rows:4,maxLength:200,onChange:e=>u(e.target.value),style:{width:"100%",padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical"}})),t.createElement("div",{className:"yt-collection-bundle-form-group",style:{marginBottom:"24px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"6px",color:"#333"}},"Upload Images"),t.createElement("sub",{style:{display:"block",color:"#666",fontSize:"12px",marginTop:"4px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),t.createElement("div",{className:"yt-collection-bundle-attachment-box",ref:b,style:{marginTop:"16px",padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa",position:"relative"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},"Attachment 1"),t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png/img (max size: 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",backgroundColor:"white",cursor:"pointer"},onClick:()=>h.current?.click()},"Upload Image"),t.createElement("input",{ref:h,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>P(e)})),Object.keys(m).length<2&&t.createElement("button",{type:"button",style:{marginTop:"12px",background:"transparent",border:"none",color:"#007bff",fontSize:"14px",cursor:"pointer",textDecoration:"underline"},onClick:()=>v.current&&(v.current.style.display="block")},"+ Add another image"),t.createElement("div",{className:"yt-collection-bundle-attachment-box",ref:v,style:{marginTop:"16px",padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa",position:"relative",display:"none"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},"Attachment 2"),t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png/img (max size: 5MB)"),t.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",backgroundColor:"white",cursor:"pointer"},onClick:()=>y.current?.click()},"Upload Image"),t.createElement("input",{ref:y,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>P(e)}))))),t.createElement("div",{className:"yt-collection-bundle-bar",style:{background:k?.bundleBg||"#fff",color:k?.bundleText||"#333",border:k?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"600px",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:k?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:e?.config?.hideSelectedProducts&&0!==d.length?"0":"8px 8px 0",background:"#fff",position:"relative",borderRadius:k?.borderRadius||"8px"}},d.length>0?t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:e?.config?.hideSelectedProducts?"0":"4px 0",margin:"0 0 0 20px",scrollbarWidth:"none"}},!e?.config?.hideSelectedProducts&&d.reduce(((e,t)=>{const n=e.find((e=>e.productId===t.productId&&e.variantId===t.variantId));return n?n.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e}),[]).map(((e,n)=>{const r=[...T,...S].find((t=>t.id.toString()===e.productId));if(!r)return null;const o=(l=e.productId,T.some((e=>e.id.toString()===l))?1:S?.some((e=>e.id.toString()===l))?2:1);var l;const c=a===o;return t.createElement("div",{key:n,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"65px",height:"65px",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:c?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!c&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!c&&i(o)},t.createElement("img",{src:r.images[0],className:"yt-collection-bundle-bundle-img",style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600}},"x",e.quantity),c&&t.createElement("button",{className:"yt-collection-bundle-remove-item",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},onClick:t=>{var n,r;t.stopPropagation(),n=e.productId,r=e.variantId,s((e=>{const t=e.find((e=>e.productId===n&&e.variantId===r));return t?E.allowMultipleQty&&t.quantity>1?e.map((e=>e===t?{...e,quantity:e.quantity-1}:e)):e.filter((e=>e!==t)):e}))}},"x")))}))):t.createElement("div",{className:"yt-collection-bundle-items-ctx",style:{textAlign:"center",fontSize:"16px",color:"#555",zIndex:1,padding:"6px 60px",width:"100%"}},"add upto ",t.createElement("span",null,"8 items"))),w?t.createElement("div",{style:{display:"flex",flexDirection:"column",padding:"4px",gap:"10px"}},t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},$," Gifts Selected"),$>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",D.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",I.toLocaleString()))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s"},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>x(-1),onMouseLeave:()=>x(null)},"Back"),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(3===a&&0===$?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:3===a&&0===$?.6:1},onClick:3===a?N:()=>_(a+1),disabled:3===a&&0===$,onMouseEnter:()=>x(-2),onMouseLeave:()=>x(null)},n?"Loading...":3===a?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:k?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1==g&&{filter:"brightness(60%)"}},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>x(-1),onMouseLeave:()=>x(null)},"Back"),t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},$," Gifts Selected"),$>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",D.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",I.toLocaleString()))),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(3===a&&0===$?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:3===a&&0===$?.6:1,...-2==g&&{filter:"brightness(90%)"}},onClick:3===a?N:()=>_(a+1),disabled:3===a&&0===$,onMouseEnter:()=>x(-2),onMouseLeave:()=>x(null)},n?"Loading...":3===a?"Checkout":"Next"))))},Dx=window?.Shopify?.currency||{rate:1,active:"INR"},Ix=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Dx.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},_x=(e,t)=>t==Dx.active?e:dn(Dx.active)||Dx.active,Nx=(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)))},Px=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(tf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(rf,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(fg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(zx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Of,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Bx,{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 Ox=()=>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{Px as Bundle,Ox as BundleLoader,cu as Cart,ra as CouponFrame,qe as Nudge,Je as SpinnerWheel};
@@ -83,7 +83,7 @@ export type BundleConfig = {
83
83
  };
84
84
  declare const CollectionBundle: React.FC<{
85
85
  config: BundleConfig;
86
- setSelectedItems: (items: any) => void;
86
+ addCustomBundleToCart: (items: any) => void;
87
87
  bundleAddToCartLoading: boolean;
88
88
  }>;
89
89
  export default CollectionBundle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.7.397-collection-bundle.3",
3
+ "version": "0.7.397-collection-bundle.5",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "tsc && rollup -c",