@anker-in/headless-ui 1.0.26-alpha.1762848170464 → 1.0.26-alpha.1762872688412
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/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.d.ts +10 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.js.map +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.d.ts +10 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/types.d.ts +3 -0
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +2 -2
- package/package.json +1 -1
package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts
CHANGED
|
@@ -12,18 +12,16 @@ interface BenefitsTabTextConfig {
|
|
|
12
12
|
bundleOffer?: string;
|
|
13
13
|
creditsTitle?: string;
|
|
14
14
|
creditsDesc?: string;
|
|
15
|
-
yourBenefits?: string;
|
|
16
15
|
off?: string;
|
|
17
|
-
memberBenefits?: string;
|
|
18
16
|
memberBenefitsNotLogin?: string;
|
|
19
17
|
memberBenefitsNotLoginText?: string;
|
|
20
|
-
installment?: string;
|
|
21
18
|
forNewMember?: string;
|
|
22
19
|
expressShipping?: string;
|
|
23
20
|
creditsAfterActivation?: string;
|
|
24
21
|
active?: string;
|
|
25
22
|
flexibleInstallment?: string;
|
|
26
23
|
}
|
|
24
|
+
export type ProductBenefitsTabsValueType = 'coupon' | 'membership' | 'pay' | 'installment';
|
|
27
25
|
export type ModalData = {
|
|
28
26
|
needClickAway?: boolean;
|
|
29
27
|
className?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var se=Object.create;var T=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var de=(t,s)=>{for(var a in s)T(t,a,{get:s[a],enumerable:!0})},O=(t,s,a,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of re(s))!pe.call(t,c)&&c!==a&&T(t,c,{get:()=>s[c],enumerable:!(l=le(s,c))||l.enumerable});return t};var M=(t,s,a)=>(a=t!=null?se(ce(t)):{},O(s||!t||!t.__esModule?T(a,"default",{value:t,enumerable:!0}):a,t)),ue=t=>O(T({},"__esModule",{value:!0}),t);var Ce={};de(Ce,{default:()=>xe});module.exports=ue(Ce);var e=require("react/jsx-runtime"),i=require("../../../../../components/index.js"),f=M(require("./ProductBenefitsTabs/index.js")),Z=require("../../../BizProductProvider.js"),W=require("../../../hooks/useBenefits"),g=require("../../../utils/index.js"),S=require("../../../utils/textFormat"),p=require("react"),E=require("../../../../AiuiProvider/index.js"),q=M(require("../../../../../hooks/useCountDown.js")),Y=M(require("../../../hooks/useCopy")),P=require("../../../../../helpers/index.js"),K=M(require("./ProductBenefitsTabs/ModalContainer.js"));const fe={couponCode:"Code",copyCode:"Copy Code",copied:"Copied",expired:"Expired",offCoupon:"{discount} off coupon",offMemberOnly:"{amount} off Member Only",loginNow:"Login now",selectFreeGift:"You can select the free gift below.",bundleSaveUpTo:"Bundle purchases save extra up to",bundleOffer:"We offer {count} bundle for you",creditsTitle:"Soundcore credits for cash",creditsDesc:"100 Soundcore credits=$1",off:" off",memberBenefitsNotLogin:"You will enjoy a {amount} member discount after logging in.",memberBenefitsNotLoginText:"Sign Up to Get Benefits Below",forNewMember:"{amount} off for New Member",expressShipping:"Express Shipping Method",creditsAfterActivation:"You will get soundcoreCredits after activation. ",active:"Active",flexibleInstallment:"Flexible installment payment "},be=({item:t,textConfig:s,benefitPayloadData:a})=>{const{trackingData:l}=(0,E.useAiuiContext)(),{copied:c,copy:h}=(0,Y.default)(),d=l?.common?.coupon,{days:y,hours:B,minutes:F,seconds:N}=(0,q.default)({endTime:t?.ends_at||""}),{openModal:I}=(0,Z.useBizProductContext)();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("style",{jsx:!0,children:`
|
|
2
2
|
.coupon-card {
|
|
3
3
|
/* \u4F7F\u7528mask\u521B\u5EFA\u5185\u5207\u5706\u89D2 */
|
|
4
4
|
mask:
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
bottom left;
|
|
15
15
|
mask-repeat: no-repeat;
|
|
16
16
|
}
|
|
17
|
-
`}),(0,e.jsxs)("div",{style:{background:t.couponBgColor||"white"},className:(0,
|
|
17
|
+
`}),(0,e.jsxs)("div",{style:{background:t.couponBgColor||"white"},className:(0,P.cn)("relative h-[100px] p-3 overflow-hidden laptop:h-[112px] lg-desktop:h-[130px]",t.borderStyle==="inset"?"coupon-card ":"rounded-[8px]"),children:[t?.bgImage?.url&&(0,e.jsx)(i.Picture,{source:t.bgImage.url,alt:t.bgImage.alt,className:"absolute bottom-0 right-0 w-auto",imgClassName:"object-contain"}),(0,e.jsxs)("div",{className:"relative z-1 ",children:[(0,e.jsxs)("div",{className:"flex items-center justify-start",children:[t.useAble&&(0,e.jsx)(i.Checkbox,{size:"lg",className:"mr-2 rounded-full border-[#D1D1D1] border-[1.6px] data-[state=checked]:border-primary",checked:t?.isAutoUse,onCheckedChange:H=>{t?.onUseChange?.(H)}}),(0,e.jsx)(i.Text,{html:t.title,className:"text-[16px] leading-[1.2] font-bold laptop:text-[20px] lg-desktop:text-[24px]"})]}),t.description&&(0,e.jsx)(i.Text,{...typeof t.description=="string"?{html:t.description}:{},as:"p",className:"mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F] lg-desktop:text-[16px]",children:t.description}),t.code&&(0,e.jsxs)("div",{className:"desktop:mt-2 flex items-center gap-2",children:[(0,e.jsx)(i.Text,{html:`${a?.couponBenefitData?.commonCoupon?.couponCode}: ${t.code}`,className:"text-[14px] lg-desktop:text-[16px] font-bold text-[#3D3D3F]"}),(0,e.jsx)("button",{className:"text-[14px] lg-desktop:text-[16px] font-bold underline",onClick:()=>h(t.code??""),children:c?d?.copied||a?.couponBenefitData?.commonCoupon?.copied:d?.copy||a?.couponBenefitData?.commonCoupon?.copyCode})]}),t.ends_at&&(0,e.jsx)("button",{onClick:()=>{d?.modal&&I(d?.modal)},className:"lg-desktop:mt-[24px] text-brand-0 desktop:mt-4 mt-[14px] text-left text-[14px] font-bold lg-desktop:text-[16px] text-[#1F2021] md-l:hidden",children:Number(y)<Number(d?.hurry?.daysLeft)?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:d?.ends}),(0,e.jsx)("span",{className:"font-bold",children:` ${y} ${d?.days} ${B.toString().padStart(2,"0")}:${F.toString().padStart(2,"0")}:${N.toString().padStart(2,"0")}`})]}):d?.hurry?.label||a?.couponBenefitData?.commonCoupon?.expired})]})]})]})},me=({coupons:t,className:s,textConfig:a,benefitPayloadData:l})=>(0,e.jsx)("div",{className:(0,P.cn)("flex flex-col gap-3 laptop:grid laptop:grid-cols-2 desktop:grid-cols-1",s),children:t?.map((c,h)=>(0,e.jsx)(be,{item:c,textConfig:a,benefitPayloadData:l},h))}),ge=({textConfig:t})=>{const{isLogin:s,profile:a,variant:l,renderInstallments:c,onUseCouponChange:h,onUseMemberDiscountChange:d,discount:y,savingDetail:B,openModal:F,openSignInPopup:N,openAuthCodePopup:I,openSignUpPopup:H,product:G}=(0,Z.useBizProductContext)(),b=(0,p.useMemo)(()=>G?.payload?.components?.find(o=>o.componentKey==="ProductBenefits")?.data||{},[G?.payload]),[J,j]=(0,p.useState)(!1),Q=(0,W.useBenefits)({variant:l}),{locale:x="us",copyWriting:X}=(0,E.useAiuiContext)(),A=(0,p.useRef)(null),ee={...fe,...t},{activated:te=!1}=a||{},{memberDiscount:C,commonCoupon:m,creditsRedemption:k,freeGift:z,bundle:V,paidShipping:oe,fullGift:_,levelDiscount:R}=Q,n=(0,p.useMemo)(()=>{const o=b?.benefitTabs?.find(u=>u?.value==="coupon")??{},r=b?.benefitTabs?.find(u=>u?.value==="membership")??{},w=b?.benefitTabs?.find(u=>u?.value==="installment")??{},D=b?.benefitTabs?.find(u=>u?.value==="pay")??{};return{couponBenefitData:o,membershipBenefitData:r,installmentBenefitData:w,payBenefitData:D}},[b]),v=[m?.enable?{...m.config,isAutoUse:B?.coupon>0,useAble:!0,borderStyle:"rounded",code:m?.config?.title??"",description:m?.config?.desc??"",onUseChange:o=>{const r=o?y?.codeSavings??0:0;h?.(r)},title:(0,S.replaceTemplate)(n?.couponBenefitData?.commonCoupon?.offCoupon,{discount:m?.config?.value_type=="percentage"?Math.abs(Number(m?.config?.value||0))+"%":(0,g.formatPrice)({amount:Math.abs(Number(m?.config?.fixed_value||0)),currencyCode:l.price.currencyCode,locale:x})})}:null,C.enable?{useAble:!0,isAutoUse:!!a?.email&&!!B?.member,title:(0,S.replaceTemplate)(n?.couponBenefitData?.member?.offMemberOnly,{amount:(0,g.formatPrice)({amount:C?.config?.amount??0,currencyCode:l.price.currencyCode,locale:x})}),description:(0,e.jsxs)(e.Fragment,{children:[a?.email?n?.couponBenefitData?.member?.memberDiscounts:n?.membershipBenefitData?.memberBenefitsNotLogin?.replace("{amount}",(0,g.formatPrice)({amount:C?.config?.amount??0,currencyCode:l.price.currencyCode,locale:x}))??""," ",a?.email?"":(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:()=>N?.(),className:"underline",children:n?.couponBenefitData?.member?.loginNow})]}),borderStyle:"rounded",onUseChange:o=>{if(a?.email){const r=o?C?.config?.amount??0:0;d?.(r)}else N?.()}}:null,R.enable?{title:R?.config?.title??"",description:R?.config?.tag??"",borderStyle:"inset",bgImage:{url:n?.couponBenefitData?.levelDiscount?.bgImage}}:null,z.enable?{title:z?.config?.title??"",description:n?.couponBenefitData?.freeGift?.selectFreeGift,borderStyle:"inset",bgImage:{url:n?.couponBenefitData?.freeGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,V.enable?{title:`${n?.couponBenefitData?.bundle?.bundleSaveUpTo} ${(0,g.formatPrice)({amount:Math.max(...V?.config?.bundleList?.map(o=>o.savings??0)??[]),currencyCode:l.price.currencyCode,locale:x})}`,borderStyle:"inset",description:n?.couponBenefitData?.bundle?.bundleOffer.replace("{count}",V?.config?.bundleList?.length?.toString()??""),bgImage:{url:n?.couponBenefitData?.bundle?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,_.enable?{title:_?.config?.title??"",description:_?.config?.desc??"",borderStyle:"inset",bgImage:{url:n?.couponBenefitData?.fullGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,k.enable?{title:n?.couponBenefitData?.creditsRedemption?.creditsTitle,description:n?.couponBenefitData?.creditsRedemption?.creditsDesc,borderStyle:"inset",bgImage:{url:n?.couponBenefitData?.creditsRedemption?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null].filter(Boolean);(0,p.useEffect)(()=>{U(v?.length?"coupon":"membership")},[]);const[$,U]=(0,p.useState)("coupon"),ne=()=>{I?.()};if(!f.default)return null;const ae=(o,r)=>{if(U(r),A.current){const w=A.current,D=o.currentTarget,u=D.offsetLeft-w.offsetWidth/2+D.offsetWidth/2;w.scrollTo({left:u,behavior:"smooth"})}},ie=(0,p.useMemo)(()=>b?.benefitTabs?.map(o=>o?.value==="coupon"&&!v?.length?null:o).filter(Boolean),[b,v]);return(0,e.jsxs)(f.default,{className:"relative",id:"ipc-product-detail-benefits-tabs",onValueChange:o=>U(o),value:$,children:[(0,e.jsx)("div",{className:"absolute right-0 z-[1] top-0 w-[25px] h-[40px] bg-gradient-to-r from-transparent to-[#EAEAEC]"}),(0,e.jsx)(f.default.List,{ref:A,children:ie?.map(o=>(0,e.jsx)(f.default.Trigger,{className:(0,P.cn)($===o.value&&"text-[#1D1D1F]"),value:o.value,onClick:r=>ae(r,o?.value),children:o.label},o?.value))}),(0,e.jsx)("style",{global:!0,jsx:!0,children:`
|
|
18
18
|
.benefits-tabs-content::-webkit-scrollbar {
|
|
19
19
|
width: 4px; /* \u6EDA\u52A8\u6761\u5BBD\u5EA6 */
|
|
20
20
|
height: 64px; /* \u6A2A\u5411\u6EDA\u52A8\u6761\u9AD8\u5EA6 */
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
.benefits-tabs-content::-webkit-scrollbar-thumb:hover {
|
|
33
33
|
background-color: rgba(100, 100, 100, 0.6);
|
|
34
34
|
}
|
|
35
|
-
`}),
|
|
35
|
+
`}),v?.length?(0,e.jsx)(f.default.Content,{value:"coupon",className:"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px]",children:(0,e.jsx)("div",{className:"p-3 lg-desktop:p-4",children:(0,e.jsx)(me,{coupons:v,textConfig:ee,benefitPayloadData:n})})}):null,(0,e.jsx)(f.default.Content,{value:"membership",className:"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px]",children:(0,e.jsxs)("div",{className:"p-3 lg-desktop:p-4",children:[!a?.email&&(0,e.jsx)("h3",{className:"mb-2 text-left text-lg font-bold",children:n?.membershipBenefitData?.memberBenefitsNotLoginText}),(0,e.jsx)("div",{className:"rounded-[16px]",children:(0,e.jsxs)("ul",{className:`list-none [&_li:first-child]:rounded-t-[16px]
|
|
36
36
|
[&_li:last-child]:rounded-b-[16px] [&_li:last-child]:last:border-b-0 [&_li]:flex [&_li]:items-center [&_li]:gap-2
|
|
37
37
|
[&_li]:border-b [&_li]:border-b-[#E4E5E6] [&_li]:bg-white [&_li]:px-4
|
|
38
38
|
[&_li]:py-4
|
|
39
|
-
[&_li]:text-left`,children:[
|
|
39
|
+
[&_li]:text-left`,children:[C.enable&&(0,e.jsxs)("li",{className:"justify-between",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,e.jsx)("path",{d:"M20 3.5C21.6569 3.5 23 4.84315 23 6.5V9.65625C23 10.0791 22.7342 10.4566 22.3359 10.5986C21.6665 10.8372 21.1816 11.4844 21.1816 12.25C21.1816 13.0156 21.6665 13.6628 22.3359 13.9014C22.7342 14.0434 23 14.4209 23 14.8438V18C23 19.6569 21.6569 21 20 21H4C2.34315 21 1 19.6569 1 18V14.8438L1.01172 14.6875C1.06803 14.3301 1.31557 14.0256 1.66406 13.9014C2.33345 13.6628 2.81836 13.0156 2.81836 12.25C2.81836 11.4844 2.33345 10.8372 1.66406 10.5986C1.26583 10.4566 1 10.0791 1 9.65625V6.5C1 4.84315 2.34315 3.5 4 3.5H20ZM4 5.5C3.44772 5.5 3 5.94772 3 6.5V9.03125C4.08987 9.68678 4.81836 10.8833 4.81836 12.25C4.81836 13.6165 4.08963 14.8122 3 15.4678V18C3 18.5523 3.44772 19 4 19H20C20.5523 19 21 18.5523 21 18V15.4678C19.9104 14.8122 19.1816 13.6165 19.1816 12.25C19.1816 10.8833 19.9101 9.68677 21 9.03125V6.5C21 5.94772 20.5523 5.5 20 5.5H4ZM15.793 6.79297C16.1835 6.40244 16.8165 6.40244 17.207 6.79297C17.5976 7.18349 17.5976 7.81651 17.207 8.20703L8.20703 17.207C7.81651 17.5976 7.18349 17.5976 6.79297 17.207C6.40244 16.8165 6.40244 16.1835 6.79297 15.793L15.793 6.79297ZM15.25 13.25C16.3546 13.25 17.25 14.1454 17.25 15.25C17.25 16.3546 16.3546 17.25 15.25 17.25C14.1454 17.25 13.25 16.3546 13.25 15.25C13.25 14.1454 14.1454 13.25 15.25 13.25ZM15.25 14.75C14.9739 14.75 14.75 14.9739 14.75 15.25C14.75 15.5261 14.9739 15.75 15.25 15.75C15.5261 15.75 15.75 15.5261 15.75 15.25C15.75 14.9739 15.5261 14.75 15.25 14.75ZM8.75 6.75C9.85457 6.75 10.75 7.64543 10.75 8.75C10.75 9.85457 9.85457 10.75 8.75 10.75C7.64543 10.75 6.75 9.85457 6.75 8.75C6.75 7.64543 7.64543 6.75 8.75 6.75ZM8.75 8.25C8.47386 8.25 8.25 8.47386 8.25 8.75C8.25 9.02614 8.47386 9.25 8.75 9.25C9.02614 9.25 9.25 9.02614 9.25 8.75C9.25 8.47386 9.02614 8.25 8.75 8.25Z",fill:"#1D1D1F"})}),(0,e.jsx)(i.Text,{as:"p",className:"text-left text-[16px] font-bold x:text-[14px]",children:(0,S.replaceTemplate)(n?.membershipBenefitData?.forNewMember,{amount:(0,g.formatPrice)({amount:C?.config?.amount??0,currencyCode:l.price.currencyCode,locale:x})})})]}),!!a?.email&&(0,e.jsx)(L,{})]}),n?.membershipBenefitData?.equities?.map((o,r)=>o.modalText?(0,e.jsxs)("li",{className:"justify-between gap-2",children:[(0,e.jsxs)("button",{onClick:()=>F?.({title:o.label,content:o.modalText}),className:"flex justify-between",children:[(0,e.jsx)(i.Picture,{source:o.icon,alt:o.text,className:"size-6 shrink-0"}),(0,e.jsx)(i.Text,{className:"text-left text-[16px] font-bold x:text-[14px]",children:o.text})]},r),!!a?.email&&(0,e.jsx)(L,{})]},r):(0,e.jsxs)("li",{className:"justify-between",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(i.Picture,{source:o.icon,alt:o.text,className:" size-6 shrink-0"}),(0,e.jsx)(i.Text,{as:"p",className:"text-left text-[16px] font-bold x:text-[14px]",children:o.label})]}),!!a?.email&&(0,e.jsx)(L,{})]},r)),oe.enable?(0,e.jsxs)("li",{className:"justify-between",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("path",{d:"M19 3C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H10V16H21C21.5523 16 22 16.4477 22 17C22 17.5523 21.5523 18 21 18H19.9961C19.9961 19.6559 18.6547 21 16.998 21C15.3414 21 14 19.6559 14 18H10C10 19.6568 8.65684 21 7 21C5.34317 21 4 19.6568 4 18H2C1.44772 18 1 17.5523 1 17V10.6738L1.00488 10.5771C1.02632 10.3554 1.12145 10.146 1.27637 9.9834L4.77637 6.31055L4.84961 6.24023C5.02993 6.08586 5.26042 6 5.5 6H8V5C8 3.89544 8.89541 3 10 3H19ZM6.00488 18.1025C6.05622 18.6067 6.48234 19 7 19C7.51766 19 7.94378 18.6067 7.99512 18.1025L8 18H6L6.00488 18.1025ZM16.0049 18.1025C16.0561 18.6074 16.4823 19 16.998 19C17.5138 19 17.94 18.6074 17.9912 18.1025L17.9961 18H16L16.0049 18.1025ZM3 11.0723V16H8V8H5.92773L3 11.0723ZM21.6621 6.8252C22.0348 6.41765 22.6676 6.38902 23.0752 6.76172C23.4827 7.13443 23.5104 7.76725 23.1377 8.1748L18.0518 13.7363C17.6625 14.162 17.003 14.1954 16.5732 13.8105L13.333 10.9092C12.9216 10.5408 12.8865 9.90853 13.2549 9.49707C13.6232 9.08565 14.2555 9.05066 14.667 9.41895L17.208 11.6943L21.6621 6.8252Z",fill:"#1D1D1F"})}),(0,e.jsx)(i.Text,{as:"p",className:"text-left text-[16px] font-bold x:text-[14px]",children:n?.membershipBenefitData?.expressShipping})]}),!!a?.email&&(0,e.jsx)(L,{})]}):null,k.enable?(0,e.jsxs)("li",{children:[(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("path",{d:"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z",fill:"#1D1D1F"})}),(0,e.jsx)(i.Text,{as:"p",className:"text-left text-[16px] font-bold x:text-[14px]",children:te?k?.config?.label?.replace("{{amount}}",(0,g.formatPrice)({amount:k?.config?.amount??0,currencyCode:l.price.currencyCode,locale:x})):(0,e.jsxs)(e.Fragment,{children:[n?.membershipBenefitData?.creditsAfterActivation,(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:()=>ne(),className:"underline",children:n?.membershipBenefitData?.active})]})})]}):null]})}),!a?.email&&(0,e.jsx)("div",{className:"px-4 pt-4",children:(0,e.jsx)(i.Button,{variant:"primary",className:"w-full",onClick:()=>H?.(),children:X?.signUp})})]})}),(0,e.jsxs)(f.default.Content,{value:"pay",className:"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px] ",children:[(0,e.jsxs)("div",{className:"p-3 lg-desktop:p-4",children:[(0,e.jsx)(i.Heading,{size:2,className:"mb-2 text-left text-lg font-bold",children:n?.payBenefitData?.payMethod}),(0,e.jsxs)("div",{className:"flex items-center gap-2 justify-between rounded-[16px] p-3 lg-desktop:p-4 bg-white",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(i.Picture,{source:n?.payBenefitData?.icon,className:"size-[40px] h-[20px] desktop:size-[70px] desktop:h-[34px] shrink-0"}),(0,e.jsx)(i.Text,{as:"p",className:"text-left text-[16px] font-bold x:text-[14px]",html:n?.payBenefitData?.withCheckout})]}),(0,e.jsx)("button",{className:"underline text-brand-0 whitespace-nowrap text-sm font-bold desktop:text-[16px]",onClick:()=>j(!0),children:n?.payBenefitData?.learnMore})]})]}),(0,e.jsx)(K.default,{showModal:J,closeModal:()=>j(!1),children:(0,e.jsx)(i.Picture,{source:n?.payBenefitData?.payImage})})]}),(0,e.jsx)(f.default.Content,{value:"installment",className:"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px] ",children:(0,e.jsxs)("div",{className:"p-3 lg-desktop:p-4",children:[(0,e.jsx)(i.Heading,{size:2,className:"mb-2 text-left text-lg font-bold",children:n?.installmentBenefitData?.flexibleInstallment}),(0,e.jsx)("div",{className:"overflow-hidden rounded-[16px] p-3 lg-desktop:p-4 bg-white",children:c})]})})]})},L=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...t,children:(0,e.jsx)("path",{d:"M4 9.19472L8.51935 13.667L16.2668 6.00024",stroke:"#2BBC4F",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});var xe=ge;
|
|
40
40
|
//# sourceMappingURL=BenefitsTab.js.map
|
package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.tsx"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { Button, Checkbox, Text, Picture, Heading } from '../../../../../components/index.js'\nimport ProductBenefitsTabs from './ProductBenefitsTabs/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useBenefits } from '../../../hooks/useBenefits'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat'\nimport React, { useMemo, useRef, useState } from 'react'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport useCountDown from '../../../../../hooks/useCountDown.js'\nimport useCopy from '../../../hooks/useCopy'\nimport { cn } from '../../../../../helpers/index.js'\n// \u6587\u6848\u914D\u7F6E\u63A5\u53E3\ninterface BenefitsTabTextConfig {\n // Coupon \u76F8\u5173\n couponCode?: string // \"Code\"\n copyCode?: string // \"Copy Code\"\n copied?: string // \"Copied\"\n expired?: string // \"Expired\"\n offCoupon?: string // \"off coupon\"\n offMemberOnly?: string // \"{amount} off Member Only\"\n loginNow?: string // \"login now\"\n selectFreeGift?: string // \"You can select the free gift below.\"\n bundleSaveUpTo?: string // \"Bundle purchases save extra up to\"\n bundleOffer?: string // \"We offer {count} bundle for you\"\n creditsTitle?: string // \"Soundcore credits for cash\"\n creditsDesc?: string // \"100 Soundcore credits=$1\"\n\n // Tab \u6807\u7B7E\n yourBenefits?: string // \"Your Benefits\"\n off?: string // \"off\"\n memberBenefits?: string // \"Member Benefits\"\n memberBenefitsNotLogin?: string // \"Member Benefits\"\n memberBenefitsNotLoginText?: string //\n installment?: string // \"Installment\"\n\n // Member Benefits \u90E8\u5206\n forNewMember?: string // \"for New Member\"\n expressShipping?: string // \"Express Shipping Method\"\n creditsAfterActivation?: string // \"You will get soundcoreCredits after activation.\"\n active?: string // \"Active\"\n\n // Installment \u90E8\u5206\n flexibleInstallment?: string // \"Flexible installment payment\"\n}\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\n\ninterface BenefitsTabProps {\n textConfig?: BenefitsTabTextConfig\n}\n\n// \u9ED8\u8BA4\u6587\u6848\u914D\u7F6E\nconst defaultTextConfig: Required<BenefitsTabTextConfig> = {\n couponCode: 'Code',\n copyCode: 'Copy Code',\n copied: 'Copied',\n expired: 'Expired',\n offCoupon: '{discount} off coupon',\n offMemberOnly: '{amount} off Member Only',\n loginNow: 'Login now',\n selectFreeGift: 'You can select the free gift below.',\n bundleSaveUpTo: 'Bundle purchases save extra up to',\n bundleOffer: 'We offer {count} bundle for you',\n creditsTitle: 'Soundcore credits for cash',\n creditsDesc: '100 Soundcore credits=$1',\n yourBenefits: 'Your Benefits',\n off: ' off',\n memberBenefits: 'Member Benefits',\n memberBenefitsNotLogin: 'You will enjoy a {amount} member discount after logging in.',\n memberBenefitsNotLoginText: 'Sign Up to Get Benefits Below',\n installment: 'Installment',\n forNewMember: '{amount} off for New Member',\n expressShipping: 'Express Shipping Method',\n creditsAfterActivation: 'You will get soundcoreCredits after activation. ',\n active: 'Active',\n flexibleInstallment: 'Flexible installment payment ',\n}\n\n// Coupon content component (commonly used)\ninterface CouponContentProps {\n coupons?: Array<{\n borderStyle: 'inset' | 'rounded' // \u8FD9\u4E24\u79CD\u6837\u5F0F\u4E0D\u4E00\u6837\uFF0C inset \u56DB\u89D2\u662F\u5185\u5207\u5706\u89D2\uFF0C rounded \u56DB\u89D2\u662F\u666E\u901A\u5706\u89D2\n useAble?: boolean\n isAutoUse?: boolean\n onUseChange?: (useAble: boolean) => void\n code?: string\n title: string\n description: string | React.ReactNode\n discount?: number\n couponBgColor?: string\n bgImage?: { url: string; alt?: string }\n ends_at?: string\n }>\n className?: string\n}\n\nconst CouponItem = ({\n item,\n textConfig,\n}: {\n item: NonNullable<CouponContentProps['coupons']>[number]\n textConfig: Required<BenefitsTabTextConfig>\n}) => {\n const { trackingData } = useAiuiContext()\n const { copied: isCopied, copy: copyToClipboard } = useCopy()\n const couponCopy = trackingData?.common?.coupon\n const { days, hours, minutes, seconds } = useCountDown({ endTime: item?.ends_at || '' })\n const { openModal } = useBizProductContext()\n return (\n <>\n <style jsx>{`\n .coupon-card {\n /* \u4F7F\u7528mask\u521B\u5EFA\u5185\u5207\u5706\u89D2 */\n mask:\n radial-gradient(circle at 0 0, transparent 12px, white 12px),\n radial-gradient(circle at 100% 0, transparent 12px, white 12px),\n radial-gradient(circle at 100% 100%, transparent 12px, white 12px),\n radial-gradient(circle at 0 100%, transparent 12px, white 12px);\n mask-size: 50% 50%;\n mask-position:\n top left,\n top right,\n bottom right,\n bottom left;\n mask-repeat: no-repeat;\n }\n `}</style>\n <div\n style={{\n background: item.couponBgColor || 'white',\n }}\n className={cn(\n 'relative h-[100px] p-3 overflow-hidden laptop:h-[112px] lg-desktop:h-[130px]',\n item.borderStyle === 'inset' ? 'coupon-card ' : 'rounded-[8px]'\n )}\n >\n {item?.bgImage?.url && (\n <Picture\n source={item.bgImage.url}\n alt={item.bgImage.alt}\n className=\"absolute bottom-0 right-0 w-auto\"\n imgClassName=\"object-contain\"\n />\n )}\n <div className=\"relative z-1 \">\n <div className=\"flex items-center justify-start\">\n {item.useAble && (\n <Checkbox\n size=\"lg\"\n className=\"mr-2 rounded-full border-[#D1D1D1] border-[1.6px] data-[state=checked]:border-primary\"\n checked={item?.isAutoUse}\n onCheckedChange={(e: boolean) => {\n item?.onUseChange?.(e)\n }}\n />\n )}\n <Text\n html={item.title}\n className=\"text-[16px] leading-[1.2] font-bold laptop:text-[20px] lg-desktop:text-[24px]\"\n />\n </div>\n {item.description && (\n <Text\n {...(typeof item.description === 'string' ? { html: item.description } : {})}\n as=\"p\"\n className=\"mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F] lg-desktop:text-[16px]\"\n >\n {item.description}\n </Text>\n )}\n {item.code && (\n <div className=\"desktop:mt-2 flex items-center gap-2\">\n <Text\n html={`${textConfig.couponCode}: ${item.code}`}\n className=\"text-[14px] lg-desktop:text-[16px] font-bold text-[#3D3D3F]\"\n />\n <button\n className=\"text-[14px] lg-desktop:text-[16px] font-bold underline\"\n onClick={() => copyToClipboard(item.code ?? '')}\n >\n {isCopied ? couponCopy?.copied || textConfig.copied : couponCopy?.copy || textConfig.copyCode}\n </button>\n </div>\n )}\n {item.ends_at && (\n <button\n onClick={() => {\n if (couponCopy?.modal) {\n openModal(couponCopy?.modal!)\n }\n }}\n className=\"lg-desktop:mt-[24px] text-brand-0 desktop:mt-4 mt-[14px] text-left text-[14px] font-bold lg-desktop:text-[16px] text-[#1F2021] md-l:hidden\"\n >\n {Number(days) < Number(couponCopy?.hurry?.daysLeft) ? (\n <>\n <span>{couponCopy?.ends}</span>\n <span className=\"font-bold\">\n {` ${days} ${couponCopy?.days} ${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`}\n </span>\n </>\n ) : (\n couponCopy?.hurry?.label || textConfig.expired\n )}\n </button>\n )}\n </div>\n </div>\n </>\n )\n}\n\nconst CouponContent = ({\n coupons,\n className,\n textConfig,\n}: CouponContentProps & { textConfig: Required<BenefitsTabTextConfig> }) => {\n return (\n <div className={cn('flex flex-col gap-3 laptop:grid laptop:grid-cols-2 desktop:grid-cols-1', className)}>\n {coupons?.map((item, index) => (\n <CouponItem key={index} item={item} textConfig={textConfig} />\n ))}\n </div>\n )\n}\n\nconst BenefitsTab = ({ textConfig }: BenefitsTabProps) => {\n const {\n isLogin,\n profile,\n variant,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n savingDetail,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n } = useBizProductContext()\n const benefits = useBenefits({ variant })\n const [productBenefitsTabsValue, setProductBenefitsTabsValue] = useState<'coupon' | 'membership' | 'installment'>(\n 'coupon'\n )\n const { trackingData, locale = 'us', copyWriting } = useAiuiContext()\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n\n // \u5408\u5E76\u9ED8\u8BA4\u914D\u7F6E\u548C\u4F20\u5165\u7684\u914D\u7F6E\n const mergedTextConfig = { ...defaultTextConfig, ...textConfig }\n\n const { activated = false } = profile || {} // \u7528\u6237\u662F\u5426\u6FC0\u6D3B\n const { memberDiscount, commonCoupon, creditsRedemption, freeGift, bundle, paidShipping, fullGift, levelDiscount } =\n benefits\n\n const productsBenefits = trackingData?.productsBenefits ?? {}\n const { thirdParty = {} } = trackingData?.common || {}\n\n const coupons = [\n commonCoupon?.enable\n ? {\n ...commonCoupon.config,\n isAutoUse: savingDetail?.coupon > 0,\n useAble: true,\n borderStyle: 'rounded',\n code: commonCoupon?.config?.title ?? '',\n description: commonCoupon?.config?.desc ?? '',\n onUseChange: (value: boolean) => {\n const couponSaving = value ? (discount?.codeSavings ?? 0) : 0\n onUseCouponChange?.(couponSaving)\n },\n title: replaceTemplate(mergedTextConfig.offCoupon, {\n discount:\n commonCoupon?.config?.value_type == 'percentage'\n ? Math.abs(Number(commonCoupon?.config?.value || 0)) + '%'\n : formatPrice({\n amount: Math.abs(Number(commonCoupon?.config?.fixed_value || 0)),\n currencyCode: variant.price.currencyCode,\n locale,\n }),\n }),\n }\n : null,\n memberDiscount.enable\n ? {\n useAble: true,\n isAutoUse: Boolean(profile?.email) && !!savingDetail?.member,\n title: replaceTemplate(mergedTextConfig.offMemberOnly, {\n amount: formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n }),\n }),\n description: (\n <>\n {Boolean(profile?.email)\n ? (memberDiscount?.config?.description ?? '')\n : (mergedTextConfig.memberBenefitsNotLogin.replace(\n '{amount}',\n formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n })\n ) ?? '')}{' '}\n {Boolean(profile?.email) ? (\n ''\n ) : (\n <span role=\"button\" tabIndex={0} onClick={() => openSignInPopup?.()} className=\"underline\">\n {mergedTextConfig.loginNow}\n </span>\n )}\n </>\n ),\n borderStyle: 'rounded',\n onUseChange: (value: boolean) => {\n if (Boolean(profile?.email)) {\n const memberSaving = value ? (memberDiscount?.config?.amount ?? 0) : 0\n onUseMemberDiscountChange?.(memberSaving)\n // setSavingDetail(prev => ({\n // ...prev,\n // member: value ? (memberDiscount?.config?.amount ?? 0) : 0,\n // }))\n } else {\n openSignInPopup?.()\n }\n },\n }\n : null,\n levelDiscount.enable\n ? {\n title: levelDiscount?.config?.title ?? '',\n description: levelDiscount?.config?.tag ?? '',\n borderStyle: 'inset',\n bgImage: {\n url: 'https://cdn.shopify.com/s/files/1/0521/9411/5753/files/levelDiscount.png?v=1760437385',\n },\n }\n : null,\n freeGift.enable\n ? {\n title: freeGift?.config?.title ?? '',\n description: mergedTextConfig.selectFreeGift,\n borderStyle: 'inset',\n bgImage: {\n url: 'https://cdn.shopify.com/s/files/1/0516/3761/6830/files/gift.png?v=1759113534',\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n bundle.enable\n ? {\n title: `${mergedTextConfig.bundleSaveUpTo} ${formatPrice({\n amount: Math.max(...(bundle?.config?.bundleList?.map((item: any) => item.savings ?? 0) ?? [])),\n currencyCode: variant.price.currencyCode,\n locale,\n })}`,\n borderStyle: 'inset',\n description: mergedTextConfig.bundleOffer.replace(\n '{count}',\n bundle?.config?.bundleList?.length?.toString() ?? ''\n ),\n bgImage: {\n url: 'https://cdn.shopify.com/s/files/1/0516/3761/6830/files/bundle.png?v=1759113534',\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n fullGift.enable\n ? {\n title: fullGift?.config?.title ?? '',\n description: fullGift?.config?.desc ?? '',\n borderStyle: 'inset',\n bgImage: {\n url: 'https://cdn.shopify.com/s/files/1/0516/3761/6830/files/fullGift.png?v=1759141790',\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n creditsRedemption.enable\n ? {\n title: mergedTextConfig.creditsTitle,\n description: mergedTextConfig.creditsDesc,\n borderStyle: 'inset',\n bgImage: {\n url: 'https://cdn.shopify.com/s/files/1/0516/3761/6830/files/cash.png?v=1759113534',\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n ].filter(Boolean)\n\n const handleActivate = () => {\n openAuthCodePopup?.()\n }\n\n if (!ProductBenefitsTabs) return null\n\n const handleProductBenefitsTabListClick = (el: React.MouseEvent<HTMLButtonElement>) => {\n if (scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = el.currentTarget\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }\n\n return (\n <ProductBenefitsTabs\n className=\"relative\"\n ipc-product-detail-benefits-tabs\n onValueChange={value => setProductBenefitsTabsValue(value as 'coupon' | 'membership' | 'installment')}\n defaultValue={coupons?.length ? 'coupon' : 'membership'}\n >\n <div className=\"absolute right-0 z-[1] top-0 w-[25px] rounded-xl h-[40px] bg-gradient-to-r from-transparent to-[#EAEAEC]\"></div>\n <ProductBenefitsTabs.List ref={scrollContainerRef}>\n {coupons?.length ? (\n <ProductBenefitsTabs.Trigger\n className={cn(productBenefitsTabsValue === 'coupon' && 'text-[#1D1D1F]')}\n value=\"coupon\"\n onClick={handleProductBenefitsTabListClick}\n >\n {mergedTextConfig.yourBenefits}\n {/* {(savingDetail.coupon || 0) > 0 && (\n <ProductBenefitsTabs.Badge>\n {commonCoupon?.config?.value_type == 'percentage'\n ? Math.abs(Number(commonCoupon?.config?.value || 0)) + '%'\n : formatPrice({\n amount: Math.abs(Number(commonCoupon?.config?.fixed_value || 0)),\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n {mergedTextConfig.off}\n </ProductBenefitsTabs.Badge>\n )} */}\n </ProductBenefitsTabs.Trigger>\n ) : null}\n <ProductBenefitsTabs.Trigger\n className={cn(productBenefitsTabsValue === 'membership' && 'text-[#1D1D1F]')}\n value=\"membership\"\n onClick={handleProductBenefitsTabListClick}\n >\n {mergedTextConfig.memberBenefits}\n </ProductBenefitsTabs.Trigger>\n <ProductBenefitsTabs.Trigger\n className={cn(productBenefitsTabsValue === 'installment' && 'text-[#1D1D1F]')}\n value=\"installment\"\n onClick={handleProductBenefitsTabListClick}\n >\n {mergedTextConfig.installment}\n </ProductBenefitsTabs.Trigger>\n </ProductBenefitsTabs.List>\n <style global jsx>\n {`\n .benefits-tabs-content::-webkit-scrollbar {\n width: 4px; /* \u6EDA\u52A8\u6761\u5BBD\u5EA6 */\n height: 64px; /* \u6A2A\u5411\u6EDA\u52A8\u6761\u9AD8\u5EA6 */\n }\n\n .benefits-tabs-content::-webkit-scrollbar-track {\n background: transparent; /* \u6EDA\u52A8\u6761\u8F68\u9053\u80CC\u666F */\n }\n\n .benefits-tabs-content::-webkit-scrollbar-thumb {\n background-color: #d1d1d1; /* \u6EDA\u52A8\u6761\u989C\u8272 */\n border-radius: 9999px; /* \u5706\u89D2 */\n }\n\n .benefits-tabs-content::-webkit-scrollbar-thumb:hover {\n background-color: rgba(100, 100, 100, 0.6);\n }\n `}\n </style>\n {/* \u4F7F\u7528\u5185\u7F6E\u7684 CouponContent \u5B50\u7EC4\u4EF6 */}\n {coupons?.length ? (\n <ProductBenefitsTabs.Content\n value=\"coupon\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px]\"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n <CouponContent\n coupons={coupons as NonNullable<CouponContentProps['coupons']>}\n className=\"\"\n textConfig={mergedTextConfig}\n />\n </div>\n </ProductBenefitsTabs.Content>\n ) : null}\n <ProductBenefitsTabs.Content\n value=\"membership\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px]\"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n {!profile?.email && (\n <h3 className=\"mb-2 text-left text-lg font-bold\">{mergedTextConfig.memberBenefitsNotLoginText}</h3>\n )}\n <div className={`rounded-[16px] ${Boolean(profile?.email) ? 'max-h-[240px]' : 'max-h-[160px]'}`}>\n <ul\n className={`list-none [&_li:first-child]:rounded-t-[16px] \n [&_li:last-child]:rounded-b-[16px] [&_li:last-child]:last:border-b-0 [&_li]:flex [&_li]:items-center [&_li]:gap-2\n [&_li]:border-b [&_li]:border-b-[#E4E5E6] [&_li]:bg-white [&_li]:px-4\n [&_li]:py-4 \n [&_li]:text-left`}\n >\n {memberDiscount.enable && (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M20 3.5C21.6569 3.5 23 4.84315 23 6.5V9.65625C23 10.0791 22.7342 10.4566 22.3359 10.5986C21.6665 10.8372 21.1816 11.4844 21.1816 12.25C21.1816 13.0156 21.6665 13.6628 22.3359 13.9014C22.7342 14.0434 23 14.4209 23 14.8438V18C23 19.6569 21.6569 21 20 21H4C2.34315 21 1 19.6569 1 18V14.8438L1.01172 14.6875C1.06803 14.3301 1.31557 14.0256 1.66406 13.9014C2.33345 13.6628 2.81836 13.0156 2.81836 12.25C2.81836 11.4844 2.33345 10.8372 1.66406 10.5986C1.26583 10.4566 1 10.0791 1 9.65625V6.5C1 4.84315 2.34315 3.5 4 3.5H20ZM4 5.5C3.44772 5.5 3 5.94772 3 6.5V9.03125C4.08987 9.68678 4.81836 10.8833 4.81836 12.25C4.81836 13.6165 4.08963 14.8122 3 15.4678V18C3 18.5523 3.44772 19 4 19H20C20.5523 19 21 18.5523 21 18V15.4678C19.9104 14.8122 19.1816 13.6165 19.1816 12.25C19.1816 10.8833 19.9101 9.68677 21 9.03125V6.5C21 5.94772 20.5523 5.5 20 5.5H4ZM15.793 6.79297C16.1835 6.40244 16.8165 6.40244 17.207 6.79297C17.5976 7.18349 17.5976 7.81651 17.207 8.20703L8.20703 17.207C7.81651 17.5976 7.18349 17.5976 6.79297 17.207C6.40244 16.8165 6.40244 16.1835 6.79297 15.793L15.793 6.79297ZM15.25 13.25C16.3546 13.25 17.25 14.1454 17.25 15.25C17.25 16.3546 16.3546 17.25 15.25 17.25C14.1454 17.25 13.25 16.3546 13.25 15.25C13.25 14.1454 14.1454 13.25 15.25 13.25ZM15.25 14.75C14.9739 14.75 14.75 14.9739 14.75 15.25C14.75 15.5261 14.9739 15.75 15.25 15.75C15.5261 15.75 15.75 15.5261 15.75 15.25C15.75 14.9739 15.5261 14.75 15.25 14.75ZM8.75 6.75C9.85457 6.75 10.75 7.64543 10.75 8.75C10.75 9.85457 9.85457 10.75 8.75 10.75C7.64543 10.75 6.75 9.85457 6.75 8.75C6.75 7.64543 7.64543 6.75 8.75 6.75ZM8.75 8.25C8.47386 8.25 8.25 8.47386 8.25 8.75C8.25 9.02614 8.47386 9.25 8.75 9.25C9.02614 9.25 9.25 9.02614 9.25 8.75C9.25 8.47386 9.02614 8.25 8.75 8.25Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {replaceTemplate(mergedTextConfig.forNewMember, {\n amount: formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n }),\n })}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n )}\n {productsBenefits?.items?.map((item: any, index: number) =>\n item.modalText ? (\n <li key={index} className=\"justify-between\">\n <button\n onClick={() => openModal?.({ title: item.text, content: item.modalText })}\n key={index}\n className=\"flex justify-between\"\n >\n <Picture source={item.icon} alt={item.text} className=\"mr-[8px] size-[20px] shrink-0\" />\n <Text className=\"text-left text-[16px] font-bold x:text-[14px]\">{item.text}</Text>\n </button>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : (\n <li key={index} className=\"justify-between\">\n <div className=\"flex gap-2\">\n <Picture source={item.icon} alt={item.text} className=\"mr-[8px] size-[20px] shrink-0\" />\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {item.text}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n )\n )}\n {/* \u9AD8\u6807\u7269\u6D41 */}\n {paidShipping.enable ? (\n <li>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M19 3C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H10V16H21C21.5523 16 22 16.4477 22 17C22 17.5523 21.5523 18 21 18H19.9961C19.9961 19.6559 18.6547 21 16.998 21C15.3414 21 14 19.6559 14 18H10C10 19.6568 8.65684 21 7 21C5.34317 21 4 19.6568 4 18H2C1.44772 18 1 17.5523 1 17V10.6738L1.00488 10.5771C1.02632 10.3554 1.12145 10.146 1.27637 9.9834L4.77637 6.31055L4.84961 6.24023C5.02993 6.08586 5.26042 6 5.5 6H8V5C8 3.89544 8.89541 3 10 3H19ZM6.00488 18.1025C6.05622 18.6067 6.48234 19 7 19C7.51766 19 7.94378 18.6067 7.99512 18.1025L8 18H6L6.00488 18.1025ZM16.0049 18.1025C16.0561 18.6074 16.4823 19 16.998 19C17.5138 19 17.94 18.6074 17.9912 18.1025L17.9961 18H16L16.0049 18.1025ZM3 11.0723V16H8V8H5.92773L3 11.0723ZM21.6621 6.8252C22.0348 6.41765 22.6676 6.38902 23.0752 6.76172C23.4827 7.13443 23.5104 7.76725 23.1377 8.1748L18.0518 13.7363C17.6625 14.162 17.003 14.1954 16.5732 13.8105L13.333 10.9092C12.9216 10.5408 12.8865 9.90853 13.2549 9.49707C13.6232 9.08565 14.2555 9.05066 14.667 9.41895L17.208 11.6943L21.6621 6.8252Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {mergedTextConfig.expressShipping}\n </Text>\n </li>\n ) : null}\n {/* \u79EF\u5206\u62B5\u73B0 */}\n {creditsRedemption.enable ? (\n <li>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {activated ? (\n creditsRedemption?.config?.label?.replace(\n '{{amount}}',\n formatPrice({\n amount: creditsRedemption?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n })\n )\n ) : (\n <>\n {mergedTextConfig.creditsAfterActivation}\n <span role=\"button\" tabIndex={0} onClick={() => handleActivate()} className=\"underline\">\n {mergedTextConfig.active}\n </span>\n </>\n )}\n </Text>\n </li>\n ) : null}\n </ul>\n </div>\n {!profile?.email && (\n <div className=\"px-4 pt-4\">\n <Button variant=\"primary\" className=\"w-full\" onClick={() => openSignUpPopup?.()}>\n {copyWriting?.signUp}\n </Button>\n </div>\n )}\n </div>\n </ProductBenefitsTabs.Content>\n {/* \u81EA\u5B9A\u4E49\u5185\u5BB9 */}\n <ProductBenefitsTabs.Content\n value=\"installment\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px] \"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {mergedTextConfig.flexibleInstallment}\n </Heading>\n <div className=\"overflow-hidden rounded-[16px] p-3 lg-desktop:p-4 bg-white\">{renderInstallments}</div>\n </div>\n </ProductBenefitsTabs.Content>\n </ProductBenefitsTabs>\n )\n}\n\nconst CheckedIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" {...props}>\n <path\n d=\"M4 9.19472L8.51935 13.667L16.2668 6.00024\"\n stroke=\"#2BBC4F\"\n strokeWidth=\"1.67\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\nexport default BenefitsTab\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,
|
|
6
|
-
"names": ["BenefitsTab_exports", "__export", "BenefitsTab_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_ProductBenefitsTabs", "import_BizProductProvider", "import_useBenefits", "import_utils", "import_textFormat", "import_react", "import_AiuiProvider", "import_useCountDown", "import_useCopy", "import_helpers", "defaultTextConfig", "CouponItem", "item", "textConfig", "trackingData", "isCopied", "copyToClipboard", "useCopy", "couponCopy", "days", "hours", "minutes", "seconds", "useCountDown", "openModal", "e", "CouponContent", "coupons", "className", "index", "BenefitsTab", "isLogin", "profile", "variant", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "savingDetail", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport { Button, Checkbox, Text, Picture, Heading } from '../../../../../components/index.js'\nimport ProductBenefitsTabs from './ProductBenefitsTabs/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useBenefits } from '../../../hooks/useBenefits'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat'\nimport React, { useEffect, useMemo, useRef, useState } from 'react'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport useCountDown from '../../../../../hooks/useCountDown.js'\nimport useCopy from '../../../hooks/useCopy'\nimport { cn } from '../../../../../helpers/index.js'\nimport ModalContainer from './ProductBenefitsTabs/ModalContainer.js'\n// \u6587\u6848\u914D\u7F6E\u63A5\u53E3\ninterface BenefitsTabTextConfig {\n // Coupon \u76F8\u5173\n couponCode?: string // \"Code\"\n copyCode?: string // \"Copy Code\"\n copied?: string // \"Copied\"\n expired?: string // \"Expired\"\n offCoupon?: string // \"off coupon\"\n offMemberOnly?: string // \"{amount} off Member Only\"\n loginNow?: string // \"login now\"\n selectFreeGift?: string // \"You can select the free gift below.\"\n bundleSaveUpTo?: string // \"Bundle purchases save extra up to\"\n bundleOffer?: string // \"We offer {count} bundle for you\"\n creditsTitle?: string // \"Soundcore credits for cash\"\n creditsDesc?: string // \"100 Soundcore credits=$1\"\n\n // Tab \u6807\u7B7E\n off?: string // \"off\"\n memberBenefitsNotLogin?: string // \"Member Benefits\"\n memberBenefitsNotLoginText?: string //\n\n // Member Benefits \u90E8\u5206\n forNewMember?: string // \"for New Member\"\n expressShipping?: string // \"Express Shipping Method\"\n creditsAfterActivation?: string // \"You will get soundcoreCredits after activation.\"\n active?: string // \"Active\"\n\n // Installment \u90E8\u5206\n flexibleInstallment?: string // \"Flexible installment payment\"\n}\n\nexport type ProductBenefitsTabsValueType = 'coupon' | 'membership' | 'pay' | 'installment'\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\n\ninterface BenefitsTabProps {\n textConfig?: BenefitsTabTextConfig\n}\n\n// \u9ED8\u8BA4\u6587\u6848\u914D\u7F6E\nconst defaultTextConfig: Required<BenefitsTabTextConfig> = {\n couponCode: 'Code',\n copyCode: 'Copy Code',\n copied: 'Copied',\n expired: 'Expired',\n offCoupon: '{discount} off coupon',\n offMemberOnly: '{amount} off Member Only',\n loginNow: 'Login now',\n selectFreeGift: 'You can select the free gift below.',\n bundleSaveUpTo: 'Bundle purchases save extra up to',\n bundleOffer: 'We offer {count} bundle for you',\n creditsTitle: 'Soundcore credits for cash',\n creditsDesc: '100 Soundcore credits=$1',\n off: ' off',\n memberBenefitsNotLogin: 'You will enjoy a {amount} member discount after logging in.',\n memberBenefitsNotLoginText: 'Sign Up to Get Benefits Below',\n forNewMember: '{amount} off for New Member',\n expressShipping: 'Express Shipping Method',\n creditsAfterActivation: 'You will get soundcoreCredits after activation. ',\n active: 'Active',\n flexibleInstallment: 'Flexible installment payment ',\n}\n\n// Coupon content component (commonly used)\ninterface CouponContentProps {\n coupons?: Array<{\n borderStyle: 'inset' | 'rounded' // \u8FD9\u4E24\u79CD\u6837\u5F0F\u4E0D\u4E00\u6837\uFF0C inset \u56DB\u89D2\u662F\u5185\u5207\u5706\u89D2\uFF0C rounded \u56DB\u89D2\u662F\u666E\u901A\u5706\u89D2\n useAble?: boolean\n isAutoUse?: boolean\n onUseChange?: (useAble: boolean) => void\n code?: string\n title: string\n description: string | React.ReactNode\n discount?: number\n couponBgColor?: string\n bgImage?: { url: string; alt?: string }\n ends_at?: string\n }>\n className?: string\n}\n\nconst CouponItem = ({\n item,\n textConfig,\n benefitPayloadData,\n}: {\n item: NonNullable<CouponContentProps['coupons']>[number]\n textConfig: Required<BenefitsTabTextConfig>\n benefitPayloadData: any\n}) => {\n const { trackingData } = useAiuiContext()\n const { copied: isCopied, copy: copyToClipboard } = useCopy()\n const couponCopy = trackingData?.common?.coupon\n const { days, hours, minutes, seconds } = useCountDown({ endTime: item?.ends_at || '' })\n const { openModal } = useBizProductContext()\n return (\n <>\n <style jsx>{`\n .coupon-card {\n /* \u4F7F\u7528mask\u521B\u5EFA\u5185\u5207\u5706\u89D2 */\n mask:\n radial-gradient(circle at 0 0, transparent 12px, white 12px),\n radial-gradient(circle at 100% 0, transparent 12px, white 12px),\n radial-gradient(circle at 100% 100%, transparent 12px, white 12px),\n radial-gradient(circle at 0 100%, transparent 12px, white 12px);\n mask-size: 50% 50%;\n mask-position:\n top left,\n top right,\n bottom right,\n bottom left;\n mask-repeat: no-repeat;\n }\n `}</style>\n <div\n style={{\n background: item.couponBgColor || 'white',\n }}\n className={cn(\n 'relative h-[100px] p-3 overflow-hidden laptop:h-[112px] lg-desktop:h-[130px]',\n item.borderStyle === 'inset' ? 'coupon-card ' : 'rounded-[8px]'\n )}\n >\n {item?.bgImage?.url && (\n <Picture\n source={item.bgImage.url}\n alt={item.bgImage.alt}\n className=\"absolute bottom-0 right-0 w-auto\"\n imgClassName=\"object-contain\"\n />\n )}\n <div className=\"relative z-1 \">\n <div className=\"flex items-center justify-start\">\n {item.useAble && (\n <Checkbox\n size=\"lg\"\n className=\"mr-2 rounded-full border-[#D1D1D1] border-[1.6px] data-[state=checked]:border-primary\"\n checked={item?.isAutoUse}\n onCheckedChange={(e: boolean) => {\n item?.onUseChange?.(e)\n }}\n />\n )}\n <Text\n html={item.title}\n className=\"text-[16px] leading-[1.2] font-bold laptop:text-[20px] lg-desktop:text-[24px]\"\n />\n </div>\n {item.description && (\n <Text\n {...(typeof item.description === 'string' ? { html: item.description } : {})}\n as=\"p\"\n className=\"mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F] lg-desktop:text-[16px]\"\n >\n {item.description}\n </Text>\n )}\n {item.code && (\n <div className=\"desktop:mt-2 flex items-center gap-2\">\n <Text\n html={`${benefitPayloadData?.couponBenefitData?.commonCoupon?.couponCode}: ${item.code}`}\n className=\"text-[14px] lg-desktop:text-[16px] font-bold text-[#3D3D3F]\"\n />\n <button\n className=\"text-[14px] lg-desktop:text-[16px] font-bold underline\"\n onClick={() => copyToClipboard(item.code ?? '')}\n >\n {isCopied\n ? couponCopy?.copied || benefitPayloadData?.couponBenefitData?.commonCoupon?.copied\n : couponCopy?.copy || benefitPayloadData?.couponBenefitData?.commonCoupon?.copyCode}\n </button>\n </div>\n )}\n {item.ends_at && (\n <button\n onClick={() => {\n if (couponCopy?.modal) {\n openModal(couponCopy?.modal!)\n }\n }}\n className=\"lg-desktop:mt-[24px] text-brand-0 desktop:mt-4 mt-[14px] text-left text-[14px] font-bold lg-desktop:text-[16px] text-[#1F2021] md-l:hidden\"\n >\n {Number(days) < Number(couponCopy?.hurry?.daysLeft) ? (\n <>\n <span>{couponCopy?.ends}</span>\n <span className=\"font-bold\">\n {` ${days} ${couponCopy?.days} ${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`}\n </span>\n </>\n ) : (\n couponCopy?.hurry?.label || benefitPayloadData?.couponBenefitData?.commonCoupon?.expired\n )}\n </button>\n )}\n </div>\n </div>\n </>\n )\n}\n\nconst CouponContent = ({\n coupons,\n className,\n textConfig,\n benefitPayloadData,\n}: CouponContentProps & { textConfig: Required<BenefitsTabTextConfig>; benefitPayloadData: any }) => {\n return (\n <div className={cn('flex flex-col gap-3 laptop:grid laptop:grid-cols-2 desktop:grid-cols-1', className)}>\n {coupons?.map((item, index) => (\n <CouponItem key={index} item={item} textConfig={textConfig} benefitPayloadData={benefitPayloadData} />\n ))}\n </div>\n )\n}\n\nconst BenefitsTab = ({ textConfig }: BenefitsTabProps) => {\n const {\n isLogin,\n profile,\n variant,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n savingDetail,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n product,\n } = useBizProductContext()\n\n const productBenefitsData = useMemo(() => {\n return product?.payload?.components?.find((item: any) => item.componentKey === 'ProductBenefits')?.data || {}\n }, [product?.payload])\n\n const [isFlexModalOpen, setIsFlexModalOpen] = useState(false)\n\n const benefits = useBenefits({ variant })\n const { locale = 'us', copyWriting } = useAiuiContext()\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n\n // \u5408\u5E76\u9ED8\u8BA4\u914D\u7F6E\u548C\u4F20\u5165\u7684\u914D\u7F6E\n const mergedTextConfig = { ...defaultTextConfig, ...textConfig }\n\n const { activated = false } = profile || {} // \u7528\u6237\u662F\u5426\u6FC0\u6D3B\n const { memberDiscount, commonCoupon, creditsRedemption, freeGift, bundle, paidShipping, fullGift, levelDiscount } =\n benefits\n\n const benefitPayloadData = useMemo(() => {\n const couponBenefitData = productBenefitsData?.benefitTabs?.find((item: any) => item?.value === 'coupon') ?? {}\n const membershipBenefitData =\n productBenefitsData?.benefitTabs?.find((item: any) => item?.value === 'membership') ?? {}\n const installmentBenefitData =\n productBenefitsData?.benefitTabs?.find((item: any) => item?.value === 'installment') ?? {}\n const payBenefitData = productBenefitsData?.benefitTabs?.find((item: any) => item?.value === 'pay') ?? {}\n return { couponBenefitData, membershipBenefitData, installmentBenefitData, payBenefitData }\n }, [productBenefitsData])\n\n const coupons = [\n commonCoupon?.enable\n ? {\n ...commonCoupon.config,\n isAutoUse: savingDetail?.coupon > 0,\n useAble: true,\n borderStyle: 'rounded',\n code: commonCoupon?.config?.title ?? '',\n description: commonCoupon?.config?.desc ?? '',\n onUseChange: (value: boolean) => {\n const couponSaving = value ? (discount?.codeSavings ?? 0) : 0\n onUseCouponChange?.(couponSaving)\n },\n title: replaceTemplate(benefitPayloadData?.couponBenefitData?.commonCoupon?.offCoupon, {\n discount:\n commonCoupon?.config?.value_type == 'percentage'\n ? Math.abs(Number(commonCoupon?.config?.value || 0)) + '%'\n : formatPrice({\n amount: Math.abs(Number(commonCoupon?.config?.fixed_value || 0)),\n currencyCode: variant.price.currencyCode,\n locale,\n }),\n }),\n }\n : null,\n memberDiscount.enable\n ? {\n useAble: true,\n isAutoUse: Boolean(profile?.email) && !!savingDetail?.member,\n title: replaceTemplate(benefitPayloadData?.couponBenefitData?.member?.offMemberOnly, {\n amount: formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n }),\n }),\n description: (\n <>\n {Boolean(profile?.email)\n ? benefitPayloadData?.couponBenefitData?.member?.memberDiscounts\n : (benefitPayloadData?.membershipBenefitData?.memberBenefitsNotLogin?.replace(\n '{amount}',\n formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n })\n ) ?? '')}{' '}\n {Boolean(profile?.email) ? (\n ''\n ) : (\n <span role=\"button\" tabIndex={0} onClick={() => openSignInPopup?.()} className=\"underline\">\n {benefitPayloadData?.couponBenefitData?.member?.loginNow}\n </span>\n )}\n </>\n ),\n borderStyle: 'rounded',\n onUseChange: (value: boolean) => {\n if (Boolean(profile?.email)) {\n const memberSaving = value ? (memberDiscount?.config?.amount ?? 0) : 0\n onUseMemberDiscountChange?.(memberSaving)\n // setSavingDetail(prev => ({\n // ...prev,\n // member: value ? (memberDiscount?.config?.amount ?? 0) : 0,\n // }))\n } else {\n openSignInPopup?.()\n }\n },\n }\n : null,\n levelDiscount.enable\n ? {\n title: levelDiscount?.config?.title ?? '',\n description: levelDiscount?.config?.tag ?? '',\n borderStyle: 'inset',\n bgImage: {\n url: benefitPayloadData?.couponBenefitData?.levelDiscount?.bgImage,\n },\n }\n : null,\n freeGift.enable\n ? {\n title: freeGift?.config?.title ?? '',\n description: benefitPayloadData?.couponBenefitData?.freeGift?.selectFreeGift,\n borderStyle: 'inset',\n bgImage: {\n url: benefitPayloadData?.couponBenefitData?.freeGift?.bgImage,\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n bundle.enable\n ? {\n title: `${benefitPayloadData?.couponBenefitData?.bundle?.bundleSaveUpTo} ${formatPrice({\n amount: Math.max(...(bundle?.config?.bundleList?.map((item: any) => item.savings ?? 0) ?? [])),\n currencyCode: variant.price.currencyCode,\n locale,\n })}`,\n borderStyle: 'inset',\n description: benefitPayloadData?.couponBenefitData?.bundle?.bundleOffer.replace(\n '{count}',\n bundle?.config?.bundleList?.length?.toString() ?? ''\n ),\n bgImage: {\n url: benefitPayloadData?.couponBenefitData?.bundle?.bgImage,\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n fullGift.enable\n ? {\n title: fullGift?.config?.title ?? '',\n description: fullGift?.config?.desc ?? '',\n borderStyle: 'inset',\n bgImage: {\n url: benefitPayloadData?.couponBenefitData?.fullGift?.bgImage,\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n creditsRedemption.enable\n ? {\n title: benefitPayloadData?.couponBenefitData?.creditsRedemption?.creditsTitle,\n description: benefitPayloadData?.couponBenefitData?.creditsRedemption?.creditsDesc,\n borderStyle: 'inset',\n bgImage: {\n url: benefitPayloadData?.couponBenefitData?.creditsRedemption?.bgImage,\n },\n couponBgColor:\n 'linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF',\n }\n : null,\n ].filter(Boolean)\n\n useEffect(() => {\n setProductBenefitsTabsValue(coupons?.length ? 'coupon' : 'membership')\n }, [])\n\n const [productBenefitsTabsValue, setProductBenefitsTabsValue] = useState<ProductBenefitsTabsValueType>('coupon')\n\n const handleActivate = () => {\n openAuthCodePopup?.()\n }\n\n if (!ProductBenefitsTabs) return null\n\n const handleProductBenefitsTabListClick = (\n el: React.MouseEvent<HTMLButtonElement>,\n value: ProductBenefitsTabsValueType\n ) => {\n setProductBenefitsTabsValue(value)\n if (scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = el.currentTarget\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }\n\n const benefitTabs = useMemo(() => {\n return productBenefitsData?.benefitTabs\n ?.map((item: any) => {\n if (item?.value === 'coupon' && !coupons?.length) {\n return null\n }\n return item\n })\n .filter(Boolean)\n }, [productBenefitsData, coupons])\n\n return (\n <ProductBenefitsTabs\n className=\"relative\"\n id=\"ipc-product-detail-benefits-tabs\"\n onValueChange={value => setProductBenefitsTabsValue(value as 'coupon' | 'membership' | 'installment')}\n value={productBenefitsTabsValue}\n >\n <div className=\"absolute right-0 z-[1] top-0 w-[25px] h-[40px] bg-gradient-to-r from-transparent to-[#EAEAEC]\"></div>\n <ProductBenefitsTabs.List ref={scrollContainerRef}>\n {benefitTabs?.map((item: any) => (\n <ProductBenefitsTabs.Trigger\n key={item?.value}\n className={cn(productBenefitsTabsValue === item.value && 'text-[#1D1D1F]')}\n value={item.value}\n onClick={e => handleProductBenefitsTabListClick(e, item?.value)}\n >\n {item.label}\n </ProductBenefitsTabs.Trigger>\n ))}\n </ProductBenefitsTabs.List>\n <style global jsx>\n {`\n .benefits-tabs-content::-webkit-scrollbar {\n width: 4px; /* \u6EDA\u52A8\u6761\u5BBD\u5EA6 */\n height: 64px; /* \u6A2A\u5411\u6EDA\u52A8\u6761\u9AD8\u5EA6 */\n }\n\n .benefits-tabs-content::-webkit-scrollbar-track {\n background: transparent; /* \u6EDA\u52A8\u6761\u8F68\u9053\u80CC\u666F */\n }\n\n .benefits-tabs-content::-webkit-scrollbar-thumb {\n background-color: #d1d1d1; /* \u6EDA\u52A8\u6761\u989C\u8272 */\n border-radius: 9999px; /* \u5706\u89D2 */\n }\n\n .benefits-tabs-content::-webkit-scrollbar-thumb:hover {\n background-color: rgba(100, 100, 100, 0.6);\n }\n `}\n </style>\n {/* \u4F7F\u7528\u5185\u7F6E\u7684 CouponContent \u5B50\u7EC4\u4EF6 */}\n {coupons?.length ? (\n <ProductBenefitsTabs.Content\n value=\"coupon\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px]\"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n <CouponContent\n coupons={coupons as NonNullable<CouponContentProps['coupons']>}\n textConfig={mergedTextConfig}\n benefitPayloadData={benefitPayloadData}\n />\n </div>\n </ProductBenefitsTabs.Content>\n ) : null}\n <ProductBenefitsTabs.Content\n value=\"membership\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px]\"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n {!profile?.email && (\n <h3 className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.membershipBenefitData?.memberBenefitsNotLoginText}\n </h3>\n )}\n <div className={`rounded-[16px]`}>\n <ul\n className={`list-none [&_li:first-child]:rounded-t-[16px] \n [&_li:last-child]:rounded-b-[16px] [&_li:last-child]:last:border-b-0 [&_li]:flex [&_li]:items-center [&_li]:gap-2\n [&_li]:border-b [&_li]:border-b-[#E4E5E6] [&_li]:bg-white [&_li]:px-4\n [&_li]:py-4 \n [&_li]:text-left`}\n >\n {memberDiscount.enable && (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M20 3.5C21.6569 3.5 23 4.84315 23 6.5V9.65625C23 10.0791 22.7342 10.4566 22.3359 10.5986C21.6665 10.8372 21.1816 11.4844 21.1816 12.25C21.1816 13.0156 21.6665 13.6628 22.3359 13.9014C22.7342 14.0434 23 14.4209 23 14.8438V18C23 19.6569 21.6569 21 20 21H4C2.34315 21 1 19.6569 1 18V14.8438L1.01172 14.6875C1.06803 14.3301 1.31557 14.0256 1.66406 13.9014C2.33345 13.6628 2.81836 13.0156 2.81836 12.25C2.81836 11.4844 2.33345 10.8372 1.66406 10.5986C1.26583 10.4566 1 10.0791 1 9.65625V6.5C1 4.84315 2.34315 3.5 4 3.5H20ZM4 5.5C3.44772 5.5 3 5.94772 3 6.5V9.03125C4.08987 9.68678 4.81836 10.8833 4.81836 12.25C4.81836 13.6165 4.08963 14.8122 3 15.4678V18C3 18.5523 3.44772 19 4 19H20C20.5523 19 21 18.5523 21 18V15.4678C19.9104 14.8122 19.1816 13.6165 19.1816 12.25C19.1816 10.8833 19.9101 9.68677 21 9.03125V6.5C21 5.94772 20.5523 5.5 20 5.5H4ZM15.793 6.79297C16.1835 6.40244 16.8165 6.40244 17.207 6.79297C17.5976 7.18349 17.5976 7.81651 17.207 8.20703L8.20703 17.207C7.81651 17.5976 7.18349 17.5976 6.79297 17.207C6.40244 16.8165 6.40244 16.1835 6.79297 15.793L15.793 6.79297ZM15.25 13.25C16.3546 13.25 17.25 14.1454 17.25 15.25C17.25 16.3546 16.3546 17.25 15.25 17.25C14.1454 17.25 13.25 16.3546 13.25 15.25C13.25 14.1454 14.1454 13.25 15.25 13.25ZM15.25 14.75C14.9739 14.75 14.75 14.9739 14.75 15.25C14.75 15.5261 14.9739 15.75 15.25 15.75C15.5261 15.75 15.75 15.5261 15.75 15.25C15.75 14.9739 15.5261 14.75 15.25 14.75ZM8.75 6.75C9.85457 6.75 10.75 7.64543 10.75 8.75C10.75 9.85457 9.85457 10.75 8.75 10.75C7.64543 10.75 6.75 9.85457 6.75 8.75C6.75 7.64543 7.64543 6.75 8.75 6.75ZM8.75 8.25C8.47386 8.25 8.25 8.47386 8.25 8.75C8.25 9.02614 8.47386 9.25 8.75 9.25C9.02614 9.25 9.25 9.02614 9.25 8.75C9.25 8.47386 9.02614 8.25 8.75 8.25Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {replaceTemplate(benefitPayloadData?.membershipBenefitData?.forNewMember, {\n amount: formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n }),\n })}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n )}\n {benefitPayloadData?.membershipBenefitData?.equities?.map((item: any, index: number) =>\n item.modalText ? (\n <li key={index} className=\"justify-between gap-2\">\n <button\n onClick={() => openModal?.({ title: item.label, content: item.modalText })}\n key={index}\n className=\"flex justify-between\"\n >\n <Picture source={item.icon} alt={item.text} className=\"size-6 shrink-0\" />\n <Text className=\"text-left text-[16px] font-bold x:text-[14px]\">{item.text}</Text>\n </button>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : (\n <li key={index} className=\"justify-between\">\n <div className=\"flex gap-2\">\n <Picture source={item.icon} alt={item.text} className=\" size-6 shrink-0\" />\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {item.label}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n )\n )}\n {/* \u9AD8\u6807\u7269\u6D41 */}\n {paidShipping.enable ? (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M19 3C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H10V16H21C21.5523 16 22 16.4477 22 17C22 17.5523 21.5523 18 21 18H19.9961C19.9961 19.6559 18.6547 21 16.998 21C15.3414 21 14 19.6559 14 18H10C10 19.6568 8.65684 21 7 21C5.34317 21 4 19.6568 4 18H2C1.44772 18 1 17.5523 1 17V10.6738L1.00488 10.5771C1.02632 10.3554 1.12145 10.146 1.27637 9.9834L4.77637 6.31055L4.84961 6.24023C5.02993 6.08586 5.26042 6 5.5 6H8V5C8 3.89544 8.89541 3 10 3H19ZM6.00488 18.1025C6.05622 18.6067 6.48234 19 7 19C7.51766 19 7.94378 18.6067 7.99512 18.1025L8 18H6L6.00488 18.1025ZM16.0049 18.1025C16.0561 18.6074 16.4823 19 16.998 19C17.5138 19 17.94 18.6074 17.9912 18.1025L17.9961 18H16L16.0049 18.1025ZM3 11.0723V16H8V8H5.92773L3 11.0723ZM21.6621 6.8252C22.0348 6.41765 22.6676 6.38902 23.0752 6.76172C23.4827 7.13443 23.5104 7.76725 23.1377 8.1748L18.0518 13.7363C17.6625 14.162 17.003 14.1954 16.5732 13.8105L13.333 10.9092C12.9216 10.5408 12.8865 9.90853 13.2549 9.49707C13.6232 9.08565 14.2555 9.05066 14.667 9.41895L17.208 11.6943L21.6621 6.8252Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {benefitPayloadData?.membershipBenefitData?.expressShipping}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : null}\n {/* \u79EF\u5206\u62B5\u73B0 */}\n {creditsRedemption.enable ? (\n <li>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n <Text as=\"p\" className=\"text-left text-[16px] font-bold x:text-[14px]\">\n {activated ? (\n creditsRedemption?.config?.label?.replace(\n '{{amount}}',\n formatPrice({\n amount: creditsRedemption?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n })\n )\n ) : (\n <>\n {benefitPayloadData?.membershipBenefitData?.creditsAfterActivation}\n <span role=\"button\" tabIndex={0} onClick={() => handleActivate()} className=\"underline\">\n {benefitPayloadData?.membershipBenefitData?.active}\n </span>\n </>\n )}\n </Text>\n </li>\n ) : null}\n </ul>\n </div>\n {!profile?.email && (\n <div className=\"px-4 pt-4\">\n <Button variant=\"primary\" className=\"w-full\" onClick={() => openSignUpPopup?.()}>\n {copyWriting?.signUp}\n </Button>\n </div>\n )}\n </div>\n </ProductBenefitsTabs.Content>\n <ProductBenefitsTabs.Content\n value=\"pay\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px] \"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.payBenefitData?.payMethod}\n </Heading>\n <div className=\"flex items-center gap-2 justify-between rounded-[16px] p-3 lg-desktop:p-4 bg-white\">\n <div className=\"flex items-center gap-2\">\n <Picture\n source={benefitPayloadData?.payBenefitData?.icon}\n className=\"size-[40px] h-[20px] desktop:size-[70px] desktop:h-[34px] shrink-0\"\n />\n <Text\n as=\"p\"\n className=\"text-left text-[16px] font-bold x:text-[14px]\"\n html={benefitPayloadData?.payBenefitData?.withCheckout}\n />\n </div>\n <button\n className=\"underline text-brand-0 whitespace-nowrap text-sm font-bold desktop:text-[16px]\"\n onClick={() => setIsFlexModalOpen(true)}\n >\n {benefitPayloadData?.payBenefitData?.learnMore}\n </button>\n </div>\n </div>\n\n <ModalContainer showModal={isFlexModalOpen} closeModal={() => setIsFlexModalOpen(false)}>\n <Picture source={benefitPayloadData?.payBenefitData?.payImage}></Picture>\n </ModalContainer>\n </ProductBenefitsTabs.Content>\n {/* \u81EA\u5B9A\u4E49\u5185\u5BB9 */}\n <ProductBenefitsTabs.Content\n value=\"installment\"\n className=\"benefits-tabs-content overflow-y-auto lg-desktop:h-[240px] desktop:h-[196px] h-[180px] laptop:h-[220px] \"\n >\n <div className=\"p-3 lg-desktop:p-4\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.installmentBenefitData?.flexibleInstallment}\n </Heading>\n <div className=\"overflow-hidden rounded-[16px] p-3 lg-desktop:p-4 bg-white\">{renderInstallments}</div>\n </div>\n </ProductBenefitsTabs.Content>\n </ProductBenefitsTabs>\n )\n}\n\nconst CheckedIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" {...props}>\n <path\n d=\"M4 9.19472L8.51935 13.667L16.2668 6.00024\"\n stroke=\"#2BBC4F\"\n strokeWidth=\"1.67\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\nexport default BenefitsTab\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAoHM,IAAAI,EAAA,6BAnHNC,EAAyD,8CACzDC,EAAgC,6CAChCC,EAAqC,0CACrCC,EAA4B,sCAC5BC,EAA4B,mCAC5BC,EAAgC,qCAChCC,EAA4D,iBAC5DC,EAA+B,6CAC/BC,EAAyB,mDACzBC,EAAoB,qCACpBC,EAAmB,2CACnBC,EAA2B,sDA+C3B,MAAMC,GAAqD,CACzD,WAAY,OACZ,SAAU,YACV,OAAQ,SACR,QAAS,UACT,UAAW,wBACX,cAAe,2BACf,SAAU,YACV,eAAgB,sCAChB,eAAgB,oCAChB,YAAa,kCACb,aAAc,6BACd,YAAa,2BACb,IAAK,OACL,uBAAwB,8DACxB,2BAA4B,gCAC5B,aAAc,8BACd,gBAAiB,0BACjB,uBAAwB,mDACxB,OAAQ,SACR,oBA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C,OAAQA,GAAoB,gBAAgB,KAC5C,UAAU,qEACZ,KACA,OAAC,QACC,GAAG,IACH,UAAU,gDACV,KAAMA,GAAoB,gBAAgB,aAC5C,GACF,KACA,OAAC,UACC,UAAU,iFACV,QAAS,IAAMgC,EAAmB,EAAI,EAErC,SAAAhC,GAAoB,gBAAgB,UACvC,GACF,GACF,KAEA,OAAC,EAAAiE,QAAA,CAAe,UAAWlC,EAAiB,WAAY,IAAMC,EAAmB,EAAK,EACpF,mBAAC,WAAQ,OAAQhC,GAAoB,gBAAgB,SAAU,EACjE,GACF,KAEA,OAAC,EAAAyD,QAAoB,QAApB,CACC,MAAM,cACN,UAAU,2GAEV,oBAAC,OAAI,UAAU,qBACb,oBAAC,WAAQ,KAAM,EAAG,UAAU,mCACzB,SAAAzD,GAAoB,wBAAwB,oBAC/C,KACA,OAAC,OAAI,UAAU,6DAA8D,SAAAqB,EAAmB,GAClG,EACF,GACF,CAEJ,EAEM2C,EAAeE,MAEjB,OAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAQ,GAAGA,EACjG,mBAAC,QACC,EAAE,4CACF,OAAO,UACP,YAAY,OACZ,cAAc,QACd,eAAe,QACjB,EACF,EAIJ,IAAOrF,GAAQoC",
|
|
6
|
+
"names": ["BenefitsTab_exports", "__export", "BenefitsTab_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_ProductBenefitsTabs", "import_BizProductProvider", "import_useBenefits", "import_utils", "import_textFormat", "import_react", "import_AiuiProvider", "import_useCountDown", "import_useCopy", "import_helpers", "import_ModalContainer", "defaultTextConfig", "CouponItem", "item", "textConfig", "benefitPayloadData", "trackingData", "isCopied", "copyToClipboard", "useCopy", "couponCopy", "days", "hours", "minutes", "seconds", "useCountDown", "openModal", "e", "CouponContent", "coupons", "className", "index", "BenefitsTab", "isLogin", "profile", "variant", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "savingDetail", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "product", "productBenefitsData", "isFlexModalOpen", "setIsFlexModalOpen", "benefits", "locale", "copyWriting", "scrollContainerRef", "mergedTextConfig", "activated", "memberDiscount", "commonCoupon", "creditsRedemption", "freeGift", "bundle", "paidShipping", "fullGift", "levelDiscount", "couponBenefitData", "membershipBenefitData", "installmentBenefitData", "payBenefitData", "value", "couponSaving", "memberSaving", "setProductBenefitsTabsValue", "productBenefitsTabsValue", "handleActivate", "ProductBenefitsTabs", "handleProductBenefitsTabListClick", "el", "container", "button", "scrollLeft", "benefitTabs", "CheckedIcon", "ModalContainer", "props"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
declare const ModalContainer: ({ title, className, showModal, closeModal, children, stickyHeader, }: PropsWithChildren<{
|
|
3
|
+
title?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
showModal: boolean;
|
|
6
|
+
closeModal: () => void;
|
|
7
|
+
needClickAway?: boolean;
|
|
8
|
+
stickyHeader?: boolean;
|
|
9
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default ModalContainer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var u=Object.create;var n=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},c=(e,o,t,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of x(o))!w.call(e,a)&&a!==t&&n(e,a,{get:()=>o[a],enumerable:!(l=v(o,a))||l.enumerable});return e};var m=(e,o,t)=>(t=e!=null?u(h(e)):{},c(o||!e||!e.__esModule?n(t,"default",{value:e,enumerable:!0}):t,e)),N=e=>c(n({},"__esModule",{value:!0}),e);var k={};y(k,{default:()=>C});module.exports=N(k);var i=require("react/jsx-runtime"),s=require("../../../../../../helpers/index.js"),r=require("framer-motion"),p=m(require("react")),d=m(require("../../../../../HeaderNavigation/icons/Close.js"));const g=({title:e,className:o,showModal:t,closeModal:l,children:a,stickyHeader:b=!0})=>{const f=p.default.useRef(null);return(0,i.jsx)(r.motion.div,{animate:t?{opacity:1}:{opacity:0,pointerEvents:"none"},transition:{duration:.1,bounce:0},className:"fixed left-0 top-0 z-[80] flex h-full w-full items-center justify-center bg-black bg-opacity-50 opacity-0",children:(0,i.jsx)(r.motion.div,{transition:{duration:.1,bounce:0},ref:f,animate:t?{scale:1}:{scale:.7},children:(0,i.jsxs)("div",{className:(0,s.cn)("relative z-1 max-h-[80vh] w-min min-w-[600px] overflow-scroll rounded-xl bg-white md:min-w-[90vw]",o),children:[(0,i.jsxs)("div",{className:(0,s.cn)(b&&"sticky top-0 z-[2] bg-white"),children:[e&&(0,i.jsx)("p",{className:(0,s.cn)("w-full border-b border-[#e6e6e6] py-[16px] pl-[20px] pr-[60px] text-[20px] font-bold"),children:e}),(0,i.jsx)("button",{onClick:l,className:"close-button absolute right-4 top-5 z-[2]","aria-label":"Close modal",children:(0,i.jsx)(d.default,{className:"h-[24px] w-[24px]"})})]}),a]})})})};var C=g;
|
|
2
|
+
//# sourceMappingURL=ModalContainer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.tsx"],
|
|
4
|
+
"sourcesContent": ["import { cn as classNames } from '../../../../../../helpers/index.js'\nimport { motion } from 'framer-motion'\nimport React, { type PropsWithChildren } from 'react'\nimport Close from '../../../../../HeaderNavigation/icons/Close.js'\n\nconst ModalContainer = ({\n title,\n className,\n showModal,\n closeModal,\n children,\n stickyHeader = true,\n}: PropsWithChildren<{\n title?: string\n className?: string\n showModal: boolean\n closeModal: () => void\n needClickAway?: boolean\n stickyHeader?: boolean\n}>) => {\n const modalRef = React.useRef<HTMLDivElement>(null)\n\n return (\n <motion.div\n animate={showModal ? { opacity: 1 } : { opacity: 0, pointerEvents: 'none' }}\n transition={{ duration: 0.1, bounce: 0 }}\n className=\"fixed left-0 top-0 z-[80] flex h-full w-full items-center justify-center bg-black bg-opacity-50 opacity-0\"\n >\n <motion.div\n transition={{ duration: 0.1, bounce: 0 }}\n ref={modalRef}\n animate={showModal ? { scale: 1 } : { scale: 0.7 }}\n >\n <div\n className={classNames(\n 'relative z-1 max-h-[80vh] w-min min-w-[600px] overflow-scroll rounded-xl bg-white md:min-w-[90vw]',\n className\n )}\n >\n <div className={classNames(stickyHeader && 'sticky top-0 z-[2] bg-white')}>\n {title && (\n <p\n className={classNames(\n 'w-full border-b border-[#e6e6e6] py-[16px] pl-[20px] pr-[60px] text-[20px] font-bold'\n )}\n >\n {title}\n </p>\n )}\n <button\n onClick={closeModal}\n className={'close-button absolute right-4 top-5 z-[2]'}\n aria-label=\"Close modal\"\n >\n <Close className=\"h-[24px] w-[24px]\" />\n </button>\n </div>\n {children}\n </div>\n </motion.div>\n </motion.div>\n )\n}\n\nexport default ModalContainer\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAuCU,IAAAI,EAAA,6BAvCVC,EAAiC,8CACjCC,EAAuB,yBACvBC,EAA8C,oBAC9CC,EAAkB,6DAElB,MAAMC,EAAiB,CAAC,CACtB,MAAAC,EACA,UAAAC,EACA,UAAAC,EACA,WAAAC,EACA,SAAAC,EACA,aAAAC,EAAe,EACjB,IAOO,CACL,MAAMC,EAAW,EAAAC,QAAM,OAAuB,IAAI,EAElD,SACE,OAAC,SAAO,IAAP,CACC,QAASL,EAAY,CAAE,QAAS,CAAE,EAAI,CAAE,QAAS,EAAG,cAAe,MAAO,EAC1E,WAAY,CAAE,SAAU,GAAK,OAAQ,CAAE,EACvC,UAAU,4GAEV,mBAAC,SAAO,IAAP,CACC,WAAY,CAAE,SAAU,GAAK,OAAQ,CAAE,EACvC,IAAKI,EACL,QAASJ,EAAY,CAAE,MAAO,CAAE,EAAI,CAAE,MAAO,EAAI,EAEjD,oBAAC,OACC,aAAW,EAAAM,IACT,oGACAP,CACF,EAEA,qBAAC,OAAI,aAAW,EAAAO,IAAWH,GAAgB,6BAA6B,EACrE,UAAAL,MACC,OAAC,KACC,aAAW,EAAAQ,IACT,sFACF,EAEC,SAAAR,EACH,KAEF,OAAC,UACC,QAASG,EACT,UAAW,4CACX,aAAW,cAEX,mBAAC,EAAAM,QAAA,CAAM,UAAU,oBAAoB,EACvC,GACF,EACCL,GACH,EACF,EACF,CAEJ,EAEA,IAAOZ,EAAQO",
|
|
6
|
+
"names": ["ModalContainer_exports", "__export", "ModalContainer_default", "__toCommonJS", "import_jsx_runtime", "import_helpers", "import_framer_motion", "import_react", "import_Close", "ModalContainer", "title", "className", "showModal", "closeModal", "children", "stickyHeader", "modalRef", "React", "classNames", "Close"]
|
|
7
|
+
}
|
package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var z=(r,a)=>{for(var l in a)n(r,l,{get:a[l],enumerable:!0})},L=(r,a,l,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let s of P(a))!O.call(r,s)&&s!==l&&n(r,s,{get:()=>a[s],enumerable:!(o=D(a,s))||o.enumerable});return r};var E=r=>L(n({},"__esModule",{value:!0}),r);var S={};z(S,{default:()=>F});module.exports=E(S);var t=require("react/jsx-runtime"),d=require("../../../../../../components"),p=require("../../../../../../helpers/index.js"),v=require("../../../../../AiuiProvider"),x=require("../../../../BizProductProvider.js"),u=require("../../../../utils");const w=()=>{const{locale:r="us"}=(0,v.useAiuiContext)(),{variant:a,bundle:l,checkedBundle:o,setCheckedBundle:s,setCheckedGift:g,savingDetail:h,setSavingDetail:k,setCheckedExchangePurchase:y,setJoinedRecommendBuyProducts:m}=(0,x.useBizProductContext)(),{title:C,bundleList:N,showAtListing:b}=l||{},f=N?.filter(e=>e.variants.slice(1,e.variants.length).every(c=>c.variant.availableForSale));if(!f?.length&&b)return null;const B=e=>{o?.id===e.id?(s?.(void 0),m?.({gift:{value:void 0,canOperate:!0},exchange:{value:void 0,canOperate:!0},bundle:{value:void 0,canOperate:!0}})):(g?.(void 0),y?.(void 0),s?.(e),k?.({...h,exchangePurchase:0}),m?.({gift:{value:void 0,canOperate:!0},exchange:{value:void 0,canOperate:!0},bundle:{value:e,canOperate:!1}}))};return(0,t.jsxs)("div",{className:"ipc-product-detail-bundle",children:[(0,t.jsx)(d.Text,{size:3,className:"font-bold",html:C}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 laptop:grid-cols-2 mt-3 desktop:grid-cols-1 desktop:mt-4",children:f?.map(e=>{const c=e.variants.filter(i=>i.variant.sku!==a.sku);return(0,t.jsx)("div",{children:(0,t.jsxs)("div",{className:(0,p.cn)("flex items-center gap-2 text-left font-bold px-4 rounded-box border-[#E4E5E6] border-2",{"border-brand":o?.id===e.id}),children:[(0,t.jsx)(d.Checkbox,{onCheckedChange:()=>B(e),size:"lg",className:(0,p.cn)("rounded-full border-[#D1D1D1] border-[2px]",{"border-brand":o?.id===e.id}),id:e.id,value:e.id,checked:o?.id===e.id}),(0,t.jsx)("label",{htmlFor:e.id,className:"size-full cursor-pointer py-6",children:c?.map(i=>(0,t.jsxs)("div",{className:"flex justify-between items-center gap-6 ",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Picture,{source:i?.variant?.image?.url,className:"size-12 flex-shrink-0"}),(0,t.jsx)(d.Text,{className:"text-sm laptop:text-[16px] line-clamp-2 lg-desktop:text-[18px] font-bold",html:i.variant.product.title})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1 laptop:flex-row flex-col shrink-0",children:[(0,t.jsx)(d.Text,{className:"text-base laptop:text-[20px] lg-desktop:text-2xl font-bold",html:(0,u.formatPrice)({amount:i.price,locale:r,currencyCode:i.variant.price.currencyCode})}),i.price<i.variant.price.amount&&(0,t.jsx)(d.Text,{className:"text-base laptop:text-[20px] lg-desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:(0,u.formatPrice)({amount:i.variant.price.amount,locale:r,currencyCode:i.variant.price.currencyCode})})]})]},i.variant.id))})]})},e.id)})})]})};var F=w;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Picture, Button, Checkbox } from '../../../../../../components'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils'\nimport type { BundleListItem } from '../../../../types/product'\n\nconst ProductBundle = () => {\n const { locale = 'us' } = useAiuiContext()\n const {\n variant,\n bundle,\n checkedBundle,\n setCheckedBundle,\n setCheckedGift,\n savingDetail,\n setSavingDetail,\n setCheckedExchangePurchase,\n setJoinedRecommendBuyProducts,\n
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["ProductBundle_exports", "__export", "ProductBundle_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_AiuiProvider", "import_BizProductProvider", "import_utils", "ProductBundle", "locale", "variant", "bundle", "checkedBundle", "setCheckedBundle", "setCheckedGift", "savingDetail", "setSavingDetail", "setCheckedExchangePurchase", "setJoinedRecommendBuyProducts", "
|
|
4
|
+
"sourcesContent": ["import { Text, Picture, Button, Checkbox } from '../../../../../../components'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils'\nimport type { BundleListItem } from '../../../../types/product'\n\nconst ProductBundle = () => {\n const { locale = 'us' } = useAiuiContext()\n const {\n variant,\n bundle,\n checkedBundle,\n setCheckedBundle,\n setCheckedGift,\n savingDetail,\n setSavingDetail,\n setCheckedExchangePurchase,\n setJoinedRecommendBuyProducts,\n } = useBizProductContext()\n\n const { title, bundleList, showAtListing } = bundle || {}\n\n const availableBundleList = bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n )\n\n if (!availableBundleList?.length && showAtListing) return null\n\n const handleSelectedChange = (bundleItem: BundleListItem) => {\n if (checkedBundle?.id === bundleItem.id) {\n setCheckedBundle?.(undefined)\n setJoinedRecommendBuyProducts?.({\n gift: {\n value: undefined,\n canOperate: true,\n },\n exchange: {\n value: undefined,\n canOperate: true,\n },\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n } else {\n setCheckedGift?.(undefined)\n setCheckedExchangePurchase?.(undefined)\n setCheckedBundle?.(bundleItem)\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n gift: {\n value: undefined,\n canOperate: true,\n },\n exchange: {\n value: undefined,\n canOperate: true,\n },\n bundle: {\n value: bundleItem,\n canOperate: false,\n },\n })\n }\n }\n\n return (\n <div className=\"ipc-product-detail-bundle\">\n <Text size={3} className=\"font-bold\" html={title} />\n <div className=\"grid grid-cols-1 gap-3 laptop:grid-cols-2 mt-3 desktop:grid-cols-1 desktop:mt-4\">\n {availableBundleList?.map(bundle => {\n const bundleVariants = bundle.variants.filter(v => v.variant.sku !== variant.sku)\n return (\n <div key={bundle.id}>\n <div\n className={cn(\n 'flex items-center gap-2 text-left font-bold px-4 rounded-box border-[#E4E5E6] border-2',\n {\n ['border-brand']: checkedBundle?.id === bundle.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleSelectedChange(bundle)}\n size=\"lg\"\n className={cn('rounded-full border-[#D1D1D1] border-[2px]', {\n 'border-brand': checkedBundle?.id === bundle.id,\n })}\n id={bundle.id}\n value={bundle.id}\n checked={checkedBundle?.id === bundle.id}\n />\n <label htmlFor={bundle.id} className=\"size-full cursor-pointer py-6\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex justify-between items-center gap-6 \" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-2\">\n <Picture source={bundleVariant?.variant?.image?.url} className=\"size-12 flex-shrink-0\" />\n <Text\n className=\"text-sm laptop:text-[16px] line-clamp-2 lg-desktop:text-[18px] font-bold\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n <div className=\"flex items-center justify-end gap-1 laptop:flex-row flex-col shrink-0\">\n <Text\n className=\"text-base laptop:text-[20px] lg-desktop:text-2xl font-bold\"\n html={formatPrice({\n amount: bundleVariant.price,\n locale,\n currencyCode: bundleVariant.variant.price.currencyCode,\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"text-base laptop:text-[20px] lg-desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount,\n locale,\n currencyCode: bundleVariant.variant.price.currencyCode,\n })}\n />\n )}\n </div>\n </div>\n )\n })}\n </label>\n </div>\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nexport default ProductBundle\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsEM,IAAAI,EAAA,6BAtENC,EAAgD,wCAChDC,EAAmB,8CACnBC,EAA+B,uCAC/BC,EAAqC,6CACrCC,EAA4B,6BAG5B,MAAMC,EAAgB,IAAM,CAC1B,KAAM,CAAE,O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EA,oBAAC,YACC,gBAAiB,IAAMa,EAAqBb,CAAM,EAClD,KAAK,KACL,aAAW,MAAG,6CAA8C,CAC1D,eAAgBC,GAAe,KAAOD,EAAO,EAC/C,CAAC,EACD,GAAIA,EAAO,GACX,MAAOA,EAAO,GACd,QAASC,GAAe,KAAOD,EAAO,GACxC,KACA,OAAC,SAAM,QAASA,EAAO,GAAI,UAAU,gCAClC,SAAAe,GAAgB,IAAIC,MAEjB,QAAC,OAAI,UAAU,2CACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,WAAQ,OAAQA,GAAe,SAAS,OAAO,IAAK,UAAU,wBAAwB,KACvF,OAAC,QACC,UAAU,2EACV,KAAMA,EAAc,QAAQ,QAAQ,MACtC,GACF,KACA,QAAC,OAAI,UAAU,yEACb,oBAAC,QACC,UAAU,6DACV,QAAM,eAAY,CAChB,OAAQA,EAAc,MACtB,OAAAlB,EACA,aAAckB,EAAc,QAAQ,MAAM,YAC5C,CAAC,EACH,EACCA,EAAc,MAAQA,EAAc,QAAQ,MAAM,WACjD,OAAC,QACC,UAAU,yFACV,QAAM,eAAY,CAChB,OAAQA,EAAc,QAAQ,MAAM,OACpC,OAAAlB,EACA,aAAckB,EAAc,QAAQ,MAAM,YAC5C,CAAC,EACH,GAEJ,IA3B6DA,EAAc,QAAQ,EA4BrF,CAEH,EACH,GACF,GAtDQhB,EAAO,EAuDjB,CAEJ,CAAC,EACH,GACF,CAEJ,EAEA,IAAOX,EAAQQ",
|
|
6
|
+
"names": ["ProductBundle_exports", "__export", "ProductBundle_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_AiuiProvider", "import_BizProductProvider", "import_utils", "ProductBundle", "locale", "variant", "bundle", "checkedBundle", "setCheckedBundle", "setCheckedGift", "savingDetail", "setSavingDetail", "setCheckedExchangePurchase", "setJoinedRecommendBuyProducts", "title", "bundleList", "showAtListing", "availableBundleList", "v", "handleSelectedChange", "bundleItem", "bundleVariants", "bundleVariant"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var W=Object.create;var M=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var K=(t,a)=>{for(var o in a)M(t,o,{get:a[o],enumerable:!0})},D=(t,a,o,g)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of U(a))!q.call(t,r)&&r!==o&&M(t,r,{get:()=>a[r],enumerable:!(g=O(a,r))||g.enumerable});return t};var J=(t,a,o)=>(o=t!=null?W(Z(t)):{},D(a||!t||!t.__esModule?M(o,"default",{value:t,enumerable:!0}):o,t)),Q=t=>D(M({},"__esModule",{value:!0}),t);var ae={};K(ae,{default:()=>le});module.exports=Q(ae);var e=require("react/jsx-runtime"),_=require("../../../../AiuiProvider/index.js"),k=require("../../../../../components"),l=require("react"),N=require("swiper/react"),u=require("swiper/modules"),b=require("../../../../../helpers/index.js"),T=require("./types.js"),I=require("@radix-ui/react-tabs"),z=require("../../../BizProductProvider.js"),j=require("../../../hooks/use-variant-media.js"),H=require("./components/SpecsModal.js"),Y=J(require("./components/CompareModal.js")),$=require("../../../utils/index.js");const B=t=>(0,e.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,e.jsx)("rect",{x:"48",y:"48",width:"48",height:"48",rx:"24",transform:"rotate(-180 48 48)",fill:"white"}),(0,e.jsx)("path",{d:"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z",fill:"currentColor"})]}),F=t=>(0,e.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,e.jsx)("rect",{width:"48",height:"48",rx:"24",transform:"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)",fill:"white"}),(0,e.jsx)("path",{d:"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z",fill:"currentColor"})]}),X=()=>{const{copyWriting:t}=(0,_.useAiuiContext)(),{product:a,variant:o,selectedOptions:g}=(0,z.useBizProductContext)(),r=(0,j.useVariantMedia)({product:a,variant:o}),[f,v]=(0,l.useState)(null),n=o?.metafields?.component?.custom_media_list;let h,w,S,y;n&&n?.available?(h=n?.product||[],w=n?.scenarios||[],S=n?.keyFeatures||[],y=n?.video||[]):(h=r?.productList,w=r?.sceneList,S=r?.keyFeaturesList,y=r?.videoList);const A=(0,l.useMemo)(()=>[...h,...w,...y],[h,w,y]),p={productList:h,sceneList:w,keyFeaturesList:S,videoList:y},d=(0,l.useMemo)(()=>(a?.payload?.components?.find(c=>c.componentKey==="ProductGallery")?.data||[])?.map(c=>({...c,galleries:p[c?.galleries]||[]})).filter(c=>c.galleries.length>0),[a?.payload,p]),[G,L]=(0,l.useState)(d?.[0]),[C,P]=(0,l.useState)(0),[E,x]=(0,l.useState)(null),s=(0,l.useCallback)(()=>{const i=(C+1)%d.length;P(i),L(d[i]),x(0)},[C,d]),m=(0,l.useCallback)(()=>{const i=C===0?d.length-1:C-1;P(i),L(d[i]);const c=d[i]?.galleries||[];x(c.length-1)},[C,d]);(0,l.useEffect)(()=>{L(d[0])},[o?.id]);const V=(i,c)=>{switch(i?.galleryTabType){case T.GalleryTabType.GALLERY_IMAGE_MAIN:return(0,e.jsx)(R,{...i,index:c,onNextTab:s,onPrevTab:m,targetSlideIndex:E,onSlideChange:()=>x(null)});case T.GalleryTabType.GALLERY_IMAGE_FEATURES:return(0,e.jsx)(R,{...i,index:c,onNextTab:s,onPrevTab:m,targetSlideIndex:E,onSlideChange:()=>x(null)});case T.GalleryTabType.GALLERY_IMAGE_SCENE:return(0,e.jsx)(R,{...i,index:c,onNextTab:s,onPrevTab:m,targetSlideIndex:E,onSlideChange:()=>x(null)});case T.GalleryTabType.GALLERY_VIDEO:return(0,e.jsx)(te,{...i,onNextTab:s,onPrevTab:m,targetSlideIndex:E,onSlideChange:()=>x(null)});default:return null}};return(0,e.jsx)("div",{id:"ipc-product-gallery",children:(0,e.jsxs)(I.Root,{className:"relative",value:G?.tabValue,defaultValue:d?.[0]?.tabValue,children:[(0,e.jsx)("div",{className:"h-[420px] overflow-hidden tablet:h-[620px] desktop:rounded-2xl desktop:h-[560px] lg-desktop:h-[700px] bg-[#EAEAEC] desktop:relative ",children:d.map((i,c)=>(0,e.jsx)(I.Content,{className:"h-full",value:i.tabValue,children:V(i,c)},i.tabValue))}),(0,e.jsx)(ee,{galleryTabs:d,activeGalleryTab:G,setActiveGalleryTab:L,setActiveTabIndex:P,setTargetSlideIndex:x})]})})},ee=({galleryTabs:t,activeGalleryTab:a,setActiveGalleryTab:o,setActiveTabIndex:g,setTargetSlideIndex:r})=>{const{product:f}=(0,z.useBizProductContext)(),v=(0,l.useRef)(null);return(0,e.jsxs)("div",{className:"absolute z-[2] bottom-4 left-4 right-4 laptop:left-16 laptop:right-16 flex justify-between items-center tablet:mt-3 desktop:static",children:[(0,e.jsx)(I.List,{ref:v,className:"rounded-full bg-[#EAEAEC] p-1 laptop:p-0 desktop:p-1 overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,e.jsx)("div",{className:"whitespace-nowrap",children:t?.map((n,h)=>(0,e.jsx)(I.Trigger,{className:(0,b.cn)("lg-desktop:px-7 lg-desktop:pb-[14px] rounded-full font-bold lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",n.tabValue===a?.tabValue&&"bg-white"),onClick:w=>{if(o(n),g(h),r(0),v.current){const S=v.current,y=w.currentTarget,A=y.offsetLeft-S.offsetWidth/2+y.offsetWidth/2;S.scrollTo({left:A,behavior:"smooth"})}},value:n.tabValue,children:n.tabLabel},n.tabValue))})}),(0,e.jsx)("div",{className:"laptop:gap-2 hidden laptop:flex",children:f.metafields?.global?.specifications&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(H.SpecsModal,{})," | ",(0,e.jsx)(Y.default,{})]})})]})},R=(0,l.forwardRef)((t,a)=>{const{locale:o="us",copyWriting:g}=(0,_.useAiuiContext)(),{variant:r,totalSavings:f}=(0,z.useBizProductContext)(),v=(0,l.useRef)(null),[n,h]=(0,l.useState)(null),[w,S]=(0,l.useState)(!0),[y,A]=(0,l.useState)(!1),[p,d]=(0,l.useState)(null),G=(0,l.useRef)(null),[L,C]=(0,l.useState)(!1),P=(0,l.useMemo)(()=>{if(t?.galleryTabType===T.GalleryTabType.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";t?.galleryTabType===T.GalleryTabType.GALLERY_IMAGE_FEATURES||(t?.galleryTabType,T.GalleryTabType.GALLERY_IMAGE_SCENE)},[t?.galleryTabType]),E=(0,l.useCallback)(()=>{p?.isBeginning?t.onPrevTab?.():p?.slidePrev()},[p,t]),x=(0,l.useCallback)(()=>{p?.isEnd?t.onNextTab?.():p?.slideNext()},[p,t]);return(0,l.useEffect)(()=>{p&&t.targetSlideIndex&&(p.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[p,t.targetSlideIndex,t]),(0,l.useEffect)(()=>{if(G.current){const s=G.current,m=s.scrollHeight,V=s.clientHeight,i=m>V;C(i)}},[]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(N.Swiper,{ref:a,className:"h-full",onSwiper:d,onProgress:s=>{S(s.isBeginning),A(s.isEnd)},pagination:{clickable:!0,el:v.current},thumbs:{swiper:n},modules:[u.Mousewheel,u.Thumbs,u.Navigation,u.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((s,m)=>(0,e.jsx)(N.SwiperSlide,{className:"h-full",children:(0,e.jsx)(k.Picture,{source:s?.image?.url,alt:s?.image?.altText,className:(0,b.cn)("h-full",P),imgClassName:"object-cover h-full"})},t?.id+"SwiperSlideItem"+m))}),r.availableForSale&&!!f&&!t.index&&(0,e.jsx)(k.Badge,{size:"lg",className:"absolute bg-brand text-white top-3 laptop:left-16 laptop:top-5 left-4 z-[2] desktop:left-6 desktop:top-6",children:`${(0,$.formatPrice)({amount:f,currencyCode:r?.price?.currencyCode,locale:o})} ${g?.off}`}),(0,e.jsx)("div",{className:(0,b.cn)("hidden tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 desktop:left-6 z-10 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:E,children:(0,e.jsx)(B,{className:(0,b.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsx)("div",{className:(0,b.cn)("hidden tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 z-10 desktop:right-6 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:x,children:(0,e.jsx)(F,{className:(0,b.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsxs)("div",{className:"absolute bottom-[94px] tablet:bottom-[70px] left-4 right-4 z-10 items-center tablet:flex justify-between laptop:left-16 laptop:right-16 desktop:bottom-[20px] desktop:right-6 desktop:left-6",children:[(0,e.jsx)("div",{className:"hidden tablet:block",children:(0,e.jsx)(N.Swiper,{className:"flex items-center justify-between",onSwiper:h,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[u.Navigation,u.Thumbs],children:t?.galleries?.map((s,m)=>(0,e.jsx)(N.SwiperSlide,{className:"!w-auto [&.swiper-slide-thumb-active]:border [&.swiper-slide-thumb-active]:rounded [&.swiper-slide-thumb-active]:border-brand",children:(0,e.jsx)(k.Picture,{source:s.image?.url,alt:s.image?.altText,className:"size-10 lg-desktop:size-12 overflow-hidden bg-white rounded",imgClassName:"object-contain h-full"})},t?.id+"SwiperSlideThumbItem"+m))})}),!t?.index&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(k.Picture,{source:t?.comment?.avatar?.url,className:"size-8 laptop:size-10 rounded-full shrink-0",imgClassName:"object-cover "}),(0,e.jsx)("div",{className:"overflow-hidden max-w-[528px] relative",children:(0,e.jsx)("div",{ref:G,className:(0,b.cn)("h-10 lg-desktop:h-12",L?"animate-marquee-scroll":""),style:{animationDuration:"3s"},children:(0,e.jsx)(k.Text,{html:t?.comment?.content,className:"text-sm lg-desktop:text-base font-bold text-[#1D1D1F]"})})})]})]}),(0,e.jsx)("div",{ref:v,className:"tablet:hidden text-center absolute !bottom-[70px] left-4 right-4 z-10"})]})}),te=t=>{const[a,o]=(0,l.useState)(null),g=(0,l.useCallback)(()=>{a?.isBeginning?t.onPrevTab?.():a?.slidePrev()},[a,t]),r=(0,l.useCallback)(()=>{a?.isEnd?t.onNextTab?.():a?.slideNext()},[a,t]);return(0,l.useEffect)(()=>{a&&t.targetSlideIndex!==null&&t.targetSlideIndex!==void 0&&(a.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[a,t.targetSlideIndex,t]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(N.Swiper,{className:"h-full",onSwiper:o,modules:[u.Mousewheel,u.Thumbs,u.Navigation,u.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((f,v)=>(0,e.jsx)(N.SwiperSlide,{className:"h-full",children:(0,e.jsxs)("video",{controls:!0,className:"size-full",children:[(0,e.jsx)("track",{kind:"captions"}),(0,e.jsx)("source",{src:f?.sources?.[0]?.url,type:"video/mp4"}),(0,e.jsx)("source",{src:f?.sources?.[0]?.url,type:"video/webm"}),(0,e.jsx)("source",{src:f?.sources?.[0]?.url,type:"video/ogg"})]})},t?.id+"SwiperSlideItem"+v))}),(0,e.jsx)("div",{className:(0,b.cn)("hidden swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:g,children:(0,e.jsx)(B,{className:"tablet:size-10 lg-desktop:size-12"})}),(0,e.jsx)("div",{className:(0,b.cn)("hidden tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:r,children:(0,e.jsx)(F,{className:"tablet:size-10 lg-desktop:size-12"})})]})},re=t=>(0,e.jsx)("div",{children:"3D View"});var le=X;
|
|
1
|
+
"use strict";var W=Object.create;var M=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var K=(t,a)=>{for(var o in a)M(t,o,{get:a[o],enumerable:!0})},D=(t,a,o,g)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of U(a))!q.call(t,r)&&r!==o&&M(t,r,{get:()=>a[r],enumerable:!(g=O(a,r))||g.enumerable});return t};var J=(t,a,o)=>(o=t!=null?W(Z(t)):{},D(a||!t||!t.__esModule?M(o,"default",{value:t,enumerable:!0}):o,t)),Q=t=>D(M({},"__esModule",{value:!0}),t);var ae={};K(ae,{default:()=>le});module.exports=Q(ae);var e=require("react/jsx-runtime"),_=require("../../../../AiuiProvider/index.js"),k=require("../../../../../components"),l=require("react"),N=require("swiper/react"),u=require("swiper/modules"),m=require("../../../../../helpers/index.js"),T=require("./types.js"),I=require("@radix-ui/react-tabs"),z=require("../../../BizProductProvider.js"),j=require("../../../hooks/use-variant-media.js"),H=require("./components/SpecsModal.js"),Y=J(require("./components/CompareModal.js")),$=require("../../../utils/index.js");const B=t=>(0,e.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,e.jsx)("rect",{x:"48",y:"48",width:"48",height:"48",rx:"24",transform:"rotate(-180 48 48)",fill:"white"}),(0,e.jsx)("path",{d:"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z",fill:"currentColor"})]}),F=t=>(0,e.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,e.jsx)("rect",{width:"48",height:"48",rx:"24",transform:"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)",fill:"white"}),(0,e.jsx)("path",{d:"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z",fill:"currentColor"})]}),X=()=>{const{copyWriting:t}=(0,_.useAiuiContext)(),{product:a,variant:o,selectedOptions:g}=(0,z.useBizProductContext)(),r=(0,j.useVariantMedia)({product:a,variant:o}),[f,h]=(0,l.useState)(null),n=o?.metafields?.component?.custom_media_list;let v,x,S,y;n&&n?.available?(v=n?.product||[],x=n?.scenarios||[],S=n?.keyFeatures||[],y=n?.video||[]):(v=r?.productList,x=r?.sceneList,S=r?.keyFeaturesList,y=r?.videoList);const A=(0,l.useMemo)(()=>[...v,...x,...y],[v,x,y]),p={productList:v,sceneList:x,keyFeaturesList:S,videoList:y},d=(0,l.useMemo)(()=>(a?.payload?.components?.find(c=>c.componentKey==="ProductGallery")?.data||[])?.map(c=>({...c,galleries:p[c?.galleries]||[]})).filter(c=>c.galleries.length>0),[a?.payload,p]),[G,L]=(0,l.useState)(d?.[0]),[C,P]=(0,l.useState)(0),[E,w]=(0,l.useState)(null),s=(0,l.useCallback)(()=>{const i=(C+1)%d.length;P(i),L(d[i]),w(0)},[C,d]),b=(0,l.useCallback)(()=>{const i=C===0?d.length-1:C-1;P(i),L(d[i]);const c=d[i]?.galleries||[];w(c.length-1)},[C,d]);(0,l.useEffect)(()=>{L(d[0])},[o?.id]);const V=(i,c)=>{switch(i?.galleryTabType){case T.GalleryTabType.GALLERY_IMAGE_MAIN:return(0,e.jsx)(R,{...i,index:c,onNextTab:s,onPrevTab:b,targetSlideIndex:E,onSlideChange:()=>w(null)});case T.GalleryTabType.GALLERY_IMAGE_FEATURES:return(0,e.jsx)(R,{...i,index:c,onNextTab:s,onPrevTab:b,targetSlideIndex:E,onSlideChange:()=>w(null)});case T.GalleryTabType.GALLERY_IMAGE_SCENE:return(0,e.jsx)(R,{...i,index:c,onNextTab:s,onPrevTab:b,targetSlideIndex:E,onSlideChange:()=>w(null)});case T.GalleryTabType.GALLERY_VIDEO:return(0,e.jsx)(te,{...i,onNextTab:s,onPrevTab:b,targetSlideIndex:E,onSlideChange:()=>w(null)});default:return null}};return(0,e.jsx)("div",{id:"ipc-product-gallery",children:(0,e.jsxs)(I.Root,{className:"relative",value:G?.tabValue,defaultValue:d?.[0]?.tabValue,children:[(0,e.jsx)("div",{className:"h-[420px] overflow-hidden tablet:h-[620px] desktop:rounded-2xl desktop:h-[560px] lg-desktop:h-[700px] bg-[#EAEAEC] desktop:relative ",children:d.map((i,c)=>(0,e.jsx)(I.Content,{className:"h-full",value:i.tabValue,children:V(i,c)},i.tabValue))}),(0,e.jsx)(ee,{galleryTabs:d,activeGalleryTab:G,setActiveGalleryTab:L,setActiveTabIndex:P,setTargetSlideIndex:w})]})})},ee=({galleryTabs:t,activeGalleryTab:a,setActiveGalleryTab:o,setActiveTabIndex:g,setTargetSlideIndex:r})=>{const{product:f}=(0,z.useBizProductContext)(),h=(0,l.useRef)(null);return(0,e.jsxs)("div",{className:"absolute z-[2] bottom-4 left-4 right-4 laptop:left-16 laptop:right-16 flex justify-between items-center tablet:mt-3 desktop:static",children:[(0,e.jsx)(I.List,{ref:h,className:"rounded-full bg-[#EAEAEC] p-1 laptop:p-0 desktop:p-1 overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,e.jsx)("div",{className:"whitespace-nowrap",children:t?.map((n,v)=>(0,e.jsx)(I.Trigger,{className:(0,m.cn)("lg-desktop:px-7 lg-desktop:pb-[14px] rounded-full font-bold lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",n.tabValue===a?.tabValue&&"bg-white"),onClick:x=>{if(o(n),g(v),r(0),h.current){const S=h.current,y=x.currentTarget,A=y.offsetLeft-S.offsetWidth/2+y.offsetWidth/2;S.scrollTo({left:A,behavior:"smooth"})}},value:n.tabValue,children:n.tabLabel},n.tabValue))})}),(0,e.jsx)("div",{className:"laptop:gap-2 hidden laptop:flex",children:f.metafields?.global?.specifications&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(H.SpecsModal,{})," | ",(0,e.jsx)(Y.default,{})]})})]})},R=(0,l.forwardRef)((t,a)=>{const{locale:o="us",copyWriting:g}=(0,_.useAiuiContext)(),{variant:r,totalSavings:f}=(0,z.useBizProductContext)(),h=(0,l.useRef)(null),[n,v]=(0,l.useState)(null),[x,S]=(0,l.useState)(!0),[y,A]=(0,l.useState)(!1),[p,d]=(0,l.useState)(null),G=(0,l.useRef)(null),[L,C]=(0,l.useState)(!1),P=(0,l.useMemo)(()=>{if(t?.galleryTabType===T.GalleryTabType.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";t?.galleryTabType===T.GalleryTabType.GALLERY_IMAGE_FEATURES||(t?.galleryTabType,T.GalleryTabType.GALLERY_IMAGE_SCENE)},[t?.galleryTabType]),E=(0,l.useCallback)(()=>{p?.isBeginning?t.onPrevTab?.():p?.slidePrev()},[p,t]),w=(0,l.useCallback)(()=>{p?.isEnd?t.onNextTab?.():p?.slideNext()},[p,t]);return(0,l.useEffect)(()=>{p&&t.targetSlideIndex&&(p.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[p,t.targetSlideIndex,t]),(0,l.useEffect)(()=>{if(G.current){const s=G.current,b=s.scrollHeight,V=s.clientHeight,i=b>V;C(i)}},[]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(N.Swiper,{ref:a,className:"h-full",onSwiper:d,onProgress:s=>{S(s.isBeginning),A(s.isEnd)},pagination:{clickable:!0,el:h.current},thumbs:{swiper:n},modules:[u.Mousewheel,u.Thumbs,u.Navigation,u.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((s,b)=>(0,e.jsx)(N.SwiperSlide,{className:"h-full",children:(0,e.jsx)(k.Picture,{source:s?.image?.url,alt:s?.image?.altText,className:(0,m.cn)("h-full",P),imgClassName:"object-cover h-full"})},t?.id+"SwiperSlideItem"+b))}),r.availableForSale&&!!f&&!t.index&&(0,e.jsx)(k.Badge,{size:"lg",className:"absolute bg-brand text-white top-3 laptop:left-16 laptop:top-5 left-4 z-[2] desktop:left-6 desktop:top-6",children:`${(0,$.formatPrice)({amount:f,currencyCode:r?.price?.currencyCode,locale:o})} ${g?.off}`}),(0,e.jsx)("div",{className:(0,m.cn)("hidden tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 desktop:left-6 z-10 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:E,children:(0,e.jsx)(B,{className:(0,m.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsx)("div",{className:(0,m.cn)("hidden tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 z-10 desktop:right-6 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:w,children:(0,e.jsx)(F,{className:(0,m.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsxs)("div",{className:"absolute bottom-[94px] tablet:bottom-[70px] left-4 right-4 z-10 items-center tablet:flex justify-between laptop:left-16 laptop:right-16 desktop:bottom-[20px] desktop:right-6 desktop:left-6",children:[(0,e.jsx)("div",{className:"hidden tablet:block",children:(0,e.jsx)(N.Swiper,{className:"flex items-center justify-between",onSwiper:v,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[u.Navigation,u.Thumbs],children:t?.galleries?.map((s,b)=>(0,e.jsx)(N.SwiperSlide,{className:"!w-auto [&.swiper-slide-thumb-active]:border [&.swiper-slide-thumb-active]:rounded [&.swiper-slide-thumb-active]:border-brand",children:(0,e.jsx)(k.Picture,{source:s.image?.url,alt:s.image?.altText,className:"size-10 lg-desktop:size-12 overflow-hidden bg-white rounded",imgClassName:"object-contain h-full"})},t?.id+"SwiperSlideThumbItem"+b))})}),!t?.index&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(k.Picture,{source:t?.comment?.avatar?.url,className:"size-8 laptop:size-10 rounded-full shrink-0",imgClassName:"object-cover "}),(0,e.jsx)("div",{className:"overflow-hidden max-w-[528px] relative",children:(0,e.jsx)("div",{ref:G,className:(0,m.cn)("h-10 lg-desktop:h-12",L?"animate-marquee-scroll":""),style:{animationDuration:"3s"},children:(0,e.jsx)(k.Text,{html:t?.comment?.content,className:"text-sm lg-desktop:text-base font-bold text-[#1D1D1F]"})})})]})]}),(0,e.jsx)("div",{ref:h,className:"tablet:hidden [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100 [&_.swiper-pagination-bullet]:bg-white text-center absolute !bottom-[70px] left-4 right-4 z-10"})]})}),te=t=>{const[a,o]=(0,l.useState)(null),g=(0,l.useCallback)(()=>{a?.isBeginning?t.onPrevTab?.():a?.slidePrev()},[a,t]),r=(0,l.useCallback)(()=>{a?.isEnd?t.onNextTab?.():a?.slideNext()},[a,t]);return(0,l.useEffect)(()=>{a&&t.targetSlideIndex!==null&&t.targetSlideIndex!==void 0&&(a.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[a,t.targetSlideIndex,t]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(N.Swiper,{className:"h-full",onSwiper:o,modules:[u.Mousewheel,u.Thumbs,u.Navigation,u.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((f,h)=>(0,e.jsx)(N.SwiperSlide,{className:"h-full",children:(0,e.jsxs)("video",{controls:!0,className:"size-full",children:[(0,e.jsx)("track",{kind:"captions"}),(0,e.jsx)("source",{src:f?.sources?.[0]?.url,type:"video/mp4"}),(0,e.jsx)("source",{src:f?.sources?.[0]?.url,type:"video/webm"}),(0,e.jsx)("source",{src:f?.sources?.[0]?.url,type:"video/ogg"})]})},t?.id+"SwiperSlideItem"+h))}),(0,e.jsx)("div",{className:(0,m.cn)("hidden swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:g,children:(0,e.jsx)(B,{className:"tablet:size-10 lg-desktop:size-12"})}),(0,e.jsx)("div",{className:(0,m.cn)("hidden tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:r,children:(0,e.jsx)(F,{className:"tablet:size-10 lg-desktop:size-12"})})]})},re=t=>(0,e.jsx)("div",{children:"3D View"});var le=X;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|