@funhub/platform 0.2.34 → 0.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{trackAdClick as e,trackAdImpression as t,trackAdvertising as n}from"../../../../../utils/tracking.mjs";import{Button as r}from"../../../../ui/button.mjs";import{Image as i}from"../../../../ui/image.mjs";import{Box as a}from"../../../../ui/box.mjs";import{Dialog as o,DialogContent as s}from"../../../../ui/dialog.mjs";import c from"../../../../ui/link.mjs";import l from"../../../../common/video-player/index.mjs";import{adaptPopupAdMaterials as u,hasMatchedAds as d}from"../ad-match.mjs";import{useAdProvider as f}from"../ad-provider.mjs";import{resolveAdVideoSource as p}from"../../../../common/video-player/ad-video-source.mjs";import{useEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";const b=[{id:`popup-ad-1`,title:`弹窗广告标题`,jumpUrl:`/search`,materialUrl:`/static/components-resource/banner.png`,desc:`这里是弹窗广告描述`}];function x(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function S(e,t){return Number(e?.advertiseType)===2&&!!t}function C(e){return e?.resolution||`1080x1920`}function w({items:w,mode:T=`renderer`,pageKey:E=`home`,pageName:D=`首页`}){let O=f(),k=h(()=>d(O?.matchData)?u(O?.matchData):T===`editor`?x(w,b):w??[],[O?.matchData,T,w]),[A,j]=_(0),[M,N]=_(!1),P=g(null),F=O?.matchData?.advertiseLocationCode||`home_popup`;m(()=>{j(0)},[k]),m(()=>{N(!1)},[A,k]),m(()=>()=>{P.current&&window.clearTimeout(P.current)},[]);let I=k[A],L=h(()=>p(I?.videoUrl),[I?.videoUrl]),R=S(I,L.playerUrl);m(()=>{I?.id&&t({page_key:E,page_name:D,ad_slot_key:F,ad_slot_name:`弹窗广告`,ad_id:I.id,ad_type:`pop-ups-600800`})},[I?.id,F,E,D]);function z(){j(e=>e+1)}function B(){M||(N(!0),P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{P.current=null,z()},260))}function V(e){e||B()}function H(){I?.id&&e({page_key:E,page_name:D,ad_slot_key:F,ad_slot_name:`弹窗广告`,ad_id:I.id,ad_type:`pop-ups-600800`})}function U(){I?.id&&(n({event_type:`close`,advertising_key:F,advertising_name:`弹窗广告`,advertising_id:I.id}),B())}return I?v(o,{open:!0,onOpenChange:V,disablePointerDismissal:!0,children:y(s,{showCloseButton:!1,className:`w-[320px] max-w-[calc(100vw-32px)] border-none bg-transparent p-0 shadow-none`,children:[y(a,{className:`flex flex-col items-center gap-[24px]`,style:{animation:M?`funhub-popup-ad-exit 260ms cubic-bezier(0.4, 0, 0.2, 1) both`:`funhub-popup-ad-enter 420ms cubic-bezier(0.2, 0.9, 0.2, 1) both, funhub-popup-ad-float 3.2s ease-in-out 420ms infinite`,transformOrigin:`center bottom`},children:[v(a,{className:`w-full overflow-hidden rounded-[20px] bg-[#434343]`,style:{boxShadow:`0 18px 48px rgba(0, 0, 0, 0.26)`},onClick:H,children:R?v(a,{className:`w-full bg-black`,children:y(a,{className:`relative
|
|
2
|
+
"use client";import{trackAdClick as e,trackAdImpression as t,trackAdvertising as n}from"../../../../../utils/tracking.mjs";import{Button as r}from"../../../../ui/button.mjs";import{Image as i}from"../../../../ui/image.mjs";import{Box as a}from"../../../../ui/box.mjs";import{Dialog as o,DialogContent as s}from"../../../../ui/dialog.mjs";import c from"../../../../ui/link.mjs";import l from"../../../../common/video-player/index.mjs";import{adaptPopupAdMaterials as u,hasMatchedAds as d}from"../ad-match.mjs";import{useAdProvider as f}from"../ad-provider.mjs";import{resolveAdVideoSource as p}from"../../../../common/video-player/ad-video-source.mjs";import{useEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";const b=[{id:`popup-ad-1`,title:`弹窗广告标题`,jumpUrl:`/search`,materialUrl:`/static/components-resource/banner.png`,desc:`这里是弹窗广告描述`}];function x(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function S(e,t){return Number(e?.advertiseType)===2&&!!t}function C(e){return e?.resolution||`1080x1920`}function w({items:w,mode:T=`renderer`,pageKey:E=`home`,pageName:D=`首页`}){let O=f(),k=h(()=>d(O?.matchData)?u(O?.matchData):T===`editor`?x(w,b):w??[],[O?.matchData,T,w]),[A,j]=_(0),[M,N]=_(!1),P=g(null),F=O?.matchData?.advertiseLocationCode||`home_popup`;m(()=>{j(0)},[k]),m(()=>{N(!1)},[A,k]),m(()=>()=>{P.current&&window.clearTimeout(P.current)},[]);let I=k[A],L=h(()=>p(I?.videoUrl),[I?.videoUrl]),R=S(I,L.playerUrl);m(()=>{I?.id&&t({page_key:E,page_name:D,ad_slot_key:F,ad_slot_name:`弹窗广告`,ad_id:I.id,ad_type:`pop-ups-600800`})},[I?.id,F,E,D]);function z(){j(e=>e+1)}function B(){M||(N(!0),P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{P.current=null,z()},260))}function V(e){e||B()}function H(){I?.id&&e({page_key:E,page_name:D,ad_slot_key:F,ad_slot_name:`弹窗广告`,ad_id:I.id,ad_type:`pop-ups-600800`})}function U(){I?.id&&(n({event_type:`close`,advertising_key:F,advertising_name:`弹窗广告`,advertising_id:I.id}),B())}return I?v(o,{open:!0,onOpenChange:V,disablePointerDismissal:!0,children:y(s,{showCloseButton:!1,className:`w-[320px] max-w-[calc(100vw-32px)] border-none bg-transparent p-0 shadow-none`,children:[y(a,{className:`flex flex-col items-center gap-[24px]`,style:{animation:M?`funhub-popup-ad-exit 260ms cubic-bezier(0.4, 0, 0.2, 1) both`:`funhub-popup-ad-enter 420ms cubic-bezier(0.2, 0.9, 0.2, 1) both, funhub-popup-ad-float 3.2s ease-in-out 420ms infinite`,transformOrigin:`center bottom`},children:[v(a,{className:`w-full overflow-hidden rounded-[20px] bg-[#434343]`,style:{boxShadow:`0 18px 48px rgba(0, 0, 0, 0.26)`},onClick:H,children:R?v(a,{className:`w-full bg-black`,children:y(a,{className:`relative w-full cursor-pointer overflow-hidden bg-black`,children:[v(l,{plyerId:`popup-ad-${I.id}`,resolution:C(I),poster:I.materialUrl||``,videoUrl:L.playerUrl,mergeConfig:{fitVideoSize:`fixWidth`,autoplayMuted:!0,controls:!1,loop:!0}}),v(c,{href:I.jumpUrl,"aria-label":I.title||`跳转广告详情`,className:`absolute inset-0 z-10 block`,children:v(`span`,{className:`sr-only`,children:I.title||`跳转广告详情`})})]})}):v(c,{href:I.jumpUrl,className:`block w-full overflow-hidden bg-[#434343]`,children:v(a,{className:`w-full overflow-hidden bg-[#434343]`,children:v(i,{src:I.materialUrl,alt:I.title||`弹窗广告`,width:1200,height:1600,className:`block w-full h-auto`,unoptimized:!0})})})}),v(r,{type:`button`,"aria-label":`关闭弹窗广告`,variant:`ghost`,size:`icon-lg`,className:`relative h-[54px] w-[54px] rounded-full border-[3px] border-white bg-transparent p-0 text-white hover:bg-white/8`,onClick:U,style:{animation:M?`funhub-popup-ad-close-exit 260ms ease-out both`:`funhub-popup-ad-close-breathe 2.4s ease-in-out 480ms infinite`},children:y(a,{className:`relative h-[24px] w-[24px]`,children:[v(a,{className:`absolute left-1/2 top-1/2 h-[4px] w-full -translate-x-1/2 -translate-y-1/2 rotate-45 rounded-full bg-current`}),v(a,{className:`absolute left-1/2 top-1/2 h-[4px] w-full -translate-x-1/2 -translate-y-1/2 -rotate-45 rounded-full bg-current`})]})})]},I.id),v(`style`,{children:`
|
|
3
3
|
@keyframes funhub-popup-ad-enter {
|
|
4
4
|
0% {
|
|
5
5
|
opacity: 0;
|
|
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
10
|
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
11
|
-
size?: "
|
|
11
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -34,7 +34,7 @@ type EmptyStateProps = React.ComponentProps<'div'> & {
|
|
|
34
34
|
};
|
|
35
35
|
/** emptyMediaVariants 工具定义。 */
|
|
36
36
|
declare const emptyMediaVariants: (props?: ({
|
|
37
|
-
variant?: "
|
|
37
|
+
variant?: "default" | "icon" | null | undefined;
|
|
38
38
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
39
39
|
/** EmptyMedia 组件。 */
|
|
40
40
|
declare function EmptyMedia({
|
|
@@ -82,7 +82,7 @@ declare function Item({
|
|
|
82
82
|
}: ItemProps): React.ReactElement;
|
|
83
83
|
/** itemMediaVariants 工具定义。 */
|
|
84
84
|
declare const itemMediaVariants: (props?: ({
|
|
85
|
-
variant?: "
|
|
85
|
+
variant?: "default" | "icon" | "image" | null | undefined;
|
|
86
86
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
87
87
|
/** ItemMedia 组件。 */
|
|
88
88
|
declare function ItemMedia({
|