@anker-in/headless-ui 1.0.19-temp-101507 → 1.0.19-temp-101508

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.
@@ -1,2 +1,2 @@
1
- "use strict";var he=Object.create;var _=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty;var we=(e,r)=>{for(var l in r)_(e,l,{get:r[l],enumerable:!0})},K=(e,r,l,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of ke(r))!Ne.call(e,p)&&p!==l&&_(e,p,{get:()=>r[p],enumerable:!(x=_e(r,p))||x.enumerable});return e};var P=(e,r,l)=>(l=e!=null?he(Ce(e)):{},K(r||!e||!e.__esModule?_(l,"default",{value:e,enumerable:!0}):l,e)),Se=e=>K(_({},"__esModule",{value:!0}),e);var Be={};we(Be,{default:()=>Te});module.exports=Se(Be);var t=require("react/jsx-runtime"),a=require("../../helpers/utils.js"),Q=require("../AiuiProvider/index.js"),X=require("../ShelfDisplay/shelfDisplay.js"),Y=P(require("../../components/badge.js")),Z=require("../../components/text.js"),B=P(require("../../components/button.js")),M=P(require("../../components/picture.js")),k=require("../../shared/trackUrlRef.js"),ee=require("./component/price.js"),i=require("react");const I="image",T="product_shelf",$e=999999999e-2,Pe=e=>{let r;return e?.includes("products")?r=e?.split("products")[0]+"files/":r=e?.replace(e?.split("files")?.pop()||"","")+"/",r},Ie=({data:e,buttonText:r,itemShape:l,metafields:x,onPrimaryChange:p,onSecondaryChange:te})=>{const{memberPriceDiscount:oe,memberSetting:z,discounts:L,shopCommon:se}=x,[b,W]=(0,i.useState)(""),[re,j]=(0,i.useState)(""),[g,F]=(0,i.useState)(""),[O,ne]=(0,i.useState)(!1),[D,ie]=(0,i.useState)({}),[le,ae]=(0,i.useState)(!1),[H,ce]=(0,i.useState)({price:"",basePrice:""}),[A,de]=(0,i.useState)([]),[me,ue]=(0,i.useState)([]),[y,pe]=(0,i.useState)(""),[fe,be]=(0,i.useState)(""),{locale:c="us",currencyCode:ge,isLogin:U}=(0,Q.useAiuiContext)(),C=e?.custom_name||e?.title||e?.name,E=e?.custom_description||e?.description||e?.descriptionHtml,m=e?.filter_variants||e?.variants||[],R=(0,a.atobID)(e?.id||""),V=e?.images?.[0]?.url,xe=o=>F(o),N=(o,n,s,d)=>{ae(d),pe(o||""),ce({basePrice:n||"",price:s||""})};return(0,i.useEffect)(()=>{if(g){const s=m?.find(d=>d?.name?.includes?.(g));W(s?.sku||m?.[0]?.sku||""),j(s?.image?.url||m?.[0]?.image?.url||"");return}const o=e?.options?.find(s=>s?.displayName==="color")?.values?.[0]?.label;o&&F(o);const n=m?.find(s=>s?.name?.includes?.(o));W(n?.sku||m?.[0]?.sku||""),j(n?.image?.url||m?.[0]?.image?.url||"")},[g]),(0,i.useEffect)(()=>{if(!b)return;de(e?.tags||[]);const o=m?.find(u=>u?.sku===b)||m?.[0]||{};ie(o),ne(!o?.availableForSale||o?.price?.amount===$e);const{infos:n}=o?.metafields||{},{productInfos:s,preRender:d}=e?.metafields||{};be(n?.comingSoon||s?.comingSoon||d?.soldOut||se?.soldOut||"");const v=o?.coupons?.[0],{price:q,basePrice:G,discount:ye,discountAmount:ve}=(0,X.formatVariantPrice)({locale:c,amount:v?v.variant_price4wscode:o.price,baseAmount:v?o.price:0,currencyCode:e?.price?.currencyCode||"USD"}),J=(()=>{if(v?.value_type==="fixed_amount"){const u=ve||"",h=u.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(h){const[,w,f,S]=h;let $=f;return f.endsWith(".00")?$=f.replace(/\.00$/,""):f.endsWith(",00")&&($=f.replace(/,00$/,"")),`${w}${$}${S}`}return u}return ye||""})();if(U){const u=(0,ee.getFunctionMemberPrice)({locale:c,variant:o,shopMemberPriceDiscountConfig:oe,currencyCode:ge||e?.price?.currencyCode||"USD"});if(u){const{hasMemberPrice:h,salePriceWithCurrency:w,originalPriceWithCurrency:f,savePriceWithCurrency:S}=u;N(S||"",f||"",h?w:"",u?.hasMemberPrice)}else N(J,G||"",q||"",!1)}else N(J,G||"",q||"",!1)},[e,b]),(0,i.useEffect)(()=>{let o=[];if(y){const s=`${y} ${L?.off}`;o.push(s)}const n=A?.filter?.(s=>s?.startsWith?.("CLtag"))?.map?.(s=>s?.replace?.("CLtag:",""))?.slice?.(0,y?1:2);ue(o.concat(n))},[A,y]),(0,t.jsx)("div",{className:(0,a.cn)(l==="round"?"rounded-2xl":"rounded-none","tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300",{"aiui-dark":e.theme==="dark"}),children:e?.mImage?(0,t.jsx)("div",{className:"size-full box-border overflow-hidden hover:[&_img]:scale-105",children:(0,t.jsx)("div",{className:"relative inset-0 size-full",children:(0,t.jsxs)("a",{className:"size-full",href:(0,k.trackUrlRef)(e?.link,`${I}_${T}`),children:[(0,t.jsx)(M.default,{alt:"",source:e?.mImage?.url||e?.mImage,className:"size-full [&_img]:object-cover [&_img]:size-full",imgClassName:"size-full object-cover transition-all duration-300"}),(0,t.jsxs)("div",{className:"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4",children:[(0,t.jsx)("p",{className:"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.subTitle}}),(0,t.jsx)("span",{className:"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6",dangerouslySetInnerHTML:{__html:e?.title}})]})]})})}):(0,t.jsxs)("div",{className:"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4",children:[(0,t.jsx)("div",{className:"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags",children:me?.map?.((o,n)=>(0,t.jsx)(Y.default,{className:"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge",children:o},n))}),(0,t.jsx)("a",{target:"_blank","aria-label":C,className:"my-1",href:(0,k.trackUrlRef)(`${c==="us"||!c?"":`/${c}`}/products/${e?.handle}`,`${I}_${T}`),children:(0,t.jsx)("div",{className:(0,a.cn)("m-auto desktop:size-[196px] size-[120px] overflow-hidden"),children:(0,t.jsx)(M.default,{alt:"",source:re,className:"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit"})})}),e?.options?.map(o=>{if(o?.displayName==="color")return(0,t.jsx)("div",{className:"flex items-center gap-1",children:o?.values?.map(n=>{const s=n?.hexColors?n.hexColors?.[0]:n?.label,d=s.startsWith("#")?s:"";return(0,t.jsx)("button",{onClick:()=>xe(n?.label),className:(0,a.cn)("size-4 rounded-full cursor-pointer overflow-hidden",`${g===n?.label?"border-[#00BEFA]":""}`),children:(0,t.jsx)("span",{className:(0,a.cn)("h-full w-full overflow-hidden border-[0.5px] border-transparent","relative flex items-center justify-center overflow-hidden rounded-full",g===n?.label&&"border-[#ddd]"),style:d?{backgroundColor:d}:{},children:!d&&V&&(0,t.jsx)("img",{alt:s,className:"h-full w-full object-cover",src:`${Pe(V)}${s?.toLowerCase().split(" ")?.join("-")}_50x.png`})})},n?.label)})})}),(0,t.jsxs)("div",{children:[C?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:C||""},className:"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold"}):null,e?.metafields?.judgemeBadge?(0,t.jsx)("a",{target:"_blank",className:"font-bold text-xs [&_.jdgm-star]:text-[#F77234]",dangerouslySetInnerHTML:{__html:e?.metafields?.judgemeBadge},href:(0,k.trackUrlRef)(`${c==="us"||!c?"":`/${c}`}/products/${e?.handle}`,`${I}_${T}`)}):(0,t.jsx)("div",{className:"w-full truncatefont-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3.5px]","data-yotpo-instance-id":(0,a.yotpoInstanceId)(c),"data-yotpo-product-id":R,"data-yotpo-cart-product-id":R,"data-yotpo-section-id":""}),E?(0,t.jsx)(Z.Text,{size:2,html:E||"",className:"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold"}):null,(0,t.jsxs)("div",{className:"mt-3 mb-2",children:[(0,t.jsx)("p",{dangerouslySetInnerHTML:{__html:U&&le&&(L?.memberPrice||z?.member_price||z?.plus_member_price)||""},className:"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold"}),(0,t.jsx)("div",{className:"flex items-center",children:O?(0,t.jsx)("div",{className:"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:fe||""}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:D?.availableForSale&&H?.price||""}),(0,t.jsx)("div",{className:"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through",children:D?.availableForSale&&H?.basePrice||""})]})})]}),(0,t.jsxs)("div",{className:(0,a.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col"),children:[(0,t.jsx)(B.default,{variant:"secondary",className:"m-tablet:w-full font-bold",onClick:()=>te?.(e,b),children:r?.secondaryButton||"Learn More"}),(0,t.jsx)(B.default,{variant:"primary",className:"m-tablet:w-full font-bold",disabled:O,onClick:()=>p?.(e,b),children:r?.primaryButton||"Shop Now"})]})]})]})},e?.id||e?.handle)};var Te=Ie;
1
+ "use strict";var he=Object.create;var _=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty;var we=(e,r)=>{for(var l in r)_(e,l,{get:r[l],enumerable:!0})},K=(e,r,l,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of ke(r))!Ne.call(e,p)&&p!==l&&_(e,p,{get:()=>r[p],enumerable:!(x=_e(r,p))||x.enumerable});return e};var P=(e,r,l)=>(l=e!=null?he(Ce(e)):{},K(r||!e||!e.__esModule?_(l,"default",{value:e,enumerable:!0}):l,e)),Se=e=>K(_({},"__esModule",{value:!0}),e);var Be={};we(Be,{default:()=>Te});module.exports=Se(Be);var t=require("react/jsx-runtime"),a=require("../../helpers/utils.js"),Q=require("../AiuiProvider/index.js"),X=require("../ShelfDisplay/shelfDisplay.js"),Y=P(require("../../components/badge.js")),Z=require("../../components/text.js"),B=P(require("../../components/button.js")),M=P(require("../../components/picture.js")),k=require("../../shared/trackUrlRef.js"),ee=require("./component/price.js"),i=require("react");const I="image",T="product_shelf",$e=999999999e-2,Pe=e=>{let r;return e?.includes("products")?r=e?.split("products")[0]+"files/":r=e?.replace(e?.split("files")?.pop()||"","")+"/",r},Ie=({data:e,buttonText:r,itemShape:l,metafields:x,onPrimaryChange:p,onSecondaryChange:te})=>{const{memberPriceDiscount:oe,memberSetting:z,discounts:L,shopCommon:se}=x,[b,W]=(0,i.useState)(""),[re,j]=(0,i.useState)(""),[g,F]=(0,i.useState)(""),[O,ne]=(0,i.useState)(!1),[D,ie]=(0,i.useState)({}),[le,ae]=(0,i.useState)(!1),[H,ce]=(0,i.useState)({price:"",basePrice:""}),[A,de]=(0,i.useState)([]),[me,ue]=(0,i.useState)([]),[y,pe]=(0,i.useState)(""),[fe,be]=(0,i.useState)(""),{locale:c="us",currencyCode:ge,isLogin:U}=(0,Q.useAiuiContext)(),C=e?.custom_name||e?.title||e?.name,E=e?.custom_description||e?.description||e?.descriptionHtml,m=e?.filter_variants||e?.variants||[],R=(0,a.atobID)(e?.id||""),V=e?.images?.[0]?.url,xe=o=>F(o),N=(o,n,s,d)=>{ae(d),pe(o||""),ce({basePrice:n||"",price:s||""})};return(0,i.useEffect)(()=>{if(g){const s=m?.find(d=>d?.name?.includes?.(g));W(s?.sku||m?.[0]?.sku||""),j(s?.image?.url||m?.[0]?.image?.url||"");return}const o=e?.options?.find(s=>s?.displayName==="color")?.values?.[0]?.label;o&&F(o);const n=m?.find(s=>s?.name?.includes?.(o));W(n?.sku||m?.[0]?.sku||""),j(n?.image?.url||m?.[0]?.image?.url||"")},[g]),(0,i.useEffect)(()=>{if(!b)return;de(e?.tags||[]);const o=m?.find(u=>u?.sku===b)||m?.[0]||{};ie(o),ne(!o?.availableForSale||o?.price?.amount===$e);const{infos:n}=o?.metafields||{},{productInfos:s,preRender:d}=e?.metafields||{};be(n?.comingSoon||s?.comingSoon||d?.soldOut||se?.soldOut||"");const v=o?.coupons?.[0],{price:q,basePrice:G,discount:ye,discountAmount:ve}=(0,X.formatVariantPrice)({locale:c,amount:v?v.variant_price4wscode:o.price,baseAmount:v?o.price:0,currencyCode:e?.price?.currencyCode||"USD"}),J=(()=>{if(v?.value_type==="fixed_amount"){const u=ve||"",h=u.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(h){const[,w,f,S]=h;let $=f;return f.endsWith(".00")?$=f.replace(/\.00$/,""):f.endsWith(",00")&&($=f.replace(/,00$/,"")),`${w}${$}${S}`}return u}return ye||""})();if(U){const u=(0,ee.getFunctionMemberPrice)({locale:c,variant:o,shopMemberPriceDiscountConfig:oe,currencyCode:ge||e?.price?.currencyCode||"USD"});if(u){const{hasMemberPrice:h,salePriceWithCurrency:w,originalPriceWithCurrency:f,savePriceWithCurrency:S}=u;N(S||"",f||"",h?w:"",u?.hasMemberPrice)}else N(J,G||"",q||"",!1)}else N(J,G||"",q||"",!1)},[e,b]),(0,i.useEffect)(()=>{let o=[];if(y){const s=`${y} ${L?.off}`;o.push(s)}const n=A?.filter?.(s=>s?.startsWith?.("CLtag"))?.map?.(s=>s?.replace?.("CLtag:",""))?.slice?.(0,y?1:2);ue(o.concat(n))},[A,y]),(0,t.jsx)("div",{className:(0,a.cn)(l==="round"?"rounded-2xl":"rounded-none","tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300",{"aiui-dark":e.theme==="dark"}),children:e?.mImage?(0,t.jsx)("div",{className:"size-full box-border overflow-hidden hover:[&_img]:scale-105",children:(0,t.jsx)("div",{className:"relative inset-0 size-full",children:(0,t.jsxs)("a",{className:"size-full",href:(0,k.trackUrlRef)(e?.link,`${I}_${T}`),children:[(0,t.jsx)(M.default,{alt:"",source:e?.mImage?.url||e?.mImage,className:"size-full [&_img]:object-cover [&_img]:size-full",imgClassName:"size-full object-cover transition-all duration-300"}),(0,t.jsxs)("div",{className:"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4",children:[(0,t.jsx)("p",{className:"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.subTitle}}),(0,t.jsx)("span",{className:"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6",dangerouslySetInnerHTML:{__html:e?.title}})]})]})})}):(0,t.jsxs)("div",{className:"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4",children:[(0,t.jsx)("div",{className:"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags",children:me?.map?.((o,n)=>(0,t.jsx)(Y.default,{className:"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge",children:o},n))}),(0,t.jsx)("a",{target:"_blank","aria-label":C,className:"my-1",href:(0,k.trackUrlRef)(`${c==="us"||!c?"":`/${c}`}/products/${e?.handle}`,`${I}_${T}`),children:(0,t.jsx)("div",{className:(0,a.cn)("m-auto desktop:size-[196px] size-[120px] overflow-hidden"),children:(0,t.jsx)(M.default,{alt:"",source:re,className:"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit"})})}),e?.options?.map(o=>{if(o?.displayName==="color")return(0,t.jsx)("div",{className:"flex items-center gap-1",children:o?.values?.map(n=>{const s=n?.hexColors?n.hexColors?.[0]:n?.label,d=s.startsWith("#")?s:"";return(0,t.jsx)("button",{onClick:()=>xe(n?.label),className:(0,a.cn)("size-4 rounded-full cursor-pointer overflow-hidden",`${g===n?.label?"border-[#00BEFA]":""}`),children:(0,t.jsx)("span",{className:(0,a.cn)("h-full w-full overflow-hidden border-[0.5px] border-transparent","relative flex items-center justify-center overflow-hidden rounded-full",g===n?.label&&"border-[#ddd]"),style:d?{backgroundColor:d}:{},children:!d&&V&&(0,t.jsx)("img",{alt:s,className:"h-full w-full object-cover",src:`${Pe(V)}${s?.toLowerCase().split(" ")?.join("-")}_50x.png`})})},n?.label)})})}),(0,t.jsxs)("div",{children:[C?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:C||""},className:"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold"}):null,e?.metafields?.judgemeBadge?(0,t.jsx)("a",{target:"_blank",className:"font-bold text-xs [&_.jdgm-star]:text-[#F77234]",dangerouslySetInnerHTML:{__html:e?.metafields?.judgemeBadge},href:(0,k.trackUrlRef)(`${c==="us"||!c?"":`/${c}`}/products/${e?.handle}`,`${I}_${T}`)}):(0,t.jsx)("div",{className:"w-full truncate font-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3px]","data-yotpo-instance-id":(0,a.yotpoInstanceId)(c),"data-yotpo-product-id":R,"data-yotpo-cart-product-id":R,"data-yotpo-section-id":""}),E?(0,t.jsx)(Z.Text,{size:2,html:E||"",className:"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold"}):null,(0,t.jsxs)("div",{className:"mt-3 mb-2",children:[(0,t.jsx)("p",{dangerouslySetInnerHTML:{__html:U&&le&&(L?.memberPrice||z?.member_price||z?.plus_member_price)||""},className:"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold"}),(0,t.jsx)("div",{className:"flex items-center",children:O?(0,t.jsx)("div",{className:"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:fe||""}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:D?.availableForSale&&H?.price||""}),(0,t.jsx)("div",{className:"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through",children:D?.availableForSale&&H?.basePrice||""})]})})]}),(0,t.jsxs)("div",{className:(0,a.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col"),children:[(0,t.jsx)(B.default,{variant:"secondary",className:"m-tablet:w-full font-bold",onClick:()=>te?.(e,b),children:r?.secondaryButton||"Learn More"}),(0,t.jsx)(B.default,{variant:"primary",className:"m-tablet:w-full font-bold",disabled:O,onClick:()=>p?.(e,b),children:r?.primaryButton||"Shop Now"})]})]})]})},e?.id||e?.handle)};var Te=Ie;
2
2
  //# sourceMappingURL=FilterCardWrapItem.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/CollectionsFilters/FilterCardWrapItem.tsx"],
4
- "sourcesContent": ["import { cn, atobID, yotpoInstanceId } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport Badge from '../../components/badge.js'\nimport { Text } from '../../components/text.js'\nimport Button from '../../components/button.js'\nimport Picture from '../../components/picture.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { getFunctionMemberPrice } from './component/price.js'\nimport { useState, useEffect } from 'react'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nconst getShopifyCdnBaseUrl = (imagePath: string | null) => {\n // \u76EE\u524D\u77E5\u9053\u7684 shopify \u56FE\u7247\u8DEF\u7531\u7684\u5F62\u5F0F\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/files/Group_5581_2.jpg?v=1662379184\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/products/B2633123.jpg?v=1631264041_3840x\n // \u8FD4\u56DE https://cdn.shopify.com/s/files/1/0493/9834/9974/files/\n let path\n if (imagePath?.includes('products')) {\n path = imagePath?.split('products')[0] + 'files/'\n } else {\n path = imagePath?.replace(imagePath?.split('files')?.pop() || '', '') + '/'\n }\n return path\n}\n\ntype FilterCardWrapItemProps = {\n data: any\n buttonText?: any\n itemShape?: string\n metafields: any\n onPrimaryChange?: (item: any, sku: string) => void\n onSecondaryChange?: (item: any, sku: string) => void\n}\n\nconst FilterCardWrapItem = ({\n data,\n buttonText,\n itemShape,\n metafields,\n onPrimaryChange,\n onSecondaryChange,\n}: FilterCardWrapItemProps) => {\n const { memberPriceDiscount, memberSetting, discounts, shopCommon } = metafields\n const [currentSku, setCurrentSku] = useState<string>('')\n const [currentImage, setCurrentImage] = useState<string>('')\n const [selectedColor, setSelectedColor] = useState<string>('')\n const [isSoldOut, setIsSoldOut] = useState<any>(false)\n const [currentVariant, setCurrentVariant] = useState<any>({})\n const [plusMemberStatus, setPlusMemberStatus] = useState<boolean>(false)\n const [priceCollection, setPriceCollection] = useState<{ price: string; basePrice: string }>({\n price: '',\n basePrice: '',\n })\n const [tags, setTags] = useState<string[]>([])\n const [showTags, setShowTags] = useState<string[]>([])\n const [discountCollection, setDiscountCollection] = useState<string>('')\n const [soldOutText, setSoldOutText] = useState<string>('')\n\n const { locale = 'us', currencyCode, isLogin } = useAiuiContext()\n\n const displayTitle = data?.custom_name || data?.title || data?.name\n const displayDescription = data?.custom_description || data?.description || data?.descriptionHtml\n const skuArray = data?.filter_variants || data?.variants || []\n const id = atobID(data?.id || '')\n\n const imagePath = data?.images?.[0]?.url\n\n const onColorClick = (color: string) => setSelectedColor(color)\n\n const handleBasePrice = (discount: string, priceCurrency: string, salePrice: string, status: boolean) => {\n setPlusMemberStatus(status)\n setDiscountCollection(discount || '')\n setPriceCollection({\n basePrice: priceCurrency || '',\n price: salePrice || '',\n })\n }\n\n useEffect(() => {\n if (selectedColor) {\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(selectedColor))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n return\n }\n const firstOption = data?.options?.find((item: any) => item?.displayName === 'color')?.values?.[0]?.label\n firstOption && setSelectedColor(firstOption)\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(firstOption))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n }, [selectedColor])\n\n useEffect(() => {\n if (!currentSku) return\n setTags(data?.tags || [])\n const variant = skuArray?.find((item: any) => item?.sku === currentSku) || skuArray?.[0] || {}\n setCurrentVariant(variant)\n setIsSoldOut(!variant?.availableForSale || variant?.price?.amount === SOLD_OUT_PRICE)\n const { infos } = variant?.metafields || {}\n const { productInfos, preRender } = data?.metafields || {}\n setSoldOutText(infos?.comingSoon || productInfos?.comingSoon || preRender?.soldOut || shopCommon?.soldOut || '')\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n const { price, basePrice, discount, discountAmount } = formatVariantPrice({\n locale: locale,\n amount: coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n const showPrice = (() => {\n if (coupon?.value_type === 'fixed_amount') {\n const amountStr = discountAmount || ''\n const match = amountStr.match(/^(.*?)(\\d[\\d.,]*)(.*)$/)\n if (match) {\n const [, prefix, numeric, suffix] = match\n let updatedNumeric = numeric\n if (numeric.endsWith('.00')) {\n updatedNumeric = numeric.replace(/\\.00$/, '')\n } else if (numeric.endsWith(',00')) {\n updatedNumeric = numeric.replace(/,00$/, '')\n }\n return `${prefix}${updatedNumeric}${suffix}`\n }\n return amountStr\n }\n return discount || ''\n })()\n // \u4F1A\u5458\u6298\u6263\n if (isLogin) {\n const result = getFunctionMemberPrice({\n locale: locale,\n variant: variant,\n shopMemberPriceDiscountConfig: memberPriceDiscount,\n currencyCode: currencyCode || data?.price?.currencyCode || 'USD',\n })\n if (result) {\n const { hasMemberPrice, salePriceWithCurrency, originalPriceWithCurrency, savePriceWithCurrency } = result\n handleBasePrice(\n savePriceWithCurrency || '',\n originalPriceWithCurrency || '',\n hasMemberPrice ? salePriceWithCurrency : '',\n result?.hasMemberPrice\n )\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n }, [data, currentSku])\n\n // \u5904\u7406\u6807\u7B7E\n useEffect(() => {\n let handleTags: string[] = []\n if (discountCollection) {\n const discountTag = `${discountCollection} ${discounts?.off}`\n handleTags.push(discountTag)\n }\n const newTags = tags\n ?.filter?.((item: string) => item?.startsWith?.('CLtag'))\n ?.map?.((item: string) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, discountCollection ? 1 : 2)\n setShowTags(handleTags.concat(newTags))\n }, [tags, discountCollection])\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n {data?.mImage ? (\n <div className=\"size-full box-border overflow-hidden hover:[&_img]:scale-105\">\n <div className=\"relative inset-0 size-full\">\n <a className=\"size-full\" href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}>\n <Picture\n alt=\"\"\n source={data?.mImage?.url || data?.mImage}\n className=\"size-full [&_img]:object-cover [&_img]:size-full\"\n imgClassName=\"size-full object-cover transition-all duration-300\"\n />\n <div className=\"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4\">\n <p\n className=\"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold\"\n dangerouslySetInnerHTML={{ __html: data?.subTitle }}\n />\n <span\n className=\"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6\"\n dangerouslySetInnerHTML={{ __html: data?.title }}\n />\n </div>\n </a>\n </div>\n </div>\n ) : (\n <div className=\"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4\">\n <div className=\"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags\">\n {showTags?.map?.((item: string, index: number) => (\n <Badge key={index} className=\"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge\">\n {item}\n </Badge>\n ))}\n </div>\n <a\n target=\"_blank\"\n aria-label={displayTitle}\n className=\"my-1\"\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n >\n <div className={cn('m-auto desktop:size-[196px] size-[120px] overflow-hidden')}>\n <Picture\n alt=\"\"\n source={currentImage}\n className=\"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit\"\n />\n </div>\n </a>\n {data?.options?.map((option: any) => {\n if (option?.displayName === 'color') {\n return (\n <div className=\"flex items-center gap-1\">\n {option?.values?.map((item: any) => {\n const color = item?.hexColors ? item.hexColors?.[0] : item?.label\n const hexColor = color.startsWith('#') ? color : ''\n return (\n <button\n key={item?.label}\n onClick={() => onColorClick(item?.label)}\n className={cn(\n 'size-4 rounded-full cursor-pointer overflow-hidden',\n `${selectedColor === item?.label ? 'border-[#00BEFA]' : ''}`\n )}\n >\n <span\n className={cn(\n 'h-full w-full overflow-hidden border-[0.5px] border-transparent',\n 'relative flex items-center justify-center overflow-hidden rounded-full',\n selectedColor === item?.label && 'border-[#ddd]'\n )}\n style={hexColor ? { backgroundColor: hexColor } : {}}\n >\n {!hexColor && imagePath && (\n <img\n alt={color}\n className=\"h-full w-full object-cover\"\n src={`${getShopifyCdnBaseUrl(imagePath)}${color\n ?.toLowerCase()\n .split(' ')\n ?.join('-')}_${'50x'}.png`}\n />\n )}\n </span>\n </button>\n )\n })}\n </div>\n )\n }\n })}\n <div>\n {displayTitle ? (\n <span\n dangerouslySetInnerHTML={{ __html: displayTitle || '' }}\n className=\"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold\"\n />\n ) : null}\n {data?.metafields?.judgemeBadge ? (\n <a\n target=\"_blank\"\n className=\"font-bold text-xs [&_.jdgm-star]:text-[#F77234]\"\n dangerouslySetInnerHTML={{ __html: data?.metafields?.judgemeBadge }}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n />\n ) : (\n <div\n className=\"w-full truncatefont-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3.5px]\"\n data-yotpo-instance-id={yotpoInstanceId(locale)}\n data-yotpo-product-id={id}\n data-yotpo-cart-product-id={id}\n data-yotpo-section-id=\"\"\n />\n )}\n {displayDescription ? (\n <Text\n size={2}\n html={displayDescription || ''}\n className=\"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold\"\n />\n ) : null}\n <div className=\"mt-3 mb-2\">\n <p\n dangerouslySetInnerHTML={{\n __html:\n isLogin && plusMemberStatus\n ? discounts?.memberPrice || memberSetting?.member_price || memberSetting?.plus_member_price || ''\n : '',\n }}\n className=\"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold\"\n />\n <div className=\"flex items-center\">\n {isSoldOut ? (\n <div className=\"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {soldOutText || ''}\n </div>\n ) : (\n <>\n <div className=\"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {currentVariant?.availableForSale ? priceCollection?.price || '' : ''}\n </div>\n <div className=\"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through\">\n {currentVariant?.availableForSale ? priceCollection?.basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn('shelf-flex-button-group', 'lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col')}\n >\n <Button\n variant=\"secondary\"\n className=\"m-tablet:w-full font-bold\"\n onClick={() => onSecondaryChange?.(data, currentSku)}\n >\n {buttonText?.secondaryButton || 'Learn More'}\n </Button>\n <Button\n variant=\"primary\"\n className=\"m-tablet:w-full font-bold\"\n disabled={isSoldOut}\n onClick={() => onPrimaryChange?.(data, currentSku)}\n >\n {buttonText?.primaryButton || 'Shop Now'}\n </Button>\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\nexport default FilterCardWrapItem\n"],
5
- "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAyLc,IAAAI,EAAA,6BAzLdC,EAA4C,kCAC5CC,EAA+B,oCAC/BC,EAAmC,2CACnCC,EAAkB,wCAClBC,EAAqB,oCACrBC,EAAmB,yCACnBC,EAAoB,0CACpBC,EAA4B,uCAC5BC,GAAuC,gCACvCC,EAAoC,iBAEpC,MAAMC,EAAgB,QAChBC,EAAgB,gBAEhBC,GAAiB,aAEjBC,GAAwBC,GAA6B,CAKzD,IAAIC,EACJ,OAAID,GAAW,SAAS,UAAU,EAChCC,EAAOD,GAAW,MAAM,UAAU,EAAE,CAAC,EAAI,SAEzCC,EAAOD,GAAW,QAAQA,GAAW,MAAM,OAAO,GAAG,IAAI,G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B,6BAA4BA,EAC5B,wBAAsB,GACxB,EAEDF,KACC,OAAC,QACC,KAAM,EACN,KAAMA,GAAsB,GAC5B,UAAU,oGACZ,EACE,QACJ,QAAC,OAAI,UAAU,YACb,oBAAC,KACC,wBAAyB,CACvB,OACEF,GAAWd,KACPZ,GAAW,aAAeD,GAAe,cAAgBA,GAAe,oBAAqB,EAErG,EACA,UAAU,0FACZ,KACA,OAAC,OAAI,UAAU,oBACZ,SAAAS,KACC,OAAC,OAAI,UAAU,wEACZ,SAAAc,IAAe,GAClB,KAEA,oBACE,oBAAC,OAAI,UAAU,oFACZ,SAAAZ,GAAgB,kBAAmBI,GAAiB,OAAS,GAChE,KACA,OAAC,OAAI,UAAU,sGACZ,SAAAJ,GAAgB,kBAAmBI,GAAiB,WAAa,GACpE,GACF,EAEJ,GACF,KAEA,QAAC,OACC,aAAW,MAAG,0BAA2B,4DAA4D,EAErG,oBAAC,EAAAuD,QAAA,CACC,QAAQ,YACR,UAAU,4BACV,QAAS,IAAMxE,KAAoBL,EAAMU,CAAU,EAElD,SAAAT,GAAY,iBAAmB,aAClC,KACA,OAAC,EAAA4E,QAAA,CACC,QAAQ,UACR,UAAU,4BACV,SAAU7D,EACV,QAAS,IAAMZ,IAAkBJ,EAAMU,CAAU,EAEhD,SAAAT,GAAY,eAAiB,WAChC,GACF,GACF,GACF,GArLGD,GAAM,IAAMA,GAAM,MAuLzB,CAEJ,EACA,IAAOpB,GAAQmB",
4
+ "sourcesContent": ["import { cn, atobID, yotpoInstanceId } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport Badge from '../../components/badge.js'\nimport { Text } from '../../components/text.js'\nimport Button from '../../components/button.js'\nimport Picture from '../../components/picture.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { getFunctionMemberPrice } from './component/price.js'\nimport { useState, useEffect } from 'react'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nconst getShopifyCdnBaseUrl = (imagePath: string | null) => {\n // \u76EE\u524D\u77E5\u9053\u7684 shopify \u56FE\u7247\u8DEF\u7531\u7684\u5F62\u5F0F\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/files/Group_5581_2.jpg?v=1662379184\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/products/B2633123.jpg?v=1631264041_3840x\n // \u8FD4\u56DE https://cdn.shopify.com/s/files/1/0493/9834/9974/files/\n let path\n if (imagePath?.includes('products')) {\n path = imagePath?.split('products')[0] + 'files/'\n } else {\n path = imagePath?.replace(imagePath?.split('files')?.pop() || '', '') + '/'\n }\n return path\n}\n\ntype FilterCardWrapItemProps = {\n data: any\n buttonText?: any\n itemShape?: string\n metafields: any\n onPrimaryChange?: (item: any, sku: string) => void\n onSecondaryChange?: (item: any, sku: string) => void\n}\n\nconst FilterCardWrapItem = ({\n data,\n buttonText,\n itemShape,\n metafields,\n onPrimaryChange,\n onSecondaryChange,\n}: FilterCardWrapItemProps) => {\n const { memberPriceDiscount, memberSetting, discounts, shopCommon } = metafields\n const [currentSku, setCurrentSku] = useState<string>('')\n const [currentImage, setCurrentImage] = useState<string>('')\n const [selectedColor, setSelectedColor] = useState<string>('')\n const [isSoldOut, setIsSoldOut] = useState<any>(false)\n const [currentVariant, setCurrentVariant] = useState<any>({})\n const [plusMemberStatus, setPlusMemberStatus] = useState<boolean>(false)\n const [priceCollection, setPriceCollection] = useState<{ price: string; basePrice: string }>({\n price: '',\n basePrice: '',\n })\n const [tags, setTags] = useState<string[]>([])\n const [showTags, setShowTags] = useState<string[]>([])\n const [discountCollection, setDiscountCollection] = useState<string>('')\n const [soldOutText, setSoldOutText] = useState<string>('')\n\n const { locale = 'us', currencyCode, isLogin } = useAiuiContext()\n\n const displayTitle = data?.custom_name || data?.title || data?.name\n const displayDescription = data?.custom_description || data?.description || data?.descriptionHtml\n const skuArray = data?.filter_variants || data?.variants || []\n const id = atobID(data?.id || '')\n\n const imagePath = data?.images?.[0]?.url\n\n const onColorClick = (color: string) => setSelectedColor(color)\n\n const handleBasePrice = (discount: string, priceCurrency: string, salePrice: string, status: boolean) => {\n setPlusMemberStatus(status)\n setDiscountCollection(discount || '')\n setPriceCollection({\n basePrice: priceCurrency || '',\n price: salePrice || '',\n })\n }\n\n useEffect(() => {\n if (selectedColor) {\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(selectedColor))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n return\n }\n const firstOption = data?.options?.find((item: any) => item?.displayName === 'color')?.values?.[0]?.label\n firstOption && setSelectedColor(firstOption)\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(firstOption))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n }, [selectedColor])\n\n useEffect(() => {\n if (!currentSku) return\n setTags(data?.tags || [])\n const variant = skuArray?.find((item: any) => item?.sku === currentSku) || skuArray?.[0] || {}\n setCurrentVariant(variant)\n setIsSoldOut(!variant?.availableForSale || variant?.price?.amount === SOLD_OUT_PRICE)\n const { infos } = variant?.metafields || {}\n const { productInfos, preRender } = data?.metafields || {}\n setSoldOutText(infos?.comingSoon || productInfos?.comingSoon || preRender?.soldOut || shopCommon?.soldOut || '')\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n const { price, basePrice, discount, discountAmount } = formatVariantPrice({\n locale: locale,\n amount: coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n const showPrice = (() => {\n if (coupon?.value_type === 'fixed_amount') {\n const amountStr = discountAmount || ''\n const match = amountStr.match(/^(.*?)(\\d[\\d.,]*)(.*)$/)\n if (match) {\n const [, prefix, numeric, suffix] = match\n let updatedNumeric = numeric\n if (numeric.endsWith('.00')) {\n updatedNumeric = numeric.replace(/\\.00$/, '')\n } else if (numeric.endsWith(',00')) {\n updatedNumeric = numeric.replace(/,00$/, '')\n }\n return `${prefix}${updatedNumeric}${suffix}`\n }\n return amountStr\n }\n return discount || ''\n })()\n // \u4F1A\u5458\u6298\u6263\n if (isLogin) {\n const result = getFunctionMemberPrice({\n locale: locale,\n variant: variant,\n shopMemberPriceDiscountConfig: memberPriceDiscount,\n currencyCode: currencyCode || data?.price?.currencyCode || 'USD',\n })\n if (result) {\n const { hasMemberPrice, salePriceWithCurrency, originalPriceWithCurrency, savePriceWithCurrency } = result\n handleBasePrice(\n savePriceWithCurrency || '',\n originalPriceWithCurrency || '',\n hasMemberPrice ? salePriceWithCurrency : '',\n result?.hasMemberPrice\n )\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n }, [data, currentSku])\n\n // \u5904\u7406\u6807\u7B7E\n useEffect(() => {\n let handleTags: string[] = []\n if (discountCollection) {\n const discountTag = `${discountCollection} ${discounts?.off}`\n handleTags.push(discountTag)\n }\n const newTags = tags\n ?.filter?.((item: string) => item?.startsWith?.('CLtag'))\n ?.map?.((item: string) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, discountCollection ? 1 : 2)\n setShowTags(handleTags.concat(newTags))\n }, [tags, discountCollection])\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n {data?.mImage ? (\n <div className=\"size-full box-border overflow-hidden hover:[&_img]:scale-105\">\n <div className=\"relative inset-0 size-full\">\n <a className=\"size-full\" href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}>\n <Picture\n alt=\"\"\n source={data?.mImage?.url || data?.mImage}\n className=\"size-full [&_img]:object-cover [&_img]:size-full\"\n imgClassName=\"size-full object-cover transition-all duration-300\"\n />\n <div className=\"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4\">\n <p\n className=\"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold\"\n dangerouslySetInnerHTML={{ __html: data?.subTitle }}\n />\n <span\n className=\"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6\"\n dangerouslySetInnerHTML={{ __html: data?.title }}\n />\n </div>\n </a>\n </div>\n </div>\n ) : (\n <div className=\"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4\">\n <div className=\"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags\">\n {showTags?.map?.((item: string, index: number) => (\n <Badge key={index} className=\"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge\">\n {item}\n </Badge>\n ))}\n </div>\n <a\n target=\"_blank\"\n aria-label={displayTitle}\n className=\"my-1\"\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n >\n <div className={cn('m-auto desktop:size-[196px] size-[120px] overflow-hidden')}>\n <Picture\n alt=\"\"\n source={currentImage}\n className=\"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit\"\n />\n </div>\n </a>\n {data?.options?.map((option: any) => {\n if (option?.displayName === 'color') {\n return (\n <div className=\"flex items-center gap-1\">\n {option?.values?.map((item: any) => {\n const color = item?.hexColors ? item.hexColors?.[0] : item?.label\n const hexColor = color.startsWith('#') ? color : ''\n return (\n <button\n key={item?.label}\n onClick={() => onColorClick(item?.label)}\n className={cn(\n 'size-4 rounded-full cursor-pointer overflow-hidden',\n `${selectedColor === item?.label ? 'border-[#00BEFA]' : ''}`\n )}\n >\n <span\n className={cn(\n 'h-full w-full overflow-hidden border-[0.5px] border-transparent',\n 'relative flex items-center justify-center overflow-hidden rounded-full',\n selectedColor === item?.label && 'border-[#ddd]'\n )}\n style={hexColor ? { backgroundColor: hexColor } : {}}\n >\n {!hexColor && imagePath && (\n <img\n alt={color}\n className=\"h-full w-full object-cover\"\n src={`${getShopifyCdnBaseUrl(imagePath)}${color\n ?.toLowerCase()\n .split(' ')\n ?.join('-')}_${'50x'}.png`}\n />\n )}\n </span>\n </button>\n )\n })}\n </div>\n )\n }\n })}\n <div>\n {displayTitle ? (\n <span\n dangerouslySetInnerHTML={{ __html: displayTitle || '' }}\n className=\"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold\"\n />\n ) : null}\n {data?.metafields?.judgemeBadge ? (\n <a\n target=\"_blank\"\n className=\"font-bold text-xs [&_.jdgm-star]:text-[#F77234]\"\n dangerouslySetInnerHTML={{ __html: data?.metafields?.judgemeBadge }}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n />\n ) : (\n <div\n className=\"w-full truncate font-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3px]\"\n data-yotpo-instance-id={yotpoInstanceId(locale)}\n data-yotpo-product-id={id}\n data-yotpo-cart-product-id={id}\n data-yotpo-section-id=\"\"\n />\n )}\n {displayDescription ? (\n <Text\n size={2}\n html={displayDescription || ''}\n className=\"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold\"\n />\n ) : null}\n <div className=\"mt-3 mb-2\">\n <p\n dangerouslySetInnerHTML={{\n __html:\n isLogin && plusMemberStatus\n ? discounts?.memberPrice || memberSetting?.member_price || memberSetting?.plus_member_price || ''\n : '',\n }}\n className=\"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold\"\n />\n <div className=\"flex items-center\">\n {isSoldOut ? (\n <div className=\"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {soldOutText || ''}\n </div>\n ) : (\n <>\n <div className=\"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {currentVariant?.availableForSale ? priceCollection?.price || '' : ''}\n </div>\n <div className=\"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through\">\n {currentVariant?.availableForSale ? priceCollection?.basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn('shelf-flex-button-group', 'lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col')}\n >\n <Button\n variant=\"secondary\"\n className=\"m-tablet:w-full font-bold\"\n onClick={() => onSecondaryChange?.(data, currentSku)}\n >\n {buttonText?.secondaryButton || 'Learn More'}\n </Button>\n <Button\n variant=\"primary\"\n className=\"m-tablet:w-full font-bold\"\n disabled={isSoldOut}\n onClick={() => onPrimaryChange?.(data, currentSku)}\n >\n {buttonText?.primaryButton || 'Shop Now'}\n </Button>\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\nexport default FilterCardWrapItem\n"],
5
+ "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAyLc,IAAAI,EAAA,6BAzLdC,EAA4C,kCAC5CC,EAA+B,oCAC/BC,EAAmC,2CACnCC,EAAkB,wCAClBC,EAAqB,oCACrBC,EAAmB,yCACnBC,EAAoB,0CACpBC,EAA4B,uCAC5BC,GAAuC,gCACvCC,EAAoC,iBAEpC,MAAMC,EAAgB,QAChBC,EAAgB,gBAEhBC,GAAiB,aAEjBC,GAAwBC,GAA6B,CAKzD,IAAIC,EACJ,OAAID,GAAW,SAAS,UAAU,EAChCC,EAAOD,GAAW,MAAM,UAAU,EAA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KAEA,OAAC,OACC,UAAU,0TACV,4BAAwB,mBAAgBsC,CAAM,EAC9C,wBAAuBM,EACvB,6BAA4BA,EAC5B,wBAAsB,GACxB,EAEDF,KACC,OAAC,QACC,KAAM,EACN,KAAMA,GAAsB,GAC5B,UAAU,oGACZ,EACE,QACJ,QAAC,OAAI,UAAU,YACb,oBAAC,KACC,wBAAyB,CACvB,OACEF,GAAWd,KACPZ,GAAW,aAAeD,GAAe,cAAgBA,GAAe,oBAAqB,EAErG,EACA,UAAU,0FACZ,KACA,OAAC,OAAI,UAAU,oBACZ,SAAAS,KACC,OAAC,OAAI,UAAU,wEACZ,SAAAc,IAAe,GAClB,KAEA,oBACE,oBAAC,OAAI,UAAU,oFACZ,SAAAZ,GAAgB,kBAAmBI,GAAiB,OAAS,GAChE,KACA,OAAC,OAAI,UAAU,sGACZ,SAAAJ,GAAgB,kBAAmBI,GAAiB,WAAa,GACpE,GACF,EAEJ,GACF,KAEA,QAAC,OACC,aAAW,MAAG,0BAA2B,4DAA4D,EAErG,oBAAC,EAAAuD,QAAA,CACC,QAAQ,YACR,UAAU,4BACV,QAAS,IAAMxE,KAAoBL,EAAMU,CAAU,EAElD,SAAAT,GAAY,iBAAmB,aAClC,KACA,OAAC,EAAA4E,QAAA,CACC,QAAQ,UACR,UAAU,4BACV,SAAU7D,EACV,QAAS,IAAMZ,IAAkBJ,EAAMU,CAAU,EAEhD,SAAAT,GAAY,eAAiB,WAChC,GACF,GACF,GACF,GArLGD,GAAM,IAAMA,GAAM,MAuLzB,CAEJ,EACA,IAAOpB,GAAQmB",
6
6
  "names": ["FilterCardWrapItem_exports", "__export", "FilterCardWrapItem_default", "__toCommonJS", "import_jsx_runtime", "import_utils", "import_AiuiProvider", "import_shelfDisplay", "import_badge", "import_text", "import_button", "import_picture", "import_trackUrlRef", "import_price", "import_react", "componentType", "componentName", "SOLD_OUT_PRICE", "getShopifyCdnBaseUrl", "imagePath", "path", "FilterCardWrapItem", "data", "buttonText", "itemShape", "metafields", "onPrimaryChange", "onSecondaryChange", "memberPriceDiscount", "memberSetting", "discounts", "shopCommon", "currentSku", "setCurrentSku", "currentImage", "setCurrentImage", "selectedColor", "setSelectedColor", "isSoldOut", "setIsSoldOut", "currentVariant", "setCurrentVariant", "plusMemberStatus", "setPlusMemberStatus", "priceCollection", "setPriceCollection", "tags", "setTags", "showTags", "setShowTags", "discountCollection", "setDiscountCollection", "soldOutText", "setSoldOutText", "locale", "currencyCode", "isLogin", "displayTitle", "displayDescription", "skuArray", "id", "onColorClick", "color", "handleBasePrice", "discount", "priceCurrency", "salePrice", "status", "findSku", "item", "firstOption", "variant", "infos", "productInfos", "preRender", "coupon", "price", "basePrice", "discountAmount", "showPrice", "amountStr", "match", "prefix", "numeric", "suffix", "updatedNumeric", "result", "hasMemberPrice", "salePriceWithCurrency", "originalPriceWithCurrency", "savePriceWithCurrency", "handleTags", "discountTag", "newTags", "Picture", "index", "Badge", "option", "hexColor", "Button"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Fragment as Ne,jsx as t,jsxs as m}from"react/jsx-runtime";import{cn as b,atobID as fe,yotpoInstanceId as be}from"../../helpers/utils.js";import{useAiuiContext as ge}from"../AiuiProvider/index.js";import{formatVariantPrice as xe}from"../ShelfDisplay/shelfDisplay.js";import ye from"../../components/badge.js";import{Text as ve}from"../../components/text.js";import R from"../../components/button.js";import V from"../../components/picture.js";import{trackUrlRef as N}from"../../shared/trackUrlRef.js";import{getFunctionMemberPrice as he}from"./component/price.js";import{useState as n,useEffect as w}from"react";const S="image",$="product_shelf",_e=999999999e-2,ke=e=>{let u;return e?.includes("products")?u=e?.split("products")[0]+"files/":u=e?.replace(e?.split("files")?.pop()||"","")+"/",u},Ce=({data:e,buttonText:u,itemShape:q,metafields:G,onPrimaryChange:J,onSecondaryChange:K})=>{const{memberPriceDiscount:Q,memberSetting:P,discounts:I,shopCommon:X}=G,[p,T]=n(""),[Y,B]=n(""),[f,M]=n(""),[z,Z]=n(!1),[L,ee]=n({}),[te,oe]=n(!1),[W,se]=n({price:"",basePrice:""}),[j,re]=n([]),[ne,ie]=n([]),[g,le]=n(""),[ae,ce]=n(""),{locale:i="us",currencyCode:de,isLogin:F}=ge(),v=e?.custom_name||e?.title||e?.name,O=e?.custom_description||e?.description||e?.descriptionHtml,a=e?.filter_variants||e?.variants||[],D=fe(e?.id||""),H=e?.images?.[0]?.url,me=o=>M(o),h=(o,r,s,l)=>{oe(l),le(o||""),se({basePrice:r||"",price:s||""})};return w(()=>{if(f){const s=a?.find(l=>l?.name?.includes?.(f));T(s?.sku||a?.[0]?.sku||""),B(s?.image?.url||a?.[0]?.image?.url||"");return}const o=e?.options?.find(s=>s?.displayName==="color")?.values?.[0]?.label;o&&M(o);const r=a?.find(s=>s?.name?.includes?.(o));T(r?.sku||a?.[0]?.sku||""),B(r?.image?.url||a?.[0]?.image?.url||"")},[f]),w(()=>{if(!p)return;re(e?.tags||[]);const o=a?.find(c=>c?.sku===p)||a?.[0]||{};ee(o),Z(!o?.availableForSale||o?.price?.amount===_e);const{infos:r}=o?.metafields||{},{productInfos:s,preRender:l}=e?.metafields||{};ce(r?.comingSoon||s?.comingSoon||l?.soldOut||X?.soldOut||"");const x=o?.coupons?.[0],{price:A,basePrice:U,discount:ue,discountAmount:pe}=xe({locale:i,amount:x?x.variant_price4wscode:o.price,baseAmount:x?o.price:0,currencyCode:e?.price?.currencyCode||"USD"}),E=(()=>{if(x?.value_type==="fixed_amount"){const c=pe||"",y=c.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(y){const[,_,d,k]=y;let C=d;return d.endsWith(".00")?C=d.replace(/\.00$/,""):d.endsWith(",00")&&(C=d.replace(/,00$/,"")),`${_}${C}${k}`}return c}return ue||""})();if(F){const c=he({locale:i,variant:o,shopMemberPriceDiscountConfig:Q,currencyCode:de||e?.price?.currencyCode||"USD"});if(c){const{hasMemberPrice:y,salePriceWithCurrency:_,originalPriceWithCurrency:d,savePriceWithCurrency:k}=c;h(k||"",d||"",y?_:"",c?.hasMemberPrice)}else h(E,U||"",A||"",!1)}else h(E,U||"",A||"",!1)},[e,p]),w(()=>{let o=[];if(g){const s=`${g} ${I?.off}`;o.push(s)}const r=j?.filter?.(s=>s?.startsWith?.("CLtag"))?.map?.(s=>s?.replace?.("CLtag:",""))?.slice?.(0,g?1:2);ie(o.concat(r))},[j,g]),t("div",{className:b(q==="round"?"rounded-2xl":"rounded-none","tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300",{"aiui-dark":e.theme==="dark"}),children:e?.mImage?t("div",{className:"size-full box-border overflow-hidden hover:[&_img]:scale-105",children:t("div",{className:"relative inset-0 size-full",children:m("a",{className:"size-full",href:N(e?.link,`${S}_${$}`),children:[t(V,{alt:"",source:e?.mImage?.url||e?.mImage,className:"size-full [&_img]:object-cover [&_img]:size-full",imgClassName:"size-full object-cover transition-all duration-300"}),m("div",{className:"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4",children:[t("p",{className:"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.subTitle}}),t("span",{className:"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6",dangerouslySetInnerHTML:{__html:e?.title}})]})]})})}):m("div",{className:"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4",children:[t("div",{className:"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags",children:ne?.map?.((o,r)=>t(ye,{className:"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge",children:o},r))}),t("a",{target:"_blank","aria-label":v,className:"my-1",href:N(`${i==="us"||!i?"":`/${i}`}/products/${e?.handle}`,`${S}_${$}`),children:t("div",{className:b("m-auto desktop:size-[196px] size-[120px] overflow-hidden"),children:t(V,{alt:"",source:Y,className:"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit"})})}),e?.options?.map(o=>{if(o?.displayName==="color")return t("div",{className:"flex items-center gap-1",children:o?.values?.map(r=>{const s=r?.hexColors?r.hexColors?.[0]:r?.label,l=s.startsWith("#")?s:"";return t("button",{onClick:()=>me(r?.label),className:b("size-4 rounded-full cursor-pointer overflow-hidden",`${f===r?.label?"border-[#00BEFA]":""}`),children:t("span",{className:b("h-full w-full overflow-hidden border-[0.5px] border-transparent","relative flex items-center justify-center overflow-hidden rounded-full",f===r?.label&&"border-[#ddd]"),style:l?{backgroundColor:l}:{},children:!l&&H&&t("img",{alt:s,className:"h-full w-full object-cover",src:`${ke(H)}${s?.toLowerCase().split(" ")?.join("-")}_50x.png`})})},r?.label)})})}),m("div",{children:[v?t("span",{dangerouslySetInnerHTML:{__html:v||""},className:"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold"}):null,e?.metafields?.judgemeBadge?t("a",{target:"_blank",className:"font-bold text-xs [&_.jdgm-star]:text-[#F77234]",dangerouslySetInnerHTML:{__html:e?.metafields?.judgemeBadge},href:N(`${i==="us"||!i?"":`/${i}`}/products/${e?.handle}`,`${S}_${$}`)}):t("div",{className:"w-full truncatefont-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3.5px]","data-yotpo-instance-id":be(i),"data-yotpo-product-id":D,"data-yotpo-cart-product-id":D,"data-yotpo-section-id":""}),O?t(ve,{size:2,html:O||"",className:"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold"}):null,m("div",{className:"mt-3 mb-2",children:[t("p",{dangerouslySetInnerHTML:{__html:F&&te&&(I?.memberPrice||P?.member_price||P?.plus_member_price)||""},className:"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold"}),t("div",{className:"flex items-center",children:z?t("div",{className:"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:ae||""}):m(Ne,{children:[t("div",{className:"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:L?.availableForSale&&W?.price||""}),t("div",{className:"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through",children:L?.availableForSale&&W?.basePrice||""})]})})]}),m("div",{className:b("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col"),children:[t(R,{variant:"secondary",className:"m-tablet:w-full font-bold",onClick:()=>K?.(e,p),children:u?.secondaryButton||"Learn More"}),t(R,{variant:"primary",className:"m-tablet:w-full font-bold",disabled:z,onClick:()=>J?.(e,p),children:u?.primaryButton||"Shop Now"})]})]})]})},e?.id||e?.handle)};var We=Ce;export{We as default};
1
+ import{Fragment as Ne,jsx as t,jsxs as m}from"react/jsx-runtime";import{cn as b,atobID as fe,yotpoInstanceId as be}from"../../helpers/utils.js";import{useAiuiContext as ge}from"../AiuiProvider/index.js";import{formatVariantPrice as xe}from"../ShelfDisplay/shelfDisplay.js";import ye from"../../components/badge.js";import{Text as ve}from"../../components/text.js";import R from"../../components/button.js";import V from"../../components/picture.js";import{trackUrlRef as N}from"../../shared/trackUrlRef.js";import{getFunctionMemberPrice as he}from"./component/price.js";import{useState as n,useEffect as w}from"react";const S="image",$="product_shelf",_e=999999999e-2,ke=e=>{let u;return e?.includes("products")?u=e?.split("products")[0]+"files/":u=e?.replace(e?.split("files")?.pop()||"","")+"/",u},Ce=({data:e,buttonText:u,itemShape:q,metafields:G,onPrimaryChange:J,onSecondaryChange:K})=>{const{memberPriceDiscount:Q,memberSetting:P,discounts:I,shopCommon:X}=G,[p,T]=n(""),[Y,B]=n(""),[f,M]=n(""),[z,Z]=n(!1),[L,ee]=n({}),[te,oe]=n(!1),[W,se]=n({price:"",basePrice:""}),[j,re]=n([]),[ne,ie]=n([]),[g,le]=n(""),[ae,ce]=n(""),{locale:i="us",currencyCode:de,isLogin:F}=ge(),v=e?.custom_name||e?.title||e?.name,O=e?.custom_description||e?.description||e?.descriptionHtml,a=e?.filter_variants||e?.variants||[],D=fe(e?.id||""),H=e?.images?.[0]?.url,me=o=>M(o),h=(o,r,s,l)=>{oe(l),le(o||""),se({basePrice:r||"",price:s||""})};return w(()=>{if(f){const s=a?.find(l=>l?.name?.includes?.(f));T(s?.sku||a?.[0]?.sku||""),B(s?.image?.url||a?.[0]?.image?.url||"");return}const o=e?.options?.find(s=>s?.displayName==="color")?.values?.[0]?.label;o&&M(o);const r=a?.find(s=>s?.name?.includes?.(o));T(r?.sku||a?.[0]?.sku||""),B(r?.image?.url||a?.[0]?.image?.url||"")},[f]),w(()=>{if(!p)return;re(e?.tags||[]);const o=a?.find(c=>c?.sku===p)||a?.[0]||{};ee(o),Z(!o?.availableForSale||o?.price?.amount===_e);const{infos:r}=o?.metafields||{},{productInfos:s,preRender:l}=e?.metafields||{};ce(r?.comingSoon||s?.comingSoon||l?.soldOut||X?.soldOut||"");const x=o?.coupons?.[0],{price:A,basePrice:U,discount:ue,discountAmount:pe}=xe({locale:i,amount:x?x.variant_price4wscode:o.price,baseAmount:x?o.price:0,currencyCode:e?.price?.currencyCode||"USD"}),E=(()=>{if(x?.value_type==="fixed_amount"){const c=pe||"",y=c.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(y){const[,_,d,k]=y;let C=d;return d.endsWith(".00")?C=d.replace(/\.00$/,""):d.endsWith(",00")&&(C=d.replace(/,00$/,"")),`${_}${C}${k}`}return c}return ue||""})();if(F){const c=he({locale:i,variant:o,shopMemberPriceDiscountConfig:Q,currencyCode:de||e?.price?.currencyCode||"USD"});if(c){const{hasMemberPrice:y,salePriceWithCurrency:_,originalPriceWithCurrency:d,savePriceWithCurrency:k}=c;h(k||"",d||"",y?_:"",c?.hasMemberPrice)}else h(E,U||"",A||"",!1)}else h(E,U||"",A||"",!1)},[e,p]),w(()=>{let o=[];if(g){const s=`${g} ${I?.off}`;o.push(s)}const r=j?.filter?.(s=>s?.startsWith?.("CLtag"))?.map?.(s=>s?.replace?.("CLtag:",""))?.slice?.(0,g?1:2);ie(o.concat(r))},[j,g]),t("div",{className:b(q==="round"?"rounded-2xl":"rounded-none","tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300",{"aiui-dark":e.theme==="dark"}),children:e?.mImage?t("div",{className:"size-full box-border overflow-hidden hover:[&_img]:scale-105",children:t("div",{className:"relative inset-0 size-full",children:m("a",{className:"size-full",href:N(e?.link,`${S}_${$}`),children:[t(V,{alt:"",source:e?.mImage?.url||e?.mImage,className:"size-full [&_img]:object-cover [&_img]:size-full",imgClassName:"size-full object-cover transition-all duration-300"}),m("div",{className:"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4",children:[t("p",{className:"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.subTitle}}),t("span",{className:"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6",dangerouslySetInnerHTML:{__html:e?.title}})]})]})})}):m("div",{className:"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4",children:[t("div",{className:"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags",children:ne?.map?.((o,r)=>t(ye,{className:"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge",children:o},r))}),t("a",{target:"_blank","aria-label":v,className:"my-1",href:N(`${i==="us"||!i?"":`/${i}`}/products/${e?.handle}`,`${S}_${$}`),children:t("div",{className:b("m-auto desktop:size-[196px] size-[120px] overflow-hidden"),children:t(V,{alt:"",source:Y,className:"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit"})})}),e?.options?.map(o=>{if(o?.displayName==="color")return t("div",{className:"flex items-center gap-1",children:o?.values?.map(r=>{const s=r?.hexColors?r.hexColors?.[0]:r?.label,l=s.startsWith("#")?s:"";return t("button",{onClick:()=>me(r?.label),className:b("size-4 rounded-full cursor-pointer overflow-hidden",`${f===r?.label?"border-[#00BEFA]":""}`),children:t("span",{className:b("h-full w-full overflow-hidden border-[0.5px] border-transparent","relative flex items-center justify-center overflow-hidden rounded-full",f===r?.label&&"border-[#ddd]"),style:l?{backgroundColor:l}:{},children:!l&&H&&t("img",{alt:s,className:"h-full w-full object-cover",src:`${ke(H)}${s?.toLowerCase().split(" ")?.join("-")}_50x.png`})})},r?.label)})})}),m("div",{children:[v?t("span",{dangerouslySetInnerHTML:{__html:v||""},className:"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold"}):null,e?.metafields?.judgemeBadge?t("a",{target:"_blank",className:"font-bold text-xs [&_.jdgm-star]:text-[#F77234]",dangerouslySetInnerHTML:{__html:e?.metafields?.judgemeBadge},href:N(`${i==="us"||!i?"":`/${i}`}/products/${e?.handle}`,`${S}_${$}`)}):t("div",{className:"w-full truncate font-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3px]","data-yotpo-instance-id":be(i),"data-yotpo-product-id":D,"data-yotpo-cart-product-id":D,"data-yotpo-section-id":""}),O?t(ve,{size:2,html:O||"",className:"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold"}):null,m("div",{className:"mt-3 mb-2",children:[t("p",{dangerouslySetInnerHTML:{__html:F&&te&&(I?.memberPrice||P?.member_price||P?.plus_member_price)||""},className:"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold"}),t("div",{className:"flex items-center",children:z?t("div",{className:"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:ae||""}):m(Ne,{children:[t("div",{className:"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold",children:L?.availableForSale&&W?.price||""}),t("div",{className:"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through",children:L?.availableForSale&&W?.basePrice||""})]})})]}),m("div",{className:b("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col"),children:[t(R,{variant:"secondary",className:"m-tablet:w-full font-bold",onClick:()=>K?.(e,p),children:u?.secondaryButton||"Learn More"}),t(R,{variant:"primary",className:"m-tablet:w-full font-bold",disabled:z,onClick:()=>J?.(e,p),children:u?.primaryButton||"Shop Now"})]})]})]})},e?.id||e?.handle)};var We=Ce;export{We as default};
2
2
  //# sourceMappingURL=FilterCardWrapItem.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/CollectionsFilters/FilterCardWrapItem.tsx"],
4
- "sourcesContent": ["import { cn, atobID, yotpoInstanceId } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport Badge from '../../components/badge.js'\nimport { Text } from '../../components/text.js'\nimport Button from '../../components/button.js'\nimport Picture from '../../components/picture.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { getFunctionMemberPrice } from './component/price.js'\nimport { useState, useEffect } from 'react'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nconst getShopifyCdnBaseUrl = (imagePath: string | null) => {\n // \u76EE\u524D\u77E5\u9053\u7684 shopify \u56FE\u7247\u8DEF\u7531\u7684\u5F62\u5F0F\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/files/Group_5581_2.jpg?v=1662379184\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/products/B2633123.jpg?v=1631264041_3840x\n // \u8FD4\u56DE https://cdn.shopify.com/s/files/1/0493/9834/9974/files/\n let path\n if (imagePath?.includes('products')) {\n path = imagePath?.split('products')[0] + 'files/'\n } else {\n path = imagePath?.replace(imagePath?.split('files')?.pop() || '', '') + '/'\n }\n return path\n}\n\ntype FilterCardWrapItemProps = {\n data: any\n buttonText?: any\n itemShape?: string\n metafields: any\n onPrimaryChange?: (item: any, sku: string) => void\n onSecondaryChange?: (item: any, sku: string) => void\n}\n\nconst FilterCardWrapItem = ({\n data,\n buttonText,\n itemShape,\n metafields,\n onPrimaryChange,\n onSecondaryChange,\n}: FilterCardWrapItemProps) => {\n const { memberPriceDiscount, memberSetting, discounts, shopCommon } = metafields\n const [currentSku, setCurrentSku] = useState<string>('')\n const [currentImage, setCurrentImage] = useState<string>('')\n const [selectedColor, setSelectedColor] = useState<string>('')\n const [isSoldOut, setIsSoldOut] = useState<any>(false)\n const [currentVariant, setCurrentVariant] = useState<any>({})\n const [plusMemberStatus, setPlusMemberStatus] = useState<boolean>(false)\n const [priceCollection, setPriceCollection] = useState<{ price: string; basePrice: string }>({\n price: '',\n basePrice: '',\n })\n const [tags, setTags] = useState<string[]>([])\n const [showTags, setShowTags] = useState<string[]>([])\n const [discountCollection, setDiscountCollection] = useState<string>('')\n const [soldOutText, setSoldOutText] = useState<string>('')\n\n const { locale = 'us', currencyCode, isLogin } = useAiuiContext()\n\n const displayTitle = data?.custom_name || data?.title || data?.name\n const displayDescription = data?.custom_description || data?.description || data?.descriptionHtml\n const skuArray = data?.filter_variants || data?.variants || []\n const id = atobID(data?.id || '')\n\n const imagePath = data?.images?.[0]?.url\n\n const onColorClick = (color: string) => setSelectedColor(color)\n\n const handleBasePrice = (discount: string, priceCurrency: string, salePrice: string, status: boolean) => {\n setPlusMemberStatus(status)\n setDiscountCollection(discount || '')\n setPriceCollection({\n basePrice: priceCurrency || '',\n price: salePrice || '',\n })\n }\n\n useEffect(() => {\n if (selectedColor) {\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(selectedColor))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n return\n }\n const firstOption = data?.options?.find((item: any) => item?.displayName === 'color')?.values?.[0]?.label\n firstOption && setSelectedColor(firstOption)\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(firstOption))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n }, [selectedColor])\n\n useEffect(() => {\n if (!currentSku) return\n setTags(data?.tags || [])\n const variant = skuArray?.find((item: any) => item?.sku === currentSku) || skuArray?.[0] || {}\n setCurrentVariant(variant)\n setIsSoldOut(!variant?.availableForSale || variant?.price?.amount === SOLD_OUT_PRICE)\n const { infos } = variant?.metafields || {}\n const { productInfos, preRender } = data?.metafields || {}\n setSoldOutText(infos?.comingSoon || productInfos?.comingSoon || preRender?.soldOut || shopCommon?.soldOut || '')\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n const { price, basePrice, discount, discountAmount } = formatVariantPrice({\n locale: locale,\n amount: coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n const showPrice = (() => {\n if (coupon?.value_type === 'fixed_amount') {\n const amountStr = discountAmount || ''\n const match = amountStr.match(/^(.*?)(\\d[\\d.,]*)(.*)$/)\n if (match) {\n const [, prefix, numeric, suffix] = match\n let updatedNumeric = numeric\n if (numeric.endsWith('.00')) {\n updatedNumeric = numeric.replace(/\\.00$/, '')\n } else if (numeric.endsWith(',00')) {\n updatedNumeric = numeric.replace(/,00$/, '')\n }\n return `${prefix}${updatedNumeric}${suffix}`\n }\n return amountStr\n }\n return discount || ''\n })()\n // \u4F1A\u5458\u6298\u6263\n if (isLogin) {\n const result = getFunctionMemberPrice({\n locale: locale,\n variant: variant,\n shopMemberPriceDiscountConfig: memberPriceDiscount,\n currencyCode: currencyCode || data?.price?.currencyCode || 'USD',\n })\n if (result) {\n const { hasMemberPrice, salePriceWithCurrency, originalPriceWithCurrency, savePriceWithCurrency } = result\n handleBasePrice(\n savePriceWithCurrency || '',\n originalPriceWithCurrency || '',\n hasMemberPrice ? salePriceWithCurrency : '',\n result?.hasMemberPrice\n )\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n }, [data, currentSku])\n\n // \u5904\u7406\u6807\u7B7E\n useEffect(() => {\n let handleTags: string[] = []\n if (discountCollection) {\n const discountTag = `${discountCollection} ${discounts?.off}`\n handleTags.push(discountTag)\n }\n const newTags = tags\n ?.filter?.((item: string) => item?.startsWith?.('CLtag'))\n ?.map?.((item: string) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, discountCollection ? 1 : 2)\n setShowTags(handleTags.concat(newTags))\n }, [tags, discountCollection])\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n {data?.mImage ? (\n <div className=\"size-full box-border overflow-hidden hover:[&_img]:scale-105\">\n <div className=\"relative inset-0 size-full\">\n <a className=\"size-full\" href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}>\n <Picture\n alt=\"\"\n source={data?.mImage?.url || data?.mImage}\n className=\"size-full [&_img]:object-cover [&_img]:size-full\"\n imgClassName=\"size-full object-cover transition-all duration-300\"\n />\n <div className=\"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4\">\n <p\n className=\"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold\"\n dangerouslySetInnerHTML={{ __html: data?.subTitle }}\n />\n <span\n className=\"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6\"\n dangerouslySetInnerHTML={{ __html: data?.title }}\n />\n </div>\n </a>\n </div>\n </div>\n ) : (\n <div className=\"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4\">\n <div className=\"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags\">\n {showTags?.map?.((item: string, index: number) => (\n <Badge key={index} className=\"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge\">\n {item}\n </Badge>\n ))}\n </div>\n <a\n target=\"_blank\"\n aria-label={displayTitle}\n className=\"my-1\"\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n >\n <div className={cn('m-auto desktop:size-[196px] size-[120px] overflow-hidden')}>\n <Picture\n alt=\"\"\n source={currentImage}\n className=\"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit\"\n />\n </div>\n </a>\n {data?.options?.map((option: any) => {\n if (option?.displayName === 'color') {\n return (\n <div className=\"flex items-center gap-1\">\n {option?.values?.map((item: any) => {\n const color = item?.hexColors ? item.hexColors?.[0] : item?.label\n const hexColor = color.startsWith('#') ? color : ''\n return (\n <button\n key={item?.label}\n onClick={() => onColorClick(item?.label)}\n className={cn(\n 'size-4 rounded-full cursor-pointer overflow-hidden',\n `${selectedColor === item?.label ? 'border-[#00BEFA]' : ''}`\n )}\n >\n <span\n className={cn(\n 'h-full w-full overflow-hidden border-[0.5px] border-transparent',\n 'relative flex items-center justify-center overflow-hidden rounded-full',\n selectedColor === item?.label && 'border-[#ddd]'\n )}\n style={hexColor ? { backgroundColor: hexColor } : {}}\n >\n {!hexColor && imagePath && (\n <img\n alt={color}\n className=\"h-full w-full object-cover\"\n src={`${getShopifyCdnBaseUrl(imagePath)}${color\n ?.toLowerCase()\n .split(' ')\n ?.join('-')}_${'50x'}.png`}\n />\n )}\n </span>\n </button>\n )\n })}\n </div>\n )\n }\n })}\n <div>\n {displayTitle ? (\n <span\n dangerouslySetInnerHTML={{ __html: displayTitle || '' }}\n className=\"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold\"\n />\n ) : null}\n {data?.metafields?.judgemeBadge ? (\n <a\n target=\"_blank\"\n className=\"font-bold text-xs [&_.jdgm-star]:text-[#F77234]\"\n dangerouslySetInnerHTML={{ __html: data?.metafields?.judgemeBadge }}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n />\n ) : (\n <div\n className=\"w-full truncatefont-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3.5px]\"\n data-yotpo-instance-id={yotpoInstanceId(locale)}\n data-yotpo-product-id={id}\n data-yotpo-cart-product-id={id}\n data-yotpo-section-id=\"\"\n />\n )}\n {displayDescription ? (\n <Text\n size={2}\n html={displayDescription || ''}\n className=\"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold\"\n />\n ) : null}\n <div className=\"mt-3 mb-2\">\n <p\n dangerouslySetInnerHTML={{\n __html:\n isLogin && plusMemberStatus\n ? discounts?.memberPrice || memberSetting?.member_price || memberSetting?.plus_member_price || ''\n : '',\n }}\n className=\"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold\"\n />\n <div className=\"flex items-center\">\n {isSoldOut ? (\n <div className=\"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {soldOutText || ''}\n </div>\n ) : (\n <>\n <div className=\"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {currentVariant?.availableForSale ? priceCollection?.price || '' : ''}\n </div>\n <div className=\"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through\">\n {currentVariant?.availableForSale ? priceCollection?.basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn('shelf-flex-button-group', 'lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col')}\n >\n <Button\n variant=\"secondary\"\n className=\"m-tablet:w-full font-bold\"\n onClick={() => onSecondaryChange?.(data, currentSku)}\n >\n {buttonText?.secondaryButton || 'Learn More'}\n </Button>\n <Button\n variant=\"primary\"\n className=\"m-tablet:w-full font-bold\"\n disabled={isSoldOut}\n onClick={() => onPrimaryChange?.(data, currentSku)}\n >\n {buttonText?.primaryButton || 'Shop Now'}\n </Button>\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\nexport default FilterCardWrapItem\n"],
5
- "mappings": "AAyLc,OAwII,YAAAA,GAxIJ,OAAAC,EAMA,QAAAC,MANA,oBAzLd,OAAS,MAAAC,EAAI,UAAAC,GAAQ,mBAAAC,OAAuB,yBAC5C,OAAS,kBAAAC,OAAsB,2BAC/B,OAAS,sBAAAC,OAA0B,kCACnC,OAAOC,OAAW,4BAClB,OAAS,QAAAC,OAAY,2BACrB,OAAOC,MAAY,6BACnB,OAAOC,MAAa,8BACpB,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,0BAAAC,OAA8B,uBACvC,OAAS,YAAAC,EAAU,aAAAC,MAAiB,QAEpC,MAAMC,EAAgB,QAChBC,EAAgB,gBAEhBC,GAAiB,aAEjBC,GAAwBC,GAA6B,CAKzD,IAAIC,EACJ,OAAID,GAAW,SAAS,UAAU,EAChCC,EAAOD,GAAW,MAAM,UAAU,EAAE,CAAC,EAAI,SAEzCC,EAAOD,GAAW,QAAQA,GAAW,MAAM,OAAO,GAAG,IAAI,GAAK,GAAI,EAAE,EAAI,IAEnEC,CACT,EAWMC,GAAqB,CAAC,CAC1B,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,kBAAAC,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6BAA4BA,EAC5B,wBAAsB,GACxB,EAEDF,EACC1D,EAACQ,GAAA,CACC,KAAM,EACN,KAAMkD,GAAsB,GAC5B,UAAU,oGACZ,EACE,KACJzD,EAAC,OAAI,UAAU,YACb,UAAAD,EAAC,KACC,wBAAyB,CACvB,OACEwD,GAAWd,KACPZ,GAAW,aAAeD,GAAe,cAAgBA,GAAe,oBAAqB,EAErG,EACA,UAAU,0FACZ,EACA7B,EAAC,OAAI,UAAU,oBACZ,SAAAsC,EACCtC,EAAC,OAAI,UAAU,wEACZ,SAAAoD,IAAe,GAClB,EAEAnD,EAAAF,GAAA,CACE,UAAAC,EAAC,OAAI,UAAU,oFACZ,SAAAwC,GAAgB,kBAAmBI,GAAiB,OAAS,GAChE,EACA5C,EAAC,OAAI,UAAU,sGACZ,SAAAwC,GAAgB,kBAAmBI,GAAiB,WAAa,GACpE,GACF,EAEJ,GACF,EAEA3C,EAAC,OACC,UAAWC,EAAG,0BAA2B,4DAA4D,EAErG,UAAAF,EAACS,EAAA,CACC,QAAQ,YACR,UAAU,4BACV,QAAS,IAAMkB,IAAoBL,EAAMU,CAAU,EAElD,SAAAT,GAAY,iBAAmB,aAClC,EACAvB,EAACS,EAAA,CACC,QAAQ,UACR,UAAU,4BACV,SAAU6B,EACV,QAAS,IAAMZ,IAAkBJ,EAAMU,CAAU,EAEhD,SAAAT,GAAY,eAAiB,WAChC,GACF,GACF,GACF,GArLGD,GAAM,IAAMA,GAAM,MAuLzB,CAEJ,EACA,IAAO2E,GAAQ5E",
4
+ "sourcesContent": ["import { cn, atobID, yotpoInstanceId } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport Badge from '../../components/badge.js'\nimport { Text } from '../../components/text.js'\nimport Button from '../../components/button.js'\nimport Picture from '../../components/picture.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { getFunctionMemberPrice } from './component/price.js'\nimport { useState, useEffect } from 'react'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nconst getShopifyCdnBaseUrl = (imagePath: string | null) => {\n // \u76EE\u524D\u77E5\u9053\u7684 shopify \u56FE\u7247\u8DEF\u7531\u7684\u5F62\u5F0F\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/files/Group_5581_2.jpg?v=1662379184\n // https://cdn.shopify.com/s/files/1/0493/9834/9974/products/B2633123.jpg?v=1631264041_3840x\n // \u8FD4\u56DE https://cdn.shopify.com/s/files/1/0493/9834/9974/files/\n let path\n if (imagePath?.includes('products')) {\n path = imagePath?.split('products')[0] + 'files/'\n } else {\n path = imagePath?.replace(imagePath?.split('files')?.pop() || '', '') + '/'\n }\n return path\n}\n\ntype FilterCardWrapItemProps = {\n data: any\n buttonText?: any\n itemShape?: string\n metafields: any\n onPrimaryChange?: (item: any, sku: string) => void\n onSecondaryChange?: (item: any, sku: string) => void\n}\n\nconst FilterCardWrapItem = ({\n data,\n buttonText,\n itemShape,\n metafields,\n onPrimaryChange,\n onSecondaryChange,\n}: FilterCardWrapItemProps) => {\n const { memberPriceDiscount, memberSetting, discounts, shopCommon } = metafields\n const [currentSku, setCurrentSku] = useState<string>('')\n const [currentImage, setCurrentImage] = useState<string>('')\n const [selectedColor, setSelectedColor] = useState<string>('')\n const [isSoldOut, setIsSoldOut] = useState<any>(false)\n const [currentVariant, setCurrentVariant] = useState<any>({})\n const [plusMemberStatus, setPlusMemberStatus] = useState<boolean>(false)\n const [priceCollection, setPriceCollection] = useState<{ price: string; basePrice: string }>({\n price: '',\n basePrice: '',\n })\n const [tags, setTags] = useState<string[]>([])\n const [showTags, setShowTags] = useState<string[]>([])\n const [discountCollection, setDiscountCollection] = useState<string>('')\n const [soldOutText, setSoldOutText] = useState<string>('')\n\n const { locale = 'us', currencyCode, isLogin } = useAiuiContext()\n\n const displayTitle = data?.custom_name || data?.title || data?.name\n const displayDescription = data?.custom_description || data?.description || data?.descriptionHtml\n const skuArray = data?.filter_variants || data?.variants || []\n const id = atobID(data?.id || '')\n\n const imagePath = data?.images?.[0]?.url\n\n const onColorClick = (color: string) => setSelectedColor(color)\n\n const handleBasePrice = (discount: string, priceCurrency: string, salePrice: string, status: boolean) => {\n setPlusMemberStatus(status)\n setDiscountCollection(discount || '')\n setPriceCollection({\n basePrice: priceCurrency || '',\n price: salePrice || '',\n })\n }\n\n useEffect(() => {\n if (selectedColor) {\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(selectedColor))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n return\n }\n const firstOption = data?.options?.find((item: any) => item?.displayName === 'color')?.values?.[0]?.label\n firstOption && setSelectedColor(firstOption)\n const findSku = skuArray?.find((item: any) => item?.name?.includes?.(firstOption))\n setCurrentSku(findSku?.sku || skuArray?.[0]?.sku || '')\n setCurrentImage(findSku?.image?.url || skuArray?.[0]?.image?.url || '')\n }, [selectedColor])\n\n useEffect(() => {\n if (!currentSku) return\n setTags(data?.tags || [])\n const variant = skuArray?.find((item: any) => item?.sku === currentSku) || skuArray?.[0] || {}\n setCurrentVariant(variant)\n setIsSoldOut(!variant?.availableForSale || variant?.price?.amount === SOLD_OUT_PRICE)\n const { infos } = variant?.metafields || {}\n const { productInfos, preRender } = data?.metafields || {}\n setSoldOutText(infos?.comingSoon || productInfos?.comingSoon || preRender?.soldOut || shopCommon?.soldOut || '')\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n const { price, basePrice, discount, discountAmount } = formatVariantPrice({\n locale: locale,\n amount: coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n const showPrice = (() => {\n if (coupon?.value_type === 'fixed_amount') {\n const amountStr = discountAmount || ''\n const match = amountStr.match(/^(.*?)(\\d[\\d.,]*)(.*)$/)\n if (match) {\n const [, prefix, numeric, suffix] = match\n let updatedNumeric = numeric\n if (numeric.endsWith('.00')) {\n updatedNumeric = numeric.replace(/\\.00$/, '')\n } else if (numeric.endsWith(',00')) {\n updatedNumeric = numeric.replace(/,00$/, '')\n }\n return `${prefix}${updatedNumeric}${suffix}`\n }\n return amountStr\n }\n return discount || ''\n })()\n // \u4F1A\u5458\u6298\u6263\n if (isLogin) {\n const result = getFunctionMemberPrice({\n locale: locale,\n variant: variant,\n shopMemberPriceDiscountConfig: memberPriceDiscount,\n currencyCode: currencyCode || data?.price?.currencyCode || 'USD',\n })\n if (result) {\n const { hasMemberPrice, salePriceWithCurrency, originalPriceWithCurrency, savePriceWithCurrency } = result\n handleBasePrice(\n savePriceWithCurrency || '',\n originalPriceWithCurrency || '',\n hasMemberPrice ? salePriceWithCurrency : '',\n result?.hasMemberPrice\n )\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n } else {\n handleBasePrice(showPrice, basePrice || '', price || '', false)\n }\n }, [data, currentSku])\n\n // \u5904\u7406\u6807\u7B7E\n useEffect(() => {\n let handleTags: string[] = []\n if (discountCollection) {\n const discountTag = `${discountCollection} ${discounts?.off}`\n handleTags.push(discountTag)\n }\n const newTags = tags\n ?.filter?.((item: string) => item?.startsWith?.('CLtag'))\n ?.map?.((item: string) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, discountCollection ? 1 : 2)\n setShowTags(handleTags.concat(newTags))\n }, [tags, discountCollection])\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'tablet:hover:bg-info-white bg-container-secondary-1 box-border w-full cursor-pointer overflow-hidden duration-300',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n {data?.mImage ? (\n <div className=\"size-full box-border overflow-hidden hover:[&_img]:scale-105\">\n <div className=\"relative inset-0 size-full\">\n <a className=\"size-full\" href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}>\n <Picture\n alt=\"\"\n source={data?.mImage?.url || data?.mImage}\n className=\"size-full [&_img]:object-cover [&_img]:size-full\"\n imgClassName=\"size-full object-cover transition-all duration-300\"\n />\n <div className=\"desktop:p-6 absolute inset-x-0 top-0 box-border overflow-hidden p-4\">\n <p\n className=\"desktop:mb-2 mb-1 text-info-primary desktop:text-base text-sm font-bold\"\n dangerouslySetInnerHTML={{ __html: data?.subTitle }}\n />\n <span\n className=\"text-info-secondary desktop:text-[32px] text-[20px] font-bold desktop:leading-9 line-clamp-4 leading-6\"\n dangerouslySetInnerHTML={{ __html: data?.title }}\n />\n </div>\n </a>\n </div>\n </div>\n ) : (\n <div className=\"size-full desktop:p-6 desktop:pt-4 box-border overflow-hidden flex flex-col justify-between tablet:p-4 p-2 pb-4\">\n <div className=\"min-h-6 flex flex-wrap gap-1 overflow-hidden collection-filter-tags\">\n {showTags?.map?.((item: string, index: number) => (\n <Badge key={index} className=\"whitespace-nowrap max-w-full truncate px-1 box-border font-bold item-badge\">\n {item}\n </Badge>\n ))}\n </div>\n <a\n target=\"_blank\"\n aria-label={displayTitle}\n className=\"my-1\"\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n >\n <div className={cn('m-auto desktop:size-[196px] size-[120px] overflow-hidden')}>\n <Picture\n alt=\"\"\n source={currentImage}\n className=\"h-full [&_img]:object-cover [&_img]:h-full [&_img]:w-fit\"\n />\n </div>\n </a>\n {data?.options?.map((option: any) => {\n if (option?.displayName === 'color') {\n return (\n <div className=\"flex items-center gap-1\">\n {option?.values?.map((item: any) => {\n const color = item?.hexColors ? item.hexColors?.[0] : item?.label\n const hexColor = color.startsWith('#') ? color : ''\n return (\n <button\n key={item?.label}\n onClick={() => onColorClick(item?.label)}\n className={cn(\n 'size-4 rounded-full cursor-pointer overflow-hidden',\n `${selectedColor === item?.label ? 'border-[#00BEFA]' : ''}`\n )}\n >\n <span\n className={cn(\n 'h-full w-full overflow-hidden border-[0.5px] border-transparent',\n 'relative flex items-center justify-center overflow-hidden rounded-full',\n selectedColor === item?.label && 'border-[#ddd]'\n )}\n style={hexColor ? { backgroundColor: hexColor } : {}}\n >\n {!hexColor && imagePath && (\n <img\n alt={color}\n className=\"h-full w-full object-cover\"\n src={`${getShopifyCdnBaseUrl(imagePath)}${color\n ?.toLowerCase()\n .split(' ')\n ?.join('-')}_${'50x'}.png`}\n />\n )}\n </span>\n </button>\n )\n })}\n </div>\n )\n }\n })}\n <div>\n {displayTitle ? (\n <span\n dangerouslySetInnerHTML={{ __html: displayTitle || '' }}\n className=\"shelf-display-product-title line-clamp-2 lg-desktop:text-2xl laptop:text-xl text-base font-bold\"\n />\n ) : null}\n {data?.metafields?.judgemeBadge ? (\n <a\n target=\"_blank\"\n className=\"font-bold text-xs [&_.jdgm-star]:text-[#F77234]\"\n dangerouslySetInnerHTML={{ __html: data?.metafields?.judgemeBadge }}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n />\n ) : (\n <div\n className=\"w-full truncate font-bold yotpo-widget-instance [&_.yotpo-sr-bottom-line-new-review]:hidden [&_.yotpo-sr-bottom-line-text]:!text-xs [&_.yotpo-sr-bottom-line-text]:!pt-0 [&_.yotpo-sr-bottom-line-summary]:!items-center [&_.yotpo-sr-bottom-line-summary_span]:!h-auto [&_.yotpo-sr-bottom-line-summary_svg]:!mr-[3px]\"\n data-yotpo-instance-id={yotpoInstanceId(locale)}\n data-yotpo-product-id={id}\n data-yotpo-cart-product-id={id}\n data-yotpo-section-id=\"\"\n />\n )}\n {displayDescription ? (\n <Text\n size={2}\n html={displayDescription || ''}\n className=\"desktop:text-base laptop:text-sm shelf-display-product-description line-clamp-1 text-xs font-bold\"\n />\n ) : null}\n <div className=\"mt-3 mb-2\">\n <p\n dangerouslySetInnerHTML={{\n __html:\n isLogin && plusMemberStatus\n ? discounts?.memberPrice || memberSetting?.member_price || memberSetting?.plus_member_price || ''\n : '',\n }}\n className=\"text-info-primary lg-desktop:text-lg desktop:text-base laptop:text-sm text-xs font-bold\"\n />\n <div className=\"flex items-center\">\n {isSoldOut ? (\n <div className=\"desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {soldOutText || ''}\n </div>\n ) : (\n <>\n <div className=\"final-price desktop:text-2xl tablet:text-xl text-info-primary text-base font-bold\">\n {currentVariant?.availableForSale ? priceCollection?.price || '' : ''}\n </div>\n <div className=\"origin-price desktop:text-xl tablet:text-lg text-info-secondary ml-1 text-sm font-bold line-through\">\n {currentVariant?.availableForSale ? priceCollection?.basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn('shelf-flex-button-group', 'lg-desktop:gap-3 flex items-center gap-2 m-tablet:flex-col')}\n >\n <Button\n variant=\"secondary\"\n className=\"m-tablet:w-full font-bold\"\n onClick={() => onSecondaryChange?.(data, currentSku)}\n >\n {buttonText?.secondaryButton || 'Learn More'}\n </Button>\n <Button\n variant=\"primary\"\n className=\"m-tablet:w-full font-bold\"\n disabled={isSoldOut}\n onClick={() => onPrimaryChange?.(data, currentSku)}\n >\n {buttonText?.primaryButton || 'Shop Now'}\n </Button>\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\nexport default FilterCardWrapItem\n"],
5
+ "mappings": "AAyLc,OAwII,YAAAA,GAxIJ,OAAAC,EAMA,QAAAC,MANA,oBAzLd,OAAS,MAAAC,EAAI,UAAAC,GAAQ,mBAAAC,OAAuB,yBAC5C,OAAS,kBAAAC,OAAsB,2BAC/B,OAAS,sBAAAC,OAA0B,kCACnC,OAAOC,OAAW,4BAClB,OAAS,QAAAC,OAAY,2BACrB,OAAOC,MAAY,6BACnB,OAAOC,MAAa,8BACpB,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,0BAAAC,OAA8B,uBACvC,OAAS,YAAAC,EAAU,aAAAC,MAAiB,QAEpC,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ACF,GArLGD,GAAM,IAAMA,GAAM,MAuLzB,CAEJ,EACA,IAAO2E,GAAQ5E",
6
6
  "names": ["Fragment", "jsx", "jsxs", "cn", "atobID", "yotpoInstanceId", "useAiuiContext", "formatVariantPrice", "Badge", "Text", "Button", "Picture", "trackUrlRef", "getFunctionMemberPrice", "useState", "useEffect", "componentType", "componentName", "SOLD_OUT_PRICE", "getShopifyCdnBaseUrl", "imagePath", "path", "FilterCardWrapItem", "data", "buttonText", "itemShape", "metafields", "onPrimaryChange", "onSecondaryChange", "memberPriceDiscount", "memberSetting", "discounts", "shopCommon", "currentSku", "setCurrentSku", "currentImage", "setCurrentImage", "selectedColor", "setSelectedColor", "isSoldOut", "setIsSoldOut", "currentVariant", "setCurrentVariant", "plusMemberStatus", "setPlusMemberStatus", "priceCollection", "setPriceCollection", "tags", "setTags", "showTags", "setShowTags", "discountCollection", "setDiscountCollection", "soldOutText", "setSoldOutText", "locale", "currencyCode", "isLogin", "displayTitle", "displayDescription", "skuArray", "id", "onColorClick", "color", "handleBasePrice", "discount", "priceCurrency", "salePrice", "status", "findSku", "item", "firstOption", "variant", "infos", "productInfos", "preRender", "coupon", "price", "basePrice", "discountAmount", "showPrice", "amountStr", "match", "prefix", "numeric", "suffix", "updatedNumeric", "result", "hasMemberPrice", "salePriceWithCurrency", "originalPriceWithCurrency", "savePriceWithCurrency", "handleTags", "discountTag", "newTags", "index", "option", "hexColor", "FilterCardWrapItem_default"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "1.0.19-temp-101507",
3
+ "version": "1.0.19-temp-101508",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",