yt-uikit 0.10.79 → 0.10.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +5 -3
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1234,9 +1234,10 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
|
|
|
1234
1234
|
}
|
|
1235
1235
|
`,sa=c.div`
|
|
1236
1236
|
display: flex;
|
|
1237
|
+
flex-wrap: wrap;
|
|
1237
1238
|
justify-content: space-between;
|
|
1238
1239
|
align-items: center;
|
|
1239
|
-
gap: 16px;
|
|
1240
|
+
gap: 4px 16px;
|
|
1240
1241
|
margin-top: 2px;
|
|
1241
1242
|
`,ca=c.div`
|
|
1242
1243
|
display: flex;
|
|
@@ -1259,9 +1260,10 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
|
|
|
1259
1260
|
}
|
|
1260
1261
|
`,ma=c.div`
|
|
1261
1262
|
display: flex;
|
|
1263
|
+
flex-shrink: 0;
|
|
1262
1264
|
align-items: center;
|
|
1263
1265
|
gap: 8px;
|
|
1264
|
-
margin-
|
|
1266
|
+
margin-left: auto;
|
|
1265
1267
|
`,ua=c.div`
|
|
1266
1268
|
display: inline-flex;
|
|
1267
1269
|
align-items: center;
|
|
@@ -1312,7 +1314,7 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
|
|
|
1312
1314
|
padding: 2px 0px 4px 0px;
|
|
1313
1315
|
border-bottom-left-radius: 8px;
|
|
1314
1316
|
border-bottom-right-radius: 8px;
|
|
1315
|
-
`,xa=({imageUrl:t,overlayText:n,themeColor:r,themeTextColor:o})=>e.createElement("div",{className:"yt-cart-product-overlay-image-wrapper",style:{position:"relative",width:"100%",height:"100%"}},e.createElement("img",{className:"yt-cart-product-overlay-image",src:t,alt:"Free Gift",style:{width:"100%",height:"100%",objectFit:"fill",borderRadius:"8px"}}),n&&e.createElement(fa,{className:"yt-cart-product-freebie-overlay-text",$themeColor:r,$themeTextColor:o},n));var ha=e.memo(({product:n,handleDecrement:r,handleIncrement:o,removeCartItem:a,addCartItem:i,isDev:l,themeColor:s,primaryTextColor:c,secondaryTextColor:d,tertiaryColor:p,tertiaryTextColor:m,showQtySelector:u=!0,themeTextColor:g,showEditOptionOnProducts:y,percentageOff:f,removeFreebieFromCart:x,showDeleteOnFreebies:h,imageAspectSelector:b,cartComponentsCornerType:w,cartComponentsCornerRadius:v,backgroundSubdued:C,backgroundColor:E,showDiscountOnMRP:k,freeLabelText:T,isLargeScreen:S=!1})=>{const N=Bn(),F=Ce(En),[I,B]=ve(Vo),z=we(zn),$=Yo(),P="undefined"!=typeof window&&"swashaa.myshopify.com"===window?.Shopify?.shop&&Number(n?.total_discount)>0&&Array.isArray(n?.discounts)&&n.discounts.length>0&&Number(n?.line_price)<Number(n?.final_line_price),A=P?n.line_price:n.final_line_price,D=!!n.properties?._isYtFreebie,_=!!n.properties?._isStealDeal,L=D&&"number"==typeof n.final_line_price&&n.final_line_price>0&&"number"==typeof n.original_line_price&&n.original_line_price>n.final_line_price,R=L&&n.original_line_price?`${((n.original_line_price-n.final_line_price)/n.original_line_price*100).toFixed(0)}% off`:f&&D?`${f}% Off`:"";let O=Dn(F,F?.currency);const M=["__Added with Frequently Bought Together button","_has_gpo","_y"],V=n?.options_with_values&&n.options_with_values.filter(e=>"Title"!==e.name).length>0||n?.properties&&Object.keys(n.properties).filter(e=>!M.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).length>0||y,W=(()=>{if(n.line_level_discount_allocations&&n.line_level_discount_allocations.length>0&&n.line_level_discount_allocations[0].discount_application){const e=n.line_level_discount_allocations[0].discount_application.title,t=nr(e);switch(n.line_level_discount_allocations[0].discount_application.value_type){case"amount":return`${t})`;case"percentage":case"fixed_amount":return t;default:return""}}if(P&&Array.isArray(n.discounts)&&n.discounts[0]?.title)return nr(n.discounts[0].title)})(),q=W,U=(()=>{const e=n?.properties?._bundleImage;if(!e||"string"!=typeof e)return;const t=e.trim();return t.length>0?t:void 0})(),Q=!!U,Y=(()=>{const e=n?.properties?.itemsInBundle;return"string"!=typeof e?[]:e.split(/,\s*/).map(e=>e.trim()).filter(e=>e.length>0)})(),G=(()=>{const e=n?.properties?._bundleItems;if("string"==typeof e&&e.trim().length>0)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.reduce((e,t)=>{const n=Number(t?.quantity);return e+(isNaN(n)?0:n)},0);if(e>0)return e}}catch(e){}let t=0;for(const e of Y){const n=e.match(/^(\d+)\s*x\s*/i);t+=n?parseInt(n[1],10)||0:1}return t})(),Z=(()=>{try{const e=Number(n?.compare_at_price),t=Number(n?.quantity)||1;if(Number.isFinite(e)&&e>0)return e*t}catch(e){}return null})(),[X,K]=t(!0),J=S?"250px":"190px",ee=$n(A,F?.currency),te="undefined"!=typeof window?`${window.location.origin}${n.url}`:n.url,ne=D||Q||0===ee,re="undefined"!=typeof window&&"whats-up-wellness.myshopify.com"===window.ytapp?.storeDomain?"Free Gift":_?"Steal Deal":L||f?"Special Offer":"",oe=e.createElement(ra,{className:"yt-cart-product-image-wrapper",$isBundle:Q},e.createElement(na,{className:"yt-cart-product-image",$imageAspectSelector:b,$isBundle:Q},u?e.createElement("img",{className:"yt-cart-product-item-image",style:{height:"100%",width:"100%",opacity:0===n.quantity?.5:1},src:tr(U??n.image,200,85,"webp"),alt:(e=>e.title?`Product image - ${e.title}`:"Product image")(n),loading:"lazy"}):e.createElement(xa,{imageUrl:tr(U??n.image??n?.featuredImage?.url??"/placeholder.svg",200,85,"webp"),overlayText:re,themeColor:s,themeTextColor:g})),(u||n?.quantity>1)&&e.createElement(oa,{className:"yt-cart-product-quantity-badge"},n.quantity));return e.createElement(ta,{className:"yt-cart-product-card",$hasVariantInfo:V||Q,$backgroundColor:E,style:{display:"flex",flexDirection:"row",alignItems:"center",margin:"0 1rem"}},ne?oe:e.createElement("a",{className:"yt-cart-product-image-link",href:te,style:{textDecoration:"none",display:"contents"}},oe),e.createElement("div",{className:"yt-cart-product-details",style:{display:"flex",flexDirection:"column",flex:1,padding:"4px 0"}},e.createElement("div",{className:"yt-cart-product-header",style:{display:"flex",flexDirection:"row",alignItems:"flex-start"}},e.createElement(ea,{as:ne?"span":"a",className:"yt-cart-product-title",$themeColor:s,$primaryTextColor:c,$isNavigationDisabled:ne,href:ne?void 0:te},Qn(n.product_title??"")),e.createElement("div",{className:"yt-cart-product-actions",style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{className:"yt-cart-product-remove-action-wrapper",style:{marginLeft:"3px",display:"flex",alignItems:"center",justifyContent:"center"}},(u||h)&&e.createElement(la,{onClick:u?async()=>{N&&N(!0,!0);try{a&&await a(n.key)}catch(e){}N&&N(!1,!1)}:async()=>{N&&N(!0,!0);try{x&&await x(n.key)}catch(e){}N&&N(!1,!1)}},e.createElement(aa,null,e.createElement(me,{className:"outline"}),e.createElement(ue,{className:"filled"})))))),Q?e.createElement("div",{className:"yt-cart-product-bundle-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement("div",{className:"yt-cart-product-bundle-toggle",role:"button",onClick:()=>K(!X),style:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"4px 6px",width:"fit-content",cursor:"pointer",userSelect:"none",fontSize:"12px",fontWeight:600,color:d??"#1a1a1a"}},e.createElement("span",{className:"yt-cart-product-bundle-toggle-label"},`Contain ${G} Items`),X?e.createElement(j,null):e.createElement(H,null)),X&&Y.length>0&&e.createElement("div",{className:"yt-cart-product-bundle-items-popover",style:{marginTop:"4px",backgroundColor:"#F8F9FA",borderRadius:"8px",padding:"8px 10px",border:"1px solid rgba(0,0,0,0.06)",maxWidth:J,width:"fit-content"}},e.createElement("div",{className:"yt-cart-product-bundle-items-list",style:{display:"flex",flexDirection:"column",gap:"4px",maxWidth:J}},Y.map((t,n)=>e.createElement("div",{className:"yt-cart-product-bundle-item",key:`${t}-${n}`,style:{color:d??"#1a1a1a",fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:J},title:t},t))))):V&&e.createElement("div",{className:"yt-cart-product-variant-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement(Go,{className:"yt-cart-product-variant-container"},n?.options_with_values?.filter(e=>"Title"!==e.name).map(t=>{const n=$?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),r=Uo(n,t.value),o=Qo(n,t.value);return"color"===n?.type?.toLowerCase()&&r?e.createElement(Zo,{key:t.name,$colorValue:r.value,style:{display:"block"}}):"image"===n?.type?.toLowerCase()&&r?e.createElement(Xo,{key:t.name,src:tr(r.value,36,85,"webp"),alt:t.value}):o.length>15||o.includes("#")?null:e.createElement(ia,{className:"yt-cart-variant-text",key:t.name,$secondaryTextColor:d,style:{display:"flex",alignItems:"center",borderRadius:"6px",border:"1px solid rgb(117 117 117 / 50%)",padding:"1px 3px"}},o)}),n?.properties&&Object.entries(n.properties).filter(([e])=>!M.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).map(([t,n])=>{const r=String(n);return r.includes("#")||($?.options??[]).some(e=>e.name.trim().toLowerCase()===t.trim().toLowerCase()&&e.values.some(e=>e.name.trim().toLowerCase()===r.trim().toLowerCase()))?null:e.createElement(ia,{key:t,$secondaryTextColor:d,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px"}},r)}),y&&!n?.product_has_only_default_variant&&e.createElement(la,{onClick:()=>{const e=!!n.properties?._isYtFreebie;let t;if(e){const e=n.properties?._yt_allowed_variants;if(e&&"string"==typeof e)try{t=JSON.parse(e)}catch(r){console.error(`ProductCard: Failed to parse _yt_allowed_variants for ${n.key}:`,e,r),t=[String(n.variant_id)]}else console.warn(`ProductCard: No allowed variants property found for freebie ${n.key}. Defaulting to current variant.`),t=[String(n.variant_id)]}const r=void 0!==n.properties?._yt_coupon_template_id&&null!==n.properties?._yt_coupon_template_id?String(n.properties._yt_coupon_template_id):void 0,o=e&&r?{couponTemplateId:r,rewardKey:void 0!==n.properties?._yt_reward_key&&null!==n.properties?._yt_reward_key?String(n.properties._yt_reward_key):void 0}:void 0;z({open:!0,variantId:String(n.variant_id),quantity:n.quantity,handle:n.handle,lineItemKey:n.key,freebieSelection:e,productId:String(n.product_id),allowedVariantIds:t,rewardContext:o})},style:{display:"flex",alignItems:"center"}},e.createElement(Qe,null))),n?.options_with_values?.filter(e=>"Title"!==e.name).map(t=>{const n=$?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),r=Uo(n,t.value),o=Qo(n,t.value);return r&&["color","image"].includes((n?.type??"").toLowerCase())||o.length<=15||o.includes("#")?null:e.createElement(ia,{key:t.name,$secondaryTextColor:d,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px",width:"fit-content"}},o)})),e.createElement(sa,{className:"yt-cart-product-bottom-row"},e.createElement("div",{className:"yt-cart-product-pricing-row",style:{display:"flex",flexDirection:S?"row":"column",alignItems:S?"center":"flex-start",gap:S?"0px":"4px"}},e.createElement(ca,{className:"yt-cart-product-price-container"},Q?e.createElement(e.Fragment,null,e.createElement(da,{$primaryTextColor:c},0===$n(A,F?.currency)?e.createElement(ya,{$primaryColor:c,$themeColor:s,$backgroundSubdued:C},T||"FREE"):e.createElement(e.Fragment,null,O,Jn($n(A,F?.currency)))),Z&&Z>Number(A)&&k&&e.createElement(pa,null,O,Jn($n(Z,F?.currency)))):e.createElement(da,{$primaryTextColor:c},0===$n(A,F?.currency)?e.createElement(ya,{$primaryColor:c,$themeColor:s,$backgroundSubdued:C},T||"FREE"):e.createElement(e.Fragment,null,O,Jn($n(A,F?.currency)))),!Q&&(n.compare_at_price&&Number(n.compare_at_price)*n.quantity>Number(A)||!n.compare_at_price&&W&&n.original_line_price)&&k&&e.createElement(pa,null,O,n.compare_at_price?Jn($n(Number(n.compare_at_price)*n.quantity,F?.currency)):Jn($n(n.original_line_price,F?.currency))),S&&(u||L)&&W&&e.createElement(ua,{className:"yt-cart-product-discount",$tertiaryColor:p},e.createElement(Ve,{size:14,color:m}),e.createElement(ga,{$tertiaryTextColor:m},q))),!S&&(u||L)&&W&&e.createElement(ua,{className:"yt-cart-product-discount",$tertiaryColor:p},e.createElement(Ve,{size:12,color:m}),e.createElement(ga,{$tertiaryTextColor:m},q))),e.createElement(ma,{className:"yt-cart-product-quantity-controls"},u?e.createElement(Mo,{handleItemQuantityDecrement:async()=>{N&&N(!0,!0);try{r&&await r(n.key,n.quantity-1)}catch(e){}N&&N(!1,!1)},handleItemQuantityIncrement:async()=>{N&&N(!0,!0);try{if(o){-1===await o(n.key,n.quantity+1,n.properties)&&(B(n?.key),setTimeout(()=>B(void 0),3e3))}}catch(e){}N&&N(!1,!1)},value:n.quantity,isDev:l,themeColor:s,cartComponentsCornerType:w,cartComponentsCornerRadius:v,backgroundSubdued:C}):(!_||L||f)&&R?e.createElement("span",{className:"yt-cart-line-item-freebie-badge",style:{padding:"2px 8px",fontSize:"10px",backgroundColor:p,color:m??"#000",borderRadius:"4px"}},R):null)),I&&I===n?.key&&e.createElement("span",{className:"yt-cart-product-quantity-error",style:{fontSize:"10px",color:"red",marginTop:"4px"}},"⚠️You've reached the maximum quantity for this item")))});const ba=c.div`
|
|
1317
|
+
`,xa=({imageUrl:t,overlayText:n,themeColor:r,themeTextColor:o})=>e.createElement("div",{className:"yt-cart-product-overlay-image-wrapper",style:{position:"relative",width:"100%",height:"100%"}},e.createElement("img",{className:"yt-cart-product-overlay-image",src:t,alt:"Free Gift",style:{width:"100%",height:"100%",objectFit:"fill",borderRadius:"8px"}}),n&&e.createElement(fa,{className:"yt-cart-product-freebie-overlay-text",$themeColor:r,$themeTextColor:o},n));var ha=e.memo(({product:n,handleDecrement:r,handleIncrement:o,removeCartItem:a,addCartItem:i,isDev:l,themeColor:s,primaryTextColor:c,secondaryTextColor:d,tertiaryColor:p,tertiaryTextColor:m,showQtySelector:u=!0,themeTextColor:g,showEditOptionOnProducts:y,percentageOff:f,removeFreebieFromCart:x,showDeleteOnFreebies:h,imageAspectSelector:b,cartComponentsCornerType:w,cartComponentsCornerRadius:v,backgroundSubdued:C,backgroundColor:E,showDiscountOnMRP:k,freeLabelText:T,isLargeScreen:S=!1})=>{const N=Bn(),F=Ce(En),[I,B]=ve(Vo),z=we(zn),$=Yo(),P="undefined"!=typeof window&&"swashaa.myshopify.com"===window?.Shopify?.shop&&Number(n?.total_discount)>0&&Array.isArray(n?.discounts)&&n.discounts.length>0&&Number(n?.line_price)<Number(n?.final_line_price),A=P?n.line_price:n.final_line_price,D=!!n.properties?._isYtFreebie,_=!!n.properties?._isStealDeal,L=D&&"number"==typeof n.final_line_price&&n.final_line_price>0&&"number"==typeof n.original_line_price&&n.original_line_price>n.final_line_price,R=L&&n.original_line_price?`${((n.original_line_price-n.final_line_price)/n.original_line_price*100).toFixed(0)}% off`:f&&D?`${f}% Off`:"";let O=Dn(F,F?.currency);const M=["__Added with Frequently Bought Together button","_has_gpo","_y"],V=n?.options_with_values&&n.options_with_values.filter(e=>"Title"!==e.name).length>0||n?.properties&&Object.keys(n.properties).filter(e=>!M.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).length>0||y,W=(()=>{if(n.line_level_discount_allocations&&n.line_level_discount_allocations.length>0&&n.line_level_discount_allocations[0].discount_application){const e=n.line_level_discount_allocations[0].discount_application.title,t=nr(e);switch(n.line_level_discount_allocations[0].discount_application.value_type){case"amount":return`${t})`;case"percentage":case"fixed_amount":return t;default:return""}}if(P&&Array.isArray(n.discounts)&&n.discounts[0]?.title)return nr(n.discounts[0].title)})(),q=W,U=(()=>{const e=n?.properties?._bundleImage;if(!e||"string"!=typeof e)return;const t=e.trim();return t.length>0?t:void 0})(),Q=!!U,Y=(()=>{const e=n?.properties?.itemsInBundle;return"string"!=typeof e?[]:e.split(/,\s*/).map(e=>e.trim()).filter(e=>e.length>0)})(),G=(()=>{const e=n?.properties?._bundleItems;if("string"==typeof e&&e.trim().length>0)try{const t=JSON.parse(e);if(Array.isArray(t)){const e=t.reduce((e,t)=>{const n=Number(t?.quantity);return e+(isNaN(n)?0:n)},0);if(e>0)return e}}catch(e){}let t=0;for(const e of Y){const n=e.match(/^(\d+)\s*x\s*/i);t+=n?parseInt(n[1],10)||0:1}return t})(),Z=(()=>{try{const e=Number(n?.compare_at_price),t=Number(n?.quantity)||1;if(Number.isFinite(e)&&e>0)return e*t}catch(e){}return null})(),[X,K]=t(!0),J=S?"250px":"190px",ee=$n(A,F?.currency),te="undefined"!=typeof window?`${window.location.origin}${n.url}`:n.url,ne=D||Q||0===ee,re="undefined"!=typeof window&&"whats-up-wellness.myshopify.com"===window.ytapp?.storeDomain?"Free Gift":_?"Steal Deal":L||f?"Special Offer":"",oe=e.createElement(ra,{className:"yt-cart-product-image-wrapper",$isBundle:Q},e.createElement(na,{className:"yt-cart-product-image",$imageAspectSelector:b,$isBundle:Q},u?e.createElement("img",{className:"yt-cart-product-item-image",style:{height:"100%",width:"100%",opacity:0===n.quantity?.5:1},src:tr(U??n.image,200,85,"webp"),alt:(e=>e.title?`Product image - ${e.title}`:"Product image")(n),loading:"lazy"}):e.createElement(xa,{imageUrl:tr(U??n.image??n?.featuredImage?.url??"/placeholder.svg",200,85,"webp"),overlayText:re,themeColor:s,themeTextColor:g})),(u||n?.quantity>1)&&e.createElement(oa,{className:"yt-cart-product-quantity-badge"},n.quantity));return e.createElement(ta,{className:"yt-cart-product-card",$hasVariantInfo:V||Q,$backgroundColor:E,style:{display:"flex",flexDirection:"row",alignItems:"center",margin:"0 1rem"}},ne?oe:e.createElement("a",{className:"yt-cart-product-image-link",href:te,style:{textDecoration:"none",display:"contents"}},oe),e.createElement("div",{className:"yt-cart-product-details",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0,padding:"4px 0"}},e.createElement("div",{className:"yt-cart-product-header",style:{display:"flex",flexDirection:"row",alignItems:"flex-start"}},e.createElement(ea,{as:ne?"span":"a",className:"yt-cart-product-title",$themeColor:s,$primaryTextColor:c,$isNavigationDisabled:ne,href:ne?void 0:te},Qn(n.product_title??"")),e.createElement("div",{className:"yt-cart-product-actions",style:{marginLeft:"auto",display:"flex",flexShrink:0,alignItems:"center",justifyContent:"center"}},e.createElement("div",{className:"yt-cart-product-remove-action-wrapper",style:{marginLeft:"3px",display:"flex",alignItems:"center",justifyContent:"center"}},(u||h)&&e.createElement(la,{onClick:u?async()=>{N&&N(!0,!0);try{a&&await a(n.key)}catch(e){}N&&N(!1,!1)}:async()=>{N&&N(!0,!0);try{x&&await x(n.key)}catch(e){}N&&N(!1,!1)}},e.createElement(aa,null,e.createElement(me,{className:"outline"}),e.createElement(ue,{className:"filled"})))))),Q?e.createElement("div",{className:"yt-cart-product-bundle-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement("div",{className:"yt-cart-product-bundle-toggle",role:"button",onClick:()=>K(!X),style:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"4px 6px",width:"fit-content",cursor:"pointer",userSelect:"none",fontSize:"12px",fontWeight:600,color:d??"#1a1a1a"}},e.createElement("span",{className:"yt-cart-product-bundle-toggle-label"},`Contain ${G} Items`),X?e.createElement(j,null):e.createElement(H,null)),X&&Y.length>0&&e.createElement("div",{className:"yt-cart-product-bundle-items-popover",style:{marginTop:"4px",backgroundColor:"#F8F9FA",borderRadius:"8px",padding:"8px 10px",border:"1px solid rgba(0,0,0,0.06)",maxWidth:J,width:"fit-content"}},e.createElement("div",{className:"yt-cart-product-bundle-items-list",style:{display:"flex",flexDirection:"column",gap:"4px",maxWidth:J}},Y.map((t,n)=>e.createElement("div",{className:"yt-cart-product-bundle-item",key:`${t}-${n}`,style:{color:d??"#1a1a1a",fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:J},title:t},t))))):V&&e.createElement("div",{className:"yt-cart-product-variant-info",style:{display:"flex",flexDirection:"column",marginBottom:"4px"}},e.createElement(Go,{className:"yt-cart-product-variant-container"},n?.options_with_values?.filter(e=>"Title"!==e.name).map(t=>{const n=$?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),r=Uo(n,t.value),o=Qo(n,t.value);return"color"===n?.type?.toLowerCase()&&r?e.createElement(Zo,{key:t.name,$colorValue:r.value,style:{display:"block"}}):"image"===n?.type?.toLowerCase()&&r?e.createElement(Xo,{key:t.name,src:tr(r.value,36,85,"webp"),alt:t.value}):o.length>15||o.includes("#")?null:e.createElement(ia,{className:"yt-cart-variant-text",key:t.name,$secondaryTextColor:d,style:{display:"flex",alignItems:"center",borderRadius:"6px",border:"1px solid rgb(117 117 117 / 50%)",padding:"1px 3px"}},o)}),n?.properties&&Object.entries(n.properties).filter(([e])=>!M.includes(e)&&!e.startsWith("_")&&!e.startsWith("__")).map(([t,n])=>{const r=String(n);return r.includes("#")||($?.options??[]).some(e=>e.name.trim().toLowerCase()===t.trim().toLowerCase()&&e.values.some(e=>e.name.trim().toLowerCase()===r.trim().toLowerCase()))?null:e.createElement(ia,{key:t,$secondaryTextColor:d,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px"}},r)}),y&&!n?.product_has_only_default_variant&&e.createElement(la,{onClick:()=>{const e=!!n.properties?._isYtFreebie;let t;if(e){const e=n.properties?._yt_allowed_variants;if(e&&"string"==typeof e)try{t=JSON.parse(e)}catch(r){console.error(`ProductCard: Failed to parse _yt_allowed_variants for ${n.key}:`,e,r),t=[String(n.variant_id)]}else console.warn(`ProductCard: No allowed variants property found for freebie ${n.key}. Defaulting to current variant.`),t=[String(n.variant_id)]}const r=void 0!==n.properties?._yt_coupon_template_id&&null!==n.properties?._yt_coupon_template_id?String(n.properties._yt_coupon_template_id):void 0,o=e&&r?{couponTemplateId:r,rewardKey:void 0!==n.properties?._yt_reward_key&&null!==n.properties?._yt_reward_key?String(n.properties._yt_reward_key):void 0}:void 0;z({open:!0,variantId:String(n.variant_id),quantity:n.quantity,handle:n.handle,lineItemKey:n.key,freebieSelection:e,productId:String(n.product_id),allowedVariantIds:t,rewardContext:o})},style:{display:"flex",alignItems:"center"}},e.createElement(Qe,null))),n?.options_with_values?.filter(e=>"Title"!==e.name).map(t=>{const n=$?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),r=Uo(n,t.value),o=Qo(n,t.value);return r&&["color","image"].includes((n?.type??"").toLowerCase())||o.length<=15||o.includes("#")?null:e.createElement(ia,{key:t.name,$secondaryTextColor:d,style:{display:"flex",alignItems:"center",backgroundColor:"#F8F9FA",borderRadius:"6px",border:"1px solid rgba(0,0,0,0.1)",padding:"1px 3px",width:"fit-content"}},o)})),e.createElement(sa,{className:"yt-cart-product-bottom-row"},e.createElement("div",{className:"yt-cart-product-pricing-row",style:{display:"flex",flexDirection:S?"row":"column",alignItems:S?"center":"flex-start",gap:S?"0px":"4px"}},e.createElement(ca,{className:"yt-cart-product-price-container"},Q?e.createElement(e.Fragment,null,e.createElement(da,{$primaryTextColor:c},0===$n(A,F?.currency)?e.createElement(ya,{$primaryColor:c,$themeColor:s,$backgroundSubdued:C},T||"FREE"):e.createElement(e.Fragment,null,O,Jn($n(A,F?.currency)))),Z&&Z>Number(A)&&k&&e.createElement(pa,null,O,Jn($n(Z,F?.currency)))):e.createElement(da,{$primaryTextColor:c},0===$n(A,F?.currency)?e.createElement(ya,{$primaryColor:c,$themeColor:s,$backgroundSubdued:C},T||"FREE"):e.createElement(e.Fragment,null,O,Jn($n(A,F?.currency)))),!Q&&(n.compare_at_price&&Number(n.compare_at_price)*n.quantity>Number(A)||!n.compare_at_price&&W&&n.original_line_price)&&k&&e.createElement(pa,null,O,n.compare_at_price?Jn($n(Number(n.compare_at_price)*n.quantity,F?.currency)):Jn($n(n.original_line_price,F?.currency))),S&&(u||L)&&W&&e.createElement(ua,{className:"yt-cart-product-discount",$tertiaryColor:p},e.createElement(Ve,{size:14,color:m}),e.createElement(ga,{$tertiaryTextColor:m},q))),!S&&(u||L)&&W&&e.createElement(ua,{className:"yt-cart-product-discount",$tertiaryColor:p},e.createElement(Ve,{size:12,color:m}),e.createElement(ga,{$tertiaryTextColor:m},q))),e.createElement(ma,{className:"yt-cart-product-quantity-controls"},u?e.createElement(Mo,{handleItemQuantityDecrement:async()=>{N&&N(!0,!0);try{r&&await r(n.key,n.quantity-1)}catch(e){}N&&N(!1,!1)},handleItemQuantityIncrement:async()=>{N&&N(!0,!0);try{if(o){-1===await o(n.key,n.quantity+1,n.properties)&&(B(n?.key),setTimeout(()=>B(void 0),3e3))}}catch(e){}N&&N(!1,!1)},value:n.quantity,isDev:l,themeColor:s,cartComponentsCornerType:w,cartComponentsCornerRadius:v,backgroundSubdued:C}):(!_||L||f)&&R?e.createElement("span",{className:"yt-cart-line-item-freebie-badge",style:{padding:"2px 8px",fontSize:"10px",backgroundColor:p,color:m??"#000",borderRadius:"4px"}},R):null)),I&&I===n?.key&&e.createElement("span",{className:"yt-cart-product-quantity-error",style:{fontSize:"10px",color:"red",marginTop:"4px"}},"⚠️You've reached the maximum quantity for this item")))});const ba=c.div`
|
|
1316
1318
|
margin: 8px 0 6px 0;
|
|
1317
1319
|
padding: 12px;
|
|
1318
1320
|
background: ${e=>e.$backgroundColor??"rgba(0,0,0,0.04)"};
|