@anker-in/headless-ui 1.1.14 → 1.1.16-beta.3
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/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/AccordionCards/index.js.map +2 -2
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.js.map +2 -2
- package/dist/cjs/biz-components/Category/SwiperCategory.d.ts +1 -1
- package/dist/cjs/biz-components/Category/SwiperCategory.js +1 -1
- package/dist/cjs/biz-components/Category/SwiperCategory.js.map +3 -3
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Category/index.js.map +3 -3
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
- package/dist/cjs/biz-components/FooterNavigation/icons/Subtract.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/icons/Subtract.js.map +2 -2
- package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/index.js.map +2 -2
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.js +1 -1
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/Close.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/Close.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/DownArrow.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/DownArrow.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/LeftArrow.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/LeftArrow.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/RightArrow.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/RightArrow.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
- 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/MediaPlayerMulti/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js.map +2 -2
- package/dist/cjs/biz-components/MediaPlayerSticky/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerSticky/index.js.map +3 -3
- package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
- package/dist/cjs/biz-components/MemberEquity/index.js.map +2 -2
- package/dist/cjs/biz-components/NavigationSearch/index.js +2 -2
- package/dist/cjs/biz-components/NavigationSearch/index.js.map +2 -2
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.d.ts +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js.map +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/cjs/biz-components/Slogan/index.js +1 -1
- package/dist/cjs/biz-components/Slogan/index.js.map +1 -1
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/biz-components/Specs/index.js.map +2 -2
- package/dist/cjs/biz-components/Subscribe/index.js.map +2 -2
- package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
- package/dist/cjs/biz-components/Tabs/Tabs.js.map +2 -2
- package/dist/cjs/biz-components/TabsGroup/index.js +1 -1
- package/dist/cjs/biz-components/TabsGroup/index.js.map +2 -2
- package/dist/cjs/biz-components/TextModal/index.js +1 -1
- package/dist/cjs/biz-components/TextModal/index.js.map +2 -2
- package/dist/cjs/biz-components/VideoModal/index.js +1 -1
- package/dist/cjs/biz-components/VideoModal/index.js.map +2 -2
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/components/container.js.map +2 -2
- package/dist/cjs/components/drop-down.js +1 -1
- package/dist/cjs/components/drop-down.js.map +2 -2
- package/dist/cjs/components/picture.d.ts +2 -0
- package/dist/cjs/components/picture.js +1 -1
- package/dist/cjs/components/picture.js.map +3 -3
- package/dist/cjs/helpers/ScrollLoadVideo.d.ts +5 -1
- package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
- package/dist/cjs/helpers/ScrollLoadVideo.js.map +3 -3
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js.map +2 -2
- package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/esm/biz-components/BrandEquity/BrandEquity.js.map +2 -2
- package/dist/esm/biz-components/Category/SwiperCategory.d.ts +1 -1
- package/dist/esm/biz-components/Category/SwiperCategory.js +1 -1
- package/dist/esm/biz-components/Category/SwiperCategory.js.map +3 -3
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Category/index.js.map +3 -3
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
- package/dist/esm/biz-components/FooterNavigation/icons/Subtract.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/icons/Subtract.js.map +2 -2
- package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/index.js.map +2 -2
- package/dist/esm/biz-components/GraphicAttractionBlock/index.js +1 -1
- package/dist/esm/biz-components/GraphicAttractionBlock/index.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/Close.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/Close.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/DownArrow.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/DownArrow.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/LeftArrow.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/LeftArrow.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/RightArrow.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/RightArrow.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js.map +2 -2
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
- 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/MediaPlayerMulti/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.js.map +2 -2
- package/dist/esm/biz-components/MediaPlayerSticky/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerSticky/index.js.map +3 -3
- package/dist/esm/biz-components/MemberEquity/index.js +2 -2
- package/dist/esm/biz-components/MemberEquity/index.js.map +2 -2
- package/dist/esm/biz-components/NavigationSearch/index.js +2 -2
- package/dist/esm/biz-components/NavigationSearch/index.js.map +2 -2
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.d.ts +2 -2
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js.map +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/esm/biz-components/Slogan/index.js +1 -1
- package/dist/esm/biz-components/Slogan/index.js.map +1 -1
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/biz-components/Specs/index.js.map +2 -2
- package/dist/esm/biz-components/Subscribe/index.js.map +2 -2
- package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
- package/dist/esm/biz-components/Tabs/Tabs.js.map +2 -2
- package/dist/esm/biz-components/TabsGroup/index.js +1 -1
- package/dist/esm/biz-components/TabsGroup/index.js.map +2 -2
- package/dist/esm/biz-components/TextModal/index.js +1 -1
- package/dist/esm/biz-components/TextModal/index.js.map +2 -2
- package/dist/esm/biz-components/VideoModal/index.js +1 -1
- package/dist/esm/biz-components/VideoModal/index.js.map +2 -2
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/components/container.js.map +2 -2
- package/dist/esm/components/drop-down.js +1 -1
- package/dist/esm/components/drop-down.js.map +2 -2
- package/dist/esm/components/picture.d.ts +2 -0
- package/dist/esm/components/picture.js +1 -1
- package/dist/esm/components/picture.js.map +3 -3
- package/dist/esm/helpers/ScrollLoadVideo.d.ts +5 -1
- package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
- package/dist/esm/helpers/ScrollLoadVideo.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeroBanner/HeroBanner.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef, useState, useEffect } from 'react'\nimport gsap from 'gsap'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport type { HeroBannerProps } from './types.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useInView } from 'react-intersection-observer'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Countdown from './Countdown.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\nconst PlayButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"currentcolor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z\"\n fill=\"currentcolor\"\n />\n </svg>\n )\n}\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(({ data, className }, ref) => {\n const {\n title,\n subtitle,\n endDate,\n endDate_tz,\n dateFormat,\n pcImage,\n padImage,\n mobileImage,\n pcVideo,\n padVideo,\n mobileVideo,\n isShowVideo,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n caption = [],\n blockLink,\n iconArray,\n } = data\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isPad = useMediaQuery({ query: '(max-width: 1024px)' })\n const [visible, setVisible] = useState<boolean>(false)\n const { ref: inViewRef, inView } = useInView()\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const bgTriggerRef = useRef<ScrollTrigger | null>(null)\n const boxTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const bgRef = useRef<HTMLImageElement>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n useEffect(() => {\n gsap.registerPlugin(ScrollTrigger)\n function gsapResize() {\n if (!bgRef.current) return\n const clientHeight = boxRef.current?.clientHeight || 100\n const screenHeight = window.innerHeight\n\n if (screenHeight <= clientHeight) {\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 40\n const value = self.progress * base - base / 2\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n } else {\n boxTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom bottom',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base - base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n bgTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top top',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n }\n }\n if (inView) gsapResize()\n return () => {\n // ScrollTrigger.getAll().forEach((t: any) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n boxTriggerRef.current && boxTriggerRef.current.kill()\n bgTriggerRef.current && bgTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n <div ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n ' tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]': size === 'default',\n 'lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]': size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}`}\n tabIndex={-1}\n aria-hidden=\"true\"\n aria-label={title}\n ></a>\n )}\n <div ref={bgRef} className={cn('absolute left-0 top-0 size-full')}>\n {isShowVideo ? (\n <ScrollLoadVideo\n poster={isMobile ? mobileImage?.url : isPad ? padImage?.url || mobileImage?.url : pcImage?.url}\n src={\n isMobile\n ? (mobileVideo?.url as string)\n : isPad\n ? (padVideo?.url as string) || (mobileVideo?.url as string)\n : (pcVideo?.url as string)\n }\n className=\"laptop:w-full h-full\"\n videoClassName=\"h-full object-cover\"\n muted\n loop\n playsInline\n />\n ) : (\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n fetchPriority=\"high\"\n alt={pcImage?.alt || ''}\n source={`${pcImage?.url || ''} , ${padImage?.url ?? (mobileImage?.url || '')} 1024, ${mobileImage?.url || ''} 767`}\n />\n )}\n </div>\n\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]\">\n <div className=\"laptop:text-left max-w-[686px]\">\n {title && <Heading as=\"h2\" size={size === 'sm' ? 4 : 5} className={cn('hero-banner-title')} html={title} />}\n {subtitle && (\n <Heading\n as=\"h3\"\n className={cn(\n 'hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm'\n )}\n html={subtitle}\n />\n )}\n {endDate && (\n <div className=\"mt-3\">\n <Countdown endDate={endDate} endDate_tz={endDate_tz} dateFormat={dateFormat} />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2\">\n {secondaryButton?.isShowPlayVideoButton && secondaryButton?.playVideoButtonText ? (\n <Button\n onClick={() => setVisible(true)}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-play-video-button\"\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.playVideoButtonText}`}\n >\n {secondaryButton?.playVideoButtonText} <PlayButtonAppendIcon size=\"lg\" />\n </Button>\n ) : secondaryButton?.text ? (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-secondary-button\"\n as=\"a\"\n href={trackUrlRef(secondaryButton?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.text}`}\n >\n {secondaryButton?.text}\n <span className=\"sr-only\">{title ?? subtitle}</span>\n </Button>\n ) : null}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"primary\"\n className=\"hero-banner-primary-button\"\n as=\"a\"\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${primaryButton?.text}`}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n <div className=\"hero-banner-icon-group flex items-center gap-2\">\n {iconArray?.map((icon, index) => (\n <div key={index} className=\"h-12\">\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n alt={icon?.pcImage?.alt || ''}\n source={icon?.pcImage?.url}\n />\n </div>\n ))}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {caption.length > 0 && (\n <div className=\"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]\">\n {caption.map((c, index) => (\n <React.Fragment key={index}>\n <Text\n size={2}\n className={cn(\n 'hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]'\n )}\n html={c.title}\n />\n {index < caption.length - 1 && <div className={cn('bg-info-primary w-px')} />}\n </React.Fragment>\n ))}\n </div>\n )}\n\n {/* \u89C6\u9891\u5F39\u7A97 */}\n {visible && (\n <VideoModal\n visible={visible}\n videoUrl={secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.youtubeId}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </div>\n </div>\n )\n})\n\nHeroBanner.displayName = 'HeroBanner'\n\nexport default withLayout(HeroBanner)\n"],
|
|
5
|
-
"mappings": "mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAwBM,IAAAI,EAAA,6BAvBNC,EAAwE,oBACxEC,EAAiB,mBACjBC,EAA8B,mCAE9BC,EAA8B,4BAC9BC,EAA0B,uCAC1BC,EAA4B,+CAC5BC,EAA+C,qCAC/CC,EAAsB,6BACtBC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA4B,sCAC5BC,EAA4B,uCAC5BC,EAAwB,sCACxBC,EAA2B,kCAE3B,MAAMC,EAAgB,QAChBC,EAAgB,cAEhBC,GAAuB,CAAC,CAAE,KAAAC,EAAO,MAAO,IAAsC,CAClF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AI,IAAK2B,EAAO,aAAW,MAAG,iCAAiC,EAC7D,SAAAhB,MACC,OAAC,EAAAuB,QAAA,CACC,OAAQhB,EAAWX,GAAa,IAAMY,EAAQb,GAAU,KAAOC,GAAa,IAAMF,GAAS,IAC3F,IACEa,EACKR,GAAa,IACdS,EACGV,IAAU,KAAmBC,GAAa,IAC1CF,GAAS,IAElB,UAAU,uBACV,eAAe,sBACf,MAAK,GACL,KAAI,GACJ,YAAW,GACb,KAEA,OAAC,WACC,UAAU,uBACV,aAAa,sBACb,QAAQ,QACR,cAAc,OACd,IAAKH,GAAS,KAAO,GACrB,OAAQ,GAAGA,GAAS,KAAO,EAAE,MAAMC,GAAU,MAAQC,GAAa,KAAO,GAAG,UAAUA,GAAa,KAAO,EAAE,OAC9G,EAEJ,KAGA,QAAC,OAAI,UAAU,6MACb,qBAAC,OAAI,UAAU,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef, useState, useEffect } from 'react'\nimport gsap from 'gsap'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport type { HeroBannerProps } from './types.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useInView } from 'react-intersection-observer'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Countdown from './Countdown.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\nconst PlayButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"currentcolor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z\"\n fill=\"currentcolor\"\n />\n </svg>\n )\n}\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(({ data, className }, ref) => {\n const {\n title,\n subtitle,\n endDate,\n endDate_tz,\n dateFormat,\n pcImage,\n padImage,\n mobileImage,\n pcVideo,\n padVideo,\n mobileVideo,\n isShowVideo,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n caption = [],\n blockLink,\n iconArray,\n } = data\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isPad = useMediaQuery({ query: '(max-width: 1024px)' })\n const [visible, setVisible] = useState<boolean>(false)\n const { ref: inViewRef, inView } = useInView()\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const bgTriggerRef = useRef<ScrollTrigger | null>(null)\n const boxTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const bgRef = useRef<HTMLImageElement>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n useEffect(() => {\n gsap.registerPlugin(ScrollTrigger)\n function gsapResize() {\n if (!bgRef.current) return\n const clientHeight = boxRef.current?.clientHeight || 100\n const screenHeight = window.innerHeight\n\n if (screenHeight <= clientHeight) {\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 40\n const value = self.progress * base - base / 2\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n } else {\n boxTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom bottom',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base - base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n bgTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top top',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n }\n }\n if (inView) gsapResize()\n return () => {\n // ScrollTrigger.getAll().forEach((t: any) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n boxTriggerRef.current && boxTriggerRef.current.kill()\n bgTriggerRef.current && bgTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n <div ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n ' tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]': size === 'default',\n 'lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]': size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}`}\n tabIndex={-1}\n aria-hidden=\"true\"\n aria-label={title}\n ></a>\n )}\n <div ref={bgRef} className={cn('absolute left-0 top-0 size-full')}>\n {isShowVideo ? (\n <ScrollLoadVideo\n poster={isMobile ? mobileImage?.url : isPad ? padImage?.url || mobileImage?.url : pcImage?.url}\n src={\n isMobile\n ? (mobileVideo?.url as string)\n : isPad\n ? (padVideo?.url as string) || (mobileVideo?.url as string)\n : (pcVideo?.url as string)\n }\n className=\"laptop:w-full h-full\"\n videoClassName=\"h-full object-cover\"\n muted\n loop\n playsInline\n />\n ) : (\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n fetchPriority=\"high\"\n alt={pcImage?.alt || ''}\n source={`${pcImage?.url || ''} , ${padImage?.url ?? (mobileImage?.url || '')} 1024, ${mobileImage?.url || ''} 767`}\n />\n )}\n </div>\n\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]\">\n <div className=\"laptop:text-left hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]\">\n {title && <Heading as=\"h2\" size={size === 'sm' ? 4 : 5} className={cn('hero-banner-title')} html={title} />}\n {subtitle && (\n <Heading\n as=\"h3\"\n className={cn(\n 'hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm'\n )}\n html={subtitle}\n />\n )}\n {endDate && (\n <div className=\"mt-3\">\n <Countdown endDate={endDate} endDate_tz={endDate_tz} dateFormat={dateFormat} />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2\">\n {secondaryButton?.isShowPlayVideoButton && secondaryButton?.playVideoButtonText ? (\n <Button\n onClick={() => setVisible(true)}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-play-video-button\"\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.playVideoButtonText}`}\n >\n {secondaryButton?.playVideoButtonText} <PlayButtonAppendIcon size=\"lg\" />\n </Button>\n ) : secondaryButton?.text ? (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-secondary-button\"\n as=\"a\"\n href={trackUrlRef(secondaryButton?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.text}`}\n >\n {secondaryButton?.text}\n <span className=\"sr-only\">{title ?? subtitle}</span>\n </Button>\n ) : null}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"primary\"\n className=\"hero-banner-primary-button\"\n as=\"a\"\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${primaryButton?.text}`}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n <div className=\"hero-banner-icon-group flex items-center gap-2\">\n {iconArray?.map((icon, index) => (\n <div key={index} className=\"h-12\">\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n alt={icon?.pcImage?.alt || ''}\n source={icon?.pcImage?.url}\n />\n </div>\n ))}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {caption.length > 0 && (\n <div className=\"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]\">\n {caption.map((c, index) => (\n <React.Fragment key={index}>\n <Text\n size={2}\n className={cn(\n 'hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]'\n )}\n html={c.title}\n />\n {index < caption.length - 1 && <div className={cn('bg-info-primary w-px')} />}\n </React.Fragment>\n ))}\n </div>\n )}\n\n {/* \u89C6\u9891\u5F39\u7A97 */}\n {visible && (\n <VideoModal\n visible={visible}\n videoUrl={secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.youtubeId}\n onCloseModal={() => setVisible(false)}\n />\n )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,QACR,IAAKD,GAAM,SAAS,KAAO,GAC3B,OAAQA,GAAM,SAAS,IACzB,GAPQC,CAQV,CACD,EACH,GACF,EAGCtB,EAAQ,OAAS,MAChB,OAAC,OAAI,UAAU,iMACZ,SAAAA,EAAQ,IAAI,CAACuB,EAAGD,OACf,QAAC,EAAAzC,QAAM,SAAN,CACC,oBAAC,QACC,KAAM,EACN,aAAW,MACT,yIACF,EACA,KAAM0C,EAAE,MACV,EACCD,EAAQtB,EAAQ,OAAS,MAAK,OAAC,OAAI,aAAW,MAAG,sBAAsB,EAAG,IARxDsB,CASrB,CACD,EACH,EAIDjB,MACC,OAAC,cACC,QAASA,EACT,SAAUP,GAAiB,UAAU,IACrC,UAAWA,GAAiB,UAC5B,aAAc,IAAMQ,EAAW,EAAK,EACtC,GAEJ,EACF,CAEJ,CAAC,EAED1B,EAAW,YAAc,aAEzB,IAAOvB,MAAQ,cAAWuB,CAAU",
|
|
6
6
|
"names": ["HeroBanner_exports", "__export", "HeroBanner_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_ScrollTrigger", "import_react_responsive", "import_react_intersection_observer", "import_ScrollLoadVideo", "import_components", "import_Countdown", "import_helpers", "import_Styles", "import_useExposure", "import_trackUrlRef", "import_button", "import_VideoModal", "componentType", "componentName", "PlayButtonAppendIcon", "size", "width", "height", "HeroBanner", "React", "data", "className", "ref", "title", "subtitle", "endDate", "endDate_tz", "dateFormat", "pcImage", "padImage", "mobileImage", "pcVideo", "padVideo", "mobileVideo", "isShowVideo", "primaryButton", "secondaryButton", "theme", "caption", "blockLink", "iconArray", "isMobile", "isPad", "visible", "setVisible", "inViewRef", "inView", "scrollTriggerRef", "bgTriggerRef", "boxTriggerRef", "bgRef", "boxRef", "gsap", "gsapResize", "clientHeight", "self", "value", "ScrollLoadVideo", "Countdown", "icon", "index", "c"]
|
|
7
7
|
}
|
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": ["import { Button, Checkbox, Text, Picture, Heading, Link } from '../../../../../components/index.js'\nimport ProductBenefitsTabs from './ProductBenefitsTabs/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useBenefits } from '../../../hooks/useBenefits.js'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\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.js'\nimport { cn } from '../../../../../helpers/index.js'\nimport ModalContainer from './ProductBenefitsTabs/ModalContainer.js'\nimport { withLayout } from '../../../../../shared/Styles.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) => boolean | undefined\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 [checked, setChecked] = useState(false)\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 'laptop:h-[112px] lg-desktop:h-[130px] relative h-[100px] overflow-hidden p-3',\n item.borderStyle === 'inset' ? 'coupon-card ' : 'rounded-[8px]'\n )}\n {...(item.useAble && {\n role: 'button',\n tabIndex: 0,\n onClick: () => {\n const shouldChange = item?.onUseChange?.(checked)\n if (shouldChange !== false) {\n setChecked(!checked)\n }\n },\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=\"z-1 relative \">\n <div className=\"flex items-center justify-start\">\n {item.useAble && (\n <Checkbox\n size=\"lg\"\n className=\"data-[state=checked]:border-primary mr-2 rounded-full border-[1.6px] border-[#D1D1D1]\"\n checked={item?.isAutoUse}\n />\n )}\n <Text\n html={item.title}\n className=\"laptop:text-[20px] lg-desktop:text-[24px] text-[16px] font-bold leading-[1.2]\"\n />\n </div>\n {item.description && (\n <Text\n {...(typeof item.description === 'string' ? { html: item.description } : {})}\n as=\"p\"\n className=\"lg-desktop:text-[16px] mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F]\"\n >\n {item.description}\n </Text>\n )}\n {item.code && (\n <div className=\"laptop-md:mt-2 flex items-center gap-2\">\n <Text\n html={`${benefitPayloadData?.couponBenefitData?.commonCoupon?.couponCode}: ${item.code}`}\n className=\"lg-desktop:text-[16px] text-[14px] font-bold text-[#3D3D3F]\"\n />\n <Link\n className=\"lg-desktop:text-[16px] text-[14px] font-bold underline\"\n role=\"button\"\n tabIndex={0}\n onClick={event => {\n event.preventDefault()\n event.stopPropagation()\n copyToClipboard(item.code || '')\n }}\n >\n {isCopied\n ? couponCopy?.copied || benefitPayloadData?.couponBenefitData?.commonCoupon?.copied\n : couponCopy?.copy || benefitPayloadData?.couponBenefitData?.commonCoupon?.copyCode}\n </Link>\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 laptop-md:mt-4 lg-desktop:text-[16px] md-l:hidden mt-[14px] text-left text-[14px] font-bold text-[#1F2021]\"\n >\n {Number(days) < Number(couponCopy?.hurry?.daysLeft) ? (\n <>\n <span>\n {couponCopy?.ends} {days === '00' ? '0' : days} {couponCopy?.days || ''}\n </span>\n <span className=\"font-bold\">\n {` ${hours.toString()}:${minutes.toString()}:${seconds.toString()}`}\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('laptop:grid laptop:grid-cols-2 laptop-md:grid-cols-1 flex flex-col gap-3', 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 profile,\n variant,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n savingDetail,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n product,\n creditsRedemption: creditsRedemptionData,\n } = useBizProductContext()\n\n const { usedPoints = 0, availablePoints = 0 } = creditsRedemptionData ?? {}\n const [isInstallmentMounted, setIsInstallmentMounted] = useState(false)\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 {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 {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 (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 return true\n } else {\n openSignInPopup?.()\n return false\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 }, [coupons?.length])\n\n useEffect(() => {\n setIsInstallmentMounted(false)\n }, [variant?.id])\n\n const [productBenefitsTabsValue, setProductBenefitsTabsValue] = useState<ProductBenefitsTabsValueType>('coupon')\n\n const handleActivate = () => {\n openAuthCodePopup?.()\n }\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 if (!ProductBenefitsTabs) return null\n\n return (\n <ProductBenefitsTabs\n className=\"relative\"\n onValueChange={value => {\n setProductBenefitsTabsValue(value as 'coupon' | 'membership' | 'pay' | 'installment')\n if (value === 'installment') {\n setIsInstallmentMounted(true)\n } else {\n setIsInstallmentMounted(false)\n }\n }}\n value={productBenefitsTabsValue}\n >\n <div className=\"absolute right-0 top-0 z-[1] h-[40px] w-[25px] rounded-xl 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-[#080A0F]')}\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 lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto\"\n >\n <div className=\"lg-desktop:p-4 p-3\">\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={cn('benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px]', {\n 'overflow-y-auto': profile?.email,\n })}\n >\n <div className=\"lg-desktop:p-4 p-3\">\n <div\n className={cn('rounded-lg', {\n 'benefits-tabs-content lg-desktop:h-[calc(240px-100px)] laptop-md:h-[calc(196px-80px)] laptop:h-[calc(220px-72px)] h-[calc(180px-73px)] overflow-y-auto':\n !profile?.email,\n })}\n >\n {!profile?.email && (\n <h3 className=\"laptop-md:mb-2 mb-1 text-left text-lg font-bold !leading-[1.3]\">\n {benefitPayloadData?.membershipBenefitData?.memberBenefitsNotLoginText}\n </h3>\n )}\n <ul\n className={`laptop-md:[&_li]:py-4 list-none \n [&_li:first-child]:rounded-t-lg [&_li:last-child]:rounded-b-lg [&_li:last-child]:last:border-b-0 [&_li]:flex\n [&_li]:items-center [&_li]:gap-2 [&_li]:border-b [&_li]:border-b-[#E4E5E6] [&_li]:bg-white [&_li]:px-4 [&_li]:py-[10px]\n [&_li]:text-left`}\n >\n {/* \u79EF\u5206\u62B5\u73B0 */}\n {creditsRedemption.enable ? (\n <li>\n <svg\n className=\"laptop-md:size-6 size-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\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=\"x:text-[14px] text-left text-[16px] font-bold\">\n {!activated && Boolean(profile?.email) ? (\n <>\n {benefitPayloadData?.membershipBenefitData?.creditsAfterActivation}\n <span role=\"button\" tabIndex={0} onClick={() => handleActivate()} className=\"underline\">\n {benefitPayloadData?.membershipBenefitData?.active}\n </span>\n </>\n ) : (\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 </Text>\n </li>\n ) : null}\n {memberDiscount.enable && (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"laptop-md:size-6 size-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\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=\"x:text-[14px] text-left text-[16px] font-bold\">\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=\"laptop-md:size-6 size-4 shrink-0\" />\n <Text className=\"x:text-[14px] text-wrap text-left text-[16px] font-bold\">{item.text}</Text>\n </button>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : (\n <li key={index} className=\"justify-between\">\n <div className=\"flex items-center gap-2\">\n <Picture source={item.icon} alt={item.text} className=\"laptop-md:size-6 size-4 shrink-0\" />\n <Text as=\"p\" className=\"x:text-[14px] text-wrap text-left text-[16px] font-bold\">\n {item.label}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n )\n )}\n {/* <li className=\"justify-between\">\n <div className=\"flex items-center gap-2\">\n <Picture\n source={benefitPayloadData?.membershipBenefitData.memberPriceIcon}\n alt={benefitPayloadData?.membershipBenefitData.memberPriceDesc}\n className=\" size-6 shrink-0\"\n />\n <Text as=\"p\" className=\"x:text-[14px] text-wrap text-left text-[16px] font-bold\">\n {benefitPayloadData?.membershipBenefitData.memberPriceDesc}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li> */}\n {/* \u9AD8\u6807\u7269\u6D41 */}\n {paidShipping.enable ? (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg\n className=\"laptop-md:size-6 size-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\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=\"x:text-[14px] text-left text-[16px] font-bold\">\n {benefitPayloadData?.membershipBenefitData?.expressShipping}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : null}\n </ul>\n </div>\n {!profile?.email && (\n <div className=\"laptop-md:pt-4 pt-2\">\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 lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto \"\n >\n <div className=\"lg-desktop:p-4 p-3\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.payBenefitData?.payMethod}\n </Heading>\n <div className=\"lg-desktop:p-4 flex items-center justify-between gap-2 rounded-lg bg-white p-3\">\n <div className=\"flex items-center gap-2\">\n <Picture\n source={benefitPayloadData?.payBenefitData?.icon}\n className=\"laptop-md:size-[70px] laptop-md:h-[34px] size-[40px] h-[20px] shrink-0\"\n />\n <Text\n as=\"p\"\n className=\"x:text-[14px] text-left text-[16px] font-bold\"\n html={benefitPayloadData?.payBenefitData?.withCheckout}\n />\n </div>\n <button\n className=\"hover:text-brand-0 laptop-md:text-[16px] whitespace-nowrap text-sm font-bold underline\"\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 forceMount={true}\n className={cn(\n 'benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto ',\n isInstallmentMounted ? 'block' : 'hidden'\n )}\n >\n <div className=\"lg-desktop:p-4 p-3\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.installmentBenefitData?.flexibleInstallment}\n </Heading>\n <div className=\"lg-desktop:p-4 overflow-hidden rounded-lg bg-white p-3\">{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 withLayout(BenefitsTab)\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAqHM,IAAAI,EAAA,6BArHNC,EAA+D,8CAC/DC,EAAgC,6CAChCC,EAAqC,0CACrCC,EAA4B,yCAC5BC,EAA4B,mCAC5BC,EAAgC,wCAChCC,EAA4D,iBAC5DC,EAA+B,6CAC/BC,EAAyB,mDACzBC,EAAoB,wCACpBC,EAAmB,2CACnBC,EAA2B,sDAC3BC,EAA2B,2CA+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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AM,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,IAAO7F,MAAQ,cAAWuC,EAAW",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-unknown-property */\nimport { Button, Checkbox, Text, Picture, Heading, Link } from '../../../../../components/index.js'\nimport ProductBenefitsTabs from './ProductBenefitsTabs/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useBenefits } from '../../../hooks/useBenefits.js'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\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.js'\nimport { cn } from '../../../../../helpers/index.js'\nimport ModalContainer from './ProductBenefitsTabs/ModalContainer.js'\nimport { withLayout } from '../../../../../shared/Styles.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) => boolean | undefined\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 [checked, setChecked] = useState(false)\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 'laptop:h-[112px] lg-desktop:h-[130px] relative h-[100px] overflow-hidden p-3',\n item.borderStyle === 'inset' ? 'coupon-card ' : 'rounded-[8px]'\n )}\n {...(item.useAble && {\n role: 'button',\n tabIndex: 0,\n onClick: () => {\n const shouldChange = item?.onUseChange?.(checked)\n if (shouldChange !== false) {\n setChecked(!checked)\n }\n },\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=\"z-1 relative \">\n <div className=\"flex items-center justify-start\">\n {item.useAble && (\n <Checkbox\n size=\"lg\"\n className=\"data-[state=checked]:border-primary mr-2 rounded-full border-[1.6px] border-[#D1D1D1]\"\n checked={item?.isAutoUse}\n />\n )}\n <Text\n html={item.title}\n className=\"laptop:text-[20px] lg-desktop:text-[24px] text-[16px] font-bold leading-[1.2]\"\n />\n </div>\n {item.description && (\n <Text\n {...(typeof item.description === 'string' ? { html: item.description } : {})}\n as=\"p\"\n className=\"lg-desktop:text-[16px] mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F]\"\n >\n {item.description}\n </Text>\n )}\n {item.code && (\n <div className=\"laptop-md:mt-2 flex items-center gap-2\">\n <Text\n html={`${benefitPayloadData?.couponBenefitData?.commonCoupon?.couponCode}: ${item.code}`}\n className=\"lg-desktop:text-[16px] text-[14px] font-bold text-[#3D3D3F]\"\n />\n <Link\n className=\"lg-desktop:text-[16px] text-[14px] font-bold underline\"\n role=\"button\"\n tabIndex={0}\n onClick={event => {\n event.preventDefault()\n event.stopPropagation()\n copyToClipboard(item.code || '')\n }}\n >\n {isCopied\n ? couponCopy?.copied || benefitPayloadData?.couponBenefitData?.commonCoupon?.copied\n : couponCopy?.copy || benefitPayloadData?.couponBenefitData?.commonCoupon?.copyCode}\n </Link>\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 laptop-md:mt-4 lg-desktop:text-[16px] md-l:hidden mt-[14px] text-left text-[14px] font-bold text-[#1F2021]\"\n >\n {Number(days) < Number(couponCopy?.hurry?.daysLeft) ? (\n <>\n <span>\n {couponCopy?.ends} {days === '00' ? '0' : days} {couponCopy?.days || ''}\n </span>\n <span className=\"font-bold\">\n {` ${hours.toString()}:${minutes.toString()}:${seconds.toString()}`}\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('laptop:grid laptop:grid-cols-2 laptop-md:grid-cols-1 flex flex-col gap-3', 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 profile,\n variant,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n savingDetail,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n product,\n creditsRedemption: creditsRedemptionData,\n } = useBizProductContext()\n\n const { usedPoints = 0, availablePoints = 0 } = creditsRedemptionData ?? {}\n const [isInstallmentMounted, setIsInstallmentMounted] = useState(false)\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 {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 {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 (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 return true\n } else {\n openSignInPopup?.()\n return false\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 }, [coupons?.length])\n\n useEffect(() => {\n setIsInstallmentMounted(false)\n }, [variant?.id])\n\n const [productBenefitsTabsValue, setProductBenefitsTabsValue] = useState<ProductBenefitsTabsValueType>('coupon')\n\n const handleActivate = () => {\n openAuthCodePopup?.()\n }\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 if (!ProductBenefitsTabs) return null\n\n return (\n <ProductBenefitsTabs\n className=\"relative\"\n onValueChange={value => {\n setProductBenefitsTabsValue(value as 'coupon' | 'membership' | 'pay' | 'installment')\n if (value === 'installment') {\n setIsInstallmentMounted(true)\n } else {\n setIsInstallmentMounted(false)\n }\n }}\n value={productBenefitsTabsValue}\n >\n <div className=\"absolute right-0 top-0 z-[1] h-[40px] w-[25px] rounded-xl 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-[#080A0F]')}\n value={item.value}\n onClick={e => handleProductBenefitsTabListClick(e, item?.value)}\n >\n {item.label}\n </ProductBenefitsTabs.Trigger>\n ))}\n </ProductBenefitsTabs.List>\n {/* TODO: @seasail \u7528tailwind \u539F\u5B50\u7C7B\u6216\u8005\u884C\u5185\u6837\u5F0F(Inline Style)\u4EE3\u66FF jsx global */}\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 lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto\"\n >\n <div className=\"lg-desktop:p-4 p-3\">\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={cn('benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px]', {\n 'overflow-y-auto': profile?.email,\n })}\n >\n <div className=\"lg-desktop:p-4 p-3\">\n <div\n className={cn('rounded-lg', {\n 'benefits-tabs-content lg-desktop:h-[calc(240px-100px)] laptop-md:h-[calc(196px-80px)] laptop:h-[calc(220px-72px)] h-[calc(180px-73px)] overflow-y-auto':\n !profile?.email,\n })}\n >\n {!profile?.email && (\n <h3 className=\"laptop-md:mb-2 mb-1 text-left text-lg font-bold !leading-[1.3]\">\n {benefitPayloadData?.membershipBenefitData?.memberBenefitsNotLoginText}\n </h3>\n )}\n <ul\n className={`laptop-md:[&_li]:py-4 list-none \n [&_li:first-child]:rounded-t-lg [&_li:last-child]:rounded-b-lg [&_li:last-child]:last:border-b-0 [&_li]:flex\n [&_li]:items-center [&_li]:gap-2 [&_li]:border-b [&_li]:border-b-[#E4E5E6] [&_li]:bg-white [&_li]:px-4 [&_li]:py-[10px]\n [&_li]:text-left`}\n >\n {/* \u79EF\u5206\u62B5\u73B0 */}\n {creditsRedemption.enable ? (\n <li>\n <svg\n className=\"laptop-md:size-6 size-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\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=\"x:text-[14px] text-left text-[16px] font-bold\">\n {!activated && Boolean(profile?.email) ? (\n <>\n {benefitPayloadData?.membershipBenefitData?.creditsAfterActivation}\n <span role=\"button\" tabIndex={0} onClick={() => handleActivate()} className=\"underline\">\n {benefitPayloadData?.membershipBenefitData?.active}\n </span>\n </>\n ) : (\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 </Text>\n </li>\n ) : null}\n {memberDiscount.enable && (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"laptop-md:size-6 size-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\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=\"x:text-[14px] text-left text-[16px] font-bold\">\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=\"laptop-md:size-6 size-4 shrink-0\" />\n <Text className=\"x:text-[14px] text-wrap text-left text-[16px] font-bold\">{item.text}</Text>\n </button>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : (\n <li key={index} className=\"justify-between\">\n <div className=\"flex items-center gap-2\">\n <Picture source={item.icon} alt={item.text} className=\"laptop-md:size-6 size-4 shrink-0\" />\n <Text as=\"p\" className=\"x:text-[14px] text-wrap text-left text-[16px] font-bold\">\n {item.label}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n )\n )}\n {/* <li className=\"justify-between\">\n <div className=\"flex items-center gap-2\">\n <Picture\n source={benefitPayloadData?.membershipBenefitData.memberPriceIcon}\n alt={benefitPayloadData?.membershipBenefitData.memberPriceDesc}\n className=\" size-6 shrink-0\"\n />\n <Text as=\"p\" className=\"x:text-[14px] text-wrap text-left text-[16px] font-bold\">\n {benefitPayloadData?.membershipBenefitData.memberPriceDesc}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li> */}\n {/* \u9AD8\u6807\u7269\u6D41 */}\n {paidShipping.enable ? (\n <li className=\"justify-between\">\n <div className=\"flex gap-2\">\n <svg\n className=\"laptop-md:size-6 size-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\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=\"x:text-[14px] text-left text-[16px] font-bold\">\n {benefitPayloadData?.membershipBenefitData?.expressShipping}\n </Text>\n </div>\n {Boolean(profile?.email) && <CheckedIcon />}\n </li>\n ) : null}\n </ul>\n </div>\n {!profile?.email && (\n <div className=\"laptop-md:pt-4 pt-2\">\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 lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto \"\n >\n <div className=\"lg-desktop:p-4 p-3\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.payBenefitData?.payMethod}\n </Heading>\n <div className=\"lg-desktop:p-4 flex items-center justify-between gap-2 rounded-lg bg-white p-3\">\n <div className=\"flex items-center gap-2\">\n <Picture\n source={benefitPayloadData?.payBenefitData?.icon}\n className=\"laptop-md:size-[70px] laptop-md:h-[34px] size-[40px] h-[20px] shrink-0\"\n />\n <Text\n as=\"p\"\n className=\"x:text-[14px] text-left text-[16px] font-bold\"\n html={benefitPayloadData?.payBenefitData?.withCheckout}\n />\n </div>\n <button\n className=\"hover:text-brand-0 laptop-md:text-[16px] whitespace-nowrap text-sm font-bold underline\"\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 forceMount={true}\n className={cn(\n 'benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto ',\n isInstallmentMounted ? 'block' : 'hidden'\n )}\n >\n <div className=\"lg-desktop:p-4 p-3\">\n <Heading size={2} className=\"mb-2 text-left text-lg font-bold\">\n {benefitPayloadData?.installmentBenefitData?.flexibleInstallment}\n </Heading>\n <div className=\"lg-desktop:p-4 overflow-hidden rounded-lg bg-white p-3\">{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 withLayout(BenefitsTab)\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAsHM,IAAAI,EAAA,6BArHNC,EAA+D,8CAC/DC,EAAgC,6CAChCC,EAAqC,0CACrCC,EAA4B,yCAC5BC,EAA4B,mCAC5BC,EAAgC,wCAChCC,EAA4D,iBAC5DC,EAA+B,6CAC/BC,EAAyB,mDACzBC,EAAoB,wCACpBC,EAAmB,2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ACb,oBAAC,WAAQ,KAAM,EAAG,UAAU,mCACzB,SAAAlC,GAAoB,wBAAwB,oBAC/C,KACA,OAAC,OAAI,UAAU,yDAA0D,SAAAsB,EAAmB,GAC9F,EACF,GACF,EA/Q+B,IAiRnC,EAEMiD,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,IAAO7F,MAAQ,cAAWuC,EAAW",
|
|
6
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", "import_Styles", "defaultTextConfig", "CouponItem", "item", "textConfig", "benefitPayloadData", "trackingData", "isCopied", "copyToClipboard", "useCopy", "checked", "setChecked", "couponCopy", "days", "hours", "minutes", "seconds", "useCountDown", "openModal", "event", "CouponContent", "coupons", "className", "index", "BenefitsTab", "profile", "variant", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "savingDetail", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "product", "creditsRedemptionData", "usedPoints", "availablePoints", "isInstallmentMounted", "setIsInstallmentMounted", "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", "handleProductBenefitsTabListClick", "el", "container", "button", "scrollLeft", "benefitTabs", "ProductBenefitsTabs", "e", "CheckedIcon", "ModalContainer", "props"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of L(t))!C.call(e,s)&&s!==n&&c(e,s,{get:()=>t[s],enumerable:!(i=x(t,s))||i.enumerable});return e};var M=e=>h(c({},"__esModule",{value:!0}),e);var y={};P(y,{default:()=>A});module.exports=M(y);var r=require("react/jsx-runtime"),u=require("../../../../../../components/index.js"),o=require("react"),l=require("../../../../../../helpers/index.js"),a=require("@radix-ui/react-tabs");const g=(0,o.createContext)(void 0),N=()=>{const e=(0,o.useContext)(g);if(!e)throw new Error("ProductBenefitsTabs components must be used within ProductBenefitsTabs");return e},d=({defaultValue:e,value:t,onValueChange:n,children:i,className:s,...f})=>{const[m,v]=(0,o.useState)(e),b=t??m,T=p=>{t===void 0&&v(p),n?.(p)};return(0,r.jsx)(g.Provider,{value:{activeValue:b,setActiveValue:T},children:(0,r.jsx)("div",{id:"ipc-product-detail-benefits-tabs",className:(0,l.cn)("overflow-hidden rounded-xl bg-[#EAEAEC] pt-[10px]",s),...f,children:(0,r.jsx)(a.Root,{value:b,onValueChange:T,children:i})})})},B=(0,o.forwardRef)(({children:e,className:t,...n},i)=>(0,r.jsx)(a.List,{className:(0,l.cn)("relative flex space-x-6 overflow-x-auto border-b border-[#E4E5E6] px-4",t),style:{scrollbarWidth:"none",msOverflowStyle:"none"},ref:i,...n,children:e}));B.displayName="BenefitsTabsList";const w=({value:e,children:t,className:n,...i})=>{const{activeValue:s}=N(),f=s===e;return(0,r.jsxs)(a.Trigger,{value:e,className:(0,l.cn)("lg-desktop:text-base lg-desktop:pb-4 relative whitespace-nowrap pb-[10px] text-sm font-bold leading-[1.4] text-[#6D6D6F]",n),...i,children:[(0,r.jsx)(u.Text,{className:(0,l.cn)("bg-info-primary absolute bottom-0 left-0 z-10 h-[2px] w-0 transition-all duration-300",f&&"w-full")}),t]})},E=({children:e,className:t,...n})=>(0,r.jsx)(u.Text,{size:1,className:(0,l.cn)("bg-brand ml-1 !whitespace-nowrap rounded-full px-2 py-1 font-bold text-white",t),...n,children:e}),H=({value:e,forceMount:t=!1,children:n,className:i,...s})=>(0,r.jsx)(a.Content,{value:e,forceMount:t?!0:void 0,className:(0,l.cn)(i),...s,children:n});d.displayName="ProductBenefitsTabs",d.List=B,d.Trigger=w,d.Badge=E,d.Content=H;var A=d;
|
|
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/ProductBenefitsTabs/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text } from '../../../../../../components/index.js'\nimport { createContext, useContext, useState, type ReactNode, type HTMLAttributes, forwardRef } from 'react'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\n\n// Context for sharing state between components\ninterface BenefitsTabsContextType {\n activeValue: string | undefined\n setActiveValue: (_value: string) => void\n}\n\nconst BenefitsTabsContext = createContext<BenefitsTabsContextType | undefined>(undefined)\n\nconst useBenefitsTabsContext = () => {\n const context = useContext(BenefitsTabsContext)\n if (!context) {\n throw new Error('ProductBenefitsTabs components must be used within ProductBenefitsTabs')\n }\n return context\n}\n\n// Main container component\ninterface BenefitsTabsProps extends HTMLAttributes<HTMLDivElement> {\n defaultValue?: string\n value?: string\n onValueChange?: (_value: string) => void\n children: ReactNode\n}\n\nconst ProductBenefitsTabs = ({\n defaultValue,\n value,\n onValueChange,\n children,\n className,\n ...props\n}: BenefitsTabsProps) => {\n const [internalValue, setInternalValue] = useState(defaultValue)\n\n const activeValue = value ?? internalValue\n const setActiveValue = (newValue: string) => {\n if (value === undefined) {\n setInternalValue(newValue)\n }\n onValueChange?.(newValue)\n }\n\n return (\n <BenefitsTabsContext.Provider value={{ activeValue, setActiveValue }}>\n <div\n id=\"ipc-product-detail-benefits-tabs\"\n className={cn('overflow-hidden rounded-xl bg-[#EAEAEC] pt-[10px]', className)}\n {...props}\n >\n <Root value={activeValue} onValueChange={setActiveValue}>\n {children}\n </Root>\n </div>\n </BenefitsTabsContext.Provider>\n )\n}\n\n// List component for triggers\ninterface BenefitsTabsListProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode\n}\n\nconst BenefitsTabsList = forwardRef<HTMLDivElement, BenefitsTabsListProps>(({ children, className, ...props }, ref) => {\n return (\n <List\n className={cn('relative flex space-x-6 overflow-x-auto border-b border-[#E4E5E6] px-4', className)}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n ref={ref}\n {...props}\n >\n {children}\n </List>\n )\n})\n\n// Trigger component\ninterface BenefitsTabsTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n value: string\n children: ReactNode\n}\n\nconst BenefitsTabsTrigger = ({ value, children, className, ...props }: BenefitsTabsTriggerProps) => {\n const { activeValue } = useBenefitsTabsContext()\n const isActive = activeValue === value\n\n return (\n <Trigger\n value={value}\n className={cn(\n 'lg-desktop:text-base lg-desktop:pb-4 relative whitespace-nowrap pb-[10px] text-sm font-bold leading-[1.4] text-[#6D6D6F]',\n className\n )}\n {...props}\n >\n <Text\n className={cn(\n 'bg-info-primary absolute bottom-0 left-0 z-10 h-[2px] w-0 transition-all duration-300',\n isActive && 'w-full'\n )}\n />\n {children}\n </Trigger>\n )\n}\n\n// Badge component for trigger\ninterface BenefitsTabsBadgeProps extends HTMLAttributes<HTMLSpanElement> {\n children: ReactNode\n}\n\nconst BenefitsTabsBadge = ({ children, className, ...props }: BenefitsTabsBadgeProps) => {\n return (\n <Text\n size={1}\n className={cn('bg-brand ml-1 !whitespace-nowrap rounded-full px-2 py-1 font-bold text-white', className)}\n {...props}\n >\n {children}\n </Text>\n )\n}\n\n// Content component\ninterface BenefitsTabsContentProps extends HTMLAttributes<HTMLDivElement> {\n value: string\n forceMount?: boolean\n children: ReactNode\n}\n\nconst BenefitsTabsContent = ({\n value,\n forceMount = false,\n children,\n className,\n ...props\n}: BenefitsTabsContentProps) => {\n return (\n <Content value={value} forceMount={forceMount ? true : undefined} className={cn(className)} {...props}>\n {children}\n </Content>\n )\n}\n\nProductBenefitsTabs.displayName = 'ProductBenefitsTabs'\n\n// Attach sub-components to main component\nProductBenefitsTabs.List = BenefitsTabsList\nProductBenefitsTabs.Trigger = BenefitsTabsTrigger\nProductBenefitsTabs.Badge = BenefitsTabsBadge\nProductBenefitsTabs.Content = BenefitsTabsContent\n\nexport default ProductBenefitsTabs\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsDQ,IAAAI,EAAA,6BAtDRC,EAAqB,iDACrBC,EAAqG,iBACrGC,EAAmB,8CACnBC,EAA6C,gCAQ7C,MAAMC,KAAsB,iBAAmD,MAAS,EAElFC,EAAyB,IAAM,CACnC,MAAMC,KAAU,cAAWF,CAAmB,EAC9C,GAAI,CAACE,EACH,MAAM,IAAI,MAAM,wEAAwE,EAE1F,OAAOA,CACT,EAUMC,EAAsB,CAAC,CAC3B,aAAAC,EACA,MAAAC,EACA,cAAAC,EACA,SAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IAAyB,CACvB,KAAM,CAACC,EAAeC,CAAgB,KAAI,YAASP,CAAY,EAEzDQ,EAAcP,GAASK,EACvBG,EAAkBC,GAAqB,CACvCT,IAAU,QACZM,EAAiBG,CAAQ,EAE3BR,IAAgBQ,CAAQ,CAC1B,EAEA,SACE,OAACd,EAAoB,SAApB,CAA6B,MAAO,CAAE,YAAAY,EAAa,eAAAC,CAAe,EACjE,mBAAC,OACC,GAAG,mCACH,aAAW,MAAG,qDAAsDL,CAAS,EAC5E,GAAGC,EAEJ,mBAAC,QAAK,MAAOG,EAAa,cAAeC,EACtC,SAAAN,EACH,EACF,EACF,CAEJ,EAOMQ,KAAmB,cAAkD,CAAC,CAAE,SAAAR,EAAU,UAAAC,EAAW,GAAGC,CAAM,EAAGO,OAE3G,OAAC,QACC,aAAW,MAAG,yEAA0ER,CAAS,EACjG,MAAO,CACL,eAAgB,OAChB,gBAAiB,MACnB,EACA,IAAKQ,EACJ,GAAGP,EAEH,SAAAF,EACH,CAEH,
|
|
4
|
+
"sourcesContent": ["import { Text } from '../../../../../../components/index.js'\nimport { createContext, useContext, useState, type ReactNode, type HTMLAttributes, forwardRef } from 'react'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\n\n// Context for sharing state between components\ninterface BenefitsTabsContextType {\n activeValue: string | undefined\n setActiveValue: (_value: string) => void\n}\n\nconst BenefitsTabsContext = createContext<BenefitsTabsContextType | undefined>(undefined)\n\nconst useBenefitsTabsContext = () => {\n const context = useContext(BenefitsTabsContext)\n if (!context) {\n throw new Error('ProductBenefitsTabs components must be used within ProductBenefitsTabs')\n }\n return context\n}\n\n// Main container component\ninterface BenefitsTabsProps extends HTMLAttributes<HTMLDivElement> {\n defaultValue?: string\n value?: string\n onValueChange?: (_value: string) => void\n children: ReactNode\n}\n\nconst ProductBenefitsTabs = ({\n defaultValue,\n value,\n onValueChange,\n children,\n className,\n ...props\n}: BenefitsTabsProps) => {\n const [internalValue, setInternalValue] = useState(defaultValue)\n\n const activeValue = value ?? internalValue\n const setActiveValue = (newValue: string) => {\n if (value === undefined) {\n setInternalValue(newValue)\n }\n onValueChange?.(newValue)\n }\n\n return (\n <BenefitsTabsContext.Provider value={{ activeValue, setActiveValue }}>\n <div\n id=\"ipc-product-detail-benefits-tabs\"\n className={cn('overflow-hidden rounded-xl bg-[#EAEAEC] pt-[10px]', className)}\n {...props}\n >\n <Root value={activeValue} onValueChange={setActiveValue}>\n {children}\n </Root>\n </div>\n </BenefitsTabsContext.Provider>\n )\n}\n\n// List component for triggers\ninterface BenefitsTabsListProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode\n}\n\nconst BenefitsTabsList = forwardRef<HTMLDivElement, BenefitsTabsListProps>(({ children, className, ...props }, ref) => {\n return (\n <List\n className={cn('relative flex space-x-6 overflow-x-auto border-b border-[#E4E5E6] px-4', className)}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n ref={ref}\n {...props}\n >\n {children}\n </List>\n )\n})\n\nBenefitsTabsList.displayName = 'BenefitsTabsList'\n\n// Trigger component\ninterface BenefitsTabsTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n value: string\n children: ReactNode\n}\n\nconst BenefitsTabsTrigger = ({ value, children, className, ...props }: BenefitsTabsTriggerProps) => {\n const { activeValue } = useBenefitsTabsContext()\n const isActive = activeValue === value\n\n return (\n <Trigger\n value={value}\n className={cn(\n 'lg-desktop:text-base lg-desktop:pb-4 relative whitespace-nowrap pb-[10px] text-sm font-bold leading-[1.4] text-[#6D6D6F]',\n className\n )}\n {...props}\n >\n <Text\n className={cn(\n 'bg-info-primary absolute bottom-0 left-0 z-10 h-[2px] w-0 transition-all duration-300',\n isActive && 'w-full'\n )}\n />\n {children}\n </Trigger>\n )\n}\n\n// Badge component for trigger\ninterface BenefitsTabsBadgeProps extends HTMLAttributes<HTMLSpanElement> {\n children: ReactNode\n}\n\nconst BenefitsTabsBadge = ({ children, className, ...props }: BenefitsTabsBadgeProps) => {\n return (\n <Text\n size={1}\n className={cn('bg-brand ml-1 !whitespace-nowrap rounded-full px-2 py-1 font-bold text-white', className)}\n {...props}\n >\n {children}\n </Text>\n )\n}\n\n// Content component\ninterface BenefitsTabsContentProps extends HTMLAttributes<HTMLDivElement> {\n value: string\n forceMount?: boolean\n children: ReactNode\n}\n\nconst BenefitsTabsContent = ({\n value,\n forceMount = false,\n children,\n className,\n ...props\n}: BenefitsTabsContentProps) => {\n return (\n <Content value={value} forceMount={forceMount ? true : undefined} className={cn(className)} {...props}>\n {children}\n </Content>\n )\n}\n\nProductBenefitsTabs.displayName = 'ProductBenefitsTabs'\n\n// Attach sub-components to main component\nProductBenefitsTabs.List = BenefitsTabsList\nProductBenefitsTabs.Trigger = BenefitsTabsTrigger\nProductBenefitsTabs.Badge = BenefitsTabsBadge\nProductBenefitsTabs.Content = BenefitsTabsContent\n\nexport default ProductBenefitsTabs\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsDQ,IAAAI,EAAA,6BAtDRC,EAAqB,iDACrBC,EAAqG,iBACrGC,EAAmB,8CACnBC,EAA6C,gCAQ7C,MAAMC,KAAsB,iBAAmD,MAAS,EAElFC,EAAyB,IAAM,CACnC,MAAMC,KAAU,cAAWF,CAAmB,EAC9C,GAAI,CAACE,EACH,MAAM,IAAI,MAAM,wEAAwE,EAE1F,OAAOA,CACT,EAUMC,EAAsB,CAAC,CAC3B,aAAAC,EACA,MAAAC,EACA,cAAAC,EACA,SAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IAAyB,CACvB,KAAM,CAACC,EAAeC,CAAgB,KAAI,YAASP,CAAY,EAEzDQ,EAAcP,GAASK,EACvBG,EAAkBC,GAAqB,CACvCT,IAAU,QACZM,EAAiBG,CAAQ,EAE3BR,IAAgBQ,CAAQ,CAC1B,EAEA,SACE,OAACd,EAAoB,SAApB,CAA6B,MAAO,CAAE,YAAAY,EAAa,eAAAC,CAAe,EACjE,mBAAC,OACC,GAAG,mCACH,aAAW,MAAG,qDAAsDL,CAAS,EAC5E,GAAGC,EAEJ,mBAAC,QAAK,MAAOG,EAAa,cAAeC,EACtC,SAAAN,EACH,EACF,EACF,CAEJ,EAOMQ,KAAmB,cAAkD,CAAC,CAAE,SAAAR,EAAU,UAAAC,EAAW,GAAGC,CAAM,EAAGO,OAE3G,OAAC,QACC,aAAW,MAAG,yEAA0ER,CAAS,EACjG,MAAO,CACL,eAAgB,OAChB,gBAAiB,MACnB,EACA,IAAKQ,EACJ,GAAGP,EAEH,SAAAF,EACH,CAEH,EAEDQ,EAAiB,YAAc,mBAQ/B,MAAME,EAAsB,CAAC,CAAE,MAAAZ,EAAO,SAAAE,EAAU,UAAAC,EAAW,GAAGC,CAAM,IAAgC,CAClG,KAAM,CAAE,YAAAG,CAAY,EAAIX,EAAuB,EACzCiB,EAAWN,IAAgBP,EAEjC,SACE,QAAC,WACC,MAAOA,EACP,aAAW,MACT,2HACAG,CACF,EACC,GAAGC,EAEJ,oBAAC,QACC,aAAW,MACT,wFACAS,GAAY,QACd,EACF,EACCX,GACH,CAEJ,EAOMY,EAAoB,CAAC,CAAE,SAAAZ,EAAU,UAAAC,EAAW,GAAGC,CAAM,OAEvD,OAAC,QACC,KAAM,EACN,aAAW,MAAG,+EAAgFD,CAAS,EACtG,GAAGC,EAEH,SAAAF,EACH,EAWEa,EAAsB,CAAC,CAC3B,MAAAf,EACA,WAAAgB,EAAa,GACb,SAAAd,EACA,UAAAC,EACA,GAAGC,CACL,OAEI,OAAC,WAAQ,MAAOJ,EAAO,WAAYgB,EAAa,GAAO,OAAW,aAAW,MAAGb,CAAS,EAAI,GAAGC,EAC7F,SAAAF,EACH,EAIJJ,EAAoB,YAAc,sBAGlCA,EAAoB,KAAOY,EAC3BZ,EAAoB,QAAUc,EAC9Bd,EAAoB,MAAQgB,EAC5BhB,EAAoB,QAAUiB,EAE9B,IAAO3B,EAAQU",
|
|
6
6
|
"names": ["ProductBenefitsTabs_exports", "__export", "ProductBenefitsTabs_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_react", "import_helpers", "import_react_tabs", "BenefitsTabsContext", "useBenefitsTabsContext", "context", "ProductBenefitsTabs", "defaultValue", "value", "onValueChange", "children", "className", "props", "internalValue", "setInternalValue", "activeValue", "setActiveValue", "newValue", "BenefitsTabsList", "ref", "BenefitsTabsTrigger", "isActive", "BenefitsTabsBadge", "BenefitsTabsContent", "forceMount"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var le=Object.create;var B=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var se=(t,l)=>{for(var o in l)B(t,o,{get:l[o],enumerable:!0})},O=(t,l,o,w)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of oe(l))!ne.call(t,s)&&s!==o&&B(t,s,{get:()=>l[s],enumerable:!(w=ie(l,s))||w.enumerable});return t};var ce=(t,l,o)=>(o=t!=null?le(re(t)):{},O(l||!t||!t.__esModule?B(o,"default",{value:t,enumerable:!0}):o,t)),de=t=>O(B({},"__esModule",{value:!0}),t);var ge={};se(ge,{default:()=>be});module.exports=de(ge);var e=require("react/jsx-runtime"),W=require("../../../../AiuiProvider/index.js"),_=require("../../../../../components/index.js"),a=require("react"),T=require("swiper/react"),b=require("swiper/modules"),C=require("../../../../../helpers/index.js"),A=require("./types.js"),I=require("@radix-ui/react-tabs"),H=require("../../../BizProductProvider.js"),Z=require("../../../hooks/use-variant-media.js"),J=require("./components/SpecsModal.js"),Q=ce(require("./components/CompareModal.js")),X=require("../../../utils/index.js"),ee=require("../../../../../shared/Styles.js"),te=require("../../../../../shared/track.js"),ae=require("../../../../../components/index.js"),Y=require("es-toolkit");const q=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"})]}),U=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"})]}),ue=()=>{const{copyWriting:t}=(0,W.useAiuiContext)(),{product:l,variant:o,selectedOptions:w}=(0,H.useBizProductContext)(),s=(0,Z.useVariantMedia)({product:l,variant:o}),[g,N]=(0,a.useState)(null),R=(0,a.useRef)(null),v=o?.metafields?.component?.custom_media_list;let d,S,E,L;v&&v?.available?(d=v?.product||[],S=v?.scenarios||[],E=v?.keyFeatures||[],L=v?.video||[]):(d=s?.productList,S=s?.sceneList,E=s?.keyFeaturesList,L=s?.videoList);const u=(0,a.useMemo)(()=>[...d,...S,...L],[d,S,L]),f={productList:d,sceneList:S,keyFeaturesList:E,videoList:L},i=(0,a.useMemo)(()=>{const n=l?.payload?.components?.find(h=>h.componentKey==="ProductGallery")?.data||[],p=o?.payload?.components?.find(h=>h.componentKey==="ProductGallery")?.data||[];return n?.map(h=>{const k=p?.find(F=>h?.galleries===F?.galleries);let D=f[h?.galleries]||[];if(k?.images&&Array.isArray(k.images)&&k.images.length>0){const F=k.images.map(m=>{const M=[];if(m.image_1920&&m.image_1920.trim()&&M.push(`${m.image_1920}`),m.image_1440&&m.image_1440.trim()&&M.push(`${m.image_1440} 1919`),m.image_1024&&m.image_1024.trim()&&M.push(`${m.image_1024} 1439`),m.image_768&&m.image_768.trim()&&M.push(`${m.image_768} 1023`),m.image_390&&m.image_390.trim()&&M.push(`${m.image_390} 767`),M.length>0){const K=M.join(", ");return{image:{url:K,altText:h.comment?.content||""},_fromImages:!0,_responsiveSource:K}}return null}).filter(m=>m!==null);F.length>0&&(D=F)}return{...h,galleries:D}}).filter(h=>h.galleries.length>0)},[o?.payload,f,l?.payload]),[x,r]=(0,a.useState)(i?.[0]),[c,P]=(0,a.useState)(0),[y,G]=(0,a.useState)(null),V=(0,a.useCallback)(()=>{const n=(c+1)%i.length;P(n),r(i[n]),G(0)},[c,i]),z=(0,a.useCallback)(()=>{const n=c===0?i.length-1:c-1;P(n),r(i[n]);const p=i[n]?.galleries||[];G(p.length-1)},[c,i]);(0,a.useEffect)(()=>{c!=null&&requestAnimationFrame(()=>{R.current?.scrollToTab(c)})},[c]),(0,a.useEffect)(()=>{r(i[0]),P(0)},[o?.id]);const $=(n,p)=>{switch(n?.galleryTabType){case A.GalleryTabType.GALLERY_IMAGE_MAIN:return(0,e.jsx)(j,{...n,index:p,onNextTab:V,onPrevTab:z,targetSlideIndex:y,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_IMAGE_FEATURES:return(0,e.jsx)(j,{...n,index:p,onNextTab:V,onPrevTab:z,targetSlideIndex:y,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_IMAGE_SCENE:return(0,e.jsx)(j,{...n,index:p,onNextTab:V,onPrevTab:z,targetSlideIndex:y,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_VIDEO:return(0,e.jsx)(me,{...n,onNextTab:V,onPrevTab:z,targetSlideIndex:y,onSlideChange:()=>G(null)});default:return null}};return(0,e.jsx)("div",{id:"ipc-product-gallery",children:(0,e.jsxs)(I.Root,{className:"relative",value:x?.tabValue,defaultValue:i?.[0]?.tabValue,children:[(0,e.jsx)("div",{className:"tablet:h-[620px] laptop-md:rounded-2xl laptop-md:h-[560px] lg-desktop:h-[700px] laptop-md:relative h-[420px] overflow-hidden bg-[#EAEAEC] ",children:i.map((n,p)=>(0,e.jsx)(I.Content,{className:"h-full",value:n.tabValue,children:$(n,p)},n.tabValue))}),(0,e.jsx)(pe,{ref:R,galleryTabs:i,activeGalleryTab:x,setActiveGalleryTab:r,setActiveTabIndex:P,setTargetSlideIndex:G})]})})},pe=(0,a.forwardRef)((t,l)=>{const{galleryTabs:o,activeGalleryTab:w,setActiveGalleryTab:s,setActiveTabIndex:g,setTargetSlideIndex:N}=t,{product:R}=(0,H.useBizProductContext)(),v=(0,a.useRef)(null),d=(0,a.useRef)(new Map),S=(0,a.useCallback)(u=>{if(v.current){const f=v.current,i=u.currentTarget,x=i.offsetLeft-f.offsetWidth/2+i.offsetWidth/2;f.scrollTo({left:x,behavior:"smooth"})}},[]),E=(0,a.useCallback)((u,f,i)=>{s(f),g(i),N(0),S(u)},[s,g,N,S]),L=(0,a.useCallback)(u=>{if(v.current&&o[u]){const f=v.current,i=o[u],x=d.current.get(i.tabValue);if(x){const r=x.offsetLeft-f.offsetWidth/2+x.offsetWidth/2;f.scrollTo({left:r,behavior:"smooth"})}}},[o]);return(0,a.useImperativeHandle)(l,()=>({scrollToTab:L})),(0,e.jsxs)("div",{className:"laptop:inset-x-16 tablet:mt-3 laptop-md:static absolute inset-x-4 bottom-4 z-[2] flex items-center justify-between",children:[(0,e.jsx)(I.List,{ref:v,className:"laptop:p-0 laptop-md:p-1 overflow-x-auto rounded-full bg-[#EAEAEC] p-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,e.jsx)("div",{className:"whitespace-nowrap",children:o?.map((u,f)=>(0,e.jsx)(I.Trigger,{ref:i=>{i?d.current.set(u.tabValue,i):d.current.delete(u.tabValue)},className:(0,C.cn)("lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] rounded-full px-5 pb-[10px] pt-[11px] text-[14px] font-bold leading-tight",u.tabValue===w?.tabValue&&"bg-white"),onClick:i=>E(i,u,f),value:u.tabValue,children:u.tabLabel},u.tabValue+f))})}),(0,e.jsx)("div",{className:"laptop:gap-2 laptop:flex hidden",children:R.metafields?.global?.specifications&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(J.SpecsModal,{})," | ",(0,e.jsx)(Q.default,{})]})})]})}),j=(0,a.forwardRef)((t,l)=>{const{locale:o="us",copyWriting:w}=(0,W.useAiuiContext)(),{variant:s,totalSavings:g}=(0,H.useBizProductContext)(),N=(0,a.useRef)(null),[R,v]=(0,a.useState)(null),[d,S]=(0,a.useState)(null),[E,L]=(0,a.useState)([]),u=(0,a.useRef)(null),f=(0,a.useMemo)(()=>{if(t?.galleryTabType===A.GalleryTabType.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";t?.galleryTabType===A.GalleryTabType.GALLERY_IMAGE_FEATURES||(t?.galleryTabType,A.GalleryTabType.GALLERY_IMAGE_SCENE)},[t?.galleryTabType]),i=(0,a.useCallback)(()=>{d?.isBeginning?t.onPrevTab?.():d?.slidePrev()},[d,t]),x=(0,a.useCallback)(()=>{d?.isEnd?t.onNextTab?.():d?.slideNext()},[d,t]);return(0,a.useEffect)(()=>{d&&t.targetSlideIndex&&(d.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[d,t.targetSlideIndex,t]),(0,a.useEffect)(()=>{const r=()=>{if(!t?.comment?.content||!u.current)return;const y=u.current;y.textContent="Test";const V=y.offsetHeight*2+2,$=t.comment.content.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim().split(" "),n=[];let p="";for(let h=0;h<$.length;h++){const k=$[h],D=p?`${p} ${k}`:k;y.textContent=D,y.offsetHeight>V?p?(n.push(p),p=k):(n.push(k),p=""):p=D}p&&n.push(p),y.textContent="",L(n)},c=requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})}),P=()=>{r()};return window.addEventListener("resize",(0,Y.debounce)(P,500)),()=>{cancelAnimationFrame(c),window.removeEventListener("resize",(0,Y.debounce)(P,500))}},[t?.comment?.content]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(T.Swiper,{ref:l,className:"h-full",onSwiper:S,onTouchEnd:(r,c)=>{r.isBeginning&&r.swipeDirection==="prev"?i():r.isEnd&&r.swipeDirection==="next"&&x()},pagination:{clickable:!0,el:N.current},thumbs:{swiper:R},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((r,c)=>{const P=`${t.tabValue}-${c}`,y=()=>{(0,te.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${s.sku}`,component_type:"image",component_name:t?.tabLabel||"",position:c+1,creative_id:"",component_title:"",component_description:"",navigation:""}})},G=r?._responsiveSource||r?.image?.url||"";return(0,e.jsx)(T.SwiperSlide,{className:"h-full",children:(0,e.jsx)(ae.ExposureDetector,{onExposure:y,exposureKey:P,threshold:.5,duration:2e3,className:"h-full",children:(0,e.jsx)(_.Picture,{source:G,alt:r?.image?.altText,className:(0,C.cn)("h-full",f),imgClassName:"object-cover h-full"})})},t?.id+"SwiperSlideItem"+c)})}),s.availableForSale&&!!g&&!t.index&&(0,e.jsx)(_.Badge,{size:"lg",className:"bg-brand laptop:left-16 laptop:top-5 laptop-md:left-6 laptop-md:top-6 absolute left-4 top-3 z-[2] text-white",children:`${(0,X.formatPrice)({amount:g,currencyCode:s?.price?.currencyCode,locale:o})} ${w?.off}`}),(0,e.jsx)("div",{className:(0,C.cn)("tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 laptop-md:left-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:i,children:(0,e.jsx)(q,{className:(0,C.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsx)("div",{className:(0,C.cn)("tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 laptop-md:right-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:x,children:(0,e.jsx)(U,{className:(0,C.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsxs)("div",{className:"tablet:bottom-[70px] tablet:flex laptop:inset-x-16 laptop-md:bottom-[20px] laptop-md:inset-x-6 absolute inset-x-4 bottom-[94px] z-10 items-center justify-between",children:[(0,e.jsx)("div",{className:"tablet:block hidden",children:(0,e.jsx)(T.Swiper,{className:"flex items-center justify-between",onSwiper:v,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[b.Navigation,b.Thumbs],children:t?.galleries?.map((r,c)=>(0,e.jsx)(T.SwiperSlide,{className:"[&.swiper-slide-thumb-active]:border-brand !w-auto cursor-pointer border border-transparent [&.swiper-slide-thumb-active]:rounded",children:(0,e.jsx)(_.Picture,{source:r.image?.url,alt:r.image?.altText,className:"lg-desktop:size-12 size-10 overflow-hidden rounded bg-white",imgClassName:"object-cover h-full"})},t?.id+"SwiperSlideThumbItem"+c))})}),!t?.index&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_.Picture,{source:t?.comment?.avatar?.url,className:"laptop:size-10 size-8 shrink-0 rounded-full",imgClassName:"object-cover "}),(0,e.jsxs)("div",{className:"relative max-w-[528px]",children:[(0,e.jsx)("div",{ref:u,className:"lg-desktop:text-base pointer-events-none text-sm font-bold text-[#1D1D1F] opacity-0",style:{visibility:"hidden"}}),(0,e.jsx)(T.Swiper,{modules:[b.Autoplay],loop:E.length>1,className:"h-[44px]",direction:"vertical",autoplay:{delay:5e3,disableOnInteraction:!1},children:E.length>0?E.map((r,c)=>(0,e.jsx)(T.SwiperSlide,{children:(0,e.jsx)(_.Text,{html:r,as:"div",className:"lg-desktop:text-base overflow-hidden text-sm font-bold text-[#1D1D1F]"})},c+"text-group")):(0,e.jsx)(T.SwiperSlide,{children:(0,e.jsx)(_.Text,{as:"div",html:t?.comment?.content,className:"lg-desktop:text-base text-sm font-bold text-[#1D1D1F]"})})})]})]})]}),(0,e.jsx)("div",{ref:N,className:"tablet:hidden absolute inset-x-4 !bottom-[70px] z-10 text-center [&_.swiper-pagination-bullet-active]:!bg-[#080A0F] [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100"})]})}),me=t=>{const[l,o]=(0,a.useState)(null),w=(0,a.useCallback)(()=>{l?.isBeginning?t.onPrevTab?.():l?.slidePrev()},[l,t]),s=(0,a.useCallback)(()=>{l?.isEnd?t.onNextTab?.():l?.slideNext()},[l,t]);return(0,a.useEffect)(()=>{l&&t.targetSlideIndex!==null&&t.targetSlideIndex!==void 0&&(l.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[l,t.targetSlideIndex,t]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(T.Swiper,{className:"h-full",onSwiper:o,onTouchEnd:(g,N)=>{g.isBeginning&&g.swipeDirection==="prev"?w():g.isEnd&&g.swipeDirection==="next"&&s()},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((g,N)=>(0,e.jsx)(T.SwiperSlide,{className:"h-full",children:(0,e.jsxs)("video",{controls:!0,className:"size-full object-cover",children:[(0,e.jsx)("track",{kind:"captions"}),(0,e.jsx)("source",{src:g?.sources?.[0]?.url,type:"video/mp4"}),(0,e.jsx)("source",{src:g?.sources?.[0]?.url,type:"video/webm"}),(0,e.jsx)("source",{src:g?.sources?.[0]?.url,type:"video/ogg"})]})},t?.id+"SwiperSlideItem"+N))}),(0,e.jsx)("div",{className:(0,C.cn)("swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:w,children:(0,e.jsx)(q,{className:"tablet:size-10 lg-desktop:size-12"})}),(0,e.jsx)("div",{className:(0,C.cn)("tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:s,children:(0,e.jsx)(U,{className:"tablet:size-10 lg-desktop:size-12"})})]})},ve=t=>(0,e.jsx)("div",{children:"3D View"});var be=(0,ee.withLayout)(ue);
|
|
1
|
+
"use strict";var ie=Object.create;var B=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var ce=(t,l)=>{for(var o in l)B(t,o,{get:l[o],enumerable:!0})},O=(t,l,o,w)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of re(l))!se.call(t,s)&&s!==o&&B(t,s,{get:()=>l[s],enumerable:!(w=oe(l,s))||w.enumerable});return t};var de=(t,l,o)=>(o=t!=null?ie(ne(t)):{},O(l||!t||!t.__esModule?B(o,"default",{value:t,enumerable:!0}):o,t)),ue=t=>O(B({},"__esModule",{value:!0}),t);var ge={};ce(ge,{default:()=>be});module.exports=ue(ge);var e=require("react/jsx-runtime"),W=require("../../../../AiuiProvider/index.js"),_=require("../../../../../components/index.js"),a=require("react"),T=require("swiper/react"),b=require("swiper/modules"),C=require("../../../../../helpers/index.js"),A=require("./types.js"),I=require("@radix-ui/react-tabs"),j=require("../../../BizProductProvider.js"),J=require("../../../hooks/use-variant-media.js"),Q=require("./components/SpecsModal.js"),X=de(require("./components/CompareModal.js")),ee=require("../../../utils/index.js"),te=require("../../../../../shared/Styles.js"),ae=require("../../../../../shared/track.js"),le=require("../../../../../components/index.js"),Y=require("es-toolkit");const q=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"})]}),U=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"})]}),pe=()=>{const{copyWriting:t}=(0,W.useAiuiContext)(),{product:l,variant:o,selectedOptions:w}=(0,j.useBizProductContext)(),s=(0,J.useVariantMedia)({product:l,variant:o}),[g,N]=(0,a.useState)(null),R=(0,a.useRef)(null),v=o?.metafields?.component?.custom_media_list;let d,S,E,L;v&&v?.available?(d=v?.product||[],S=v?.scenarios||[],E=v?.keyFeatures||[],L=v?.video||[]):(d=s?.productList,S=s?.sceneList,E=s?.keyFeaturesList,L=s?.videoList);const u=(0,a.useMemo)(()=>[...d,...S,...L],[d,S,L]),f={productList:d,sceneList:S,keyFeaturesList:E,videoList:L},i=(0,a.useMemo)(()=>{const n=l?.payload?.components?.find(y=>y.componentKey==="ProductGallery")?.data||[],p=o?.payload?.components?.find(y=>y.componentKey==="ProductGallery")?.data||[];return n?.map(y=>{const k=p?.find(F=>y?.galleries===F?.galleries);let D=f[y?.galleries]||[];if(k?.images&&Array.isArray(k.images)&&k.images.length>0){const F=k.images.map(m=>{const M=[];if(m.image_1920&&m.image_1920.trim()&&M.push(`${m.image_1920}`),m.image_1440&&m.image_1440.trim()&&M.push(`${m.image_1440} 1919`),m.image_1024&&m.image_1024.trim()&&M.push(`${m.image_1024} 1439`),m.image_768&&m.image_768.trim()&&M.push(`${m.image_768} 1023`),m.image_390&&m.image_390.trim()&&M.push(`${m.image_390} 767`),M.length>0){const K=M.join(", ");return{image:{url:K,altText:y.comment?.content||""},_fromImages:!0,_responsiveSource:K}}return null}).filter(m=>m!==null);F.length>0&&(D=F)}return{...y,galleries:D}}).filter(y=>y.galleries.length>0)},[o?.payload,f,l?.payload]),[x,r]=(0,a.useState)(i?.[0]),[c,P]=(0,a.useState)(0),[h,G]=(0,a.useState)(null),V=(0,a.useCallback)(()=>{const n=(c+1)%i.length;P(n),r(i[n]),G(0)},[c,i]),z=(0,a.useCallback)(()=>{const n=c===0?i.length-1:c-1;P(n),r(i[n]);const p=i[n]?.galleries||[];G(p.length-1)},[c,i]);(0,a.useEffect)(()=>{c!=null&&requestAnimationFrame(()=>{R.current?.scrollToTab(c)})},[c]),(0,a.useEffect)(()=>{r(i[0]),P(0)},[o?.id]);const $=(n,p)=>{switch(n?.galleryTabType){case A.GalleryTabType.GALLERY_IMAGE_MAIN:return(0,e.jsx)(H,{...n,index:p,onNextTab:V,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_IMAGE_FEATURES:return(0,e.jsx)(H,{...n,index:p,onNextTab:V,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_IMAGE_SCENE:return(0,e.jsx)(H,{...n,index:p,onNextTab:V,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_VIDEO:return(0,e.jsx)(me,{...n,onNextTab:V,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});default:return null}};return(0,e.jsx)("div",{id:"ipc-product-gallery",children:(0,e.jsxs)(I.Root,{className:"relative",value:x?.tabValue,defaultValue:i?.[0]?.tabValue,children:[(0,e.jsx)("div",{className:"tablet:h-[620px] laptop-md:rounded-2xl laptop-md:h-[560px] lg-desktop:h-[700px] laptop-md:relative h-[420px] overflow-hidden bg-[#EAEAEC] ",children:i.map((n,p)=>(0,e.jsx)(I.Content,{className:"h-full",value:n.tabValue,children:$(n,p)},n.tabValue))}),(0,e.jsx)(Z,{ref:R,galleryTabs:i,activeGalleryTab:x,setActiveGalleryTab:r,setActiveTabIndex:P,setTargetSlideIndex:G})]})})},Z=(0,a.forwardRef)((t,l)=>{const{galleryTabs:o,activeGalleryTab:w,setActiveGalleryTab:s,setActiveTabIndex:g,setTargetSlideIndex:N}=t,{product:R}=(0,j.useBizProductContext)(),v=(0,a.useRef)(null),d=(0,a.useRef)(new Map),S=(0,a.useCallback)(u=>{if(v.current){const f=v.current,i=u.currentTarget,x=i.offsetLeft-f.offsetWidth/2+i.offsetWidth/2;f.scrollTo({left:x,behavior:"smooth"})}},[]),E=(0,a.useCallback)((u,f,i)=>{s(f),g(i),N(0),S(u)},[s,g,N,S]),L=(0,a.useCallback)(u=>{if(v.current&&o[u]){const f=v.current,i=o[u],x=d.current.get(i.tabValue);if(x){const r=x.offsetLeft-f.offsetWidth/2+x.offsetWidth/2;f.scrollTo({left:r,behavior:"smooth"})}}},[o]);return(0,a.useImperativeHandle)(l,()=>({scrollToTab:L})),(0,e.jsxs)("div",{className:"laptop:inset-x-16 tablet:mt-3 laptop-md:static absolute inset-x-4 bottom-4 z-[2] flex items-center justify-between",children:[(0,e.jsx)(I.List,{ref:v,className:"laptop:p-0 laptop-md:p-1 overflow-x-auto rounded-full bg-[#EAEAEC] p-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,e.jsx)("div",{className:"whitespace-nowrap",children:o?.map((u,f)=>(0,e.jsx)(I.Trigger,{ref:i=>{i?d.current.set(u.tabValue,i):d.current.delete(u.tabValue)},className:(0,C.cn)("lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] rounded-full px-5 pb-[10px] pt-[11px] text-[14px] font-bold leading-tight",u.tabValue===w?.tabValue&&"bg-white"),onClick:i=>E(i,u,f),value:u.tabValue,children:u.tabLabel},u.tabValue+f))})}),(0,e.jsx)("div",{className:"laptop:gap-2 laptop:flex hidden",children:R.metafields?.global?.specifications&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Q.SpecsModal,{})," | ",(0,e.jsx)(X.default,{})]})})]})});Z.displayName="ProductGalleryTab";const H=(0,a.forwardRef)((t,l)=>{const{locale:o="us",copyWriting:w}=(0,W.useAiuiContext)(),{variant:s,totalSavings:g}=(0,j.useBizProductContext)(),N=(0,a.useRef)(null),[R,v]=(0,a.useState)(null),[d,S]=(0,a.useState)(null),[E,L]=(0,a.useState)([]),u=(0,a.useRef)(null),f=(0,a.useMemo)(()=>{if(t?.galleryTabType===A.GalleryTabType.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";t?.galleryTabType===A.GalleryTabType.GALLERY_IMAGE_FEATURES||(t?.galleryTabType,A.GalleryTabType.GALLERY_IMAGE_SCENE)},[t?.galleryTabType]),i=(0,a.useCallback)(()=>{d?.isBeginning?t.onPrevTab?.():d?.slidePrev()},[d,t]),x=(0,a.useCallback)(()=>{d?.isEnd?t.onNextTab?.():d?.slideNext()},[d,t]);return(0,a.useEffect)(()=>{d&&t.targetSlideIndex&&(d.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[d,t.targetSlideIndex,t]),(0,a.useEffect)(()=>{const r=()=>{if(!t?.comment?.content||!u.current)return;const h=u.current;h.textContent="Test";const V=h.offsetHeight*2+2,$=t.comment.content.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim().split(" "),n=[];let p="";for(let y=0;y<$.length;y++){const k=$[y],D=p?`${p} ${k}`:k;h.textContent=D,h.offsetHeight>V?p?(n.push(p),p=k):(n.push(k),p=""):p=D}p&&n.push(p),h.textContent="",L(n)},c=requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})}),P=()=>{r()};return window.addEventListener("resize",(0,Y.debounce)(P,500)),()=>{cancelAnimationFrame(c),window.removeEventListener("resize",(0,Y.debounce)(P,500))}},[t?.comment?.content]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(T.Swiper,{ref:l,className:"h-full",onSwiper:S,onTouchEnd:(r,c)=>{r.isBeginning&&r.swipeDirection==="prev"?i():r.isEnd&&r.swipeDirection==="next"&&x()},pagination:{clickable:!0,el:N.current},thumbs:{swiper:R},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((r,c)=>{const P=`${t.tabValue}-${c}`,h=()=>{(0,ae.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${s.sku}`,component_type:"image",component_name:t?.tabLabel||"",position:c+1,creative_id:"",component_title:"",component_description:"",navigation:""}})},G=r?._responsiveSource||r?.image?.url||"";return(0,e.jsx)(T.SwiperSlide,{className:"h-full",children:(0,e.jsx)(le.ExposureDetector,{onExposure:h,exposureKey:P,threshold:.5,duration:2e3,className:"h-full",children:(0,e.jsx)(_.Picture,{source:G,alt:r?.image?.altText,className:(0,C.cn)("h-full",f),imgClassName:"object-cover h-full"})})},t?.id+"SwiperSlideItem"+c)})}),s.availableForSale&&!!g&&!t.index&&(0,e.jsx)(_.Badge,{size:"lg",className:"bg-brand laptop:left-16 laptop:top-5 laptop-md:left-6 laptop-md:top-6 absolute left-4 top-3 z-[2] text-white",children:`${(0,ee.formatPrice)({amount:g,currencyCode:s?.price?.currencyCode,locale:o})} ${w?.off}`}),(0,e.jsx)("div",{className:(0,C.cn)("tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 laptop-md:left-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:i,children:(0,e.jsx)(q,{className:(0,C.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsx)("div",{className:(0,C.cn)("tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 laptop-md:right-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:x,children:(0,e.jsx)(U,{className:(0,C.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,e.jsxs)("div",{className:"tablet:bottom-[70px] tablet:flex laptop:inset-x-16 laptop-md:bottom-[20px] laptop-md:inset-x-6 absolute inset-x-4 bottom-[94px] z-10 items-center justify-between",children:[(0,e.jsx)("div",{className:"tablet:block hidden",children:(0,e.jsx)(T.Swiper,{className:"flex items-center justify-between",onSwiper:v,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[b.Navigation,b.Thumbs],children:t?.galleries?.map((r,c)=>(0,e.jsx)(T.SwiperSlide,{className:"[&.swiper-slide-thumb-active]:border-brand !w-auto cursor-pointer border border-transparent [&.swiper-slide-thumb-active]:rounded",children:(0,e.jsx)(_.Picture,{source:r.image?.url,alt:r.image?.altText,className:"lg-desktop:size-12 size-10 overflow-hidden rounded bg-white",imgClassName:"object-cover h-full"})},t?.id+"SwiperSlideThumbItem"+c))})}),!t?.index&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_.Picture,{source:t?.comment?.avatar?.url,className:"laptop:size-10 size-8 shrink-0 rounded-full",imgClassName:"object-cover "}),(0,e.jsxs)("div",{className:"relative max-w-[528px]",children:[(0,e.jsx)("div",{ref:u,className:"lg-desktop:text-base pointer-events-none text-sm font-bold text-[#1D1D1F] opacity-0",style:{visibility:"hidden"}}),(0,e.jsx)(T.Swiper,{modules:[b.Autoplay],loop:E.length>1,className:"h-[44px]",direction:"vertical",autoplay:{delay:5e3,disableOnInteraction:!1},children:E.length>0?E.map((r,c)=>(0,e.jsx)(T.SwiperSlide,{children:(0,e.jsx)(_.Text,{html:r,as:"div",className:"lg-desktop:text-base overflow-hidden text-sm font-bold text-[#1D1D1F]"})},c+"text-group")):(0,e.jsx)(T.SwiperSlide,{children:(0,e.jsx)(_.Text,{as:"div",html:t?.comment?.content,className:"lg-desktop:text-base text-sm font-bold text-[#1D1D1F]"})})})]})]})]}),(0,e.jsx)("div",{ref:N,className:"tablet:hidden absolute inset-x-4 !bottom-[70px] z-10 text-center [&_.swiper-pagination-bullet-active]:!bg-[#080A0F] [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100"})]})});H.displayName="ProductGalleryTabImage";const me=t=>{const[l,o]=(0,a.useState)(null),w=(0,a.useCallback)(()=>{l?.isBeginning?t.onPrevTab?.():l?.slidePrev()},[l,t]),s=(0,a.useCallback)(()=>{l?.isEnd?t.onNextTab?.():l?.slideNext()},[l,t]);return(0,a.useEffect)(()=>{l&&t.targetSlideIndex!==null&&t.targetSlideIndex!==void 0&&(l.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[l,t.targetSlideIndex,t]),(0,e.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,e.jsx)(T.Swiper,{className:"h-full",onSwiper:o,onTouchEnd:(g,N)=>{g.isBeginning&&g.swipeDirection==="prev"?w():g.isEnd&&g.swipeDirection==="next"&&s()},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((g,N)=>(0,e.jsx)(T.SwiperSlide,{className:"h-full",children:(0,e.jsxs)("video",{controls:!0,className:"size-full object-cover",children:[(0,e.jsx)("track",{kind:"captions"}),(0,e.jsx)("source",{src:g?.sources?.[0]?.url,type:"video/mp4"}),(0,e.jsx)("source",{src:g?.sources?.[0]?.url,type:"video/webm"}),(0,e.jsx)("source",{src:g?.sources?.[0]?.url,type:"video/ogg"})]})},t?.id+"SwiperSlideItem"+N))}),(0,e.jsx)("div",{className:(0,C.cn)("swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:w,children:(0,e.jsx)(q,{className:"tablet:size-10 lg-desktop:size-12"})}),(0,e.jsx)("div",{className:(0,C.cn)("tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:s,children:(0,e.jsx)(U,{className:"tablet:size-10 lg-desktop:size-12"})})]})},ve=t=>(0,e.jsx)("div",{children:"3D View"});var be=(0,te.withLayout)(pe);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|