yt-uikit 0.7.416-collection-bundle-fixes.0 → 0.7.416-collection-bundle-fixes.1

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.
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { CartCheckpoint } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ interface ProductOffersCouponProps {
5
+ offersToShow: CartCheckpoint[];
6
+ offersConfig?: ProductsOffersConfigType | null;
7
+ getOfferCardMessage: (offer: CartCheckpoint) => string;
8
+ setSelectedOffer: (offer: CartCheckpoint | null) => void;
9
+ setShowPopup: (show: boolean) => void;
10
+ }
11
+ export declare const ProductOffersCoupon: ({ offersToShow, offersConfig, getOfferCardMessage, setSelectedOffer, setShowPopup, }: ProductOffersCouponProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { CartCheckpoint } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ interface ProductOffersListProps {
5
+ offersToShow: CartCheckpoint[];
6
+ offersConfig: ProductsOffersConfigType;
7
+ getOfferCardMessage: (offer: CartCheckpoint) => string;
8
+ setSelectedOffer: (offer: CartCheckpoint | null) => void;
9
+ setShowPopup: (show: boolean) => void;
10
+ }
11
+ export declare const ProductOffersList: ({ offersToShow, offersConfig, getOfferCardMessage, setSelectedOffer, setShowPopup, }: ProductOffersListProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { CartCheckpoint, OfferTermsAndConditions } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ export declare const ProductOffersTermsMobilePopover: ({ showPopup, selectedOffer, selectedOfferTerms, onClose, offersConfig, }: {
5
+ showPopup: boolean;
6
+ selectedOffer: CartCheckpoint | null;
7
+ selectedOfferTerms: OfferTermsAndConditions | null;
8
+ onClose: () => void;
9
+ offersConfig?: ProductsOffersConfigType | null | undefined;
10
+ }) => React.ReactPortal | null;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { CartCheckpoint, OfferTermsAndConditions } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ export declare const ProductOffersTermsPopup: ({ showPopup, selectedOffer, selectedOfferTerms, onClose, offersConfig, }: {
5
+ showPopup: boolean;
6
+ selectedOffer: CartCheckpoint | null;
7
+ selectedOfferTerms: OfferTermsAndConditions | null;
8
+ onClose: () => void;
9
+ offersConfig?: ProductsOffersConfigType | null | undefined;
10
+ }) => React.ReactPortal | null;
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import { Checkpoint } from "../Cart/Cart";
3
+ export interface ProductsOffersConfigType {
4
+ sectionType?: "coupon" | "list";
5
+ sectionTitle?: string;
6
+ sectionBackgroundColor?: string;
7
+ sectionBgContrastColor?: string;
8
+ cardBackgroundColor?: string;
9
+ cardBackgroundTransparent?: boolean;
10
+ textColor?: string;
11
+ accentColor?: string;
12
+ roundness?: number;
13
+ cardPadding?: number;
14
+ viewDetailsTitle?: string;
15
+ alignment?: "left" | "middle" | "right";
16
+ iconVisibility?: boolean;
17
+ popupIsolationStrategy?: "revert" | "revert-layer" | "unset" | "initial" | "inherit" | "none";
18
+ }
19
+ export interface CartCheckpoint extends Checkpoint {
20
+ customCartProgressBarCriteria?: string | null;
21
+ discountPercentage?: number | null;
22
+ discountId?: number | null;
23
+ }
24
+ export interface OfferTermsAndConditions {
25
+ offerMessage: string;
26
+ terms: string[];
27
+ }
28
+ declare const ProductsOffers: ({ offersConfig, offers, }: {
29
+ offersConfig?: ProductsOffersConfigType | null | undefined;
30
+ offers: CartCheckpoint[];
31
+ }) => React.JSX.Element;
32
+ export default ProductsOffers;
package/dist/esm/index.js CHANGED
@@ -4229,26 +4229,17 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4229
4229
  `,ag=x.div`
4230
4230
  position: relative;
4231
4231
  width: 90%;
4232
- max-height: 55vh;
4232
+ max-height: 57vh;
4233
4233
  max-width: 800px;
4234
4234
  background-color: white;
4235
4235
  border-radius: 8px;
4236
- padding: 12px 10px;
4237
- overflow-y: auto;
4236
+ overflow-y: hidden;
4238
4237
  z-index: 1001;
4239
4238
 
4240
- /* Hide scrollbar (Chrome, Safari) */
4241
- &::-webkit-scrollbar {
4242
- display: none;
4243
- }
4244
-
4245
- /* Hide scrollbar (Firefox) */
4246
- scrollbar-width: none;
4247
- -ms-overflow-style: none;
4248
4239
 
4249
4240
  @media (max-width: 600px) {
4250
- padding: 12px;
4251
- width: 100%;
4241
+ box-sizing: border-box;
4242
+ width: 100% ;
4252
4243
  max-height: 37vh;
4253
4244
  position: absolute;
4254
4245
  left: 0;
@@ -4261,7 +4252,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4261
4252
  display: flex;
4262
4253
  flex-direction: column;
4263
4254
  align-items: center;
4264
- padding: 8px 0px;
4255
+ padding: 10px 7px 0px 7px;
4265
4256
  `,lg=x.input`
4266
4257
  flex-grow: 1;
4267
4258
  padding: 8px 12px;
@@ -4278,10 +4269,11 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4278
4269
  padding: 6px 10px;
4279
4270
  }
4280
4271
  `,cg=x.button`
4272
+ font-weight: 600;
4273
+ font-size: 12px;
4281
4274
  background: none;
4282
4275
  border: none;
4283
4276
  color: #666;
4284
- font-size: 14px;
4285
4277
  padding: 5.36px 10.7px;
4286
4278
  cursor: pointer;
4287
4279
  `;x.div`
@@ -4310,18 +4302,24 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4310
4302
  margin-left: 4px;
4311
4303
  }
4312
4304
  `;const dg=x.div`
4305
+ max-height: calc(57vh - 80px);
4306
+ overflow-y: auto;
4313
4307
  display: flex;
4314
4308
  flex-direction: column;
4315
4309
  gap: 12px;
4310
+ @media (max-width: 600px) {
4311
+ max-height: calc(37vh - 80px);
4312
+ }
4313
+
4316
4314
  `,sg=x.div`
4317
4315
  display: flex;
4318
4316
  align-items: center;
4319
- padding: 8px;
4317
+ padding: 8px 4px;
4320
4318
  border-radius: 8px;
4321
4319
  cursor: pointer;
4322
4320
  transition: background-color 0.2s ease;
4323
-
4324
- background-color: ${e=>e.isSelected?e.primaryBgColor+"10":"transparent"};
4321
+ margin: 0px 6px;
4322
+ background-color: ${e=>e.isSelected?e.primaryBgColor+"10":"transparent"};
4325
4323
  border: ${e=>e.isSelected?"1px solid "+(e.primaryBgColor+"40"):"1px solid transparent"};
4326
4324
 
4327
4325
  &:hover {
@@ -4366,7 +4364,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4366
4364
  cursor: pointer;
4367
4365
  white-space: nowrap;
4368
4366
  transition: background-color 0.2s ease;
4369
-
4367
+ font-weight: 600;
4370
4368
  &:hover {
4371
4369
  background-color: ${e=>e.primaryBgColor?e.primaryBgColor+"20":"#e75a87cc"};
4372
4370
  cursor: pointer;
@@ -4413,7 +4411,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4413
4411
  font-size: 11px;
4414
4412
  padding: 4px 8px;
4415
4413
  }
4416
- `,bg=({bundle:e,addToCartFunction:n})=>{const[r,a]=c({}),[d,s]=c(!1),[p,u]=c(0),[m,f]=c(0),[g,h]=c(""),[x,y]=c([]),[b,v]=c({}),[w,C]=c(!1),[E,k]=c(window.innerWidth<450),T=e.builderTiers?.productTier||[],{originalPrice:S,dealPrice:$,offerValue:B}=i((()=>{const t=[];let n=0;Object.values(r).forEach((e=>{e.productId&&e.variantId&&(t.push({productId:e.productId,variantId:e.variantId}),n++)}));let o=0,a=0;for(const{productId:n,variantId:r}of t){const t=e.products.find((e=>e.productId===n));if(!t)continue;const i=t.productDetails.variants.edges.find((e=>e.node.id===r))?.node;if(!i)continue;const l=Number.parseFloat(i.price||"0"),c=Number.parseFloat(i.compareAtPrice||"0");o+=l,a+=c>0?c:l}let i=o;(n===T.length||e?.dealAmount)&&(e?.percentageOff?i=o*(1-e.percentageOff/100):e?.dealAmount?i=e.dealAmount:e?.amountOff&&e.amountOff<o&&(i=o-e.amountOff));const l=a||o,c=l-i;return{originalPrice:l.toFixed(2),dealPrice:i.toFixed(2),offerValue:c.toFixed(2)}}),[e,r,T.length]);l((()=>{u(T.length-Object.keys(r).length)}),[r]),l((()=>{const e={};let t=!1;T.forEach(((n,r)=>{if(n.isFixed&&n.products&&n.products.length>0){const o=n.products[0];if(o&&o.productId){const n=o.variantIds?.[0]||I(o.productId);n&&(e[r]={productId:o.productId,variantId:n},t=!0)}}})),t&&a((t=>({...t,...e})))}),[T]),l((()=>{if(null===m||0===T.length)return;const t=T[m].products.map((e=>e.productId)),n=new Map;e.products.forEach((e=>{t.includes(e.productId)&&!n.has(e.productId)&&n.set(e.productId,e)}));let r=Array.from(n.values());if(""!==g.trim()){const e=g.toLowerCase();r=r.filter((t=>t.productDetails.title.toLowerCase().includes(e)||t.productDetails.selectedVariant?.displayName?.toLowerCase().includes(e)||t.productDetails.collections?.edges?.some((t=>t.node.title.toLowerCase().includes(e)))))}y(r)}),[g,e.products,m,T]);const z=t=>{const n=e.products.find((e=>e.productId===t));return n?.productDetails},I=t=>{const n=e.products.find((e=>e.productId===t));return n&&n.productDetails.variants.edges.length?n.productDetails.variants.edges[0].node.id:""},D=(e,t)=>{if(null==m)return;const n=t||I(e);a((t=>({...t,[m]:{productId:e,variantId:n}}))),s(!1),h("")},_=e=>{a((t=>{const n={...t};return delete n[e],n})),v({})};console.log("version 8 ");const N=t=>{const n=T[t];if(console.log("Opening product selection for tier:",t,n),n.isFixed)return;f(t),s(!0),h("");const r=n.products.map((e=>e.productId)),o=e.products.filter((e=>r.includes(e.productId))),a=new Map;o.forEach((e=>{a.has(e.productId)||a.set(e.productId,e)})),console.log("Filtered products for tier:",Array.from(a.values())),y(Array.from(a.values()))};l((()=>{const e=()=>{k(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const P=e.customizations,O=E,A="bundles"===e.appName?e.pageHeader?.title:e?.title,F="bundles"===e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(jf,{verticalMargin:P.comboBundle.verticalMargin,borderRadius:"20px"},P.comboBundle.embedContentVisibility&&t.createElement(Vf,null,P.comboBundle?.embedContentVisibility&&P.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"10px",width:"100%",textAlign:P.comboBundle.infoAlignment||"left"}},t.createElement("h2",{style:{fontSize:"28px",color:P.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},A)),P.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&Number($)>1&&t.createElement(t.Fragment,null,t.createElement(Wf,{infoAlignment:P.comboBundle.infoAlignment},t.createElement(Hf,null,Wh(P.general.currencySymbol,e.storeCurrencyCode),Vh($)),Number($)<Number(S)&&t.createElement(Uf,{style:{minWidth:"fit-content"}},Wh(P.general.currencySymbol,e.storeCurrencyCode)," ",Vh(S)),t.createElement(qf,{style:{minWidth:"fit-content"}},"In Stock")),t.createElement(Qf,{style:{textAlign:P.comboBundle.infoAlignment||"left",fontSize:P.comboBundle.productDescriptionFontSize}},"Tax included. Shipping calculated at checkout."))),t.createElement(Gf,{gridSize:T.length,isHorizontal:O},T.map(((e,n)=>{const a=(e=>!!r[e]&&!!r[e].productId)(n),{product:i,variantId:c}=(e=>{const t=r?.[e];return t?{product:z(t.productId),variantId:t.variantId}:{product:void 0,variantId:""}})(n),d=i?((e,t)=>{if(!e||!e.variants.edges)return null;const n=e.variants.edges.find((e=>e.node.id===t));return n?.node})(i,c):null;console.log("Selected Variants",d);const s=e.isFixed,p=o(null);return l((()=>{const e=p.current;if(!e)return;const t=e.querySelector("span");if(!t)return;const n=e.clientWidth,r=t.scrollWidth;if(r<=n)return e.setAttribute("data-overflow","false"),e.style.removeProperty("--scroll-end"),void e.style.removeProperty("--duration");const o=-(r-n);e.style.setProperty("--scroll-end",`${o}px`);const a=2*Math.max(1,Math.abs(o)/40)+3;e.style.setProperty("--duration",`${a}s`),e.setAttribute("data-overflow","true")}),[d?.displayName,d?.title]),console.log(d),a&&i?t.createElement(Yf,{key:`tier-${n}`,onClick:()=>!s&&N(n),style:{borderRadius:"20px",cursor:s?"default":"pointer"},isHorizontal:O,infoAlignment:P.comboBundle.infoAlignment},!s&&t.createElement(tg,{onClick:e=>{e.stopPropagation(),_(n)}},"×"),t.createElement(Xf,{src:i?.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=200&width=200",alt:i?.title,style:{aspectRatio:P?.general.imageAspectRatio||"1/1"},isHorizontal:O}),t.createElement(Kf,{style:{color:"#1e1e1e",textAlign:"center",...O&&"right"===P.comboBundle.infoAlignment&&{padding:"0 8px",textAlign:"right",alignItems:"flex-end"},...O&&"left"===P.comboBundle.infoAlignment&&{padding:"0 5px",textAlign:"left",alignItems:"flex-start"},...!O&&"left"===P.comboBundle.infoAlignment&&{padding:"0 10px"},...O&&"center"===P.comboBundle.infoAlignment&&{textAlign:"left",alignItems:"flex-start",padding:"0 5px"}},isHorizontal:O},t.createElement(eg,{style:{fontSize:"15px",width:"100%",display:"flex",alignItems:"center",fontWeight:"600",textAlign:"center",lineHeight:"normal"},ref:p},t.createElement("span",null,i?.title," - ",d?.title)))):t.createElement(Zf,{key:`tier-${n}`,onClick:()=>!s&&N(n),isHorizontal:O,infoAlignment:P.comboBundle.infoAlignment,style:{cursor:s?"default":"pointer"}},s?t.createElement("div",{style:{textAlign:"center",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},t.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"8px"}},"Fixed Product"),t.createElement("div",{style:{fontSize:"14px",fontWeight:"600"}},e.title||`Product ${n+1}`)):t.createElement(t.Fragment,null,t.createElement("div",{style:{width:"100%",height:"80%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"18px",borderTopRightRadius:"18px",flexShrink:0,backgroundColor:"#f8f9fa"}},t.createElement(ng,null,"+")),t.createElement(Jf,{style:{fontSize:"15px",fontWeight:"600",color:P.comboBundle.titleTextColor||"#1e1e1e",lineHeight:"normal",height:"20%",display:"flex",alignItems:"center",justifyContent:"center"},isHorizontal:O,infoAlignment:P.comboBundle.infoAlignment},t.createElement("p",{style:{width:"80%",margin:"0",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e.title?`${e.title}`:`Select Product ${n+1}`))))}))),t.createElement(rg,{hoverProperties:{customizeHoverState:P.general.customizeHoverState,backgroundColor:P.general.ctaHoverBackgroundColor,textColor:P.general.ctaHoverTextColor},borderRadius:P.general.ctaBorderRadius,primaryBgColor:P.general.ctaBackgroundColor,onClick:async()=>{C(!0);try{if(p>0)return console.log("Please select all products"),void C(!1);const t=Object.values(r).map((e=>e.variantId)),o=Object.values(r).map((t=>{const n=e.products.find((e=>e.productId===t.productId));if(!n)return null;const r=n?.productDetails?.variants?.edges?.find((e=>e.node.id===t.variantId))?.node;return r?{variantId:t.variantId,price:Number(r.price)}:null})).filter(Boolean);await n(t.length,t,Number($),o)}catch(e){console.log("Add to cart error:",e)}finally{C(!1)}},textColor:P.general.ctaTextColor,borderColor:P.general.ctaBorderColor},0===p?w?t.createElement(Yo,{color:"white",loading:w,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,P.comboBundle.ctaTitle||"Add Bundle to cart"):`Add ${p} more item(s)`),P.comboBundle?.embedContentVisibility&&P.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{style:{margin:"20px 0px"}},t.createElement("h4",{style:{fontSize:"16px",color:P.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:P.general.primaryColor+"20",textAlign:P.comboBundle.infoAlignment||"left"}},"Description"),t.createElement("div",{style:{fontSize:P.comboBundle.productDescriptionFontSize||"16px",color:P.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:P.general.primaryColor+"08",textAlign:P.comboBundle.infoAlignment||"left"},dangerouslySetInnerHTML:{__html:F}})),d&&t.createElement(og,{onClick:()=>s(!1)},t.createElement(ag,{onClick:e=>e.stopPropagation()},t.createElement(ig,null,t.createElement("div",{style:{display:"flex",width:"100%",gap:"2px",alignItems:"center",marginBottom:"8px"}},t.createElement(lg,{placeholder:"Search",value:g,onChange:e=>{h(e.target.value)}}),t.createElement(cg,{onClick:()=>s(!1)},"Cancel")),t.createElement("div",{style:{height:"1px",width:"100%",backgroundColor:"#EBEBEB"}})),t.createElement(dg,null,x.length>0?x.map((n=>{const o=n.productDetails,a=(e=>{if(null==m)return!1;const t=r?.[m];return!!t&&t.productId===e})(n.productId);let i=o.variants.edges[0].node.id;return i=a&&null!==m?r?.[m]?.variantId||i:b[n.productId]||(o.variants.edges.length>0?o.variants.edges[0].node.id:""),t.createElement(sg,{className:"mixAndMatch-product-item",primaryBgColor:P.general.primaryColor||"#1e1e1e",key:o.id,isSelected:a,onClick:()=>{D(n.productId,i)}},t.createElement(pg,{className:"mixAndMatch-vendor-image",src:o.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=50&width=50",alt:o.title}),t.createElement(ug,{className:"mixAndMatch-vendor-info"},t.createElement(mg,{className:"mixAndMatch-vendor-name"},o.title),t.createElement(xg,{className:"mixAndMatch-variant-options"},o.variants.edges.map((({node:e})=>e.inventoryQuantity>0&&t.createElement(yg,{className:"mixAndMatch-variant-button "+(i===e.id?"mixAndMatch-variant-button--selected":""),primaryBgColor:P.general?.primaryColor,disabled:!!a,key:e.id,isSelected:i===e.id,tierHasProductId:!!a,onClick:t=>{var r,o;t.stopPropagation(),r=n.productId,o=e.id,v((e=>({...e,[r]:o})))}},e.title))))),t.createElement(fg,{cornerRadiusType:e?.cornerRadiusType??"",primaryBgColor:P.general?.primaryColor||"#1e1e1e",onClick:()=>a?_(m||0):D(n.productId,i)},a?t.createElement(gg,null,"Added"):" + Add"))})):t.createElement(hg,null,'No products found matching "',g,'"')))))},vg=x.div`
4414
+ `,bg=({bundle:e,addToCartFunction:n})=>{const[r,a]=c({}),[d,s]=c(!1),[p,u]=c(0),[m,f]=c(0),[g,h]=c(""),[x,y]=c([]),[b,v]=c({}),[w,C]=c(!1),[E,k]=c(window.innerWidth<450),T=e.builderTiers?.productTier||[],{originalPrice:S,dealPrice:$,offerValue:B}=i((()=>{const t=[];let n=0;Object.values(r).forEach((e=>{e.productId&&e.variantId&&(t.push({productId:e.productId,variantId:e.variantId}),n++)}));let o=0,a=0;for(const{productId:n,variantId:r}of t){const t=e.products.find((e=>e.productId===n));if(!t)continue;const i=t.productDetails.variants.edges.find((e=>e.node.id===r))?.node;if(!i)continue;const l=Number.parseFloat(i.price||"0"),c=Number.parseFloat(i.compareAtPrice||"0");o+=l,a+=c>0?c:l}let i=o;(n===T.length||e?.dealAmount)&&(e?.percentageOff?i=o*(1-e.percentageOff/100):e?.dealAmount?i=e.dealAmount:e?.amountOff&&e.amountOff<o&&(i=o-e.amountOff));const l=a||o,c=l-i;return{originalPrice:l.toFixed(2),dealPrice:i.toFixed(2),offerValue:c.toFixed(2)}}),[e,r,T.length]);l((()=>{u(T.length-Object.keys(r).length)}),[r]),l((()=>{const e={};let t=!1;T.forEach(((n,r)=>{if(n.isFixed&&n.products&&n.products.length>0){const o=n.products[0];if(o&&o.productId){const n=o.variantIds?.[0]||I(o.productId);n&&(e[r]={productId:o.productId,variantId:n},t=!0)}}})),t&&a((t=>({...t,...e})))}),[T]),l((()=>{if(null===m||0===T.length)return;const t=T[m].products.map((e=>e.productId)),n=new Map;e.products.forEach((e=>{t.includes(e.productId)&&!n.has(e.productId)&&n.set(e.productId,e)}));let r=Array.from(n.values());if(""!==g.trim()){const e=g.toLowerCase();r=r.filter((t=>t.productDetails.title.toLowerCase().includes(e)||t.productDetails.selectedVariant?.displayName?.toLowerCase().includes(e)||t.productDetails.collections?.edges?.some((t=>t.node.title.toLowerCase().includes(e)))))}y(r)}),[g,e.products,m,T]);const z=t=>{const n=e.products.find((e=>e.productId===t));return n?.productDetails},I=t=>{const n=e.products.find((e=>e.productId===t));if(!n||!n.productDetails.variants.edges.length)return"";const r=n.productDetails.variants.edges.find((e=>e.node.inventoryQuantity>0))?.node;return r?r.id:n.productDetails.variants.edges[0].node.id},D=(e,t)=>{if(null==m)return;const n=t||I(e);a((t=>({...t,[m]:{productId:e,variantId:n}}))),s(!1),h("")},_=e=>{a((t=>{const n={...t};return delete n[e],n})),v({})};console.log("version 8 ");const N=t=>{const n=T[t];if(console.log("Opening product selection for tier:",t,n),n.isFixed)return;f(t),s(!0),h("");const r=n.products.map((e=>e.productId)),o=e.products.filter((e=>r.includes(e.productId))),a=new Map;o.forEach((e=>{a.has(e.productId)||a.set(e.productId,e)})),console.log("Filtered products for tier:",Array.from(a.values())),y(Array.from(a.values()))};l((()=>{const e=()=>{k(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const P=e.customizations,O=E,A="bundles"===e.appName?e.pageHeader?.title:e?.title,F="bundles"===e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(jf,{verticalMargin:P.comboBundle.verticalMargin,borderRadius:"20px"},P.comboBundle.embedContentVisibility&&t.createElement(Vf,null,P.comboBundle?.embedContentVisibility&&P.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"10px",width:"100%",textAlign:P.comboBundle.infoAlignment||"left"}},t.createElement("h2",{style:{fontSize:"28px",color:P.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},A)),P.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&Number($)>1&&t.createElement(t.Fragment,null,t.createElement(Wf,{infoAlignment:P.comboBundle.infoAlignment},t.createElement(Hf,null,Wh(P.general.currencySymbol,e.storeCurrencyCode),Vh($)),Number($)<Number(S)&&t.createElement(Uf,{style:{minWidth:"fit-content"}},Wh(P.general.currencySymbol,e.storeCurrencyCode)," ",Vh(S)),t.createElement(qf,{style:{minWidth:"fit-content"}},"In Stock")),t.createElement(Qf,{style:{textAlign:P.comboBundle.infoAlignment||"left",fontSize:P.comboBundle.productDescriptionFontSize}},"Tax included. Shipping calculated at checkout."))),t.createElement(Gf,{gridSize:T.length,isHorizontal:O},T.map(((e,n)=>{const a=(e=>!!r[e]&&!!r[e].productId)(n),{product:i,variantId:c}=(e=>{const t=r?.[e];return t?{product:z(t.productId),variantId:t.variantId}:{product:void 0,variantId:""}})(n),d=i?((e,t)=>{if(!e||!e.variants.edges)return null;const n=e.variants.edges.find((e=>e.node.id===t));return n?.node})(i,c):null,s=e.isFixed,p=o(null);return l((()=>{const e=p.current;if(!e)return;const t=e.querySelector("span");if(!t)return;const n=e.clientWidth,r=t.scrollWidth;if(r<=n)return e.setAttribute("data-overflow","false"),e.style.removeProperty("--scroll-end"),void e.style.removeProperty("--duration");const o=-(r-n);e.style.setProperty("--scroll-end",`${o}px`);const a=2*Math.max(1,Math.abs(o)/40)+3;e.style.setProperty("--duration",`${a}s`),e.setAttribute("data-overflow","true")}),[d?.displayName,d?.title]),a&&i?t.createElement(Yf,{key:`tier-${n}`,onClick:()=>!s&&N(n),style:{borderRadius:"20px",cursor:s?"default":"pointer"},isHorizontal:O,infoAlignment:P.comboBundle.infoAlignment},!s&&t.createElement(tg,{onClick:e=>{e.stopPropagation(),_(n)}},"×"),t.createElement(Xf,{src:i?.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=200&width=200",alt:i?.title,style:{aspectRatio:P?.general.imageAspectRatio||"1/1"},isHorizontal:O}),t.createElement(Kf,{style:{color:"#1e1e1e",textAlign:"center",...O&&"right"===P.comboBundle.infoAlignment&&{padding:"0 8px",textAlign:"right",alignItems:"flex-end"},...O&&"left"===P.comboBundle.infoAlignment&&{padding:"0 5px",textAlign:"left",alignItems:"flex-start"},...!O&&"left"===P.comboBundle.infoAlignment&&{padding:"0 10px"},...O&&"center"===P.comboBundle.infoAlignment&&{textAlign:"left",alignItems:"flex-start",padding:"0 5px"}},isHorizontal:O},t.createElement(eg,{style:{fontSize:"15px",width:"100%",display:"flex",alignItems:"center",fontWeight:"600",textAlign:"center",lineHeight:"normal"},ref:p},t.createElement("span",null,i?.title," - ",d?.title)))):t.createElement(Zf,{key:`tier-${n}`,onClick:()=>!s&&N(n),isHorizontal:O,infoAlignment:P.comboBundle.infoAlignment,style:{cursor:s?"default":"pointer"}},s?t.createElement("div",{style:{textAlign:"center",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},t.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"8px"}},"Fixed Product"),t.createElement("div",{style:{fontSize:"14px",fontWeight:"600"}},e.title||`Product ${n+1}`)):t.createElement(t.Fragment,null,t.createElement("div",{style:{width:"100%",height:"80%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"18px",borderTopRightRadius:"18px",flexShrink:0,backgroundColor:"#f8f9fa"}},t.createElement(ng,null,"+")),t.createElement(Jf,{style:{fontSize:"15px",fontWeight:"600",color:P.comboBundle.titleTextColor||"#1e1e1e",lineHeight:"normal",height:"20%",display:"flex",alignItems:"center",justifyContent:"center"},isHorizontal:O,infoAlignment:P.comboBundle.infoAlignment},t.createElement("p",{style:{width:"80%",margin:"0",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},e.title?`${e.title}`:`Select Product ${n+1}`))))}))),t.createElement(rg,{hoverProperties:{customizeHoverState:P.general.customizeHoverState,backgroundColor:P.general.ctaHoverBackgroundColor,textColor:P.general.ctaHoverTextColor},borderRadius:P.general.ctaBorderRadius,primaryBgColor:P.general.ctaBackgroundColor,onClick:async()=>{C(!0);try{if(p>0)return console.log("Please select all products"),void C(!1);const t=Object.values(r).map((e=>e.variantId)),o=Object.values(r).map((t=>{const n=e.products.find((e=>e.productId===t.productId));if(!n)return null;const r=n?.productDetails?.variants?.edges?.find((e=>e.node.id===t.variantId))?.node;return r?{variantId:t.variantId,price:Number(r.price)}:null})).filter(Boolean);await n(t.length,t,Number($),o)}catch(e){console.log("Add to cart error:",e)}finally{C(!1)}},textColor:P.general.ctaTextColor,borderColor:P.general.ctaBorderColor},0===p?w?t.createElement(Yo,{color:"white",loading:w,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,P.comboBundle.ctaTitle||"Add Bundle to cart"):`Add ${p} more item(s)`),P.comboBundle?.embedContentVisibility&&P.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{style:{margin:"20px 0px"}},t.createElement("h4",{style:{fontSize:"16px",color:P.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:P.general.primaryColor+"20",textAlign:P.comboBundle.infoAlignment||"left"}},"Description"),t.createElement("div",{style:{fontSize:P.comboBundle.productDescriptionFontSize||"16px",color:P.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:P.general.primaryColor+"08",textAlign:P.comboBundle.infoAlignment||"left"},dangerouslySetInnerHTML:{__html:F}})),d&&t.createElement(og,{onClick:()=>s(!1)},t.createElement(ag,{onClick:e=>e.stopPropagation()},t.createElement(ig,{style:{position:"sticky",top:0,background:"#fff",zIndex:10}},t.createElement("div",{style:{display:"flex",width:"100%",gap:"2px",alignItems:"center",marginBottom:"8px"}},t.createElement(lg,{placeholder:"Search",value:g,onChange:e=>{h(e.target.value)}}),t.createElement(cg,{onClick:()=>s(!1)},"Cancel")),t.createElement("div",{style:{height:"1px",width:"100%",backgroundColor:"#EBEBEB"}})),t.createElement(dg,null,x.length>0?x.map((n=>{const o=n.productDetails,a=(e=>{if(null==m)return!1;const t=r?.[m];return!!t&&t.productId===e})(n.productId),i=I(n.productId);let l=i||"";return l=a&&null!==m?r?.[m]?.variantId||l:b[n.productId]||i,t.createElement(sg,{className:"mixAndMatch-product-item",primaryBgColor:P.general.primaryColor||"#1e1e1e",key:o.id,isSelected:a,onClick:()=>{D(n.productId,l)}},t.createElement(pg,{className:"mixAndMatch-vendor-image",src:o.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=50&width=50",alt:o.title}),t.createElement(ug,{className:"mixAndMatch-vendor-info"},t.createElement(mg,{className:"mixAndMatch-vendor-name"},o.title),t.createElement(xg,{className:"mixAndMatch-variant-options"},o.variants.edges.map((({node:e})=>e.inventoryQuantity>0&&t.createElement(yg,{className:"mixAndMatch-variant-button "+(l===e.id?"mixAndMatch-variant-button--selected":""),primaryBgColor:P.general?.primaryColor,disabled:!!a,key:e.id,isSelected:l===e.id,tierHasProductId:!!a,onClick:t=>{var r,o;t.stopPropagation(),r=n.productId,o=e.id,v((e=>({...e,[r]:o})))}},e.title))))),t.createElement(fg,{cornerRadiusType:e?.cornerRadiusType??"",primaryBgColor:P.general?.primaryColor||"#1e1e1e",onClick:()=>a?_(m||0):D(n.productId,l)},a?t.createElement(gg,null,"Added"):" + Add"))})):t.createElement(hg,null,'No products found matching "',g,'"')))))},vg=x.div`
4417
4415
  border-radius: 8px;
4418
4416
  container-type: inline-size;
4419
4417
  `,wg=x.div`
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { CartCheckpoint } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ interface ProductOffersCouponProps {
5
+ offersToShow: CartCheckpoint[];
6
+ offersConfig?: ProductsOffersConfigType | null;
7
+ getOfferCardMessage: (offer: CartCheckpoint) => string;
8
+ setSelectedOffer: (offer: CartCheckpoint | null) => void;
9
+ setShowPopup: (show: boolean) => void;
10
+ }
11
+ export declare const ProductOffersCoupon: ({ offersToShow, offersConfig, getOfferCardMessage, setSelectedOffer, setShowPopup, }: ProductOffersCouponProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { CartCheckpoint } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ interface ProductOffersListProps {
5
+ offersToShow: CartCheckpoint[];
6
+ offersConfig: ProductsOffersConfigType;
7
+ getOfferCardMessage: (offer: CartCheckpoint) => string;
8
+ setSelectedOffer: (offer: CartCheckpoint | null) => void;
9
+ setShowPopup: (show: boolean) => void;
10
+ }
11
+ export declare const ProductOffersList: ({ offersToShow, offersConfig, getOfferCardMessage, setSelectedOffer, setShowPopup, }: ProductOffersListProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { CartCheckpoint, OfferTermsAndConditions } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ export declare const ProductOffersTermsMobilePopover: ({ showPopup, selectedOffer, selectedOfferTerms, onClose, offersConfig, }: {
5
+ showPopup: boolean;
6
+ selectedOffer: CartCheckpoint | null;
7
+ selectedOfferTerms: OfferTermsAndConditions | null;
8
+ onClose: () => void;
9
+ offersConfig?: ProductsOffersConfigType | null | undefined;
10
+ }) => React.ReactPortal | null;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { CartCheckpoint, OfferTermsAndConditions } from "./ProductsOffers";
3
+ import { ProductsOffersConfigType } from "./ProductsOffers";
4
+ export declare const ProductOffersTermsPopup: ({ showPopup, selectedOffer, selectedOfferTerms, onClose, offersConfig, }: {
5
+ showPopup: boolean;
6
+ selectedOffer: CartCheckpoint | null;
7
+ selectedOfferTerms: OfferTermsAndConditions | null;
8
+ onClose: () => void;
9
+ offersConfig?: ProductsOffersConfigType | null | undefined;
10
+ }) => React.ReactPortal | null;
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import { Checkpoint } from "../Cart/Cart";
3
+ export interface ProductsOffersConfigType {
4
+ sectionType?: "coupon" | "list";
5
+ sectionTitle?: string;
6
+ sectionBackgroundColor?: string;
7
+ sectionBgContrastColor?: string;
8
+ cardBackgroundColor?: string;
9
+ cardBackgroundTransparent?: boolean;
10
+ textColor?: string;
11
+ accentColor?: string;
12
+ roundness?: number;
13
+ cardPadding?: number;
14
+ viewDetailsTitle?: string;
15
+ alignment?: "left" | "middle" | "right";
16
+ iconVisibility?: boolean;
17
+ popupIsolationStrategy?: "revert" | "revert-layer" | "unset" | "initial" | "inherit" | "none";
18
+ }
19
+ export interface CartCheckpoint extends Checkpoint {
20
+ customCartProgressBarCriteria?: string | null;
21
+ discountPercentage?: number | null;
22
+ discountId?: number | null;
23
+ }
24
+ export interface OfferTermsAndConditions {
25
+ offerMessage: string;
26
+ terms: string[];
27
+ }
28
+ declare const ProductsOffers: ({ offersConfig, offers, }: {
29
+ offersConfig?: ProductsOffersConfigType | null | undefined;
30
+ offers: CartCheckpoint[];
31
+ }) => React.JSX.Element;
32
+ export default ProductsOffers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.7.416-collection-bundle-fixes.0",
3
+ "version": "0.7.416-collection-bundle-fixes.1",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "tsc && rollup -c",