@anker-in/headless-ui 1.3.84 → 1.3.86
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/README.md +6 -0
- package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/cjs/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/cjs/biz-components/Category/index.d.ts +4 -2
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
- package/dist/cjs/biz-components/Chat/action.js +1 -0
- package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/button.js +1 -0
- package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
- package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/exports.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
- package/dist/cjs/biz-components/Chat/index.js +1 -0
- package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/cjs/biz-components/Chat/markdown.js +1 -0
- package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/messages.js +1 -0
- package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
- package/dist/cjs/biz-components/Chat/props.js +1 -0
- package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
- package/dist/cjs/biz-components/Chat/response.js +1 -0
- package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
- package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/utils.js +1 -0
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/cjs/biz-components/Faq/Faq.js +2 -2
- package/dist/cjs/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/cjs/biz-components/GiftShelf/index.js +1 -1
- package/dist/cjs/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/Root.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/cjs/biz-components/SceneShelf/context.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/helpers/utils.js +1 -1
- package/dist/cjs/shared/track.d.ts +13 -7
- package/dist/cjs/shared/track.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/esm/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/esm/biz-components/Category/index.d.ts +4 -2
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Chat/action.d.ts +25 -0
- package/dist/esm/biz-components/Chat/action.js +1 -0
- package/dist/esm/biz-components/Chat/button.d.ts +3 -0
- package/dist/esm/biz-components/Chat/button.js +1 -0
- package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/esm/biz-components/Chat/chatContext.js +1 -0
- package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
- package/dist/esm/biz-components/Chat/exports.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/esm/biz-components/Chat/index.d.ts +71 -0
- package/dist/esm/biz-components/Chat/index.js +1 -0
- package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/esm/biz-components/Chat/markdown.js +1 -0
- package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
- package/dist/esm/biz-components/Chat/messages.js +1 -0
- package/dist/esm/biz-components/Chat/props.d.ts +43 -0
- package/dist/esm/biz-components/Chat/props.js +1 -0
- package/dist/esm/biz-components/Chat/response.d.ts +4 -0
- package/dist/esm/biz-components/Chat/response.js +1 -0
- package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/esm/biz-components/Chat/suggestions.js +1 -0
- package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
- package/dist/esm/biz-components/Chat/utils.js +1 -0
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/esm/biz-components/Faq/Faq.js +2 -2
- package/dist/esm/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/esm/biz-components/GiftShelf/index.js +1 -1
- package/dist/esm/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/esm/biz-components/MemberEquity/index.js +2 -2
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/esm/biz-components/SceneShelf/Root.js +1 -1
- package/dist/esm/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/esm/biz-components/SceneShelf/context.js +1 -1
- package/dist/esm/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/helpers/utils.js +1 -1
- package/dist/esm/shared/track.d.ts +13 -7
- package/dist/esm/shared/track.js +1 -1
- package/dist/tokens/base.css +48 -0
- package/package.json +50 -3
- package/src/biz-components/Chat/styles/chat.css +14 -0
- package/src/biz-components/Chat/styles/css/animations.css +35 -0
- package/src/biz-components/Chat/styles/css/button.css +56 -0
- package/src/biz-components/Chat/styles/css/colors.css +12 -0
- package/src/biz-components/Chat/styles/css/console.css +134 -0
- package/src/biz-components/Chat/styles/css/header.css +43 -0
- package/src/biz-components/Chat/styles/css/input.css +89 -0
- package/src/biz-components/Chat/styles/css/markdown.css +131 -0
- package/src/biz-components/Chat/styles/css/messages.css +85 -0
- package/src/biz-components/Chat/styles/css/panel.css +23 -0
- package/src/biz-components/Chat/styles/css/popup.css +44 -0
- package/src/biz-components/Chat/styles/css/response.css +25 -0
- package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
- package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
- package/src/biz-components/Chat/styles/css/window.css +60 -0
- package/src/biz-components/Chat/styles/image.png +0 -0
- package/style.css +9 -12
- package/tailwind.config.js +3 -0
|
@@ -34,6 +34,11 @@ export interface PriceData {
|
|
|
34
34
|
export interface SceneProductCardData {
|
|
35
35
|
/** 产品唯一标识 */
|
|
36
36
|
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* 产品 SKU,用于埋点 data-headless-sku。
|
|
39
|
+
* 未传时回退到 id(兼容旧数据),但 id 不一定是 SKU,建议由数据层显式传入
|
|
40
|
+
*/
|
|
41
|
+
sku?: string;
|
|
37
42
|
/** 产品名称 */
|
|
38
43
|
title: string;
|
|
39
44
|
/** 自定义产品名称 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as I,jsx as e,jsxs as i}from"react/jsx-runtime";import{Heading as S,Tabs as q,TabsList as J,TabsTrigger as Q,TabsContent as A,Text as N,Picture as C,Link as X,Button as L,DropdownMenu as Y,DropdownMenuTrigger as Z,DropdownMenuContent as ee,DropdownMenuItem as te,LoadingDots as M,Badge as ae}from"../../components/index.js";import{DownArrow as se}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useState as O}from"react";import{cn as _,atobID as ie,highlightSearchWord as T,replaceTemplate as le}from"../../helpers/utils.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{formatVariantPrice as oe}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";import{getLocalizedPath as B}from"../../helpers/utils.js";const F=({product:t,onSecondaryButton:o,onPrimaryButton:s,searchValue:n,variantData:m,shopNowLoadingProductId:y,badgeVariant:b})=>{const l=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:c,currencyCode:x}=j(),f=y===t?.id,D=u(()=>B(`/products/${t?.handle}`,g,`variant=${ie(l?.id)}&ref=search_result_${n?.toLowerCase()}`),[t?.handle,l?.id,n,g]),P=l?.coupons?.[0],{price:k,basePrice:r}=oe({locale:x==="CAD"?"us":g||"us",amount:P?P.variant_price4wscode:l?.price?.amount??l?.price,baseAmount:P?l?.price?.amount??l?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),z=u(()=>t?.tags?.filter?.(d=>d?.startsWith?.("CLtag"))?.map?.(d=>d?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?i(X,{href:B(t?.advertisingLink,g),className:"h-full",children:[e(C,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),i("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(N,{html:t?.advertisingTitle,className:_("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(S,{size:3,html:t?.advertisingSubtitle,className:_("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):i("a",{href:D,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(C,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:l?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),i("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[i("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:z?.map((d,E)=>e(ae,{size:"lg",variant:b,children:d},E))}),e(N,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:T(t?.title||"",n||"")}),e(N,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:T(t?.description,n||"")})]}),i("div",{children:[e("div",{className:"mb-2 flex items-center",children:l?.availableForSale?i(I,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:l?.availableForSale&&k||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:l?.availableForSale&&r||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:c?.soldOutText||"Sold Out"})}),i("div",{className:_("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[c?.learnMoreText&&e(L,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:d=>{d.preventDefault(),d.stopPropagation(),o?.()},children:c?.learnMoreText}),c?.shopNowText&&e(L,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!l?.availableForSale,loading:f,onClick:d=>{d.preventDefault(),d.stopPropagation(),s?.()},children:c?.shopNowText})]})]})]})]})})},re=({blog:t,searchValue:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:i("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:e(C,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),i("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(S,{size:3,html:T(t?.title,o)}),e(N,{html:T(t?.content,o),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(L,{as:"a",href:m,variant:"secondary",size:"lg",children:s?.learnMoreText||"Learn More"})})]})]})})},ne=({searchValue:t,page:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/${o?.handle}`,n),[o,n]);return i("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(S,{size:3,html:T(o?.name,t)}),e(N,{as:"p",html:T(o?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(L,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:s?.learnMoreText||"Learn More"})]})},R=({url:t,label:o})=>i("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(C,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(N,{html:o,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),$=({products:t,title:o,buildProps:s,onSecondaryButton:n,onPrimaryButton:m,badgeVariant:y})=>{const{products:b}=s||{};return console.log(b,"buildProducts"),i("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(S,{size:4,weight:"bold",html:o}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((l,g)=>{const c=b?.find(f=>f.handle===l.handle);if(!c)return null;const x=c?.variants?.find(f=>f.sku===l.sku);return e(F,{product:c,variantData:x,badgeVariant:y,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>m?.()},l.sku+g)})})]})},de=({searchResult:t,searchValue:o,data:s,onSecondaryButton:n,onPrimaryButton:m,onChangeSort:y,loading:b,shopNowLoadingProductId:l,searchResultCount:g,onChangeTab:c,buildProps:x,componentOverrides:f,className:D,...P})=>{const k=f?.badge?.variant,[r,z]=O(s?.tabs?.[0]),[d,E]=O(!1),[V,G]=O({[v.PRODUCTS]:s?.tabs?.find(a=>a.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:s?.tabs?.find(a=>a.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:s?.tabs?.find(a=>a.tabType===v.PAGES)?.sortKeys?.[0]}),w=u(()=>t?.products||[],[t]),K=u(()=>t?.blogs||[],[t]),W=u(()=>t?.pages||[],[t]),U=u(()=>Object.values(g||{}).reduce((a,p)=>a+p,0),[g]),H=u(()=>{const a={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const h=[...w||[]];return h.length>=8?h.splice(7,0,a):h.length>0&&h.push(a),h}else return w},[r,w]);return i("div",{...P,className:_("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",D),children:[e(S,{size:4,weight:"bold",html:le(s?.title,{totalCount:U?.toString(),inputValue:`"${o}"`})}),e("div",{className:"mt-6",children:i(q,{className:"ipc_search_page_tabs",defaultValue:"products",children:[i("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(J,{children:s?.tabs?.map(a=>i(Q,{onClick:()=>{z(a);const p=a?.sortKeys?.[0];p&&(G(h=>({...h,[a?.tabType]:p})),y?.(a?.tabType,p)),c?.(a?.tabType)},defaultValue:"products",value:a.tabType,children:[a.label," (",g?.[a.tabType],")"]},a.id))}),i(Y,{onOpenChange:E,children:[e(Z,{asChild:!0,children:i("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",V?.[r?.tabType]?.label," ",e(se,{className:_("inline-block size-4",{"rotate-180":d})})]})}),e(ee,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(a=>e(te,{className:_("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":V?.[r?.tabType]?.value===a.value}),onClick:()=>{y?.(r?.tabType,a),G(p=>({...p,[r?.tabType]:a}))},children:a.label},a.id))})]})]}),i(A,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:H?.map((a,p)=>e(F,{searchValue:o,product:a,shopNowLoadingProductId:l,badgeVariant:k,onSecondaryButton:()=>n?.(a),onPrimaryButton:()=>m?.(a)},(a.id||"")+p))}),b?e("div",{className:"mt-6 flex w-full justify-center",children:e(M,{})}):!w?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]}),e(A,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:i("div",{children:[K?.map(a=>e(re,{blog:a,searchValue:o},a.id)),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!K?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,badgeVariant:k})]})]})}),i(A,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:W?.map((a,p)=>e(ne,{page:a,searchValue:o},(a.global_id||a.id)+p))}),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!W?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]})]})})]})};var fe=de;export{fe as default};
|
|
1
|
+
import{Fragment as I,jsx as e,jsxs as i}from"react/jsx-runtime";import{Heading as S,Tabs as q,TabsList as J,TabsTrigger as Q,TabsContent as A,Text as N,Picture as C,Link as X,Button as L,DropdownMenu as Y,DropdownMenuTrigger as Z,DropdownMenuContent as ee,DropdownMenuItem as te,LoadingDots as M,Badge as ae}from"../../components/index.js";import{DownArrow as se}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useState as O}from"react";import{cn as _,atobID as ie,highlightSearchWord as T,replaceTemplate as le}from"../../helpers/utils.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{formatVariantPrice as oe}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";import{getLocalizedPath as B}from"../../helpers/utils.js";const F=({product:t,onSecondaryButton:o,onPrimaryButton:s,searchValue:n,variantData:m,shopNowLoadingProductId:y,badgeVariant:b})=>{const l=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:p,currencyCode:x}=j(),f=y===t?.id,D=u(()=>B(`/products/${t?.handle}`,g,`variant=${ie(l?.id)}&ref=search_result_${n?.toLowerCase()}`),[t?.handle,l?.id,n,g]),P=l?.coupons?.[0],{price:k,basePrice:r}=oe({locale:x==="CAD"?"us":g||"us",amount:P?P.variant_price4wscode:l?.price?.amount??l?.price,baseAmount:P?l?.price?.amount??l?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),z=u(()=>t?.tags?.filter?.(d=>d?.startsWith?.("CLtag"))?.map?.(d=>d?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?i(X,{href:B(t?.advertisingLink,g),className:"h-full",children:[e(C,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),i("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(N,{html:t?.advertisingTitle,className:_("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(S,{size:3,html:t?.advertisingSubtitle,className:_("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):i("a",{href:D,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(C,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:l?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),i("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[i("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:z?.map((d,E)=>e(ae,{size:"lg",variant:b,children:d},E))}),e(N,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:T(t?.title||"",n||"")}),e(N,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:T(t?.description,n||"")})]}),i("div",{children:[e("div",{className:"mb-2 flex items-center",children:l?.availableForSale?i(I,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:l?.availableForSale&&k||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:l?.availableForSale&&r||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:p?.soldOutText||"Sold Out"})}),i("div",{className:_("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[p?.learnMoreText&&e(L,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:d=>{d.preventDefault(),d.stopPropagation(),o?.()},children:p?.learnMoreText}),p?.shopNowText&&e(L,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!l?.availableForSale,loading:f,onClick:d=>{d.preventDefault(),d.stopPropagation(),s?.()},children:p?.shopNowText})]})]})]})]})})},re=({blog:t,searchValue:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:i("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:e(C,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),i("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(S,{size:3,html:T(t?.title,o)}),e(N,{html:T(t?.content,o),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(L,{as:"a",href:m,variant:"secondary",size:"lg",children:s?.learnMoreText||"Learn More"})})]})]})})},ne=({searchValue:t,page:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/${o?.handle}`,n),[o,n]);return i("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(S,{size:3,html:T(o?.name,t)}),e(N,{as:"p",html:T(o?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(L,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:s?.learnMoreText||"Learn More"})]})},R=({url:t,label:o})=>i("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(C,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(N,{html:o,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),$=({products:t,title:o,buildProps:s,onSecondaryButton:n,onPrimaryButton:m,badgeVariant:y})=>{const{products:b}=s||{};return console.log(b,"buildProducts"),i("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(S,{size:4,weight:"bold",html:o}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((l,g)=>{const p=b?.find(f=>f.handle===l.handle);if(!p)return null;const x=p?.variants?.find(f=>f.sku===l.sku);return e(F,{product:p,variantData:x,badgeVariant:y,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>m?.()},l.sku+g)})})]})},de=({searchResult:t,searchValue:o,data:s,onSecondaryButton:n,onPrimaryButton:m,onChangeSort:y,loading:b,shopNowLoadingProductId:l,searchResultCount:g,onChangeTab:p,buildProps:x,componentOverrides:f,className:D,...P})=>{const k=f?.badge?.variant,[r,z]=O(s?.tabs?.[0]),[d,E]=O(!1),[V,G]=O({[v.PRODUCTS]:s?.tabs?.find(a=>a.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:s?.tabs?.find(a=>a.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:s?.tabs?.find(a=>a.tabType===v.PAGES)?.sortKeys?.[0]}),w=u(()=>t?.products||[],[t]),K=u(()=>t?.blogs||[],[t]),W=u(()=>t?.pages||[],[t]),U=u(()=>Object.values(g||{}).reduce((a,c)=>a+c,0),[g]),H=u(()=>{const a={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const h=[...w||[]];return h.length>=8?h.splice(7,0,a):h.length>0&&h.push(a),h}else return w},[r,w]);return i("div",{...P,className:_("ipc_search_page desktop:py-[128px] px-grid py-16",D),children:[e(S,{size:4,weight:"bold",html:le(s?.title,{totalCount:U?.toString(),inputValue:`"${o}"`})}),e("div",{className:"mt-6",children:i(q,{className:"ipc_search_page_tabs",defaultValue:"products",children:[i("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(J,{children:s?.tabs?.map(a=>i(Q,{onClick:()=>{z(a);const c=a?.sortKeys?.[0];c&&(G(h=>({...h,[a?.tabType]:c})),y?.(a?.tabType,c)),p?.(a?.tabType)},defaultValue:"products",value:a.tabType,children:[a.label," (",g?.[a.tabType],")"]},a.id))}),i(Y,{onOpenChange:E,children:[e(Z,{asChild:!0,children:i("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",V?.[r?.tabType]?.label," ",e(se,{className:_("inline-block size-4",{"rotate-180":d})})]})}),e(ee,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(a=>e(te,{className:_("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":V?.[r?.tabType]?.value===a.value}),onClick:()=>{y?.(r?.tabType,a),G(c=>({...c,[r?.tabType]:a}))},children:a.label},a.id))})]})]}),i(A,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:H?.map((a,c)=>e(F,{searchValue:o,product:a,shopNowLoadingProductId:l,badgeVariant:k,onSecondaryButton:()=>n?.(a),onPrimaryButton:()=>m?.(a)},(a.id||"")+c))}),b?e("div",{className:"mt-6 flex w-full justify-center",children:e(M,{})}):!w?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]}),e(A,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:i("div",{children:[K?.map(a=>e(re,{blog:a,searchValue:o},a.id)),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!K?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,badgeVariant:k})]})]})}),i(A,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:W?.map((a,c)=>e(ne,{page:a,searchValue:o},(a.global_id||a.id)+c))}),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!W?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]})]})})]})};var fe=de;export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as g}from"react/jsx-runtime";import*as p from"react";import{cva as ue}from"class-variance-authority";import{useMediaQuery as H}from"react-responsive";import E from"jump.js";import{cn as s,getLocalizedPath as w}from"../../helpers/index.js";import{Text as O,Button as P,Heading as ge,Picture as be,Countdown as ye}from"../../components/index.js";import{withLayout as fe}from"../../shared/Styles.js";import
|
|
1
|
+
"use client";import{jsx as t,jsxs as g}from"react/jsx-runtime";import*as p from"react";import{cva as ue}from"class-variance-authority";import{useMediaQuery as H}from"react-responsive";import E from"jump.js";import{cn as s,getLocalizedPath as w}from"../../helpers/index.js";import{Text as O,Button as P,Heading as ge,Picture as be,Countdown as ye}from"../../components/index.js";import{withLayout as fe}from"../../shared/Styles.js";import ke from"../Media/index.js";import{useAiuiContext as xe}from"../AiuiProvider/index.js";import{useExposure as he}from"../../hooks/useExposure.js";import{buildTrackingRef as Te,trackUrlRef as V}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as _,resolveComponentMediaType as ve}from"../../shared/track.js";import Be from"./SecondaryBannerCarousel.js";const u="secondary_banner",Ie=ue("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/480] desktop:aspect-[1440/480] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/1320] laptop:aspect-[1024/864] desktop:aspect-[1440/1152] lg-desktop:aspect-[1920/1440] aspect-[390/1440] overflow-visible"}},defaultVariants:{size:"base"}}),j=p.forwardRef(({className:h,classNames:a={},data:e,jumpOptions:T={},isActive:$,a11yLabels:J,trackExposure:q=!0,frameIndex:b,...v},l)=>{const{pcImage:F,padImage:W,mobileImage:G,isVideoLoop:Q,endDate:B,endDate_tz:U,dateFormat:K,size:X,iconArray:y,theme:Y,primaryButton:n,secondaryButton:i,title:c,titleTag:Z}=e,ee=Q??!0,f=X??"base",te=Y??"light",ne=Z??"h2",{locale:I="us",pageHandle:ie}=xe(),oe=H({query:"(max-width: 767px)"}),ae=H({query:"(min-width: 768px) and (max-width: 1024px)"}),M=oe?e.mobileImage:ae?e.padImage??e.pcImage:e.pcImage,m=ve(M?.mimeType==="video/mp4"),S=b??1,C=`${Te(ie??"",m,u)}${b===void 0?"":`_${b}`}`,k=M?.id||e.pcImage?.id||"",L=p.useRef(null),se=p.useCallback(o=>{L.current=o,typeof l=="function"?l(o):l&&(l.current=o)},[l]),re=p.useRef(null);he(q?L:re,{componentType:m,componentName:u,componentTitle:c?.trim()||"",componentDescription:e.subtitle?.trim()||"",position:1,creativeId:k});const le=!!(i?.link||typeof i?.onClick=="function"),pe=!!(n?.link||typeof n?.onClick=="function"),z=i?.link&&!i.link.startsWith("#")?V(w(i.link,I),C):void 0,N=n?.link&&!n.link.startsWith("#")?V(w(n.link,I),C):void 0,ce=_({interactive:le,componentType:m,componentName:u,title:c,description:e.subtitle,buttonName:i?.text,position:S,creativeId:k}),me=_({interactive:pe,componentType:m,componentName:u,title:c,description:e.subtitle,buttonName:n?.text,position:S,creativeId:k}),R={...{duration:500,offset:0},...T},x=p.useId(),d=c?`${x}-title`:void 0,D=e.subtitle?`${x}-subtitle`:void 0,A=e.superTitle?`${x}-super-title`:void 0,de=[A,D].filter(Boolean).join(" ")||void 0;return e.items&&e.items.length>0?t(Be,{data:e,className:h,classNames:a,jumpOptions:T,a11yLabels:J,ref:l,...v}):g("section",{ref:se,role:"banner","aria-labelledby":d,"aria-describedby":de,className:s({"aiui-dark":te==="dark"},Ie({size:f}),h,a?.root),...v,children:[t("div",{className:s("absolute inset-0",{"h-fit":f==="xlg"}),children:t(ke,{pcImage:F,padImage:W,mobileImage:G,className:"size-full",imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:ee,playsInline:!0,autoPlay:$??!0})}),g("div",{className:s("banner-content laptop:top-[min(50%,50vh)] laptop:-translate-y-1/2 px-grid absolute top-12 z-10 flex flex-col items-start justify-center text-left",a?.content),children:[g("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[e.superTitle&&t(O,{as:"p",size:2,id:A,className:s("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",a?.superTitle),html:e.superTitle}),e.title&&t(ge,{as:ne,size:["xlg","lg"].includes(f)?5:4,id:d,className:s("banner-title ",a?.title),html:e.title}),e.subtitle&&t(O,{as:"p",size:3,id:D,className:s("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",a?.subtitle),html:e.subtitle})]}),B&&t("div",{className:"banner-countdown",children:t(ye,{endDate:B,endDate_tz:U,dateFormat:K,variant:"spacious",className:"lg-desktop:mt-8 mt-6"})}),g("div",{className:s("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",a?.buttonGroup),children:[i?.text&&t(P,{variant:"secondary",onClick:o=>{if(i.link?.startsWith("#")){o.preventDefault();const r=document.querySelector(i.link);r&&E(r,R)}i.onClick?.()},className:s("",a?.secondaryButton),"aria-describedby":d,...z?{as:"a",href:z}:{},...ce,children:i.text}),n?.text&&t(P,{onClick:o=>{if(n.link?.startsWith("#")){o.preventDefault();const r=document.querySelector(n.link);r&&E(r,R)}n.onClick?.()},className:s("",a?.primaryButton),"aria-describedby":d,...N?{as:"a",href:N}:{},...me,children:n.text})]}),Array.isArray(y)&&y.length>0&&t("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:y.map((o,r)=>o.pcImage?t(be,{source:o.pcImage.url,alt:o.pcImage.alt||`icon ${r+1}`,role:"img",className:"laptop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},r):null)})]})]})});j.displayName="SecondaryBanner";var Pe=fe(j);export{Pe as default,Ie as secondaryBannerVariants};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as Te,jsx as s,jsxs as u}from"react/jsx-runtime";import{useAiuiContext as Ce}from"../AiuiProvider/index.js";import{formatVariantPrice as Be}from"./shelfDisplay.js";import _e from"../../components/picture.js";import Se from"../../components/badge.js";import{cn as w}from"../../helpers/utils.js";import{Text as Ne}from"../../components/text.js";import fe from"../../components/button.js";import{gaTrack as Pe}from"../../shared/track.js";import{trackUrlRef as Le}from"../../shared/trackUrlRef.js";import{Heading as $e}from"../../components/heading.js";import{useExposure as De}from"../../hooks/useExposure.js";import{useRef as Ie,useEffect as ze,useMemo as ye,useState as E}from"react";const ge="image",he="product_shelf",xe=999999999e-2,Ae=e=>{const t=e?.sku,_=e?.variants,O=_?.find(j=>j?.sku===t),K=O?.image?.url||_?.[0]?.image?.url||"",re=O?.image?.altText||_?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:K,altText:re}},Fe=({items:e})=>e?.length?s("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,_)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},_):s(Ne,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},_))}):null,Ke=({data:e,configuration:t})=>{const{isDisplayBackImage:_=!1,itemShape:O,metafields:K,isTopTag:re=!1,isShowTag:j,isShowOriginalPrice:$,isShowShortTitle:ve=!1,isShowPricesTag:D=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:v,itemsTagBgColor:Q,formatPrice:ie,renderOriginalPrice:X,renderPriceLabel:be,renderPrice:U}=t||{},{locale:N="es",copyWriting:oe,currencyDisplay:Y}=Ce(),{discounts:Z,discountsCopy:le}=K||{},ne=Ie(null),[n,ae]=E([]),[ce,I]=E(""),[pe,z]=E(!1),[b,R]=E(!1),me=(i,p,m,d)=>{const{primaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.primaryButton?.(i,p+1,m,d)},ke=(i,p,m,d)=>{const{secondaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.secondaryButton?.(i,p+1,m,d)},o=ye(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(p=>p?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),A=o?.id?.split?.("/")||[],T=A?.[A?.length-1],y=!o?.availableForSale||o?.price?.amount===xe||o?.price===xe,k=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=ye(()=>Be({locale:N,amount:k?k?.variant_price4wscode:o?.price,baseAmount:k?o?.price:0,currencyCode:de,currencyDisplay:Y,customFormatPrice:ie}),[de,N,k,Y,o,ie]),{price:F,basePrice:C,discount:B,discountAmount:M}=q,{imageUrl:V,altText:ue}=Ae(e),G=e?.custom_name||e?.title,P=ve&&o?.metafields?.infos?.page_short_title||G,ee=e?.custom_description||e?.description,r=()=>{if(k?.value_type==="fixed_amount"){const i=M||"",p=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(p){const[,m,d,x]=p;let S=d;return d.endsWith(".00")?S=d.replace(/\.00$/,""):d.endsWith(",00")&&(S=d.replace(/,00$/,"")),`${m}${S}${x}`}return i}return B||""};ze(()=>{let i=[];if(B||M){const m=`${r()} ${Z?.off||le?.off||""}`;I(m)}const p=e?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,B&&D?1:2)||[];ae(i.concat(p))},[e?.tags,B,M,D,Z?.off,le?.off]),De(ne,{componentType:ge,componentName:he,componentTitle:G,componentDescription:ee,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){z(!0);try{await me(e,t?.index,t,k)}finally{z(!1)}}},a=async()=>{if(!b&&!e?.custom_secondary_link){R(!0);try{await ke(e,t?.index,t,k)}finally{R(!1)}}},c=()=>u("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[u("div",{className:"shelf-display-product-content-title-desc",children:[P?s($e,{as:"h3",title:P||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:P||""}):null,s(Ne,{size:2,className:w("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),u("div",{className:"shelf-display-product-content-price-button",children:[s("div",{className:"mb-2 flex flex-wrap items-center",children:U?U(e,{price:F,basePrice:C,discount:B,discountAmount:M,variant:o,coupon:k,isSoldOut:y,isShowOriginalPrice:$}):y?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):u(Te,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&F||""}),X?X(e,{price:F,basePrice:C,discount:B,discountAmount:M,isShowOriginalPrice:$}):C&&$&&s("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&C||""})]})}),!U&&be?.(e,o,{isShowOriginalPrice:$}),u("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?s(fe,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:b,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:y&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),f={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},g={...v?{color:v}:{},...Q?{backgroundColor:Q,backgroundImage:"none"}:{},...v||Q?{outlineColor:v}:{}},L=()=>u("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[D&&ce&&s(Se,{className:"shelf-prices-tag",variant:"fill",style:f,children:ce||""}),j&&n?.length>0&&n?.map?.((i,p)=>s(Se,{className:"shelf-items-tag",variant:"outline",style:g,children:i},p))]}),h=e?.custom_bg_image,J=e?.custom_theme;return s("div",{ref:ne,className:w("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",h?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:h?{backgroundImage:`url(${h})`}:void 0,children:_?u(Te,{children:[s(_e,{source:V,alt:ue,className:w("absolute inset-0 size-full",{"opacity-0":h}),imgClassName:"size-full object-cover"}),u("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[s(L,{}),c()]})]}):u("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[s(L,{}),u("div",{className:w("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":h}),children:[s("a",{"aria-label":G,target:t?.target,href:Le(`${N==="us"||!N?"":`/${N}`}/products/${e?.handle}?variant=${T}`,`${ge}_${he}`),onClick:()=>{Pe({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},className:"block size-full",children:s(_e,{source:V,alt:ue,className:"size-full",imgClassName:"size-full object-cover"})}),s(Fe,{items:e?.socialEndorsements})]}),c()]})},e?.id||e?.handle)},Qe=({data:e,configuration:t})=>{const{itemShape:_,itemLength:O,metafields:K,isShowShortTitle:re,formatPrice:j,renderOriginalPrice:$,renderPriceLabel:ve,renderPrice:D}=t||{},{discounts:W,discountsCopy:H}=K||{},{locale:v="us",copyWriting:Q,currencyDisplay:ie}=Ce(),[X,be]=E([]),U=Ie(null),[N,oe]=E(!1),[Y,Z]=E(!1),le=(r,l,a,c)=>{const{primaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}J?.primaryButton?.(r,l+1,a,c)},ne=(r,l,a,c)=>{const{secondaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}J?.secondaryButton?.(r,l+1,a,c)},n=ye(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ae=n?.id?.split?.("/")||[],ce=ae?.[ae?.length-1],I=!n?.availableForSale||n?.price?.amount===xe||n?.price===xe,pe=t?.isShowTag,z=t?.isShowOriginalPrice,b=n?.coupons?.[0],R=!!(z&&b),me=e?.price?.currencyCode||"USD",ke=ye(()=>Be({locale:v,amount:R?b?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:j}),[me,v,R,b?.variant_price4wscode,n,j]),{price:o,basePrice:A,discount:T,discountAmount:y}=ke,{imageUrl:k,altText:de}=Ae(e),q=e?.custom_name||e?.title,F=re&&n?.metafields?.infos?.page_short_title||q,C=e?.custom_description||e?.description;De(U,{componentType:ge,componentName:he,componentTitle:q,componentDescription:C,position:t?.index+1});const B=async()=>{if(!N&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,b)}finally{oe(!1)}}},M=async()=>{if(!Y&&!e?.custom_secondary_link){Z(!0);try{await ne(e,t?.index,t,b)}finally{Z(!1)}}},V=()=>O>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},ue=()=>O>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",G=()=>{if(b?.value_type==="fixed_amount"){const r=y||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,c,f]=l;let g=c;return c.endsWith(".00")?g=c.replace(/\.00$/,""):c.endsWith(",00")&&(g=c.replace(/,00$/,"")),`${a}${g}${f}`}return r}return T||""};ze(()=>{let r=[];if(T||y){const a=`${G()} ${W?.off||H?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,T?1:2)||[];be(r.concat(l))},[e?.tags,T,y,W?.off,H?.off]);const P=e?.custom_bg_image,ee=e?.custom_theme;return s("div",{ref:U,className:w(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",P?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":ee==="dark","aiui-light":ee==="light"}),style:P?{backgroundImage:`url(${P})`}:void 0,children:u("div",{className:w(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:w(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":P}),children:s("a",{"aria-label":q,target:t?.target,href:Le(`${v==="us"||!v?"":`/${v}`}/products/${e?.handle}?variant=${ce}`,`${ge}_${he}`),onClick:()=>{Pe({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:s(_e,{source:k,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),u("div",{className:w("flex flex-col items-start justify-center",V().boxItem),children:[pe&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:X?.length>0&&X?.map?.((r,l)=>s(Se,{className:"shelf-items-tag",variant:"fill",children:r},l))}),F?s($e,{as:"h3",title:F||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:F||""}):null,C?s(Ne,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:C||""}):null,s("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:D?D(e,{price:o,basePrice:A,discount:T,discountAmount:y,variant:n,coupon:b,isSoldOut:I,isShowOriginalPrice:z}):I?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:Q?.soldOutText}):u(Te,{children:[s("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),$?$(e,{price:o,basePrice:A,discount:T,discountAmount:y,isShowOriginalPrice:z}):A&&s("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&A||""})]})}),!D&&ve?.(e,n,{isShowOriginalPrice:z}),u("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!I?s(fe,{disabled:I&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:M,loading:Y,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:I&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:B,loading:N,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Qe as ShelfDisplayHorizontalItem,Ke as ShelfDisplayWrapItem,Ae as getProductImage};
|
|
1
|
+
import{Fragment as Ce,jsx as s,jsxs as u}from"react/jsx-runtime";import{useAiuiContext as Be}from"../AiuiProvider/index.js";import{formatVariantPrice as Pe}from"./shelfDisplay.js";import Se from"../../components/picture.js";import Te from"../../components/badge.js";import{cn as _}from"../../helpers/utils.js";import{Text as Ne}from"../../components/text.js";import ye from"../../components/button.js";import{gaTrack as Le}from"../../shared/track.js";import{trackUrlRef as De}from"../../shared/trackUrlRef.js";import{Heading as Ie}from"../../components/heading.js";import{useExposure as $e}from"../../hooks/useExposure.js";import{useRef as ze,useEffect as Ae,useMemo as ge,useState as E}from"react";import{useTracking as Fe}from"../../hooks/useTracking.js";const he="image",xe="product_shelf",ve=999999999e-2,Me=e=>{const t=e?.sku,v=e?.variants,G=v?.find(re=>re?.sku===t),J=G?.image?.url||v?.[0]?.image?.url||"",K=G?.image?.altText||v?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:J,altText:K}},Ee=({items:e})=>e?.length?s("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,v)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},v):s(Ne,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},v))}):null,Ye=({data:e,configuration:t})=>{const{buildRef:v}=Fe(),{isDisplayBackImage:G=!1,itemShape:J,metafields:K,isTopTag:re=!1,isShowTag:ie,isShowOriginalPrice:D,isShowShortTitle:be=!1,isShowPricesTag:I=!1,pricesTagTextColor:O,pricesTagBgColor:j,itemsTagTextColor:b,itemsTagBgColor:Q,formatPrice:oe,renderOriginalPrice:X,renderPriceLabel:ke,renderPrice:W}=t||{},{locale:T="es",copyWriting:le,currencyDisplay:Y}=Be(),{discounts:Z,discountsCopy:ne}=K||{},ae=ze(null),[n,ce]=E([]),[me,$]=E(""),[pe,z]=E(!1),[k,H]=E(!1),de=(i,m,p,d)=>{const{primaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:_e}=t||{};if(x){if(x==="AddCart"&&S)return S(i,m+1,p,d);if(x==="BuyNow"&&te)return te(i,m+1,p,d);if(x==="LearnMore"&&se)return se(i,m+1,p,d)}_e?.primaryButton?.(i,m+1,p,d)},we=(i,m,p,d)=>{const{secondaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:_e}=t||{};if(x){if(x==="AddCart"&&S)return S(i,m+1,p,d);if(x==="BuyNow"&&te)return te(i,m+1,p,d);if(x==="LearnMore"&&se)return se(i,m+1,p,d)}_e?.secondaryButton?.(i,m+1,p,d)},o=ge(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(m=>m?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),A=o?.id?.split?.("/")||[],N=A?.[A?.length-1],y=!o?.availableForSale||o?.price?.amount===ve||o?.price===ve,w=o?.coupons?.[0],ue=e?.price?.currencyCode||"USD",U=ge(()=>Pe({locale:T,amount:w?w?.variant_price4wscode:o?.price,baseAmount:w?o?.price:0,currencyCode:ue,currencyDisplay:Y,customFormatPrice:oe}),[ue,T,w,Y,o,oe]),{price:F,basePrice:C,discount:B,discountAmount:M}=U,{imageUrl:R,altText:fe}=Me(e),q=e?.custom_name||e?.title,P=be&&o?.metafields?.infos?.page_short_title||q,ee=e?.custom_description||e?.description,r=()=>{if(w?.value_type==="fixed_amount"){const i=M||"",m=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(m){const[,p,d,x]=m;let S=d;return d.endsWith(".00")?S=d.replace(/\.00$/,""):d.endsWith(",00")&&(S=d.replace(/,00$/,"")),`${p}${S}${x}`}return i}return B||""};Ae(()=>{let i=[];if(B||M){const p=`${r()} ${Z?.off||ne?.off||""}`;$(p)}const m=e?.tags?.filter?.(p=>p?.startsWith?.("CLtag"))?.map?.(p=>p?.replace?.("CLtag:",""))?.slice?.(0,B&&I?1:2)||[];ce(i.concat(m))},[e?.tags,B,M,I,Z?.off,ne?.off]),$e(ae,{componentType:he,componentName:xe,componentTitle:q,componentDescription:ee,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){z(!0);try{await de(e,t?.index,t,w)}finally{z(!1)}}},a=async()=>{if(!k&&!e?.custom_secondary_link){H(!0);try{await we(e,t?.index,t,w)}finally{H(!1)}}},c=()=>u("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[u("div",{className:"shelf-display-product-content-title-desc",children:[P?s(Ie,{as:"h3",title:P||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:P||""}):null,s(Ne,{size:2,className:_("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),u("div",{className:"shelf-display-product-content-price-button",children:[s("div",{className:"mb-2 flex flex-wrap items-center",children:W?W(e,{price:F,basePrice:C,discount:B,discountAmount:M,variant:o,coupon:w,isSoldOut:y,isShowOriginalPrice:D}):y?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:le?.soldOutText}):u(Ce,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&F||""}),X?X(e,{price:F,basePrice:C,discount:B,discountAmount:M,isShowOriginalPrice:D}):C&&D&&s("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&C||""})]})}),!W&&ke?.(e,o,{isShowOriginalPrice:D}),u("div",{className:_("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?s(ye,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:k,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(ye,{disabled:y&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),f={...O?{color:O}:{},...j?{backgroundColor:j,backgroundImage:"none"}:{},...O||j?{outline:"none"}:{}},g={...b?{color:b}:{},...Q?{backgroundColor:Q,backgroundImage:"none"}:{},...b||Q?{outlineColor:b}:{}},L=()=>u("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[I&&me&&s(Te,{className:"shelf-prices-tag",variant:"fill",style:f,children:me||""}),ie&&n?.length>0&&n?.map?.((i,m)=>s(Te,{className:"shelf-items-tag",variant:"outline",style:g,children:i},m))]}),h=e?.custom_bg_image,V=e?.custom_theme;return s("div",{ref:ae,className:_("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",h?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":V==="dark","aiui-light":V==="light"}),style:h?{backgroundImage:`url(${h})`}:void 0,children:G?u(Ce,{children:[s(Se,{source:R,alt:fe,className:_("absolute inset-0 size-full",{"opacity-0":h}),imgClassName:"size-full object-cover"}),u("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[s(L,{}),c()]})]}):u("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[s(L,{}),u("div",{className:_("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":h}),children:[s("a",{"aria-label":q,target:t?.target,href:De(`${T==="us"||!T?"":`/${T}`}/products/${e?.handle}?variant=${N}`,v(he,xe)),onClick:()=>{Le({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},className:"block size-full",children:s(Se,{source:R,alt:fe,className:"size-full",imgClassName:"size-full object-cover"})}),s(Ee,{items:e?.socialEndorsements})]}),c()]})},e?.id||e?.handle)},Ze=({data:e,configuration:t})=>{const{buildRef:v}=Fe(),{itemShape:G,itemLength:J,metafields:K,isShowShortTitle:re,formatPrice:ie,renderOriginalPrice:D,renderPriceLabel:be,renderPrice:I}=t||{},{discounts:O,discountsCopy:j}=K||{},{locale:b="us",copyWriting:Q,currencyDisplay:oe}=Be(),[X,ke]=E([]),W=ze(null),[T,le]=E(!1),[Y,Z]=E(!1),ne=(r,l,a,c)=>{const{primaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:V}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}V?.primaryButton?.(r,l+1,a,c)},ae=(r,l,a,c)=>{const{secondaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:V}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}V?.secondaryButton?.(r,l+1,a,c)},n=ge(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ce=n?.id?.split?.("/")||[],me=ce?.[ce?.length-1],$=!n?.availableForSale||n?.price?.amount===ve||n?.price===ve,pe=t?.isShowTag,z=t?.isShowOriginalPrice,k=n?.coupons?.[0],H=!!(z&&k),de=e?.price?.currencyCode||"USD",we=ge(()=>Pe({locale:b,amount:H?k?.variant_price4wscode:n?.price,baseAmount:H?n?.price:0,currencyCode:de,currencyDisplay:oe,customFormatPrice:ie}),[de,b,H,k?.variant_price4wscode,n,ie]),{price:o,basePrice:A,discount:N,discountAmount:y}=we,{imageUrl:w,altText:ue}=Me(e),U=e?.custom_name||e?.title,F=re&&n?.metafields?.infos?.page_short_title||U,C=e?.custom_description||e?.description;$e(W,{componentType:he,componentName:xe,componentTitle:U,componentDescription:C,position:t?.index+1});const B=async()=>{if(!T&&!e?.custom_primary_link){le(!0);try{await ne(e,t?.index,t,k)}finally{le(!1)}}},M=async()=>{if(!Y&&!e?.custom_secondary_link){Z(!0);try{await ae(e,t?.index,t,k)}finally{Z(!1)}}},R=()=>J>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},fe=()=>J>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",q=()=>{if(k?.value_type==="fixed_amount"){const r=y||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,c,f]=l;let g=c;return c.endsWith(".00")?g=c.replace(/\.00$/,""):c.endsWith(",00")&&(g=c.replace(/,00$/,"")),`${a}${g}${f}`}return r}return N||""};Ae(()=>{let r=[];if(N||y){const a=`${q()} ${O?.off||j?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,N?1:2)||[];ke(r.concat(l))},[e?.tags,N,y,O?.off,j?.off]);const P=e?.custom_bg_image,ee=e?.custom_theme;return s("div",{ref:W,className:_(R().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",P?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":ee==="dark","aiui-light":ee==="light"}),style:P?{backgroundImage:`url(${P})`}:void 0,children:u("div",{className:_(fe(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:_(R().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":P}),children:s("a",{"aria-label":U,target:t?.target,href:De(`${b==="us"||!b?"":`/${b}`}/products/${e?.handle}?variant=${me}`,v(he,xe)),onClick:()=>{Le({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:s(Se,{source:w,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),u("div",{className:_("flex flex-col items-start justify-center",R().boxItem),children:[pe&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:X?.length>0&&X?.map?.((r,l)=>s(Te,{className:"shelf-items-tag",variant:"fill",children:r},l))}),F?s(Ie,{as:"h3",title:F||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:F||""}):null,C?s(Ne,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:C||""}):null,s("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:I?I(e,{price:o,basePrice:A,discount:N,discountAmount:y,variant:n,coupon:k,isSoldOut:$,isShowOriginalPrice:z}):$?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:Q?.soldOutText}):u(Ce,{children:[s("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),D?D(e,{price:o,basePrice:A,discount:N,discountAmount:y,isShowOriginalPrice:z}):A&&s("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&A||""})]})}),!I&&be?.(e,n,{isShowOriginalPrice:z}),u("div",{className:_("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!$?s(ye,{disabled:$&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:M,loading:Y,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(ye,{disabled:$&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:B,loading:T,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Ze as ShelfDisplayHorizontalItem,Ye as ShelfDisplayWrapItem,Me as getProductImage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as G,jsx as t,jsxs as o}from"react/jsx-runtime";import c,{useRef as d,useImperativeHandle as M}from"react";import{Button as k,Heading as p,Picture as y,Text as N}from"../../components/index.js";import{cn as i,getLocalizedPath as T}from"../../helpers/utils.js";import{withLayout as I}from"../../shared/Styles.js";import{useExposure as U}from"../../hooks/useExposure.js";import{useAiuiContext as $}from"../AiuiProvider/index.js";import{useTracking as O}from"../../hooks/useTracking.js";import{trackUrlRef as V}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as u}from"../../shared/track.js";import{Swiper as S,SwiperSlide as C}from"swiper/react";import{Navigation as W,EffectCoverflow as A}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import"swiper/css/pagination";import"swiper/css/effect-coverflow";const m="carousel",f="three_d_carousel",q=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),F=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),L=c.forwardRef(({data:z,className:E},R)=>{const{title:h,items:s=[],titleTag:D}=z,v=s.length<4?[...s,...s]:s,r=d(null),n=d(null),x=d(null),[P,j]=c.useState(180),{locale:w="us"}=$(),{buildRef:B}=O(),b=e=>e?V(T(e,w),B(m,f)):T("",w),g=e=>e.buttonLink?{"data-headless-type-name":`${m}#${f}`,"data-headless-title-desc-button":`${u(e.title)}#${u(e.description)}#${u(e.buttonText)}`,"data-headless-nav-position":`#${s.indexOf(e)+1}`}:{};return U(n,{componentType:m,componentName:f,componentTitle:h}),M(R,()=>n.current),c.useEffect(()=>{const e=x.current;if(!e)return;const l=()=>{const H=e.offsetWidth,_=Math.round(H*.125);j(_),r.current?.params?.coverflowEffect&&(r.current.params.coverflowEffect.stretch=_,r.current.update())};l();const a=new ResizeObserver(l);return a.observe(e),()=>a.disconnect()},[]),o("section",{ref:n,"data-ui-component-id":"ThreeDCarousel",className:i("three-d-carousel laptop:overflow-hidden w-full overflow-visible",E),children:[t(p,{as:D??"h2",size:4,html:h,className:"three-d-carousel__title laptop:text-center text-left"}),o("div",{ref:x,className:"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full",children:[t(S,{onSwiper:e=>r.current=e,centeredSlides:!0,initialSlide:0,loop:!0,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[A,W],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:P,depth:300,modifier:1,slideShadows:!0},children:v.map((e,l)=>t(C,{className:"three-d-carousel__slide relative !w-1/2 cursor-grab overflow-hidden opacity-0 [.swiper-slide-active&]:opacity-100 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100",children:({isActive:a})=>o(G,{children:[t(y,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:i("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:a?"":"brightness(50%) contrast(120%)"}}),o("div",{className:i("three-d-carousel__image-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 box-border flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark","opacity-0":!a}),children:[t(p,{as:"h2",size:2,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&t("a",{href:b(e.buttonLink),...g(e),className:"three-d-carousel__image-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},l))}),o("div",{className:"three-d-carousel__nav-controls laptop:px-[64px] desktop:px-[140px] lg-desktop:px-[200px] absolute left-1/2 top-1/2 z-20 flex w-full -translate-x-1/2 -translate-y-1/2 justify-between",children:[t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev",onClick:()=>r.current?.slidePrev(),"aria-label":"Previous slide",children:t(q,{})}),t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next",onClick:()=>r.current?.slideNext(),"aria-label":"Next slide",children:t(F,{})})]})]}),t("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:t(S,{loop:!0,loopAdditionalSlides:1,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:v.map((e,l)=>o(C,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[t(y,{source:e.mobImageUrl?.url||e.imageUrl?.url||"",alt:e.mobImageUrl?.alt||e.title,className:"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden",imgClassName:"h-full object-cover"}),o("div",{className:i("three-d-carousel__image-mobile-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark"}),children:[t(p,{as:"h2",size:2,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&t("a",{href:b(e.buttonLink),...g(e),className:"three-d-carousel__image-mobile-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},l))})})]})});L.displayName="ThreeDCarousel";var ce=I(L,{style:"overflow: hidden;"});export{ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as
|
|
1
|
+
"use client";import{jsx as o,jsxs as M}from"react/jsx-runtime";import st,{useEffect as lt,useRef as x,useImperativeHandle as at,useState as ct}from"react";import{gsap as H}from"gsap";import{SplitText as $}from"gsap/dist/SplitText";import{ScrollTrigger as B}from"gsap/dist/ScrollTrigger";import{cn as i,getLocalizedPath as dt}from"../../helpers/utils.js";import{Heading as ut,Text as I,Countdown as pt}from"../../components/index.js";import{withLayout as mt}from"../../shared/Styles.js";import{useAiuiContext as ft}from"../AiuiProvider/index.js";import{useExposure as gt}from"../../hooks/useExposure.js";import{useTracking as ht}from"../../hooks/useTracking.js";import{convertLexicalToPlaintext as xt}from"@payloadcms/richtext-lexical/plaintext";import{trackUrlRef as wt}from"../../shared/trackUrlRef.js";import{useInView as bt}from"react-intersection-observer";const D="link",E="title";function yt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const s=t?.root?.children;return!Array.isArray(s)||s.length===0?!1:s.some(n=>{const r=n?.children;return!Array.isArray(r)||r.length===0?!1:r.some(l=>typeof l?.text=="string"&&l.text.length>0)})}function m(t){if(!t)return"";if(typeof t=="string")return t;try{return xt({data:t})||""}catch{return""}}const Tt="text-info-primary desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",j=({data:t,onClick:s,className:n})=>{const{extensions:r,title:l,caption:f,subtitle:w,align:g}=t,{locale:b="us"}=ft(),{buildRef:c}=ht();if(!r?.textLink)return null;const h=r?.link?wt(dt(r.link,b),c(D,E)):void 0;return M("a",{className:i("text-info-primary hover:text-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"justify-center mt-4":g==="center"},{"mt-1 laptop:mt-0":g==="left"},n),...h?{href:h}:{},"data-headless-type-name":`${D}#${E}`,"data-headless-title-desc-button":`${m(f||l)}#${m(w)}#${m(r.textLink)}`,...s?{onClick:s}:{},children:[o("div",{className:"truncate whitespace-nowrap",children:r?.textLink}),o("div",{className:"lg-desktop:size-5 size-4",children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:"currentColor",className:"transition-all duration-[0.4s]"})})})]})},O=st.forwardRef(({data:t,className:s,classNames:n,as:r="h2",weight:l="bold",onButtonClick:f,id:w,...g},b)=>{const{title:c,titleSize:h=4,caption:y,subtitle:T,content:z,countdown:e,showCountdown:U=!1,theme:P="light",extensions:R,align:d="left"}=t,v=x(null),u=x(null),a=x(null),p=x(null),[_,W]=ct(!0),{ref:Z,inView:N}=bt();at(b,()=>v.current),gt(v,{componentType:D,componentName:E,componentTitle:m(y||c),componentDescription:m(T)});const q=()=>{W(!1)},F=e?.targetDateTime||e?.targetDate||"",G=e?.targetDateTime_tz,J=e?.labels?{day:e.labels.days||"Day",hour:e.labels.hours||"Hours",minute:e.labels.minutes||"Mins",second:e.labels.seconds||"Secs"}:void 0;return lt(()=>{H.registerPlugin($,B);function K(){if(!u.current)return;const Q=u.current?.clientHeight||80;a.current&&a.current.revert(),p.current&&p.current.kill(),a.current=new $(u.current,{type:"words",wordsClass:"word"});const k=a.current.words;H.set(k,{opacity:0}),p.current=B.create({trigger:u.current,start:"bottom bottom-=4%",end:`bottom+=${Q*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:X=>{const Y=X.progress,S=k.length||1,tt=.5,L=1/S,A=L*(1-tt),V=(S-1)*A+L,et=Math.min(1,V>0?Y/V:0);k.forEach((nt,rt)=>{const ot=rt*A,it=L;let C=(et-ot)/it;C=Math.max(0,Math.min(1,C)),H.set(nt,{opacity:C})})}})}return N&&K(),()=>{a.current&&a.current.revert(),p.current&&p.current.kill()}},[N]),M("div",{id:R?.id?R?.id:w,className:i("titleBottom title-box flex items-end justify-between gap-2 pb-6",{"aiui-dark":P==="dark"},s,n?.wrapper),...g,ref:v,children:[M("div",{ref:Z,className:i("flex-1",n?.container,{"text-center":d==="center","text-left":d==="left"}),children:[(y||c)&&o(ut,{ref:u,as:r,size:h,html:y||c,weight:l,className:i("text-info-primary",n?.title)}),T&&o(I,{html:T,as:"div",className:i(Tt,n?.subtitle)}),yt(z)&&o(I,{html:z,as:"div",size:4,className:i("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",n?.content)}),o(j,{data:t,className:i({"laptop:hidden":d==="left"},n?.button),onClick:f}),U&&e&&_&&o(pt,{endDate:F,endDate_tz:G,timeLabels:J,showDays:e?.showDays,showHours:e?.showHours,showMinutes:e?.showMinutes,showSeconds:e?.showSeconds,theme:P,onExpire:q,hideWhenExpired:!0,align:d==="center"?"center":"left",className:i("mt-4",n?.countdown)})]}),o(j,{data:t,className:i("hidden",{"laptop:flex":d==="left"},n?.button),onClick:f})]})});O.displayName="Title";var At=mt(O);export{At as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as b,jsx as o}from"react/jsx-runtime";import i from"react";import{cn as l}from"../helpers/utils.js";import{Slot as u}from"@radix-ui/react-slot";const N=({children:e})=>o(b,{children:e}),d=i.forwardRef(({...e},t)=>{const{asChild:p,children:n,className:s,childClassName:a,spaceY:c="none",spaceTop:r="none",spaceBottom:m="none",...x}=e,C=p?u:"div",y={default:"tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",none:""},R={default:"tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",none:""},g={default:"tablet:pb-[80px] laptop:pb-[96px] desktop:pb-[112px] lg-desktop:pb-[128px] pb-[64px]",none:""};return o(C,{...x,ref:t,className:l(s,"ipc_container","relative z-10 w-full"),children:o("div",{className:l("lg-desktop:max-w-full px-grid mx-auto size-full",a,y?.[c]||c,R?.[r]||r,g?.[m]||m),children:n})})});d.displayName="Section";const f=i.forwardRef(({...e},t)=>{const{children:p,mode:n="section"}=e,a={section:d,fragment:N}[n];return o(a,{...e,ref:t,children:p})});f.displayName="Container";export{f as Container};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{clsx as u}from"clsx";import{extendTailwindMerge as l}from"tailwind-merge";const f=l({extend:{theme:{borderRadius:["btn","box","box-small","card","tabs","sidebar-shelf","image-text"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function
|
|
1
|
+
import{clsx as u}from"clsx";import{extendTailwindMerge as l}from"tailwind-merge";const f=l({extend:{theme:{spacing:["grid"],borderRadius:["btn","box","box-small","card","tabs","sidebar-shelf","image-text"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function $(...t){return f(u(t))}function a(){}function b(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const p=t=>t?.replace(/\s+/g,"-"),g=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),y=(t,r,e="{",n="}")=>{if(!t||!r||Object.keys(r).length===0)return t;const s=g(e),o=g(n),i=new RegExp(`${s}([a-zA-Z0-9_-]+)${o}`,"g");return t.replace(i,(x,c)=>r[c]!==void 0?r[c]:x)},w=(t,r)=>{try{if(!t||!r)return t;const e=g(r),n=new RegExp(e,"gi");return t.replace(n,s=>`<span class='text-brand-0 font-bold'>${s}</span>`)}catch(e){return console.error("highlightSearchWord error:",e),t}},R=(t,r,e)=>{if(!t)return t;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("#"))return e?t.includes("?")?`${t}&${e}`:`${t}?${e}`:t;const n=t.split("/").filter(Boolean);if(n.length===0){const i=r==="us"?"/":`/${r}`;return e?`${i}?${e}`:i}if(n[0]===r){const i=`/${n.join("/")}`;return e?`${i}?${e}`:i}const o=`${r==="us"?"":`/${r}`}/${n.join("/")}`;return e?`${o}?${e}`:o};export{b as atobID,$ as cn,R as getLocalizedPath,w as highlightSearchWord,a as noop,y as replaceTemplate,p as spaceToHyphen};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical';
|
|
1
2
|
export declare const gaTrack: (data: any) => "" | undefined;
|
|
2
3
|
/**
|
|
3
4
|
* GA4 `select_item` 事件商品项
|
|
@@ -30,12 +31,17 @@ export interface TrackSelectItemOptions {
|
|
|
30
31
|
export declare const trackSelectItem: ({ pageGroup, currency, itemListId, itemListName, position, items, }: TrackSelectItemOptions) => void;
|
|
31
32
|
/** 组件类型:图片 image / 视频 video(埋点规范) */
|
|
32
33
|
export type ComponentMediaType = 'image' | 'video';
|
|
34
|
+
/** 埋点文本入参:纯字符串,或 CMS 返回的 Lexical 富文本对象 */
|
|
35
|
+
export type TrackingTextInput = string | SerializedEditorState | null | undefined;
|
|
33
36
|
/**
|
|
34
37
|
* 埋点文本归一化:CMS 富文本标题常携带 `<br>` 等 HTML 标签,
|
|
35
38
|
* 直接上报会污染 GA4 维度(如 component_title 出现 `<br>`)。
|
|
36
39
|
* 此函数去标签、还原常见实体并压缩空白。
|
|
40
|
+
*
|
|
41
|
+
* 入参也可以是 Lexical 富文本对象(CMS 的标题、描述字段),会先转成纯文本再归一化;
|
|
42
|
+
* 转换失败时返回空字符串,不抛错,避免埋点异常拖垮组件渲染。
|
|
37
43
|
*/
|
|
38
|
-
export declare const toPlainTrackingText: (value?:
|
|
44
|
+
export declare const toPlainTrackingText: (value?: TrackingTextInput) => string;
|
|
39
45
|
/** 按当前渲染的创意是否为视频解析 component_type。
|
|
40
46
|
* 埋点规范:图片传 image、视频传 video。
|
|
41
47
|
*/
|
|
@@ -48,12 +54,12 @@ export interface ClickTrackingPropsInput {
|
|
|
48
54
|
interactive: boolean;
|
|
49
55
|
componentType: ComponentMediaType;
|
|
50
56
|
componentName: string;
|
|
51
|
-
/** 运营配置的创意标题 → component_title */
|
|
52
|
-
title?:
|
|
53
|
-
/** 运营配置的创意描述 → component_description */
|
|
54
|
-
description?:
|
|
55
|
-
/** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name */
|
|
56
|
-
buttonName?:
|
|
57
|
+
/** 运营配置的创意标题 → component_title(可为 Lexical 富文本) */
|
|
58
|
+
title?: TrackingTextInput;
|
|
59
|
+
/** 运营配置的创意描述 → component_description(可为 Lexical 富文本) */
|
|
60
|
+
description?: TrackingTextInput;
|
|
61
|
+
/** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name(可为 Lexical 富文本) */
|
|
62
|
+
buttonName?: TrackingTextInput;
|
|
57
63
|
/** 导航/电梯/锚点文案,与 position 以 `#` 分隔 */
|
|
58
64
|
navigation?: string;
|
|
59
65
|
/** 同一位置内的组件顺序 / 轮播帧序号(1-based) → position */
|
package/dist/esm/shared/track.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const g=e=>{if(typeof window>"u")return"";window.dataLayer=window.dataLayer||[];try{window.dataLayer?.push({event_parameters:null}),window.dataLayer?.push(e||{})}catch(t){console.log("pageGTMEvent error",t)}},
|
|
1
|
+
import{convertLexicalToPlaintext as l}from"@payloadcms/richtext-lexical/plaintext";const g=e=>{if(typeof window>"u")return"";window.dataLayer=window.dataLayer||[];try{window.dataLayer?.push({event_parameters:null}),window.dataLayer?.push(e||{})}catch(t){console.log("pageGTMEvent error",t)}},y=({pageGroup:e="Home Page",currency:t="USD",itemListId:n,itemListName:i,position:a,items:r})=>{g({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:e,position:a,item_list_id:n,item_list_name:i,currency:t,items:r.map(p=>({...p,item_list_id:n,item_list_name:i}))}})},u=/<[^>]*>/g,T={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"},o=e=>{if(!e)return"";let t;if(typeof e=="string")t=e;else try{t=l({data:e})||""}catch{return""}return t.replace(u," ").replace(/&[a-z#0-9]+;/gi,n=>T[n.toLowerCase()]??" ").replace(/\s+/g," ").trim()},k=e=>e?"video":"image",x=({interactive:e,componentType:t,componentName:n,title:i,description:a,buttonName:r,navigation:p="",position:m=1,creativeId:s,sku:c})=>{if(!e)return{};const d=`${o(i)}#${o(a)}${r===void 0?"":`#${o(r)}`}`;return{"data-headless-type-name":`${t}#${n}`,"data-headless-title-desc-button":d,"data-headless-nav-position":`${p}#${m}`,...s?{"data-headless-creative-id":s}:{},...c?{"data-headless-sku":c}:{}}},v=({pageGroup:e="Home Page",componentType:t,componentName:n,position:i=1,buttonName:a,componentTitle:r,componentDescription:p,creativeId:m,sku:s,navigation:c=""})=>{g({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:e,component_type:t,component_name:n,position:i,creative_id:m||"",button_name:o(a),component_title:o(r),component_description:o(p),SKU:s||"",navigation:c}})};export{x as buildClickTrackingProps,g as gaTrack,k as resolveComponentMediaType,o as toPlainTrackingText,v as trackComponentClick,y as trackSelectItem};
|
package/dist/tokens/base.css
CHANGED
|
@@ -117,6 +117,54 @@
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
|
|
120
|
+
:root {
|
|
121
|
+
--grid-margin: 16px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@media (min-width: 768px) {
|
|
125
|
+
:root {
|
|
126
|
+
--grid-margin: 32px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (min-width: 1025px) {
|
|
131
|
+
:root {
|
|
132
|
+
--grid-margin: 64px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@media (min-width: 1920px) {
|
|
137
|
+
:root {
|
|
138
|
+
--grid-margin: calc(50% - 832px);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* 默认是阶梯式:16 / 32 / 64px,1440 至 1919px 固定 64px,1920px 起居中 1664px。
|
|
143
|
+
流式需要主动开启:在祖先元素或 <html> 上声明 data-grid="fluid"(或 .grid-fluid),
|
|
144
|
+
其内的 px-grid 在 1440 至 1920px 之间从 64px 线性过渡到 128px。
|
|
145
|
+
data-grid="legacy"(或 .grid-legacy)用于在流式范围内的局部区域切回阶梯式。
|
|
146
|
+
选择器优先级相同,靠书写顺序生效,顺序不可调换。 */
|
|
147
|
+
@media (min-width: 1440px) {
|
|
148
|
+
[data-grid='fluid'],
|
|
149
|
+
.grid-fluid {
|
|
150
|
+
--grid-margin: clamp(64px, calc(64px + (100% - 1440px) * 64 / 480), 128px);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-grid='legacy'],
|
|
154
|
+
.grid-legacy {
|
|
155
|
+
--grid-margin: 64px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (min-width: 1920px) {
|
|
160
|
+
[data-grid='fluid'],
|
|
161
|
+
.grid-fluid,
|
|
162
|
+
[data-grid='legacy'],
|
|
163
|
+
.grid-legacy {
|
|
164
|
+
--grid-margin: calc(50% - 832px);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
120
168
|
@media (min-width: 1024px) {
|
|
121
169
|
:root {
|
|
122
170
|
--card-radius: 16px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anker-in/headless-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.86",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
"default": "./dist/esm/biz-components/index.js"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
"./chat": {
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/cjs/biz-components/Chat/exports.d.ts",
|
|
33
|
+
"default": "./dist/cjs/biz-components/Chat/exports.js"
|
|
34
|
+
},
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/esm/biz-components/Chat/exports.d.ts",
|
|
37
|
+
"default": "./dist/esm/biz-components/Chat/exports.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./chat.css": "./src/biz-components/Chat/styles/chat.css",
|
|
30
41
|
"./cpn": {
|
|
31
42
|
"require": {
|
|
32
43
|
"types": "./dist/cjs/cpn-components/index.d.ts",
|
|
@@ -63,6 +74,7 @@
|
|
|
63
74
|
"description": "",
|
|
64
75
|
"files": [
|
|
65
76
|
"dist/**",
|
|
77
|
+
"src/biz-components/Chat/styles/**",
|
|
66
78
|
"static/**",
|
|
67
79
|
"*.css",
|
|
68
80
|
"README.md",
|
|
@@ -70,7 +82,10 @@
|
|
|
70
82
|
"tailwind.config.js",
|
|
71
83
|
"tailwind.config.d.ts"
|
|
72
84
|
],
|
|
73
|
-
"sideEffects":
|
|
85
|
+
"sideEffects": [
|
|
86
|
+
"*.css",
|
|
87
|
+
"**/*.css"
|
|
88
|
+
],
|
|
74
89
|
"keywords": [],
|
|
75
90
|
"author": "",
|
|
76
91
|
"license": "GPLv3",
|
|
@@ -78,6 +93,9 @@
|
|
|
78
93
|
"@babel/preset-env": "^7.24.6",
|
|
79
94
|
"@babel/preset-react": "^7.24.6",
|
|
80
95
|
"@babel/preset-typescript": "^7.24.6",
|
|
96
|
+
"@copilotkit/react-core": "1.1.2",
|
|
97
|
+
"@copilotkit/react-ui": "1.1.2",
|
|
98
|
+
"@copilotkit/runtime-client-gql": "1.1.2",
|
|
81
99
|
"@hyrious/esbuild-plugin-commonjs": "^0.2.6",
|
|
82
100
|
"@testing-library/jest-dom": "^6.4.6",
|
|
83
101
|
"@testing-library/react": "^14.3.1",
|
|
@@ -102,7 +120,10 @@
|
|
|
102
120
|
"postcss-import": "^16.1.0",
|
|
103
121
|
"postcss-prefix-selector": "^2.1.1",
|
|
104
122
|
"prettier": "^3.5.3",
|
|
123
|
+
"react-markdown": "^8.0.7",
|
|
105
124
|
"react-test-renderer": "^18.3.1",
|
|
125
|
+
"remark-gfm": "^3.0.1",
|
|
126
|
+
"remark-math": "^5.1.1",
|
|
106
127
|
"stylelint": "^16.6.0"
|
|
107
128
|
},
|
|
108
129
|
"dependencies": {
|
|
@@ -148,13 +169,39 @@
|
|
|
148
169
|
"zod": "^4.3.5"
|
|
149
170
|
},
|
|
150
171
|
"peerDependencies": {
|
|
172
|
+
"@copilotkit/react-core": "1.1.2",
|
|
173
|
+
"@copilotkit/react-ui": "1.1.2",
|
|
174
|
+
"@copilotkit/runtime-client-gql": "1.1.2",
|
|
151
175
|
"@gsap/react": "^2.1.2",
|
|
152
|
-
"gsap": "^3.13.0"
|
|
176
|
+
"gsap": "^3.13.0",
|
|
177
|
+
"react-markdown": "^8.0.7",
|
|
178
|
+
"remark-gfm": "^3.0.1",
|
|
179
|
+
"remark-math": "^5.1.1"
|
|
153
180
|
},
|
|
154
181
|
"publishConfig": {
|
|
155
182
|
"access": "public",
|
|
156
183
|
"registry": "https://registry.npmjs.org/"
|
|
157
184
|
},
|
|
185
|
+
"peerDependenciesMeta": {
|
|
186
|
+
"@copilotkit/react-core": {
|
|
187
|
+
"optional": true
|
|
188
|
+
},
|
|
189
|
+
"@copilotkit/react-ui": {
|
|
190
|
+
"optional": true
|
|
191
|
+
},
|
|
192
|
+
"@copilotkit/runtime-client-gql": {
|
|
193
|
+
"optional": true
|
|
194
|
+
},
|
|
195
|
+
"react-markdown": {
|
|
196
|
+
"optional": true
|
|
197
|
+
},
|
|
198
|
+
"remark-gfm": {
|
|
199
|
+
"optional": true
|
|
200
|
+
},
|
|
201
|
+
"remark-math": {
|
|
202
|
+
"optional": true
|
|
203
|
+
}
|
|
204
|
+
},
|
|
158
205
|
"scripts": {
|
|
159
206
|
"dev": "pnpm run dev:css & pnpm run dev:js:esm & pnpm run dev:js:cjs & pnpm run dev:js:esm:types & pnpm run dev:js:cjs:types",
|
|
160
207
|
"dev:js:cjs": "node esbuild-cjs.mjs watch=true",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import "./css/colors.css";
|
|
2
|
+
@import "./css/popup.css";
|
|
3
|
+
@import "./css/sidebar.css";
|
|
4
|
+
@import "./css/button.css";
|
|
5
|
+
@import "./css/header.css";
|
|
6
|
+
@import "./css/input.css";
|
|
7
|
+
@import "./css/messages.css";
|
|
8
|
+
@import "./css/window.css";
|
|
9
|
+
@import "./css/animations.css";
|
|
10
|
+
@import "./css/response.css";
|
|
11
|
+
@import "./css/markdown.css";
|
|
12
|
+
@import "./css/suggestions.css";
|
|
13
|
+
@import "./css/panel.css";
|
|
14
|
+
@import "./css/console.css";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.copilotKitActivityDot1 {
|
|
2
|
+
animation: copilotKitActivityDotsAnimation 1.05s infinite;
|
|
3
|
+
}
|
|
4
|
+
.copilotKitActivityDot2 {
|
|
5
|
+
animation-delay: 0.1s;
|
|
6
|
+
}
|
|
7
|
+
.copilotKitActivityDot3 {
|
|
8
|
+
animation-delay: 0.2s;
|
|
9
|
+
}
|
|
10
|
+
@keyframes copilotKitActivityDotsAnimation {
|
|
11
|
+
0%,
|
|
12
|
+
57.14% {
|
|
13
|
+
animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1);
|
|
14
|
+
transform: translate(0);
|
|
15
|
+
}
|
|
16
|
+
28.57% {
|
|
17
|
+
animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33);
|
|
18
|
+
transform: translateY(-6px);
|
|
19
|
+
}
|
|
20
|
+
100% {
|
|
21
|
+
transform: translate(0);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@keyframes copilotKitSpinAnimation {
|
|
26
|
+
to {
|
|
27
|
+
transform: rotate(360deg);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes copilotKitPulseAnimation {
|
|
32
|
+
50% {
|
|
33
|
+
opacity: 0.5;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.copilotKitButton {
|
|
2
|
+
width: 3.5rem;
|
|
3
|
+
height: 3.5rem;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
border-radius: 50%;
|
|
8
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
9
|
+
outline: none;
|
|
10
|
+
position: relative;
|
|
11
|
+
transform: scale(1);
|
|
12
|
+
transition: transform 200ms;
|
|
13
|
+
background-color: var(--copilot-kit-primary-color);
|
|
14
|
+
color: var(--copilot-kit-contrast-color);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.copilotKitButton:hover {
|
|
19
|
+
transform: scale(1.1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.copilotKitButton:active {
|
|
23
|
+
transform: scale(0.75);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.copilotKitButtonIcon {
|
|
27
|
+
transition:
|
|
28
|
+
opacity 100ms,
|
|
29
|
+
transform 300ms;
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 50%;
|
|
32
|
+
left: 50%;
|
|
33
|
+
transform: translate(-50%, -50%);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* State when the chat is open */
|
|
37
|
+
.copilotKitButton.open .copilotKitButtonIconOpen {
|
|
38
|
+
transform: translate(-50%, -50%) scale(0) rotate(90deg);
|
|
39
|
+
opacity: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.copilotKitButton.open .copilotKitButtonIconClose {
|
|
43
|
+
transform: translate(-50%, -50%) scale(1) rotate(0deg);
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* State when the chat is closed */
|
|
48
|
+
.copilotKitButton:not(.open) .copilotKitButtonIconOpen {
|
|
49
|
+
transform: translate(-50%, -50%) scale(1) rotate(0deg);
|
|
50
|
+
opacity: 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.copilotKitButton:not(.open) .copilotKitButtonIconClose {
|
|
54
|
+
transform: translate(-50%, -50%) scale(0) rotate(-90deg);
|
|
55
|
+
opacity: 0;
|
|
56
|
+
}
|