@anker-in/headless-ui 1.1.74 → 1.1.76
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/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js.map +2 -2
- package/dist/cjs/biz-components/ActivityMechanism/index.d.ts +9 -0
- package/dist/cjs/biz-components/ActivityMechanism/index.js +2 -0
- package/dist/cjs/biz-components/ActivityMechanism/index.js.map +7 -0
- package/dist/cjs/biz-components/ActivityMechanism/types.d.ts +43 -0
- package/dist/cjs/biz-components/ActivityMechanism/types.js +2 -0
- package/dist/cjs/biz-components/ActivityMechanism/types.js.map +7 -0
- package/dist/cjs/biz-components/ActivitySchedule/index.d.ts +3 -0
- package/dist/cjs/biz-components/ActivitySchedule/index.js +2 -0
- package/dist/cjs/biz-components/ActivitySchedule/index.js.map +7 -0
- package/dist/cjs/biz-components/ActivitySchedule/types.d.ts +44 -0
- package/dist/cjs/biz-components/ActivitySchedule/types.js +2 -0
- package/dist/cjs/biz-components/ActivitySchedule/types.js.map +7 -0
- package/dist/cjs/biz-components/AnchorNavigation/index.d.ts +20 -0
- package/dist/cjs/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/cjs/biz-components/AnchorNavigation/index.js.map +3 -3
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js.map +2 -2
- package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/index.js.map +3 -3
- package/dist/cjs/biz-components/FooterNavigation/types.d.ts +7 -0
- package/dist/cjs/biz-components/FooterNavigation/types.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/types.js.map +2 -2
- package/dist/cjs/biz-components/GiftShelf/index.d.ts +3 -0
- package/dist/cjs/biz-components/GiftShelf/index.js +2 -0
- package/dist/cjs/biz-components/GiftShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/GiftShelf/types.d.ts +120 -0
- package/dist/cjs/biz-components/GiftShelf/types.js +2 -0
- package/dist/cjs/biz-components/GiftShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/GiftTierShelf/index.d.ts +3 -0
- package/dist/cjs/biz-components/GiftTierShelf/index.js +2 -0
- package/dist/cjs/biz-components/GiftTierShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/GiftTierShelf/types.d.ts +75 -0
- package/dist/cjs/biz-components/GiftTierShelf/types.js +2 -0
- package/dist/cjs/biz-components/GiftTierShelf/types.js.map +7 -0
- 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/HeroBanner/types.d.ts +2 -0
- package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/types.js.map +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js.map +2 -2
- package/dist/cjs/biz-components/Ksp/index.d.ts +45 -6
- package/dist/cjs/biz-components/Ksp/index.js +1 -1
- package/dist/cjs/biz-components/Ksp/index.js.map +3 -3
- package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerBase/index.js.map +3 -3
- package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
- package/dist/cjs/biz-components/PromotionalBar/index.js.map +3 -3
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js.map +2 -2
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/biz-components/Title/index.js.map +3 -3
- package/dist/cjs/biz-components/Title/types.d.ts +10 -1
- package/dist/cjs/biz-components/Title/types.js +1 -1
- package/dist/cjs/biz-components/Title/types.js.map +1 -1
- package/dist/cjs/biz-components/VideoModal/index.js +1 -1
- package/dist/cjs/biz-components/VideoModal/index.js.map +2 -2
- package/dist/cjs/biz-components/WheelLottery/BaseModal.d.ts +61 -0
- package/dist/cjs/biz-components/WheelLottery/BaseModal.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/BaseModal.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/ChanceMethods.d.ts +25 -0
- package/dist/cjs/biz-components/WheelLottery/ChanceMethods.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/ChanceMethods.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/ErrorModal.d.ts +47 -0
- package/dist/cjs/biz-components/WheelLottery/ErrorModal.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/ErrorModal.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/MyRewardsModal.d.ts +101 -0
- package/dist/cjs/biz-components/WheelLottery/MyRewardsModal.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/MyRewardsModal.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/PrizePool.d.ts +29 -0
- package/dist/cjs/biz-components/WheelLottery/PrizePool.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/PrizePool.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/RulesModal.d.ts +56 -0
- package/dist/cjs/biz-components/WheelLottery/RulesModal.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/RulesModal.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/ShareModal.d.ts +79 -0
- package/dist/cjs/biz-components/WheelLottery/ShareModal.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/ShareModal.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/Wheel.d.ts +27 -0
- package/dist/cjs/biz-components/WheelLottery/Wheel.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/Wheel.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/WinnerModal.d.ts +27 -0
- package/dist/cjs/biz-components/WheelLottery/WinnerModal.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/WinnerModal.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/index.d.ts +48 -0
- package/dist/cjs/biz-components/WheelLottery/index.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/index.js.map +7 -0
- package/dist/cjs/biz-components/WheelLottery/types.d.ts +1229 -0
- package/dist/cjs/biz-components/WheelLottery/types.js +2 -0
- package/dist/cjs/biz-components/WheelLottery/types.js.map +7 -0
- package/dist/cjs/biz-components/index.d.ts +11 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/Countdown.d.ts +27 -4
- package/dist/cjs/components/Countdown.js +1 -1
- package/dist/cjs/components/Countdown.js.map +3 -3
- package/dist/cjs/hooks/useCountDown.js +1 -1
- package/dist/cjs/hooks/useCountDown.js.map +3 -3
- package/dist/cjs/hooks/useDraggableScroll.d.ts +77 -0
- package/dist/cjs/hooks/useDraggableScroll.js +2 -0
- package/dist/cjs/hooks/useDraggableScroll.js.map +7 -0
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js.map +2 -2
- package/dist/esm/biz-components/ActivityMechanism/index.d.ts +9 -0
- package/dist/esm/biz-components/ActivityMechanism/index.js +2 -0
- package/dist/esm/biz-components/ActivityMechanism/index.js.map +7 -0
- package/dist/esm/biz-components/ActivityMechanism/types.d.ts +43 -0
- package/dist/esm/biz-components/ActivityMechanism/types.js +1 -0
- package/dist/esm/biz-components/ActivityMechanism/types.js.map +7 -0
- package/dist/esm/biz-components/ActivitySchedule/index.d.ts +3 -0
- package/dist/esm/biz-components/ActivitySchedule/index.js +2 -0
- package/dist/esm/biz-components/ActivitySchedule/index.js.map +7 -0
- package/dist/esm/biz-components/ActivitySchedule/types.d.ts +44 -0
- package/dist/esm/biz-components/ActivitySchedule/types.js +1 -0
- package/dist/esm/biz-components/ActivitySchedule/types.js.map +7 -0
- package/dist/esm/biz-components/AnchorNavigation/index.d.ts +20 -0
- package/dist/esm/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/esm/biz-components/AnchorNavigation/index.js.map +3 -3
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js.map +3 -3
- package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/index.js.map +3 -3
- package/dist/esm/biz-components/FooterNavigation/types.d.ts +7 -0
- package/dist/esm/biz-components/FooterNavigation/types.js.map +2 -2
- package/dist/esm/biz-components/GiftShelf/index.d.ts +3 -0
- package/dist/esm/biz-components/GiftShelf/index.js +2 -0
- package/dist/esm/biz-components/GiftShelf/index.js.map +7 -0
- package/dist/esm/biz-components/GiftShelf/types.d.ts +120 -0
- package/dist/esm/biz-components/GiftShelf/types.js +1 -0
- package/dist/esm/biz-components/GiftShelf/types.js.map +7 -0
- package/dist/esm/biz-components/GiftTierShelf/index.d.ts +3 -0
- package/dist/esm/biz-components/GiftTierShelf/index.js +2 -0
- package/dist/esm/biz-components/GiftTierShelf/index.js.map +7 -0
- package/dist/esm/biz-components/GiftTierShelf/types.d.ts +75 -0
- package/dist/esm/biz-components/GiftTierShelf/types.js +1 -0
- package/dist/esm/biz-components/GiftTierShelf/types.js.map +7 -0
- 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/HeroBanner/types.d.ts +2 -0
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js.map +2 -2
- package/dist/esm/biz-components/Ksp/index.d.ts +45 -6
- package/dist/esm/biz-components/Ksp/index.js +1 -1
- package/dist/esm/biz-components/Ksp/index.js.map +3 -3
- package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js.map +3 -3
- package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
- package/dist/esm/biz-components/PromotionalBar/index.js.map +3 -3
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js.map +2 -2
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/biz-components/Title/index.js.map +3 -3
- package/dist/esm/biz-components/Title/types.d.ts +10 -1
- package/dist/esm/biz-components/VideoModal/index.js +1 -1
- package/dist/esm/biz-components/VideoModal/index.js.map +2 -2
- package/dist/esm/biz-components/WheelLottery/BaseModal.d.ts +61 -0
- package/dist/esm/biz-components/WheelLottery/BaseModal.js +2 -0
- package/dist/esm/biz-components/WheelLottery/BaseModal.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/ChanceMethods.d.ts +25 -0
- package/dist/esm/biz-components/WheelLottery/ChanceMethods.js +2 -0
- package/dist/esm/biz-components/WheelLottery/ChanceMethods.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/ErrorModal.d.ts +47 -0
- package/dist/esm/biz-components/WheelLottery/ErrorModal.js +2 -0
- package/dist/esm/biz-components/WheelLottery/ErrorModal.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/MyRewardsModal.d.ts +101 -0
- package/dist/esm/biz-components/WheelLottery/MyRewardsModal.js +2 -0
- package/dist/esm/biz-components/WheelLottery/MyRewardsModal.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/PrizePool.d.ts +29 -0
- package/dist/esm/biz-components/WheelLottery/PrizePool.js +2 -0
- package/dist/esm/biz-components/WheelLottery/PrizePool.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/RulesModal.d.ts +56 -0
- package/dist/esm/biz-components/WheelLottery/RulesModal.js +2 -0
- package/dist/esm/biz-components/WheelLottery/RulesModal.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/ShareModal.d.ts +79 -0
- package/dist/esm/biz-components/WheelLottery/ShareModal.js +2 -0
- package/dist/esm/biz-components/WheelLottery/ShareModal.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/Wheel.d.ts +27 -0
- package/dist/esm/biz-components/WheelLottery/Wheel.js +2 -0
- package/dist/esm/biz-components/WheelLottery/Wheel.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/WinnerModal.d.ts +27 -0
- package/dist/esm/biz-components/WheelLottery/WinnerModal.js +2 -0
- package/dist/esm/biz-components/WheelLottery/WinnerModal.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/index.d.ts +48 -0
- package/dist/esm/biz-components/WheelLottery/index.js +2 -0
- package/dist/esm/biz-components/WheelLottery/index.js.map +7 -0
- package/dist/esm/biz-components/WheelLottery/types.d.ts +1229 -0
- package/dist/esm/biz-components/WheelLottery/types.js +2 -0
- package/dist/esm/biz-components/WheelLottery/types.js.map +7 -0
- package/dist/esm/biz-components/index.d.ts +11 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/dist/esm/components/Countdown.d.ts +27 -4
- package/dist/esm/components/Countdown.js +1 -1
- package/dist/esm/components/Countdown.js.map +3 -3
- package/dist/esm/hooks/useCountDown.js +1 -1
- package/dist/esm/hooks/useCountDown.js.map +3 -3
- package/dist/esm/hooks/useDraggableScroll.d.ts +77 -0
- package/dist/esm/hooks/useDraggableScroll.js +2 -0
- package/dist/esm/hooks/useDraggableScroll.js.map +7 -0
- package/package.json +1 -1
- package/style.css +6252 -862
- package/tailwind.config.js +18 -2
- package/dist/cjs/biz-components/HeroBanner/Countdown.d.ts +0 -10
- package/dist/cjs/biz-components/HeroBanner/Countdown.js +0 -2
- package/dist/cjs/biz-components/HeroBanner/Countdown.js.map +0 -7
- package/dist/cjs/biz-components/Title/Countdown.d.ts +0 -14
- package/dist/cjs/biz-components/Title/Countdown.js +0 -2
- package/dist/cjs/biz-components/Title/Countdown.js.map +0 -7
- package/dist/esm/biz-components/HeroBanner/Countdown.d.ts +0 -10
- package/dist/esm/biz-components/HeroBanner/Countdown.js +0 -2
- package/dist/esm/biz-components/HeroBanner/Countdown.js.map +0 -7
- package/dist/esm/biz-components/Title/Countdown.d.ts +0 -14
- package/dist/esm/biz-components/Title/Countdown.js +0 -2
- package/dist/esm/biz-components/Title/Countdown.js.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/GiftShelf/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Button, Container, Heading } from '../../components/index.js'\nimport { cva } from 'class-variance-authority'\nimport type { GiftShelfProps, GiftShelfItem, CountdownConfig, ResponsiveBackgroundImage } from './types.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { Product, ProductVariant } from '../Listing/types/product.js'\nimport { formatVariantPrice } from '../Listing/utils/index.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { replaceTemplate } from '../Listing/utils/textFormat.js'\nimport type { GiftShelfProduct } from './types.js'\nimport type { Media } from '../../types/props.js'\n\n/**\n * Card style variants for gift shelf\n */\nconst giftCardVariants = cva('desktop:px-6 rounded-card relative min-w-0 overflow-hidden p-4', {\n variants: {\n state: {\n light: 'bg-[#EAEAEC]',\n dark: 'bg-[#1E2024]',\n },\n },\n defaultVariants: {\n state: 'light',\n },\n})\n\n/**\n * Content layout variants - \u63A7\u5236 Background image \u548C Bottom info area \u7684\u5E03\u5C40\n * horizontal \u5E03\u5C40\u4EC5\u5728 desktop (\u22651440px) \u65AD\u70B9\u751F\u6548\n */\nconst contentLayoutVariants = cva('', {\n variants: {\n layout: {\n vertical: '',\n horizontal: 'desktop:flex desktop:flex-row desktop:items-stretch desktop:gap-10',\n },\n },\n defaultVariants: {\n layout: 'vertical',\n },\n})\n\n/**\n * Image area variants\n * horizontal \u5E03\u5C40\u4EC5\u5728 desktop (\u22651440px) \u65AD\u70B9\u751F\u6548\n */\nconst imageAreaVariants = cva(\n 'desktop:max-w-[268px] lg-desktop:max-w-[356px] lg-desktop:h-[171px] relative mx-auto h-[118px] max-w-[256px] ',\n {\n variants: {\n layout: {\n vertical: '',\n horizontal: 'desktop:flex-1 desktop:h-[122px] lg-desktop:h-[161px]',\n },\n },\n defaultVariants: {\n layout: 'vertical',\n },\n }\n)\n\n/**\n * Info area variants\n * horizontal \u5E03\u5C40\u4EC5\u5728 desktop (\u22651440px) \u65AD\u70B9\u751F\u6548\n */\nconst infoAreaVariants = cva('mt-3', {\n variants: {\n layout: {\n vertical: '',\n horizontal: 'desktop:mt-0 desktop:flex-1 desktop:flex desktop:flex-col desktop:justify-center',\n },\n },\n defaultVariants: {\n layout: 'vertical',\n },\n})\n\n/**\n * Button style variants\n */\nconst buttonVariants = cva('mt-4 self-start', {\n variants: {\n state: {\n light: 'bg-[#080A0F] text-white',\n dark: 'bg-white text-[#080A0F]',\n },\n },\n defaultVariants: {\n state: 'light',\n },\n})\n\n/**\n * Text style variants\n */\nconst textVariants = cva('', {\n variants: {\n state: {\n light: 'text-[#080A0F]',\n dark: 'text-white',\n },\n },\n defaultVariants: {\n state: 'light',\n },\n})\n\n/**\n * Convert ResponsiveBackgroundImage to Picture source string\n * Format: \"url1 1920, url2 1439, url3 1024, url4 767, url5\"\n */\nconst getResponsiveSource = (bgImage?: ResponsiveBackgroundImage): string | undefined => {\n if (!bgImage) return undefined\n\n const sources: string[] = []\n\n // lg-desktop: \u22651920px\n if (bgImage.lgDesktop?.url) {\n sources.push(`${bgImage.lgDesktop.url} 1920`)\n }\n // desktop: \u22651440px\n if (bgImage.desktop?.url) {\n sources.push(`${bgImage.desktop.url} 1439`)\n }\n // laptop: \u22651025px\n if (bgImage.laptop?.url) {\n sources.push(`${bgImage.laptop.url} 1024`)\n }\n // tablet: \u2265768px\n if (bgImage.tablet?.url) {\n sources.push(`${bgImage.tablet.url} 767`)\n }\n // default (mobile): <768px\n if (bgImage.default?.url) {\n sources.push(bgImage.default.url)\n }\n\n return sources.length > 0 ? sources.join(', ') : undefined\n}\n\n/**\n * Get alt text from ResponsiveBackgroundImage\n */\nconst getBackgroundAlt = (bgImage?: ResponsiveBackgroundImage): string => {\n if (!bgImage) return ''\n return (\n bgImage.default?.alt ||\n bgImage.tablet?.alt ||\n bgImage.laptop?.alt ||\n bgImage.desktop?.alt ||\n bgImage.lgDesktop?.alt ||\n ''\n )\n}\n\n/**\n * Format countdown time\n */\nconst formatTime = (seconds: number) => {\n const hours = Math.floor(seconds / 3600)\n const minutes = Math.floor((seconds % 3600) / 60)\n const secs = seconds % 60\n return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`\n}\n\n/**\n * \u89E3\u6790\u5F00\u59CB\u65F6\u95F4\uFF0C\u652F\u6301 ISO 8601 \u5B57\u7B26\u4E32\u6216\u65F6\u95F4\u6233\n */\nconst parseStartTime = (startTime: string | number): number => {\n if (typeof startTime === 'number') {\n return startTime\n }\n // \u89E3\u6790 ISO 8601 \u5B57\u7B26\u4E32\n const parsed = new Date(startTime).getTime()\n return isNaN(parsed) ? 0 : parsed\n}\n\n/**\n * \u8BA1\u7B97\u5F53\u524D\u662F\u5426\u5904\u4E8E\u8F6E\u6B21\u5207\u6362\u671F\uFF08\u4E0B\u4E00\u8F6E\u5F00\u59CB\u524D5\u5206\u949F\uFF09\n * @param countdown \u5012\u8BA1\u65F6\u914D\u7F6E\n * @returns \u662F\u5426\u5904\u4E8E\u5207\u6362\u671F\n */\nconst isInTransitionPeriod = (countdown?: CountdownConfig): boolean => {\n if (!countdown) return false\n const startTimeMs = parseStartTime(countdown.startTime)\n const durationMs = (countdown.durationDays ?? 1) * 24 * 3600 * 1000\n const rounds = countdown.rounds ?? 1\n const now = Date.now()\n\n // \u672A\u5230\u5F00\u59CB\u65F6\u95F4\n if (now < startTimeMs) return false\n\n // \u8BA1\u7B97\u5F53\u524D\u8F6E\u6B21\n const elapsed = now - startTimeMs\n const currentRound = Math.floor(elapsed / durationMs) + 1\n\n // \u6240\u6709\u8F6E\u6B21\u5DF2\u7ED3\u675F\n if (currentRound > rounds) return false\n\n // \u8BA1\u7B97\u5F53\u524D\u8F6E\u6B21\u7684\u7ED3\u675F\u65F6\u95F4\n const currentRoundEndTime = startTimeMs + currentRound * durationMs\n\n // \u8DDD\u79BB\u5F53\u524D\u8F6E\u6B21\u7ED3\u675F\u7684\u65F6\u95F4\n const timeUntilRoundEnd = currentRoundEndTime - now\n\n // \u5982\u679C\u8DDD\u79BB\u7ED3\u675F\u4E0D\u52305\u5206\u949F\uFF0C\u5904\u4E8E\u5207\u6362\u671F\n const TRANSITION_PERIOD_MS = 5 * 60 * 1000 // 5\u5206\u949F\n return timeUntilRoundEnd <= TRANSITION_PERIOD_MS && timeUntilRoundEnd > 0\n}\n\n/**\n * \u6839\u636E\u5012\u8BA1\u65F6\u914D\u7F6E\u8BA1\u7B97\u5F53\u524D\u8F6E\u6B21\u7684 Code\n * @param codePrefix Code \u524D\u7F00\n * @param countdown \u5012\u8BA1\u65F6\u914D\u7F6E\n * @returns \u5B8C\u6574\u7684 Code\uFF08\u524D\u7F00 + MMDD \u540E\u7F00\uFF09\n * @description \u7EDF\u4E00\u4F7F\u7528 UTC \u65F6\u95F4\u8BA1\u7B97\uFF0C\u786E\u4FDD\u5168\u7403\u4EFB\u4F55\u65F6\u533A\u5F97\u5230\u76F8\u540C\u7684 code\n */\nconst getCodeWithSuffix = (codePrefix?: string, countdown?: CountdownConfig): string => {\n if (!codePrefix || !countdown) return codePrefix || ''\n\n const startTimeMs = parseStartTime(countdown.startTime)\n const durationMs = (countdown.durationDays ?? 1) * 24 * 3600 * 1000\n const rounds = countdown.rounds ?? 1\n const now = Date.now()\n\n // \u672A\u5230\u5F00\u59CB\u65F6\u95F4\uFF0C\u4F7F\u7528\u7B2C\u4E00\u8F6E\u7684\u65E5\u671F\uFF08UTC \u65F6\u95F4\uFF09\n if (now < startTimeMs) {\n const date = new Date(startTimeMs)\n const suffix = `${(date.getUTCMonth() + 1).toString().padStart(2, '0')}${date.getUTCDate().toString().padStart(2, '0')}`\n return `${codePrefix}${suffix}`\n }\n\n // \u8BA1\u7B97\u5F53\u524D\u5904\u4E8E\u7B2C\u51E0\u8F6E\uFF08\u4ECE 1 \u5F00\u59CB\uFF09\n const elapsed = now - startTimeMs\n const currentRound = Math.min(Math.floor(elapsed / durationMs) + 1, rounds)\n\n // \u8BA1\u7B97\u5F53\u524D\u8F6E\u6B21\u7684\u5F00\u59CB\u65E5\u671F\n const currentRoundStartMs = startTimeMs + (currentRound - 1) * durationMs\n const date = new Date(currentRoundStartMs)\n\n // \u683C\u5F0F\u5316\u4E3A MMDD\uFF08\u4F7F\u7528 UTC \u65F6\u95F4\uFF09\n const suffix = `${(date.getUTCMonth() + 1).toString().padStart(2, '0')}${date.getUTCDate().toString().padStart(2, '0')}`\n\n return `${codePrefix}${suffix}`\n}\n\n/**\n * \u5012\u8BA1\u65F6\u72B6\u6001\u7C7B\u578B\n */\ntype CountdownState = 'beforeStart' | 'running' | 'lastRound' | 'finished'\n\n/**\n * Countdown Component\n * \u652F\u6301\u591A\u8F6E\u5012\u8BA1\u65F6\uFF0C\u663E\u793A\u4E0D\u540C\u72B6\u6001\u7684\u6807\u7B7E\n */\nconst Countdown = React.memo(\n ({\n config,\n theme = 'light',\n className,\n countdownText = 'Next round start time',\n lastRoundText = 'Last round',\n beforeStartText = 'Start time',\n countdownIcon,\n onStateChange,\n }: {\n config: CountdownConfig\n theme?: 'light' | 'dark'\n className?: string\n countdownText?: string\n lastRoundText?: string\n beforeStartText?: string\n countdownIcon?: Media\n onStateChange?: (state: CountdownState) => void\n }) => {\n const [timeLeft, setTimeLeft] = React.useState(0)\n const [countdownState, setCountdownState] = React.useState<CountdownState>('beforeStart')\n\n // \u89E3\u6790\u5F00\u59CB\u65F6\u95F4\u4E3A\u65F6\u95F4\u6233\n const startTimeMs = React.useMemo(() => parseStartTime(config.startTime), [config.startTime])\n\n const rounds = config.rounds ?? 1\n // \u9ED8\u8BA4 1 \u5929\uFF0C\u8F6C\u6362\u4E3A\u6BEB\u79D2 (1\u5929 = 24\u5C0F\u65F6 = 86400\u79D2 = 86400000\u6BEB\u79D2)\n const durationMs = (config.durationDays ?? 1) * 24 * 3600 * 1000\n\n React.useEffect(() => {\n const calculateCountdown = () => {\n const now = Date.now()\n\n // \u672A\u5230\u5F00\u59CB\u65F6\u95F4\uFF0C\u663E\u793A\u5F00\u59CB\u524D\u5012\u8BA1\u65F6\n if (now < startTimeMs) {\n const diff = Math.max(0, Math.floor((startTimeMs - now) / 1000))\n setTimeLeft(diff)\n setCountdownState('beforeStart')\n return\n }\n\n // \u8BA1\u7B97\u5DF2\u7ECF\u8FC7\u53BB\u7684\u65F6\u95F4\n const elapsed = now - startTimeMs\n // \u8BA1\u7B97\u5F53\u524D\u5904\u4E8E\u7B2C\u51E0\u8F6E\uFF08\u4ECE 1 \u5F00\u59CB\uFF09\n const currentRound = Math.floor(elapsed / durationMs) + 1\n\n // \u6240\u6709\u8F6E\u6B21\u5DF2\u7ED3\u675F\n if (currentRound > rounds) {\n setCountdownState('finished')\n return\n }\n\n // \u8BA1\u7B97\u5F53\u524D\u8F6E\u6B21\u7684\u76EE\u6807\u65F6\u95F4\n const currentRoundTargetTime = startTimeMs + currentRound * durationMs\n // \u8BA1\u7B97\u5269\u4F59\u79D2\u6570\n const diff = Math.max(0, Math.floor((currentRoundTargetTime - now) / 1000))\n\n setTimeLeft(diff)\n // \u5224\u65AD\u662F\u5426\u662F\u6700\u540E\u4E00\u8F6E\n setCountdownState(currentRound === rounds ? 'lastRound' : 'running')\n }\n\n calculateCountdown()\n const timer = setInterval(calculateCountdown, 1000)\n\n return () => clearInterval(timer)\n }, [startTimeMs, durationMs, rounds])\n\n // \u901A\u77E5\u7236\u7EC4\u4EF6\u72B6\u6001\u53D8\u5316\n React.useEffect(() => {\n onStateChange?.(countdownState)\n }, [countdownState, onStateChange])\n\n // \u6839\u636E\u72B6\u6001\u83B7\u53D6\u663E\u793A\u7684\u6807\u7B7E\u6587\u672C\n const labelText = React.useMemo(() => {\n switch (countdownState) {\n case 'beforeStart':\n return beforeStartText\n case 'lastRound':\n return lastRoundText\n default:\n return countdownText\n }\n }, [countdownState, beforeStartText, lastRoundText, countdownText])\n\n // \u6240\u6709\u8F6E\u6B21\u5DF2\u7ED3\u675F\uFF0C\u4E0D\u6E32\u67D3\n if (countdownState === 'finished') {\n return null\n }\n\n return (\n <div\n className={cn(\n 'desktop:gap-2 laptop:text-base flex items-center gap-1 text-sm',\n theme === 'dark' ? 'text-white' : 'text-[#080A0F]',\n className\n )}\n >\n {countdownIcon && (\n <Picture\n source={countdownIcon.url}\n alt={countdownIcon.alt}\n className=\"laptop:size-5 size-4 shrink-0\"\n imgClassName=\"size-full object-contain\"\n />\n )}\n <Text html={labelText} className=\"whitespace-nowrap font-bold\" />\n <span className=\"font-bold\">|</span>\n <Text className=\"font-bold\" html={formatTime(timeLeft)} />\n </div>\n )\n }\n)\n\nCountdown.displayName = 'Countdown'\n\n/**\n * Progress Bar Component\n */\nconst ProgressBar = React.memo(\n ({ progress, theme = 'light', className }: { progress: number; theme?: 'light' | 'dark'; className?: string }) => {\n // Clamp progress between 0 and 100\n const clampedProgress = Math.min(100, Math.max(0, progress))\n\n return (\n <div\n className={cn(\n 'flex h-2 w-full items-stretch overflow-hidden rounded-full',\n theme === 'dark' ? 'bg-white/20' : 'bg-black/20',\n className\n )}\n role=\"progressbar\"\n aria-valuenow={clampedProgress}\n aria-valuemin={0}\n aria-valuemax={100}\n >\n <div\n className={cn(\n 'h-full rounded-full transition-all duration-300',\n theme === 'dark' ? 'bg-white' : 'bg-[#080A0F]'\n )}\n style={{ width: `${clampedProgress}%` }}\n />\n </div>\n )\n }\n)\n\nProgressBar.displayName = 'ProgressBar'\n\n/**\n * Gift Shelf Card Component\n */\nconst GiftShelfCard = React.memo(\n ({\n item,\n theme = 'light',\n layout = 'vertical',\n className,\n buttonClassName,\n countdownClassName,\n onButtonClick,\n buildData,\n buttonText,\n remainText,\n lowStockText,\n soldOutButtonText,\n discountText = 'Only {price}',\n countdownText,\n countdownIcon,\n lastRoundText,\n beforeStartText,\n comingSoonButtonText,\n loading,\n }: {\n item: GiftShelfItem\n theme?: 'light' | 'dark'\n layout?: 'vertical' | 'horizontal'\n className?: string\n buttonClassName?: string\n countdownClassName?: string\n onButtonClick?: ({ product, code }: { product: GiftShelfProduct; code: string }) => void\n buildData?: {\n products: Product[]\n }\n buttonText: string\n remainText?: string\n lowStockText?: string\n soldOutButtonText?: string\n discountText?: string\n countdownText?: string\n countdownIcon?: Media\n lastRoundText?: string\n beforeStartText?: string\n comingSoonButtonText?: string\n loading?: boolean\n }) => {\n const { locale = 'us' } = useAiuiContext()\n // \u83B7\u53D6\u7B2C\u4E00\u4E2A\u4EA7\u54C1\u7684\u7B80\u5316\u6570\u636E\n const firstProduct = item.products?.[0]\n\n // \u68C0\u6D4B\u662F\u5426\u5904\u4E8E\u8F6E\u6B21\u5207\u6362\u671F + \u5F53\u524D\u8F6E\u6B21 code\uFF08\u6BCF\u79D2\u66F4\u65B0\uFF09\n const [isTransitioning, setIsTransitioning] = React.useState(() => isInTransitionPeriod(item.countdown))\n const [currentCode, setCurrentCode] = React.useState(() => getCodeWithSuffix(item.codePrefix, item.countdown))\n // \u5012\u8BA1\u65F6\u72B6\u6001\n const [countdownState, setCountdownState] = React.useState<CountdownState>('beforeStart')\n\n React.useEffect(() => {\n const checkAndUpdate = () => {\n // \u66F4\u65B0\u8F6E\u6B21\u5207\u6362\u72B6\u6001\n setIsTransitioning(isInTransitionPeriod(item.countdown))\n // \u66F4\u65B0\u5F53\u524D\u8F6E\u6B21 code\uFF08\u4EC5\u5728\u503C\u53D8\u5316\u65F6\u66F4\u65B0\uFF09\n const newCode = getCodeWithSuffix(item.codePrefix, item.countdown)\n setCurrentCode(prev => (prev !== newCode ? newCode : prev))\n }\n\n // \u521D\u59CB\u68C0\u67E5\n checkAndUpdate()\n // \u6BCF\u79D2\u68C0\u67E5\u4E00\u6B21\n const timer = setInterval(checkAndUpdate, 1000)\n\n return () => clearInterval(timer)\n }, [item.codePrefix, item.countdown])\n\n // \u5012\u8BA1\u65F6\u72B6\u6001\u53D8\u5316\u56DE\u8C03\n const handleCountdownStateChange = React.useCallback((state: CountdownState) => {\n setCountdownState(state)\n }, [])\n\n // \u901A\u8FC7 handle \u5339\u914D buildData \u4E2D\u7684\u5B8C\u6574\u4EA7\u54C1\u6570\u636E\n const fullProduct = React.useMemo(() => {\n if (!firstProduct?.handle || !buildData?.products?.length) return null\n return buildData.products.find(p => p.handle === firstProduct.handle) || null\n }, [firstProduct?.handle, buildData?.products])\n\n const fullProductVariant = React.useMemo(\n () => fullProduct?.variants?.find(variant => variant?.sku === firstProduct?.sku) || ({} as ProductVariant),\n [firstProduct?.sku, fullProduct?.variants]\n )\n\n // \u7EC4\u5408\u5C55\u793A\u6570\u636E\uFF08\u4F18\u5148\u4F7F\u7528\u8BE6\u7EC6\u6570\u636E\uFF0C\u56DE\u9000\u5230\u7B80\u5316\u6570\u636E\uFF09\n const displayData = React.useMemo(() => {\n const { price, basePrice } = formatVariantPrice({\n locale: locale || 'us',\n baseAmount: fullProductVariant?.price?.amount,\n amount: firstProduct?.custom_price ?? fullProductVariant?.price?.amount,\n currencyCode: fullProduct?.price?.currencyCode || 'USD',\n })\n\n return {\n // \u4E3B\u4EF7\u683C/\u4EF7\u503C\u5C55\u793A\uFF1A\u6709\u8BE6\u7EC6\u6570\u636E\u65F6\u663E\u793A\u4EF7\u683C\uFF0C\u5426\u5219\u663E\u793A\u4EA7\u54C1\u540D\n value: basePrice,\n // \u4EA7\u54C1\u63CF\u8FF0/\u6807\u9898\uFF1A\u6709\u8BE6\u7EC6\u6570\u636E\u65F6\u663E\u793A\u6807\u9898\uFF0C\u5426\u5219\u4E3A\u7A7A\uFF08\u907F\u514D\u91CD\u590D\u663E\u793A\uFF09\n description: firstProduct?.custom_description,\n // \u4F18\u60E0\u4EF7\u683C\n salePrice: replaceTemplate(discountText || '', {\n price,\n }),\n }\n }, [\n fullProduct,\n fullProductVariant,\n locale,\n discountText,\n firstProduct?.custom_price,\n firstProduct?.custom_description,\n ])\n\n const handleClick = React.useCallback(() => {\n onButtonClick?.({ product: firstProduct, code: currentCode })\n }, [onButtonClick, currentCode, firstProduct])\n\n return (\n <div className={cn(giftCardVariants({ state: theme }), className)} data-ui-component-id=\"GiftShelfCard\">\n {/* Countdown section - above the card content (only in vertical layout) */}\n {item.countdown && (\n <div className=\"laptop:h-[24px] mb-4 h-[20px]\">\n <Countdown\n config={item.countdown}\n theme={theme}\n className={countdownClassName}\n countdownText={countdownText}\n lastRoundText={lastRoundText}\n beforeStartText={beforeStartText}\n countdownIcon={countdownIcon}\n onStateChange={handleCountdownStateChange}\n />\n </div>\n )}\n\n {/* Content layout wrapper - \u63A7\u5236 Background image \u548C Bottom info area \u7684\u5E03\u5C40 */}\n <div className={contentLayoutVariants({ layout })}>\n {/* Background image - responsive across 5 breakpoints */}\n <div className={imageAreaVariants({ layout })}>\n {item.backgroundImage && (\n <Picture\n source={getResponsiveSource(item.backgroundImage)}\n alt={getBackgroundAlt(item.backgroundImage)}\n className=\"rounded-card size-full overflow-hidden object-cover\"\n imgClassName=\"h-full w-full object-cover\"\n />\n )}\n {/* Card content area */}\n <div className=\"absolute top-1/2 z-10 w-full -translate-y-1/2 px-6\">\n {/* Value and description */}\n <div className=\"flex flex-col gap-1\">\n {/* Main value display */}\n {displayData.value && (\n <Heading\n html={displayData.value}\n size={4}\n className={cn('font-bold leading-none', textVariants({ state: theme }))}\n />\n )}\n\n {/* Description */}\n {displayData.description && (\n <Text\n html={displayData.description}\n className={cn('text-base font-bold opacity-60', textVariants({ state: theme }))}\n />\n )}\n </div>\n </div>\n </div>\n\n {/* Bottom/Right info area */}\n <div className={infoAreaVariants({ layout })}>\n {/* Sale price */}\n {displayData.salePrice && (\n <Text\n as=\"p\"\n html={displayData.salePrice}\n className={cn('lg-desktop:text-2xl text-xl font-bold', textVariants({ state: theme }))}\n />\n )}\n\n {/* Progress bar - \u8D85\u5356\u65F6\u9690\u85CF\uFF08availableForSale=true \u4E14 quantityAvailable<=0\uFF09 */}\n <ProgressBar\n progress={\n firstProduct?.custom_inventory\n ? ((fullProductVariant?.quantityAvailable || 0) / firstProduct.custom_inventory) * 100\n : 0\n }\n theme={theme}\n className={cn(\n 'mb-1 mt-2',\n fullProductVariant?.availableForSale && (fullProductVariant?.quantityAvailable ?? 0) <= 0 && 'invisible'\n )}\n />\n\n {/* Remain text - \u6B63\u5E38\u5E93\u5B58\u63D0\u793A */}\n {remainText && (fullProductVariant?.quantityAvailable ?? 0) >= 0 && (\n <Text\n html={replaceTemplate(remainText, {\n inventory: firstProduct?.custom_inventory?.toString() || '',\n quantity: fullProductVariant?.quantityAvailable?.toString() || '0',\n })}\n as=\"p\"\n className={cn('laptop:text-base text-sm font-bold', textVariants({ state: theme }))}\n />\n )}\n\n {/* Low stock text - \u652F\u6301\u8D85\u5356\u65F6\u663E\u793A\uFF08availableForSale=true \u4F46 quantityAvailable<=0\uFF09 */}\n {lowStockText &&\n fullProductVariant?.availableForSale &&\n (fullProductVariant?.quantityAvailable ?? 0) < 0 && (\n <Text\n html={lowStockText}\n as=\"p\"\n className={cn('laptop:text-base text-sm font-bold text-red-500', textVariants({ state: theme }))}\n />\n )}\n\n {/* Action button */}\n <Button\n size=\"lg\"\n className={cn(buttonVariants({ state: theme }), buttonClassName)}\n onClick={handleClick}\n disabled={\n !fullProductVariant?.availableForSale ||\n loading ||\n isTransitioning ||\n countdownState === 'beforeStart' ||\n countdownState === 'finished'\n }\n loading={loading && fullProductVariant?.availableForSale}\n >\n {countdownState === 'beforeStart'\n ? comingSoonButtonText || buttonText\n : fullProductVariant?.availableForSale\n ? buttonText\n : soldOutButtonText || buttonText}\n </Button>\n </div>\n </div>\n </div>\n )\n }\n)\n\nGiftShelfCard.displayName = 'GiftShelfCard'\n\n/**\n * GiftShelf - Gift/Promotion Shelf Component\n *\n * @description Display gift cards with countdown, pricing, and purchase buttons\n */\nconst GiftShelf = React.forwardRef<HTMLDivElement, GiftShelfProps>(\n ({ classNames = {}, data, onButtonClick, buildData, loading, ...rest }, ref) => {\n const theme = data.theme || 'light'\n\n const itemsPerRow = React.useMemo(() => {\n return data?.items?.length || 4\n }, [data?.items])\n\n // \u5F53\u5361\u7247\u6570\u91CF\u4E3A 2 \u65F6\u4F7F\u7528\u6C34\u5E73\u5E03\u5C40\uFF0C\u5426\u5219\u4F7F\u7528\u5782\u76F4\u5E03\u5C40\n const cardLayout = itemsPerRow === 2 ? 'horizontal' : 'vertical'\n\n const swiperBreakpoints = React.useMemo(() => {\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.2, spaceBetween: 12 }\n case 'tablet':\n if (itemsPerRow <= 2) return { slidesPerView: 2, spaceBetween: 12 }\n return { slidesPerView: 2.5, spaceBetween: 12 }\n case 'laptop':\n if (itemsPerRow <= 3) return { slidesPerView: itemsPerRow, spaceBetween: 16 }\n return { slidesPerView: 3.01, spaceBetween: 16 }\n case 'desktop':\n return { slidesPerView: Math.min(itemsPerRow, 4), spaceBetween: 20 }\n }\n }\n\n return {\n 0: getBreakpointConfig('mobile'),\n 768: getBreakpointConfig('tablet'),\n 1025: getBreakpointConfig('laptop'),\n 1440: getBreakpointConfig('desktop'),\n }\n }, [itemsPerRow])\n\n return (\n <Container\n ref={ref}\n className={cn(classNames?.root)}\n childClassName=\"overflow-hidden\"\n data-ui-component-id=\"GiftShelf\"\n {...rest}\n >\n {/* Cards swiper */}\n <Swiper breakpoints={swiperBreakpoints} className=\"w-full !overflow-visible\">\n {data.items.map((item, index) => (\n <SwiperSlide key={'giftShelfCardItem' + index}>\n <GiftShelfCard\n item={item}\n theme={theme}\n layout={cardLayout}\n className={classNames?.card}\n buttonClassName={classNames?.button}\n countdownClassName={classNames?.countdown}\n onButtonClick={onButtonClick}\n buildData={buildData}\n buttonText={data.buttonText}\n discountText={data.discountText}\n remainText={data.remainText}\n lowStockText={data.lowStockText}\n soldOutButtonText={data.soldOutButtonText}\n countdownText={data.countdownText}\n lastRoundText={data.lastRoundText}\n countdownIcon={data?.countdownIcon}\n beforeStartText={data.beforeStartText}\n comingSoonButtonText={data.comingSoonButtonText}\n loading={loading}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n </Container>\n )\n }\n)\n\nGiftShelf.displayName = 'GiftShelf'\n\nexport default withLayout(GiftShelf)\nexport type {\n GiftShelfProps,\n GiftShelfData,\n GiftShelfItem,\n GiftShelfProduct,\n CountdownConfig,\n ResponsiveBackgroundImage,\n} from './types.js'\n"],
|
|
5
|
+
"mappings": "aAgWM,OAQI,OAAAA,EARJ,QAAAC,MAAA,oBA9VN,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,QAAAC,EAAM,WAAAC,EAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,OAAe,4BAC1D,OAAS,OAAAC,MAAW,2BAEpB,OAAS,UAAAC,GAAQ,eAAAC,OAAmB,eACpC,OAAS,cAAAC,OAAkB,yBAE3B,OAAS,sBAAAC,OAA0B,4BACnC,OAAS,kBAAAC,OAAsB,2BAC/B,OAAS,mBAAAC,MAAuB,iCAOhC,MAAMC,GAAmBP,EAAI,iEAAkE,CAC7F,SAAU,CACR,MAAO,CACL,MAAO,eACP,KAAM,cACR,CACF,EACA,gBAAiB,CACf,MAAO,OACT,CACF,CAAC,EAMKQ,GAAwBR,EAAI,GAAI,CACpC,SAAU,CACR,OAAQ,CACN,SAAU,GACV,WAAY,oEACd,CACF,EACA,gBAAiB,CACf,OAAQ,UACV,CACF,CAAC,EAMKS,GAAoBT,EACxB,gHACA,CACE,SAAU,CACR,OAAQ,CACN,SAAU,GACV,WAAY,uDACd,CACF,EACA,gBAAiB,CACf,OAAQ,UACV,CACF,CACF,EAMMU,GAAmBV,EAA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AAG,CACvE,CACF,EAEA,MAAO,CACL,EAAGG,EAAoB,QAAQ,EAC/B,IAAKA,EAAoB,QAAQ,EACjC,KAAMA,EAAoB,QAAQ,EAClC,KAAMA,EAAoB,SAAS,CACrC,CACF,EAAG,CAACH,CAAW,CAAC,EAEhB,OACE5G,EAACO,EAAA,CACC,IAAKoG,EACL,UAAWxG,EAAGqG,GAAY,IAAI,EAC9B,eAAe,kBACf,uBAAqB,YACpB,GAAGE,EAGJ,SAAA1G,EAACU,GAAA,CAAO,YAAaoG,EAAmB,UAAU,2BAC/C,SAAAL,EAAK,MAAM,IAAI,CAAClC,EAAM0C,IACrBjH,EAACW,GAAA,CACC,SAAAX,EAACsE,EAAA,CACC,KAAMC,EACN,MAAOpB,EACP,OAAQ0D,EACR,UAAWL,GAAY,KACvB,gBAAiBA,GAAY,OAC7B,mBAAoBA,GAAY,UAChC,cAAe7B,EACf,UAAWC,EACX,WAAY6B,EAAK,WACjB,aAAcA,EAAK,aACnB,WAAYA,EAAK,WACjB,aAAcA,EAAK,aACnB,kBAAmBA,EAAK,kBACxB,cAAeA,EAAK,cACpB,cAAeA,EAAK,cACpB,cAAeA,GAAM,cACrB,gBAAiBA,EAAK,gBACtB,qBAAsBA,EAAK,qBAC3B,QAAStB,EACX,GArBgB,oBAAsB8B,CAsBxC,CACD,EACH,EACF,CAEJ,CACF,EAEAV,EAAU,YAAc,YAExB,IAAOW,GAAQtG,GAAW2F,CAAS",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Text", "Picture", "Button", "Container", "Heading", "cva", "Swiper", "SwiperSlide", "withLayout", "formatVariantPrice", "useAiuiContext", "replaceTemplate", "giftCardVariants", "contentLayoutVariants", "imageAreaVariants", "infoAreaVariants", "buttonVariants", "textVariants", "getResponsiveSource", "bgImage", "sources", "getBackgroundAlt", "formatTime", "seconds", "hours", "minutes", "secs", "parseStartTime", "startTime", "parsed", "isInTransitionPeriod", "countdown", "startTimeMs", "durationMs", "rounds", "now", "elapsed", "currentRound", "timeUntilRoundEnd", "TRANSITION_PERIOD_MS", "getCodeWithSuffix", "codePrefix", "date", "suffix", "currentRoundStartMs", "Countdown", "config", "theme", "className", "countdownText", "lastRoundText", "beforeStartText", "countdownIcon", "onStateChange", "timeLeft", "setTimeLeft", "countdownState", "setCountdownState", "calculateCountdown", "diff", "currentRoundTargetTime", "timer", "labelText", "ProgressBar", "progress", "clampedProgress", "GiftShelfCard", "item", "layout", "buttonClassName", "countdownClassName", "onButtonClick", "buildData", "buttonText", "remainText", "lowStockText", "soldOutButtonText", "discountText", "comingSoonButtonText", "loading", "locale", "firstProduct", "isTransitioning", "setIsTransitioning", "currentCode", "setCurrentCode", "checkAndUpdate", "newCode", "prev", "handleCountdownStateChange", "state", "fullProduct", "p", "fullProductVariant", "variant", "displayData", "price", "basePrice", "handleClick", "GiftShelf", "classNames", "data", "rest", "ref", "itemsPerRow", "cardLayout", "swiperBreakpoints", "getBreakpointConfig", "breakpoint", "index", "GiftShelf_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { Media } from '../../types/props.js';
|
|
2
|
+
import type { Product } from '../Listing/types/product.js';
|
|
3
|
+
/**
|
|
4
|
+
* 礼品货架产品项(简化版产品信息)
|
|
5
|
+
*/
|
|
6
|
+
export interface GiftShelfProduct {
|
|
7
|
+
/** 产品 SKU */
|
|
8
|
+
sku: string;
|
|
9
|
+
/** 产品名称 */
|
|
10
|
+
name: string;
|
|
11
|
+
/** 产品图片 URL */
|
|
12
|
+
image: string;
|
|
13
|
+
/** 产品值/标识 (通常与 handle 相同) */
|
|
14
|
+
value: string;
|
|
15
|
+
/** 产品 handle (URL slug) */
|
|
16
|
+
handle: string;
|
|
17
|
+
/** Shopify 产品 ID */
|
|
18
|
+
shopify_id: string;
|
|
19
|
+
/** 自定义库存 */
|
|
20
|
+
custom_inventory?: number;
|
|
21
|
+
/** 自定义价格 */
|
|
22
|
+
custom_price?: number;
|
|
23
|
+
/** 自定义产品描述 */
|
|
24
|
+
custom_description?: string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 倒计时配置接口
|
|
28
|
+
*/
|
|
29
|
+
export interface CountdownConfig {
|
|
30
|
+
/** 倒计时开始时间,支持 ISO 8601 字符串(如 "2026-02-10T04:00:00.000Z")或时间戳(毫秒) */
|
|
31
|
+
startTime: string | number;
|
|
32
|
+
/** 每轮倒计时时长(天),默认为 1 天 */
|
|
33
|
+
durationDays?: number;
|
|
34
|
+
/** 倒计时轮次,默认为 1 */
|
|
35
|
+
rounds?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 响应式背景图片类型
|
|
39
|
+
* 支持 5 个断点的图片配置
|
|
40
|
+
*/
|
|
41
|
+
export interface ResponsiveBackgroundImage {
|
|
42
|
+
/** 默认图片 (<768px 移动端) */
|
|
43
|
+
default?: Media;
|
|
44
|
+
/** tablet 断点图片 (≥768px) */
|
|
45
|
+
tablet?: Media;
|
|
46
|
+
/** laptop 断点图片 (≥1025px) */
|
|
47
|
+
laptop?: Media;
|
|
48
|
+
/** desktop 断点图片 (≥1440px) */
|
|
49
|
+
desktop?: Media;
|
|
50
|
+
/** lg-desktop 断点图片 (≥1920px) */
|
|
51
|
+
lgDesktop?: Media;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 礼品卡片项数据接口
|
|
55
|
+
*/
|
|
56
|
+
export interface GiftShelfItem {
|
|
57
|
+
/** 卡片倒计时配置(可选) */
|
|
58
|
+
countdown?: CountdownConfig;
|
|
59
|
+
/** 产品列表 */
|
|
60
|
+
products: GiftShelfProduct[];
|
|
61
|
+
/** 响应式背景图片(支持 5 个断点) */
|
|
62
|
+
backgroundImage?: ResponsiveBackgroundImage;
|
|
63
|
+
/** Code 前缀,后缀会根据当前轮次自动生成(MMDD 格式) */
|
|
64
|
+
codePrefix?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 礼品货架组件数据接口
|
|
68
|
+
*/
|
|
69
|
+
export interface GiftShelfData {
|
|
70
|
+
/** 礼品卡片列表 */
|
|
71
|
+
items: GiftShelfItem[];
|
|
72
|
+
/** 主题模式,默认为 light */
|
|
73
|
+
theme?: 'light' | 'dark';
|
|
74
|
+
/** 购买按钮文本 */
|
|
75
|
+
buttonText: string;
|
|
76
|
+
/** 购买按钮链接 */
|
|
77
|
+
buttonLink?: string;
|
|
78
|
+
/** 剩余数量提示文本,支持模板变量 {inventory} 和 {quantity} */
|
|
79
|
+
remainText?: string;
|
|
80
|
+
/** 低库存提示文本 */
|
|
81
|
+
lowStockText?: string;
|
|
82
|
+
/** 售罄按钮文本 */
|
|
83
|
+
soldOutButtonText?: string;
|
|
84
|
+
/** 折扣文案(可选) */
|
|
85
|
+
discountText?: string;
|
|
86
|
+
/** 倒计时文案 */
|
|
87
|
+
countdownText?: string;
|
|
88
|
+
/** 最后一轮提示文案 */
|
|
89
|
+
lastRoundText?: string;
|
|
90
|
+
/** 开始前提示文案 */
|
|
91
|
+
beforeStartText?: string;
|
|
92
|
+
/** 即将开始按钮文案 */
|
|
93
|
+
comingSoonButtonText?: string;
|
|
94
|
+
/** 倒计时图标 */
|
|
95
|
+
countdownIcon?: Media;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 语义化类名
|
|
99
|
+
*/
|
|
100
|
+
export type GiftShelfSemanticName = 'root' | 'card' | 'countdown' | 'button';
|
|
101
|
+
/**
|
|
102
|
+
* 礼品货架组件 Props
|
|
103
|
+
*/
|
|
104
|
+
export interface GiftShelfProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
105
|
+
/** 业务数据 */
|
|
106
|
+
data: GiftShelfData;
|
|
107
|
+
/** 构建时数据(产品列表等) */
|
|
108
|
+
buildData?: {
|
|
109
|
+
products: Product[];
|
|
110
|
+
};
|
|
111
|
+
/** 语义化类名 */
|
|
112
|
+
classNames?: Partial<Record<GiftShelfSemanticName, string>>;
|
|
113
|
+
/** 按钮点击回调,code 为当前轮次的完整 Code(前缀 + MMDD 后缀) */
|
|
114
|
+
onButtonClick?: ({ product, code }: {
|
|
115
|
+
product: GiftShelfProduct;
|
|
116
|
+
code: string;
|
|
117
|
+
}) => void;
|
|
118
|
+
/** 按钮加载状态 */
|
|
119
|
+
loading?: boolean;
|
|
120
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as f}from"react/jsx-runtime";import*as r from"react";import{cn as n}from"../../helpers/index.js";import{Text as x,Picture as k,Container as z,Heading as A}from"../../components/index.js";import{cva as T}from"class-variance-authority";import{Swiper as N,SwiperSlide as b}from"swiper/react";import*as C from"swiper/modules";import{withLayout as j}from"../../shared/Styles.js";import{useAiuiContext as L}from"../AiuiProvider/index.js";import{formatPrice as U}from"../Listing/utils/index.js";const D=T("lg-desktop:h-[400px] rounded-card desktop:pt-4 desktop:pb-6 relative flex h-[320px] flex-col items-start gap-1 overflow-hidden p-4",{variants:{theme:{light:"bg-gradient-to-b from-[#FCCA7B] to-[#FFE6BF]",dark:"bg-gradient-to-b from-[#3A3A3A] to-[#1D1D1F]"}},defaultVariants:{theme:"light"}}),P=T("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),M=r.memo(({image:t})=>t?e(k,{source:t.url,alt:t.alt||"Member Tag",className:"h-full w-auto",imgClassName:"h-full w-auto object-contain"}):null);M.displayName="MemberTag";const y=r.memo(({theme:t="light"})=>{const l=t==="light"?"bg-[#f6cd4e]":"bg-[#F5F6F7]";return e("div",{className:"flex h-4 w-full items-center",children:e("div",{className:n("flex h-1 w-full items-center justify-center",l),children:e("div",{className:n("relative size-4 shrink-0 rounded-full",l)})})})});y.displayName="TimelineItem";const V=r.memo(({item:t,theme:l="light",className:h,onClick:m,buildData:d})=>{const{locale:w="us"}=L(),s=t.products?.[0],a=r.useMemo(()=>!s?.handle||!d?.products?.length?null:d.products.find(u=>u.handle===s.handle)||null,[s?.handle,d?.products]),p=r.useMemo(()=>a?.variants?.find(u=>u?.sku===s?.sku)||{},[s?.sku,a?.variants]),g=U({locale:w||"us",amount:s?.custom_price??p?.price?.amount,currencyCode:a?.price?.currencyCode||"USD"});return f("div",{className:n(D({theme:l}),h),onClick:m,"data-ui-component-id":"GiftTierCard",children:[e("div",{className:"lg-desktop:h-[28px] z-10 h-6",children:t.showMemberTag&&t.memberTagImage&&e(M,{image:t.memberTagImage})}),e("div",{className:"relative z-10 mx-auto min-h-0 w-fit flex-1",children:e(k,{source:p?.image?.url||a?.images[0]?.url,className:"size-full",imgClassName:"size-full object-contain"})}),f("div",{className:n("z-10 flex w-full shrink-0 flex-col gap-2",P({theme:l})),children:[f("div",{className:"flex items-end gap-1",children:[e(A,{html:g,size:4,className:"font-bold leading-[1.2] tracking-[-0.04em]"}),t.valueUnit&&e(x,{html:t.valueUnit,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.2] tracking-[-0.04em]"})]}),e(x,{html:p?.title||a?.title,className:"lg-desktop:text-2xl line-clamp-2 min-h-[48px] text-wrap text-xl font-bold leading-[1.2] tracking-[-0.04em]"})]})]})});V.displayName="GiftTierCard";const G=r.forwardRef(({classNames:t={},data:l,onCardClick:h,buildData:m,...d},w)=>{const s=l.theme||"light",a=l.showTimeline!==!1,[p,g]=r.useState(null),[u,B]=r.useState(null),c=r.useMemo(()=>m?.products?.length?l.items.filter(i=>{const o=i.products?.[0];return o?.handle?m.products.find(v=>v.handle===o.handle)?.variants?.find(v=>v?.sku===o?.sku)?.availableForSale!==!1:!0}):l.items,[l.items,m?.products]),F=r.useMemo(()=>{const i=c.length;return{0:{slidesPerView:1.2,spaceBetween:12},768:{slidesPerView:Math.min(i,2.5),spaceBetween:12},1025:{slidesPerView:Math.min(i,3.5),spaceBetween:16},1440:{slidesPerView:Math.min(i,4),spaceBetween:16}}},[c.length]),I=r.useMemo(()=>{const i=c.length;return{0:{slidesPerView:1.2,spaceBetween:0},768:{slidesPerView:Math.min(i,2.5),spaceBetween:0},1025:{slidesPerView:Math.min(i,3.5),spaceBetween:0},1440:{slidesPerView:Math.min(i,4),spaceBetween:0}}},[c.length]),S=r.useMemo(()=>C.Controller?[C.Controller]:[],[]);return f(z,{ref:w,className:n(t?.root),childClassName:"overflow-hidden","data-ui-component-id":"GiftTierShelf",...d,children:[e(N,{modules:S,breakpoints:F,className:"w-full !overflow-visible",onSwiper:g,controller:{control:u},children:c.map((i,o)=>e(b,{children:e(V,{item:i,theme:s,buildData:m,className:t?.card,onClick:()=>h?.(i,o)})},"giftTierItem"+o))}),a&&e("div",{className:"mt-4 flex flex-col gap-4",children:e("div",{className:n("w-full",t?.timeline),children:e(N,{modules:S,breakpoints:I,className:"w-full !overflow-visible",onSwiper:B,controller:{control:p},children:c.map((i,o)=>e(b,{children:f("div",{className:"flex flex-col items-center",children:[e(y,{theme:s}),e(x,{html:i.threshold,className:n("lg-desktop:text-2xl text-center text-xl font-bold leading-[1.2] tracking-[-0.04em]",P({theme:s}),t?.thresholdText)})]})},"timelineItem"+o))})})})]})});G.displayName="GiftTierShelf";var W=j(G);export{W as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/GiftTierShelf/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Container, Heading } from '../../components/index.js'\nimport { cva } from 'class-variance-authority'\nimport type { GiftTierShelfProps, GiftTierItem, Media } from './types.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport * as SwiperModules from 'swiper/modules'\nimport type { Swiper as SwiperType } from 'swiper'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport type { Product, ProductVariant } from '../Listing/types/product.js'\nimport { formatPrice } from '../Listing/utils/index.js'\n\n/**\n * Card style variants\n */\nconst cardVariants = cva(\n 'lg-desktop:h-[400px] rounded-card desktop:pt-4 desktop:pb-6 relative flex h-[320px] flex-col items-start gap-1 overflow-hidden p-4',\n {\n variants: {\n theme: {\n light: 'bg-gradient-to-b from-[#FCCA7B] to-[#FFE6BF]',\n dark: 'bg-gradient-to-b from-[#3A3A3A] to-[#1D1D1F]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\n/**\n * Text color variants\n */\nconst textVariants = cva('', {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-white',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * Member Tag Component\n */\nconst MemberTag = React.memo(({ image }: { image?: Media }) => {\n if (!image) return null\n\n return (\n <Picture\n source={image.url}\n alt={image.alt || 'Member Tag'}\n className=\"h-full w-auto\"\n imgClassName=\"h-full w-auto object-contain\"\n />\n )\n})\n\nMemberTag.displayName = 'MemberTag'\n\n/**\n * Timeline Item Component - \u5355\u4E2A\u65F6\u95F4\u8F74\u8282\u70B9\n */\nconst TimelineItem = React.memo(({ theme = 'light' }: { theme?: 'light' | 'dark' }) => {\n const trackColor = theme === 'light' ? 'bg-[#f6cd4e]' : 'bg-[#F5F6F7]'\n\n return (\n <div className=\"flex h-4 w-full items-center\">\n <div className={cn('flex h-1 w-full items-center justify-center', trackColor)}>\n {/* Handle */}\n <div className={cn('relative size-4 shrink-0 rounded-full', trackColor)}></div>\n </div>\n </div>\n )\n})\n\nTimelineItem.displayName = 'TimelineItem'\n\n/**\n * Gift Tier Card Component\n */\nconst GiftTierCard = React.memo(\n ({\n item,\n theme = 'light',\n className,\n onClick,\n buildData,\n }: {\n item: GiftTierItem\n theme?: 'light' | 'dark'\n className?: string\n onClick?: () => void\n buildData?: {\n products: Product[]\n }\n }) => {\n const { locale = 'us' } = useAiuiContext()\n // \u83B7\u53D6\u7B2C\u4E00\u4E2A\u4EA7\u54C1\u7684\u7B80\u5316\u6570\u636E\n const product = item.products?.[0]\n\n const fullProduct = React.useMemo(() => {\n if (!product?.handle || !buildData?.products?.length) return null\n return buildData.products.find(p => p.handle === product.handle) || null\n }, [product?.handle, buildData?.products])\n\n const fullProductVariant = React.useMemo(\n () => fullProduct?.variants?.find(variant => variant?.sku === product?.sku) || ({} as ProductVariant),\n [product?.sku, fullProduct?.variants]\n )\n\n const price = formatPrice({\n locale: locale || 'us',\n amount: product?.custom_price ?? fullProductVariant?.price?.amount,\n currencyCode: fullProduct?.price?.currencyCode || 'USD',\n })\n\n return (\n <div className={cn(cardVariants({ theme }), className)} onClick={onClick} data-ui-component-id=\"GiftTierCard\">\n {/* Member Tag */}\n <div className=\"lg-desktop:h-[28px] z-10 h-6\">\n {item.showMemberTag && item.memberTagImage && <MemberTag image={item.memberTagImage} />}\n </div>\n\n {/* Product Image */}\n <div className=\"relative z-10 mx-auto min-h-0 w-fit flex-1\">\n <Picture\n source={fullProductVariant?.image?.url || fullProduct?.images[0]?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-contain\"\n />\n </div>\n\n {/* Product Info */}\n <div className={cn('z-10 flex w-full shrink-0 flex-col gap-2', textVariants({ theme }))}>\n {/* Price */}\n <div className=\"flex items-end gap-1\">\n <Heading html={price} size={4} className=\"font-bold leading-[1.2] tracking-[-0.04em]\" />\n {item.valueUnit && (\n <Text\n html={item.valueUnit}\n className=\"lg-desktop:text-2xl text-xl font-bold leading-[1.2] tracking-[-0.04em]\"\n />\n )}\n </div>\n\n {/* Product Name */}\n <Text\n html={fullProductVariant?.title || fullProduct?.title}\n className=\"lg-desktop:text-2xl line-clamp-2 min-h-[48px] text-wrap text-xl font-bold leading-[1.2] tracking-[-0.04em]\"\n />\n </div>\n </div>\n )\n }\n)\n\nGiftTierCard.displayName = 'GiftTierCard'\n\n/**\n * GiftTierShelf - \u6EE1\u8D60\u8D27\u67B6\u7EC4\u4EF6\n *\n * @description \u9636\u68AF\u5F0F\u6EE1\u8D60\u6D3B\u52A8\u5C55\u793A\uFF0C\u652F\u6301\u591A\u4E2A\u6863\u4F4D\u7684\u4EA7\u54C1\u5C55\u793A\u548C\u65F6\u95F4\u8F74\n */\nconst GiftTierShelf = React.forwardRef<HTMLDivElement, GiftTierShelfProps>(\n ({ classNames = {}, data, onCardClick, buildData, ...rest }, ref) => {\n const theme = data.theme || 'light'\n const showTimeline = data.showTimeline !== false\n\n // Swiper \u5B9E\u4F8B\u72B6\u6001\uFF0C\u7528\u4E8E\u8054\u52A8\u63A7\u5236\n const [cardSwiper, setCardSwiper] = React.useState<SwiperType | null>(null)\n const [timelineSwiper, setTimelineSwiper] = React.useState<SwiperType | null>(null)\n\n // \u8FC7\u6EE4\u51FA\u53EF\u552E\u4EA7\u54C1\uFF0C\u786E\u4FDD\u5361\u7247\u4E0E Timeline \u540C\u6B65\n const availableItems = React.useMemo(() => {\n if (!buildData?.products?.length) return data.items\n\n return data.items.filter(item => {\n const product = item.products?.[0]\n if (!product?.handle) return true // \u6CA1\u6709\u5173\u8054\u4EA7\u54C1\u65F6\u9ED8\u8BA4\u663E\u793A\n\n const fullProduct = buildData.products.find(p => p.handle === product.handle)\n const variant = fullProduct?.variants?.find(v => v?.sku === product?.sku)\n\n return variant?.availableForSale !== false\n })\n }, [data.items, buildData?.products])\n\n // Card Swiper breakpoints\n const cardSwiperBreakpoints = React.useMemo(() => {\n const itemCount = availableItems.length\n return {\n 0: { slidesPerView: 1.2, spaceBetween: 12 },\n 768: { slidesPerView: Math.min(itemCount, 2.5), spaceBetween: 12 },\n 1025: { slidesPerView: Math.min(itemCount, 3.5), spaceBetween: 16 },\n 1440: { slidesPerView: Math.min(itemCount, 4), spaceBetween: 16 },\n }\n }, [availableItems.length])\n\n // Timeline Swiper breakpoints (spaceBetween \u4E3A 0)\n const timelineSwiperBreakpoints = React.useMemo(() => {\n const itemCount = availableItems.length\n return {\n 0: { slidesPerView: 1.2, spaceBetween: 0 },\n 768: { slidesPerView: Math.min(itemCount, 2.5), spaceBetween: 0 },\n 1025: { slidesPerView: Math.min(itemCount, 3.5), spaceBetween: 0 },\n 1440: { slidesPerView: Math.min(itemCount, 4), spaceBetween: 0 },\n }\n }, [availableItems.length])\n\n const swiperModules = React.useMemo(() => (SwiperModules.Controller ? [SwiperModules.Controller] : []), [])\n\n return (\n <Container\n ref={ref}\n className={cn(classNames?.root)}\n childClassName=\"overflow-hidden\"\n data-ui-component-id=\"GiftTierShelf\"\n {...rest}\n >\n {/* Cards Swiper */}\n <Swiper\n modules={swiperModules}\n breakpoints={cardSwiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={setCardSwiper}\n controller={{ control: timelineSwiper }}\n >\n {availableItems.map((item, index) => (\n <SwiperSlide key={'giftTierItem' + index}>\n <GiftTierCard\n item={item}\n theme={theme}\n buildData={buildData}\n className={classNames?.card}\n onClick={() => onCardClick?.(item, index)}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n\n {/* Timeline */}\n {showTimeline && (\n <div className=\"mt-4 flex flex-col gap-4\">\n {/* Timeline Swiper */}\n <div className={cn('w-full', classNames?.timeline)}>\n <Swiper\n modules={swiperModules}\n breakpoints={timelineSwiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={setTimelineSwiper}\n controller={{ control: cardSwiper }}\n >\n {availableItems.map((item, index) => (\n <SwiperSlide key={'timelineItem' + index}>\n <div className=\"flex flex-col items-center\">\n <TimelineItem theme={theme} />\n <Text\n html={item.threshold}\n className={cn(\n 'lg-desktop:text-2xl text-center text-xl font-bold leading-[1.2] tracking-[-0.04em]',\n textVariants({ theme }),\n classNames?.thresholdText\n )}\n />\n </div>\n </SwiperSlide>\n ))}\n </Swiper>\n </div>\n </div>\n )}\n </Container>\n )\n }\n)\n\nGiftTierShelf.displayName = 'GiftTierShelf'\n\nexport default withLayout(GiftTierShelf)\nexport type { GiftTierShelfProps, GiftTierShelfData, GiftTierItem, GiftTierProduct } from './types.js'\n"],
|
|
5
|
+
"mappings": "aAuDI,cAAAA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F,GAEJ,CAEJ,CACF,EAEAhB,EAAc,YAAc,gBAE5B,IAAOiB,EAAQvC,EAAWsB,CAAa",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Text", "Picture", "Container", "Heading", "cva", "Swiper", "SwiperSlide", "SwiperModules", "withLayout", "useAiuiContext", "formatPrice", "cardVariants", "textVariants", "MemberTag", "image", "TimelineItem", "theme", "trackColor", "GiftTierCard", "item", "className", "onClick", "buildData", "locale", "product", "fullProduct", "p", "fullProductVariant", "variant", "price", "GiftTierShelf", "classNames", "data", "onCardClick", "rest", "ref", "showTimeline", "cardSwiper", "setCardSwiper", "timelineSwiper", "setTimelineSwiper", "availableItems", "cardSwiperBreakpoints", "itemCount", "timelineSwiperBreakpoints", "swiperModules", "index", "GiftTierShelf_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Media } from '../../types/props.js';
|
|
2
|
+
import type { Product } from '../Listing/types/product.js';
|
|
3
|
+
export type { Media };
|
|
4
|
+
export interface GiftShelfProduct {
|
|
5
|
+
/** 产品 SKU */
|
|
6
|
+
sku: string;
|
|
7
|
+
/** 产品名称 */
|
|
8
|
+
name: string;
|
|
9
|
+
/** 产品图片 URL */
|
|
10
|
+
image: string;
|
|
11
|
+
/** 产品值/标识 (通常与 handle 相同) */
|
|
12
|
+
value: string;
|
|
13
|
+
/** 产品 handle (URL slug) */
|
|
14
|
+
handle: string;
|
|
15
|
+
/** Shopify 产品 ID */
|
|
16
|
+
shopify_id: string;
|
|
17
|
+
/** 自定义库存 */
|
|
18
|
+
custom_inventory?: number;
|
|
19
|
+
/** 自定义价格 */
|
|
20
|
+
custom_price?: number;
|
|
21
|
+
/** 自定义产品描述 */
|
|
22
|
+
custom_description?: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 满赠阶梯产品项
|
|
26
|
+
*/
|
|
27
|
+
export interface GiftTierProduct {
|
|
28
|
+
/** 价值单位(如 "Value") */
|
|
29
|
+
valueUnit?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 满赠阶梯项
|
|
33
|
+
*/
|
|
34
|
+
export interface GiftTierItem {
|
|
35
|
+
/** 阶梯门槛文本(如 "Order Over $3,000") */
|
|
36
|
+
threshold: string;
|
|
37
|
+
/** 该阶梯对应的产品 */
|
|
38
|
+
products: GiftShelfProduct[];
|
|
39
|
+
/** 是否显示会员标签 */
|
|
40
|
+
showMemberTag?: boolean;
|
|
41
|
+
/** 会员标签图片 */
|
|
42
|
+
memberTagImage?: Media;
|
|
43
|
+
/** 价值单位(如 "Value") */
|
|
44
|
+
valueUnit?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 满赠货架组件数据接口
|
|
48
|
+
*/
|
|
49
|
+
export interface GiftTierShelfData {
|
|
50
|
+
/** 阶梯项列表 */
|
|
51
|
+
items: GiftTierItem[];
|
|
52
|
+
/** 主题模式 */
|
|
53
|
+
theme?: 'light' | 'dark';
|
|
54
|
+
/** 是否显示时间轴 */
|
|
55
|
+
showTimeline?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 语义化类名
|
|
59
|
+
*/
|
|
60
|
+
export type GiftTierShelfSemanticName = 'root' | 'card' | 'timeline' | 'thresholdText';
|
|
61
|
+
/**
|
|
62
|
+
* 满赠货架组件 Props
|
|
63
|
+
*/
|
|
64
|
+
export interface GiftTierShelfProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
65
|
+
/** 业务数据 */
|
|
66
|
+
data: GiftTierShelfData;
|
|
67
|
+
/** 构建时数据(产品列表等) */
|
|
68
|
+
buildData?: {
|
|
69
|
+
products: Product[];
|
|
70
|
+
};
|
|
71
|
+
/** 语义化类名 */
|
|
72
|
+
classNames?: Partial<Record<GiftTierShelfSemanticName, string>>;
|
|
73
|
+
/** 卡片点击回调 */
|
|
74
|
+
onCardClick?: (item: GiftTierItem, index: number) => void;
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as c}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as e,jsxs as c}from"react/jsx-runtime";import Q,{useImperativeHandle as ce,useRef as b,useState as ue,useEffect as me}from"react";import y from"gsap";import{ScrollTrigger as v}from"gsap/dist/ScrollTrigger";import{useMediaQuery as Z}from"react-responsive";import{useInView as de}from"react-intersection-observer";import ge from"../../helpers/ScrollLoadVideo.js";import{Button as P,Heading as fe,Picture as J,Text as S,Countdown as be}from"../../components/index.js";import{cn as n}from"../../helpers/index.js";import{cva as w}from"class-variance-authority";import{withLayout as xe}from"../../shared/Styles.js";import{useExposure as he}from"../../hooks/useExposure.js";import{trackUrlRef as R}from"../../shared/trackUrlRef.js";import{getLocalizedPath as ye}from"../../helpers/utils.js";import{useAiuiContext as ve}from"../AiuiProvider/index.js";import{sizeMap as we}from"../../components/button.js";import{VideoModal as ke}from"../VideoModal/index.js";const s="image",i="hero_banner",Ne=w("hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] left-0 px-[16px]",center:"left-1/2 -translate-x-1/2 items-center text-center"}},defaultVariants:{align:"left"}}),$e=w("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),Ve=w("hero-banner-button-group lg-desktop:gap-3 flex items-center gap-2",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),Be=w("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),ze=({size:u="base"})=>{const{width:k,height:x}=we[u];return e("svg",{width:k,height:x,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:e("path",{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",fill:"currentcolor"})})},K=Q.forwardRef(({data:u,className:k,classNames:x={},onSecondaryClick:O,onPrimaryClick:W,...X},ee)=>{const{locale:L}=ve(),N=t=>!t||!L?t:ye(t,L),{label:M,title:r,subtitle:o,endDate:D,endDate_tz:te,dateFormat:ae,pcImage:$,padImage:E,mobileImage:h,pcVideo:re,padVideo:oe,mobileVideo:j,isShowVideo:le,isVideoLoop:ne=!0,primaryButton:l,secondaryButton:a,theme:se="light",size:V="default",titleSize:B,caption:z=[],blockLink:U,iconArray:ie,align:m="left"}=u,_=Z({query:"(max-width: 768px)"}),G=Z({query:"(max-width: 1024px)"}),[F,A]=ue(!1),{ref:pe,inView:q}=de(),H=b(null),T=b(null),I=b(null),d=b(null),p=b(null);return he(p,{componentType:s,componentName:i,componentTitle:r,componentDescription:o}),ce(ee,()=>p.current),me(()=>{y.registerPlugin(v);function t(){if(!d.current)return;const C=p.current?.clientHeight||100;window.innerHeight<=C?H.current=v.create({trigger:p.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:g=>{const f=g.progress*40-20;y.set(d.current,{yPercent:f})}}):(I.current=v.create({trigger:p.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:g=>{const f=g.progress*20-20;y.set(d.current,{yPercent:f})}}),T.current=v.create({trigger:p.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:g=>{const f=g.progress*20;y.set(d.current,{yPercent:f})}}))}return q&&t(),()=>{H.current&&H.current.kill(),I.current&&I.current.kill(),T.current&&T.current.kill()}},[q]),e("div",{...X,ref:pe,"data-ui-component-id":"HeroBanner",children:c("div",{ref:p,className:n(se==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520] tablet:aspect-[768/660] aspect-[390/660]":V==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":V==="sm"},k),children:[U&&e("a",{className:"absolute inset-0 z-10",href:R(N(U),`${s}_${i}`),"data-headless-type-name":`${s}#${i}`,"data-headless-title-desc-button":`${r}#${o}`,tabIndex:-1,"aria-hidden":"true","aria-label":r}),e("div",{ref:d,className:n("absolute left-0 top-0 size-full"),children:le?e(ge,{poster:_?h?.url:G?E?.url||h?.url:$?.url,src:_?j?.url:G?oe?.url||j?.url:re?.url,className:"laptop:w-full h-full",videoClassName:"h-full object-cover",muted:!0,loop:ne,playsInline:!0}):e(J,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:$?.alt||"",source:`${$?.url||""} , ${E?.url??(h?.url||"")} 1024, ${h?.url||""} 767`})}),c("div",{className:Ne({align:m}),children:[c("div",{className:$e({align:m}),children:[M&&e(S,{size:2,as:"p",className:n("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:M}),r&&e(fe,{as:B==="4"?"h1":"h2",html:r,className:n("hero-banner-title",x.title),size:B?Number(B||"5"):V==="sm"?4:5}),o&&e(S,{as:"p",size:2,className:n("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm"),html:o}),D&&e("div",{className:"mt-3",children:e(be,{endDate:D,endDate_tz:te,dateFormat:ae,variant:"spacious",align:m})})]}),c("div",{className:Ve({align:m}),children:[a?.isShowPlayVideoButton&&a?.playVideoButtonText?c(P,{onClick:()=>A(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button","data-headless-type-name":`${s}#${i}`,"data-headless-title-desc-button":`${r}#${o}#${a?.playVideoButtonText}`,children:[a?.playVideoButtonText," ",e(ze,{size:"lg"})]}):a?.text?c(P,{"aria-label":r??o,size:"lg",variant:"secondary",className:"hero-banner-secondary-button",as:a?.isCustomSecondaryButton?"button":"a",href:R(N(a?.link),`${s}_${i}`),onClick:t=>a?.isCustomSecondaryButton&&O?.(u,t,a?.customSecondaryEventId),"data-headless-type-name":`${s}#${i}`,"data-headless-title-desc-button":`${r}#${o}#${a?.text}`,children:[a?.text,e("span",{className:"sr-only",children:r??o})]}):null,l&&l.text&&e(P,{"aria-label":r??o,size:"lg",variant:"primary",className:"hero-banner-primary-button",as:l?.isCustomPrimaryButton?"button":"a",href:R(N(l.link),`${s}_${i}`),onClick:t=>l?.isCustomPrimaryButton&&W?.(u,t,l?.customPrimaryEventId),"data-headless-type-name":`${s}#${i}`,"data-headless-title-desc-button":`${r}#${o}#${l?.text}`,children:l.text})]}),e("div",{className:Be({align:m}),children:ie?.map(t=>e("div",{className:"h-12",children:e(J,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:t?.pcImage?.alt||"",source:t?.pcImage?.url})},t?.pcImage?.url||t?.pcImage?.alt))})]}),z.length>0&&e("div",{className:n("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]",x.captionGroup),children:z.map((t,C)=>c(Q.Fragment,{children:[e(S,{size:2,className: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]"),html:t.title}),C<z.length-1&&e("div",{className:n("bg-info-primary w-px")})]},t.title))}),F&&e(ke,{visible:F,videoUrl:a?.isYoutubeVideo?void 0:a?.videoUrl?.url,youTubeId:a?.isYoutubeVideo?a?.youtubeId:void 0,onCloseModal:()=>A(!1)})]})})});K.displayName="HeroBanner";var qe=xe(K);export{qe as default};
|
|
2
2
|
//# sourceMappingURL=HeroBanner.js.map
|
|
@@ -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, Countdown } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\nimport { cva } from 'class-variance-authority'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { getLocalizedPath } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\n// CVA variants for align\nconst contentVariants = cva(\n 'hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] absolute top-24 z-10 flex w-full flex-col gap-[24px]',\n {\n variants: {\n align: {\n left: 'tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] left-0 px-[16px]',\n center: 'left-1/2 -translate-x-1/2 items-center text-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n }\n)\n\nconst textVariants = cva(\n '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 {\n variants: {\n align: {\n left: 'laptop:text-left',\n center: 'text-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n }\n)\n\nconst buttonGroupVariants = cva('hero-banner-button-group lg-desktop:gap-3 flex items-center gap-2', {\n variants: {\n align: {\n left: 'laptop:justify-start',\n center: 'justify-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n})\n\nconst iconGroupVariants = cva('hero-banner-icon-group flex items-center gap-2', {\n variants: {\n align: {\n left: 'justify-start',\n center: 'justify-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n})\n\nexport type HeroBannerSemanticName =\n | 'root'\n | 'title'\n | 'subtitle'\n | 'buttonGroup'\n | 'primaryButton'\n | 'secondaryButton'\n | 'captionGroup'\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<\n HTMLDivElement,\n HeroBannerProps & {\n classNames?: Partial<Record<HeroBannerSemanticName, string>>\n }\n>(({ data, className, classNames = {}, onSecondaryClick, onPrimaryClick, ...rest }, ref) => {\n const { locale } = useAiuiContext()\n\n // \u5305\u88C5\u94FE\u63A5\uFF0C\u81EA\u52A8\u6DFB\u52A0 locale \u524D\u7F00\n const localizeUrl = (url?: string) => {\n if (!url || !locale) return url\n return getLocalizedPath(url, locale)\n }\n\n const {\n label,\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 isVideoLoop = true,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n titleSize,\n caption = [],\n blockLink,\n iconArray,\n align = 'left',\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 {...rest} ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n 'text-info-primary relative w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520] tablet:aspect-[768/660] aspect-[390/660]':\n size === 'default',\n 'lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]':\n size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(localizeUrl(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={isVideoLoop}\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={contentVariants({ align })}>\n <div className={textVariants({ align })}>\n {label && (\n <Text\n size={2}\n as=\"p\"\n className={cn('hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm')}\n html={label}\n />\n )}\n {title && (\n <Heading\n as={titleSize === '4' ? 'h1' : 'h2'}\n html={title}\n className={cn('hero-banner-title', classNames.title)}\n size={titleSize ? (Number(titleSize || '5') as any) : size === 'sm' ? 4 : 5}\n />\n )}\n {subtitle && (\n <Text\n as=\"p\"\n size={2}\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\n endDate={endDate}\n endDate_tz={endDate_tz}\n dateFormat={dateFormat}\n variant=\"spacious\"\n align={align}\n />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className={buttonGroupVariants({ align })}>\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={secondaryButton?.isCustomSecondaryButton ? 'button' : 'a'}\n href={trackUrlRef(localizeUrl(secondaryButton?.link), `${componentType}_${componentName}`)}\n onClick={e =>\n secondaryButton?.isCustomSecondaryButton &&\n onSecondaryClick?.(data, e, secondaryButton?.customSecondaryEventId)\n }\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={primaryButton?.isCustomPrimaryButton ? 'button' : 'a'}\n href={trackUrlRef(localizeUrl(primaryButton.link), `${componentType}_${componentName}`)}\n onClick={e =>\n primaryButton?.isCustomPrimaryButton && onPrimaryClick?.(data, e, primaryButton?.customPrimaryEventId)\n }\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={iconGroupVariants({ align })}>\n {iconArray?.map(icon => (\n <div key={icon?.pcImage?.url || icon?.pcImage?.alt} 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\n className={cn(\n '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 classNames.captionGroup\n )}\n >\n {caption.map((c, index) => (\n <React.Fragment key={c.title}>\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": "aA0FM,cAAAA,EAmL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IC,CAAa,EAAE,EACtF,QAASyD,GACPvB,GAAe,uBAAyBpB,IAAiBJ,EAAM+C,EAAGvB,GAAe,oBAAoB,EAEvG,0BAAyB,GAAGnC,CAAa,IAAIC,CAAa,GAC1D,kCAAiC,GAAGqB,CAAK,IAAIC,CAAQ,IAAIY,GAAe,IAAI,GAE3E,SAAAA,EAAc,KACjB,GAEJ,EACA7D,EAAC,OAAI,UAAW+B,GAAkB,CAAE,MAAAqC,CAAM,CAAC,EACxC,SAAAD,IAAW,IAAIkB,GACdrF,EAAC,OAAmD,UAAU,OAC5D,SAAAA,EAACc,EAAA,CACC,UAAU,uBACV,aAAa,sBACb,QAAQ,QACR,IAAKuE,GAAM,SAAS,KAAO,GAC3B,OAAQA,GAAM,SAAS,IACzB,GAPQA,GAAM,SAAS,KAAOA,GAAM,SAAS,GAQ/C,CACD,EACH,GACF,EAGCpB,EAAQ,OAAS,GAChBjE,EAAC,OACC,UAAWiB,EACT,iMACAsB,EAAW,YACb,EAEC,SAAA0B,EAAQ,IAAI,CAACqB,EAAGC,IACftF,EAACC,EAAM,SAAN,CACC,UAAAF,EAACe,EAAA,CACC,KAAM,EACN,UAAWE,EACT,yIACF,EACA,KAAMqE,EAAE,MACV,EACCC,EAAQtB,EAAQ,OAAS,GAAKjE,EAAC,OAAI,UAAWiB,EAAG,sBAAsB,EAAG,IARxDqE,EAAE,KASvB,CACD,EACH,EAIDf,GACCvE,EAACyB,GAAA,CACC,QAAS8C,EACT,SAAUT,GAAiB,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, Countdown } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\nimport { cva } from 'class-variance-authority'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { getLocalizedPath } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\n// CVA variants for align\nconst contentVariants = cva(\n 'hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] absolute top-24 z-10 flex w-full flex-col gap-[24px]',\n {\n variants: {\n align: {\n left: 'tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] left-0 px-[16px]',\n center: 'left-1/2 -translate-x-1/2 items-center text-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n }\n)\n\nconst textVariants = cva(\n '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 {\n variants: {\n align: {\n left: 'laptop:text-left',\n center: 'text-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n }\n)\n\nconst buttonGroupVariants = cva('hero-banner-button-group lg-desktop:gap-3 flex items-center gap-2', {\n variants: {\n align: {\n left: 'laptop:justify-start',\n center: 'justify-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n})\n\nconst iconGroupVariants = cva('hero-banner-icon-group flex items-center gap-2', {\n variants: {\n align: {\n left: 'justify-start',\n center: 'justify-center',\n },\n },\n defaultVariants: {\n align: 'left',\n },\n})\n\nexport type HeroBannerSemanticName =\n | 'root'\n | 'title'\n | 'subtitle'\n | 'buttonGroup'\n | 'primaryButton'\n | 'secondaryButton'\n | 'captionGroup'\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<\n HTMLDivElement,\n HeroBannerProps & {\n classNames?: Partial<Record<HeroBannerSemanticName, string>>\n }\n>(({ data, className, classNames = {}, onSecondaryClick, onPrimaryClick, ...rest }, ref) => {\n const { locale } = useAiuiContext()\n\n // \u5305\u88C5\u94FE\u63A5\uFF0C\u81EA\u52A8\u6DFB\u52A0 locale \u524D\u7F00\n const localizeUrl = (url?: string) => {\n if (!url || !locale) return url\n return getLocalizedPath(url, locale)\n }\n\n const {\n label,\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 isVideoLoop = true,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n titleSize,\n caption = [],\n blockLink,\n iconArray,\n align = 'left',\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 {...rest} ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n 'text-info-primary relative w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520] tablet:aspect-[768/660] aspect-[390/660]':\n size === 'default',\n 'lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]':\n size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(localizeUrl(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={isVideoLoop}\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={contentVariants({ align })}>\n <div className={textVariants({ align })}>\n {label && (\n <Text\n size={2}\n as=\"p\"\n className={cn('hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm')}\n html={label}\n />\n )}\n {title && (\n <Heading\n as={titleSize === '4' ? 'h1' : 'h2'}\n html={title}\n className={cn('hero-banner-title', classNames.title)}\n size={titleSize ? (Number(titleSize || '5') as any) : size === 'sm' ? 4 : 5}\n />\n )}\n {subtitle && (\n <Text\n as=\"p\"\n size={2}\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\n endDate={endDate}\n endDate_tz={endDate_tz}\n dateFormat={dateFormat}\n variant=\"spacious\"\n align={align}\n />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className={buttonGroupVariants({ align })}>\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={secondaryButton?.isCustomSecondaryButton ? 'button' : 'a'}\n href={trackUrlRef(localizeUrl(secondaryButton?.link), `${componentType}_${componentName}`)}\n onClick={e =>\n secondaryButton?.isCustomSecondaryButton &&\n onSecondaryClick?.(data, e, secondaryButton?.customSecondaryEventId)\n }\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={primaryButton?.isCustomPrimaryButton ? 'button' : 'a'}\n href={trackUrlRef(localizeUrl(primaryButton.link), `${componentType}_${componentName}`)}\n onClick={e =>\n primaryButton?.isCustomPrimaryButton && onPrimaryClick?.(data, e, primaryButton?.customPrimaryEventId)\n }\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={iconGroupVariants({ align })}>\n {iconArray?.map(icon => (\n <div key={icon?.pcImage?.url || icon?.pcImage?.alt} 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\n className={cn(\n '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 classNames.captionGroup\n )}\n >\n {caption.map((c, index) => (\n <React.Fragment key={c.title}>\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?.isYoutubeVideo ? undefined : secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.isYoutubeVideo ? secondaryButton?.youtubeId : undefined}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </div>\n </div>\n )\n})\n\nHeroBanner.displayName = 'HeroBanner'\n\nexport default withLayout(HeroBanner)\n"],
|
|
5
|
+
"mappings": "aA0FM,cAAAA,EAmLI,QAAAC,MAnLJ,oBAzFN,OAAOC,GAAS,uBAAAC,GAAqB,UAAAC,EAAQ,YAAAC,GAAU,aAAAC,OAAiB,QACxE,OAAOC,MAAU,OACjB,OAAS,iBAAAC,MAAqB,0BAE9B,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,aAAAC,OAAiB,8BAC1B,OAAOC,OAAqB,mCAC5B,OAAS,UAAAC,EAAQ,WAAAC,GAAS,WAAAC,EAAS,QAAAC,EAAM,aAAAC,OAAiB,4BAC1D,OAAS,MAAAC,MAAU,yBACnB,OAAS,OAAAC,MAAW,2BACpB,OAAS,cAAAC,OAAkB,yB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aAAa,sBACb,QAAQ,QACR,IAAKuE,GAAM,SAAS,KAAO,GAC3B,OAAQA,GAAM,SAAS,IACzB,GAPQA,GAAM,SAAS,KAAOA,GAAM,SAAS,GAQ/C,CACD,EACH,GACF,EAGCpB,EAAQ,OAAS,GAChBjE,EAAC,OACC,UAAWiB,EACT,iMACAsB,EAAW,YACb,EAEC,SAAA0B,EAAQ,IAAI,CAACqB,EAAGC,IACftF,EAACC,EAAM,SAAN,CACC,UAAAF,EAACe,EAAA,CACC,KAAM,EACN,UAAWE,EACT,yIACF,EACA,KAAMqE,EAAE,MACV,EACCC,EAAQtB,EAAQ,OAAS,GAAKjE,EAAC,OAAI,UAAWiB,EAAG,sBAAsB,EAAG,IARxDqE,EAAE,KASvB,CACD,EACH,EAIDf,GACCvE,EAACyB,GAAA,CACC,QAAS8C,EACT,SAAUT,GAAiB,eAAiB,OAAYA,GAAiB,UAAU,IACnF,UAAWA,GAAiB,eAAiBA,GAAiB,UAAY,OAC1E,aAAc,IAAMU,EAAW,EAAK,EACtC,GAEJ,EACF,CAEJ,CAAC,EAEDpC,EAAW,YAAc,aAEzB,IAAOoD,GAAQrE,GAAWiB,CAAU",
|
|
6
6
|
"names": ["jsx", "jsxs", "React", "useImperativeHandle", "useRef", "useState", "useEffect", "gsap", "ScrollTrigger", "useMediaQuery", "useInView", "ScrollLoadVideo", "Button", "Heading", "Picture", "Text", "Countdown", "cn", "cva", "withLayout", "useExposure", "trackUrlRef", "getLocalizedPath", "useAiuiContext", "sizeMap", "VideoModal", "componentType", "componentName", "contentVariants", "textVariants", "buttonGroupVariants", "iconGroupVariants", "PlayButtonAppendIcon", "size", "width", "height", "HeroBanner", "data", "className", "classNames", "onSecondaryClick", "onPrimaryClick", "rest", "ref", "locale", "localizeUrl", "url", "label", "title", "subtitle", "endDate", "endDate_tz", "dateFormat", "pcImage", "padImage", "mobileImage", "pcVideo", "padVideo", "mobileVideo", "isShowVideo", "isVideoLoop", "primaryButton", "secondaryButton", "theme", "titleSize", "caption", "blockLink", "iconArray", "align", "isMobile", "isPad", "visible", "setVisible", "inViewRef", "inView", "scrollTriggerRef", "bgTriggerRef", "boxTriggerRef", "bgRef", "boxRef", "gsapResize", "clientHeight", "self", "value", "e", "icon", "c", "index", "HeroBanner_default"]
|
|
7
7
|
}
|
|
@@ -43,6 +43,8 @@ export interface HeroBannerProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
43
43
|
playIcon?: boolean;
|
|
44
44
|
videoUrl?: Media;
|
|
45
45
|
youtubeId?: string;
|
|
46
|
+
/** 是否为YouTube视频,true时播放YouTube视频(需要youtubeId),false时播放原生video(需要isShowPlayVideoButton为true且videoUrl.url存在) */
|
|
47
|
+
isYoutubeVideo?: boolean;
|
|
46
48
|
isCustomSecondaryButton?: boolean;
|
|
47
49
|
/** 自定义事件ID,传递给 onSecondaryClick */
|
|
48
50
|
customSecondaryEventId?: string;
|