@funhub/platform 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/biz.mjs +1 -1
- package/dist/common.d.mts +2 -1
- package/dist/common.mjs +1 -1
- package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-match.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/banner-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/advertisement/floating-ad/client.d.mts +2 -0
- package/dist/components/biz/business/advertisement/floating-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/advertisement/icon-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/icon-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/advertisement/popup-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/popup-ad/client.mjs +2 -2
- package/dist/components/biz/business/advertisement/popup-ad/schema.d.mts +3 -1
- package/dist/components/biz/business/advertisement/text-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/text-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/detail/shared/detail-info-tags.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-info-title.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/shared/video-hero.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/shell.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/tracking.mjs +2 -0
- package/dist/components/biz/business/search-bar/variants/basic-search-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/common/analytics-init/analytics-init.mjs +1 -1
- package/dist/components/common/analytics-init/index.d.mts +2 -1
- package/dist/components/common/analytics-init/sensor-init.d.mts +20 -0
- package/dist/components/common/analytics-init/sensor-init.mjs +2 -0
- package/dist/components/common/list/user-activity-list/user-activity-list-item.d.mts +2 -0
- package/dist/components/common/list/user-activity-list/user-activity-list-item.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list.d.mts +2 -0
- package/dist/components/common/list/user-activity-list/user-activity-list.mjs +1 -1
- package/dist/components/common/list/waterfall-recommend/waterfall-recommend.d.mts +4 -1
- package/dist/components/common/list/waterfall-recommend/waterfall-recommend.mjs +1 -1
- package/dist/components/common/login-dialog/login-dialog.mjs +1 -1
- package/dist/components/common/series-episodes/index.mjs +1 -1
- package/dist/components/common/top-nav-bar/client.mjs +1 -1
- package/dist/components/common/video-player/preroll-skip-button-content.mjs +2 -0
- package/dist/components/common/video-player/video-blind-ad-overlay.mjs +1 -1
- package/dist/components/common/video-player/video-preroll-ad-overlay.mjs +2 -0
- package/dist/components/common/video-player/video-preroll-ad.mjs +1 -1
- package/dist/components/pages/(follow)/_components/header-nav/index.mjs +1 -1
- package/dist/components/pages/collection-add/page.mjs +1 -1
- package/dist/components/pages/collection-create/form.mjs +1 -1
- package/dist/components/pages/collection-detail/detail.mjs +1 -1
- package/dist/components/pages/edit/page.mjs +1 -1
- package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/fullscreen-feed/page.mjs +1 -1
- package/dist/components/pages/home/client.mjs +1 -1
- package/dist/components/pages/home/index.mjs +1 -1
- package/dist/components/pages/login/index.mjs +1 -1
- package/dist/components/pages/login/login-client.mjs +1 -1
- package/dist/components/pages/login/register.mjs +1 -1
- package/dist/components/pages/login/tracking.mjs +2 -0
- package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
- package/dist/components/pages/publish/page-client.mjs +1 -1
- package/dist/components/pages/search/hot-recommend.mjs +1 -1
- package/dist/components/pages/search/page-client.mjs +1 -1
- package/dist/components/pages/search/search-result/search-user.mjs +1 -1
- package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
- package/dist/components/pages/search/search-result/shared.mjs +1 -1
- package/dist/components/pages/search/tracking.mjs +2 -0
- package/dist/components/pages/search-result/page-client.mjs +1 -1
- package/dist/components/pages/search-result/tracking.mjs +2 -0
- package/dist/components/pages/settings/_components/settings.mjs +1 -1
- package/dist/components/pages/user-follow/_components/post-tab.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/empty.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/components/ui/link.mjs +1 -1
- package/dist/utils/tracking.d.mts +231 -0
- package/dist/utils/tracking.mjs +2 -0
- package/dist/utils.d.mts +2 -1
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gInteractionGetFollowingContentList as e}from"../../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{gInteractionGetFollowingContentList as e}from"../../../../service/generated/client.mjs";import{usePageLifecycle as t}from"../../../../utils/tracking.mjs";import{Box as n}from"../../../ui/box.mjs";import{usePaginated as r}from"../../../../hooks/query/use-query.mjs";import{useIsLoggedIn as i,useUserId as a}from"../../../../hooks/use-auth.mjs";import{UserActivityList as o}from"../../../common/list/user-activity-list/user-activity-list.mjs";import{FollowNoLogin as s}from"./follow-no-login.mjs";import{useCallback as c}from"react";import{jsx as l}from"react/jsx-runtime";import{useTranslations as u}from"next-intl";const d={video:1,post:2};function f({queryKeyPrefix:f,cookieUserId:p}){let m=u(`components.pages.userFollow.components`);t(`page_user_follow`,`关注`);let h=f??[],g=a()||p||``,_=i()||!!g,v=c(async t=>{if(!g)return{data:{list:[],total:0,has_more:!1}};let n=await e({app_id:0,user_id:g,page:t,page_size:10,content_type:d.post}),r=n.data?.post_infos??[];return{data:{list:r,total:n.data?.total??r.length,has_more:!!n.data?.has_more}}},[10,g]),y=r({key:[...h,`user-follow-post`,g],initialPageParam:1,async queryFn(e){return await v(e)||{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){let n=e?.data?.list??[],r=e?.data?.has_more;if(!(n.length===0||e?.data?.total===0||!r))return t.length+1},options:{staleTime:3e5,refetchOnWindowFocus:!0}}),b=y.data?.pages.flatMap(e=>e.data?.list??[])??[];return l(n,{className:`w-full bg-bg1`,children:_?l(o,{list:b,loading:y.isFetching,hasMore:y.hasNextPage??!1,loadMore:async()=>{await y.fetchNextPage()},showGroupHeaders:!1,emptyText:m(`postTab.empty`),canEdit:!1,isEditMode:!1,onToggleSelection:()=>{},onActionSuccess:()=>{}}):l(s,{})})}export{f as PostTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{cn as t}from"../../../utils/cn.mjs";import{gContentGetAppChannels as n,gContentGetVideoDetail as r}from"../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{cn as t}from"../../../utils/cn.mjs";import{gContentGetAppChannels as n,gContentGetVideoDetail as r}from"../../../service/generated/client.mjs";import{trackAppPageView as i,usePageLifecycle as a}from"../../../utils/tracking.mjs";import{useRouter as o}from"../../../utils/use-compatible-router.mjs";import{EmptyState as s}from"../../ui/empty.mjs";import{buildVideoPlayerSrc as ee}from"../../common/video-player/process-m3u8-cache.mjs";import{notifyBridgeEpisodeChanged as c}from"../../../utils/login-modal-bridge.mjs";import{useRequest as l}from"../../../hooks/query/use-query.mjs";import{queryKey as u}from"../../../constants/query-key.mjs";import{useKeepAliveEffect as d,useKeepAliveState as f}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as p}from"../../../utils/api-collect.mjs";import m from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{VideoDetailMaterialRuntimeProvider as te}from"../../biz/business/detail/shared/runtime-context-provider.mjs";import{resolveMaterialProps as ne,videoDetailMaterials as re}from"../../biz/business/detail/shared/registry.mjs";import{DetailHero as ie}from"../../biz/business/detail/shared/video-hero.mjs";import{Fragment as ae,useCallback as h,useEffect as g,useMemo as _,useRef as oe}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import{useParams as se,useSearchParams as ce}from"next/navigation";import{useTranslations as le}from"next-intl";const x=[{id:`detail-info`,componentName:`video-detail-info`,props:{}},{id:`detail-info-title-tags-episodes`,componentName:`video-detail-info-title-tags-episodes`,props:{}},{id:`detail-actions`,componentName:`video-detail-actions`,props:{}},{id:`detail-recommend`,componentName:`video-detail-recommend`,props:{title:`猜你喜欢`,rows:2,columns:3,smartTagEnabled:!1,smartTagIds:[`腐剧`],showPlayCount:!0,playCountDelta:0,showEpisode:!0,enableInfinite:!1,items:[{contentId:`d6a35ba3279e6f0d`,contentName:`贺总的私宠罪妻`,titleMode:`custom`,title:`贺总的私宠罪妻`,description:`简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百`,coverMode:`upload`,coverUrl:`/truss/20260227/69a136457d10f.jpgxxx`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`b0f42fed731239a7`,contentName:`少年江湖物语`,titleMode:`custom`,title:`少年江湖物语`,description:`网剧《少年江湖物语》讲述了一个江湖中邪不压正,青春正好,有情有爱的温暖故事。剧中有魔教教主,有天下第一剑客,有身世成谜的江湖大夫,有忠心耿耿的小丫鬟,更有艳压秦淮的当红花魁,众多看似完全没有交集的人物纷纷亮相登场,搅乱江湖一池春水。`,coverMode:`content`,coverUrl:`/md-204/uploads/default/other/2024-08-26/14664d2c31e61c201a29cd4abba267c5.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`c2304e94ec0ba208`,contentName:`王的男人`,titleMode:`custom`,title:`王的男人`,description:`朝鲜第十代王燕山王君时期,艺人长生(甘宇成饰)和孔吉(李俊基饰)因为不肯加入当地的艺人团,来到京城汉阳谋生。此时暴君燕山君(郑镇荣饰)沉迷于宠妾张绿水(姜成妍饰),朝纲混乱,民不聊生。长生与孔吉二人在街头开始表演讽刺君主的喜剧,大受欢迎,却遭逮捕。后要求到王面前表演,求得一笑。结果,多亏孔吉的急中生智,燕山君才笑了出来。两人随即被留在宫中取乐,孔吉更是因为美色令王倍加宠爱。他们不停表演,大臣们却各自心怀鬼胎,导致了杀戮局面。最终,君王和艺人的命运又将如何呢?`,coverMode:`content`,coverUrl:`/md-204/resource/8c/8cb28f46831558fbeb2f34b2076c3b4e.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`c7ffc6a558ae8683`,contentName:`怒`,titleMode:`custom`,title:`怒`,description:`炎炎夏日,东京八王子郊外社区,一对夫妇惨遭杀害。事后凶手用血在墙上写下大大的“怒”字,随后逃亡,销声匿迹长达一年之久。而在此期间,三个身份不明的男子和身边的人相遇了。曾自甘堕落的爱子(宫崎葵饰)被父亲(渡边谦饰)领回海滨小镇,邂逅了不善言辞的哲也(松山研一饰)。在东京工作的同性恋优马(妻夫木聪饰)将柔情似水的直人(绫野刚饰)带回了家,他不相信对方,却又尝试去相信。随母亲搬到冲绳的小泉(广濑铃饰)跟着同学辰哉(佐久本宝饰)登上一座荒岛,在废墟中遇到了背包客田中(森山未来饰),他们短暂成为朋友,而可怕的命运突然降临泉的头上。不久之后,通缉令遍布全国,三个男子的真实身份引人生疑……本片根据吉田修一的同名原作改编。`,coverMode:`content`,coverUrl:`/md-204/resource/24/24ef267eef2c35b5e4cf12dac8b55c14.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`98217427ed96ec51`,contentName:`熔炉`,titleMode:`custom`,title:`熔炉`,description:`来自首尔的哑语美术老师仁浩(孔宥饰)来到雾津,应聘慈爱聋哑人学校。天降大雾,他意外撞车,维修时邂逅了人权组织成员柔珍(郑有美饰)。仁浩妻子早亡,8岁女儿天生哮喘由祖母照看,所以他不辞辛苦谋职养家。然而,双胞胎的校长与教导主任竟逼仁浩索贿5千万韩元。同时,仁浩逐渐发现学校笼罩着一种紧张压抑的气氛,令人窒息。有三个孩子引人关注:聪颖的金妍斗(金贤秀饰)、贪吃的陈宥利(郑仁絮饰)和弟弟自杀身亡的全民秀(白承焕饰),民秀总是满脸淤青。下课后,仁浩还听到女厕所中有呼喊与哭泣,在门卫的阻拦下他未深究。之后。他意外目睹了校长行贿警察,教导员毒打民秀,宿导溺罚妍斗的行径。一个惊天的隐秘被慢慢揭开,真相令韩国震惊……本片取材于2005年光州一所聋哑障碍人学校的真实事件,改编自韩国作家孔枝泳的同名小说。`,coverMode:`content`,coverUrl:`/md-204/resource/b4/b410ccdcd86936455b9460a9152aaa47.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`caa2b4eb4eb40de0`,contentName:`再次来寻我`,titleMode:`custom`,title:`再次来寻我`,description:`在宇回到曾经与初恋志勋相遇的303号房,这里即将被拆迁,他在房间里回忆和志勋的点点滴滴,突然被书桌上的电话所吸引,一拿起话筒听到的竟是志勋的声音!在房子主人的同意下,在宇带着电话离开了303室,在回家的途中他发现自己像走在一个陌生的地方,而对面走来的竟是已消失已久的志勋…`,coverMode:`content`,coverUrl:`/md-204/resource/2b/2b43375f2248c1a012847d4507fd21a3.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0}]}}];function S(e,t){let n=String(e||``).split(`/`).filter(Boolean),r=n.findIndex(e=>e===`video`||e===`webview`);return r<0?!1:n[r+1]===t}function C({detailId:p,initialInformation:C,isWebView:w=!1,materialConfig:T}){let E=le(`components.pages.videoDetail`),D=o(),O=se(),k=ce();a(`page_video_detail`,`详情页`);let A=oe(!1),j=O.level,M=Array.isArray(j)?j:typeof j==`string`?[j]:[],N=M.findIndex(e=>e===`episode`),ue=N>=0?M[N+1]:M[2],P=Math.max(1,Number(ue)||1),[F,I]=f(`detail-current-series-num-${p}`,P);g(()=>{I(P)},[P,I]);let L=Math.max(1,Number(F)||1),R=Math.max(0,L-1),{data:z,isPending:B,isFetching:V,isError:H,isSuccess:de}=l(_(()=>[`video-detail`,p],[p]),async()=>p?await r({id:p}):null,{enabled:!!p}),U=_(()=>{let e=z?.data?.video;return!e||typeof e!=`object`?null:{...e,content_type:1,episode_cnt:e.links?.length||0}},[z?.data?.video]),fe=C??U??null,[W,G]=f(`detail-information-${p}`,fe);g(()=>{!W?.id||A.current||(A.current=!0,i({page_key:`page_video_detail`,page_name:`详情页`}))},[W?.id]);let pe=W?.links?.[R]?.id||``,K=!!p&&!W&&(B||V),q=!p||!!W||H||de,[me,he]=f(`info-detail-active-tab-${p}`,`video`),[J,Y]=f(`info-detail-comment-add-count-${p}`,0),[X,ge]=f(`info-detail-comment-total-${p}`,void 0);g(()=>{!W&&U&&G(U)},[W,U,G]);let Z=h(e=>{G(t=>t&&{...t,...e})},[G]);d(()=>{W?.id&&W.id},[W?.id],`detail-page-report-${p}`),g(()=>{!W||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:W.id||p,author_id:W.up_user,object_type:W.content_type,object_category:W.content_type,object_tags:W.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[p,W]),g(()=>{Y(0)},[pe,Y]),_(()=>(typeof X==`number`?X:0)+J,[J,X]);let _e=h(()=>{},[!1,he]);h(()=>{Y(e=>e+1)},[Y]),g(()=>{},[!1,_e,W?.id,k]);let Q=h(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(typeof window>`u`)return;let n=String(W?.id||p||``).trim();if(!n)return;let r=w||window.isWebView===!0,i=`/${r?`webview`:`video`}/${n}/${encodeURIComponent(W?.name||``)}/episode/${t}`,{search:a,hash:o,pathname:s}=window.location,l=`${i}${a}${o}`,u=`${s}${a}${o}`,d=S(s,n);if(u!==l){if(r){let e=W?.links?.[Math.max(0,t-1)],r=ee(String(e?.m3u8_url||e?.preview_m3u8_url||``).trim());c({poster:String(W?.img_y||W?.img_x||W?.preview_images?.[0]||``).trim(),src:r,title:String(W?.title||W?.name||``).trim(),contentId:n,episode:t}),L!==t&&I(t);return}d&&typeof window.history?.replaceState==`function`?(window.history.replaceState(window.history.state,``,l),I(t)):D.replace(l,{scroll:!1});return}L!==t&&I(t)},[L,p,W?.id,W?.img_x,W?.img_y,W?.links,W?.name,W?.preview_images,W?.title,w,D,I]);g(()=>{let e=Array.isArray(W?.links)?W.links.length:0;e<=0||L<=e||Q(1)},[L,Q,W?.links]);let $=W?.status===`1`,{data:ve}=l([u.CHANNEL],()=>n()),ye=e(ve?.data),be=_(()=>{if(T!==void 0){let e=new Map(x.map(e=>[e.componentName,e]));return T.map(t=>{let n=e.get(t.componentName);return{...n,...t,props:{...n?.props??{},...t.props??{}}}})}return x},[T]),xe=_(()=>({information:W??void 0,currentSeriesNum:L,onEpisodeChange:Q,onUpdateInformation:Z,detailId:p,episodeIndex:R,isShow:!0,isWebView:w,isInformationLoading:K,isInformationResolved:q}),[L,p,R,Q,Z,W,K,q,w,!0]),Se=h(e=>{if(!W)return null;let t=re[e.componentName];if(!t)return null;let n=t.clientComponent,r=ne(t,e.props);return r.isValid?y(n,{...r.props}):y(`div`,{children:`组件配置错误`})},[W]);return b(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 ${w?``:`pt-11`}`,children:[!w&&y(`div`,{className:`fixed bg-black top-0 left-0 right-0 z-[1000]`,children:y(m,{data:{list:ye}})}),y(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:b(v,{children:[W&&!$&&y(s,{type:`no-content`,text:E(`videoDetailClient.videoUnavailable`)}),W&&$&&b(v,{children:[!w&&y(ie,{isVideo:!0,information:W,episodeIndex:R}),y(`div`,{id:`selectPopupPosition`,className:`w-full`}),!1,b(`div`,{className:t(`w-full`,!1),children:[y(te,{value:xe,children:be.map(e=>y(ae,{children:Se(e)},e.id))}),!1]}),!1]}),!W&&y(s,{type:`no-content`,text:E(`videoDetailClient.videoDeleted`)})]})})]})}export{C as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../utils/cn.mjs";import{Button as t}from"../../ui/button.mjs";import{pContentGetNewstVideoList as n,pContentGetTopRatedVideoList as r}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as i,pContentGetTopRatedVideoListKey as a}from"../../../service/generated/tanstack.mjs";import{
|
|
2
|
+
"use client";import{cn as e}from"../../../utils/cn.mjs";import{Button as t}from"../../ui/button.mjs";import{pContentGetNewstVideoList as n,pContentGetTopRatedVideoList as r}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as i,pContentGetTopRatedVideoListKey as a}from"../../../service/generated/tanstack.mjs";import{usePageLifecycle as o}from"../../../utils/tracking.mjs";import{useRouter as s}from"../../../utils/use-compatible-router.mjs";import{Box as c}from"../../ui/box.mjs";import{InfiniteScroll as l}from"../../ui/infinite-scroll.mjs";import{Text as u}from"../../ui/text.mjs";import{usePaginated as d}from"../../../hooks/query/use-query.mjs";import f from"../../../assets/icons/left_arrow.mjs";import{getNextVideoListPageParam as p,resolveNextCursor as m}from"./types.mjs";import{VideoListRecommendItem as h}from"./video-list-recommend-item.mjs";import{VideoListSkeleton as g}from"./video-list-skeleton.mjs";import{useEffect as _,useMemo as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";const S=[];function C({title:C=`列表页`,tags:w=S}){let T=s();o(`page_video_list`,`视频列表`);let[E,D]=y(`hot`),O=v(()=>({page_size:10,tags:w.length?w:void 0}),[w]),{data:k,fetchNextPage:A,hasNextPage:j,isPending:M,isFetching:N}=d({key:v(()=>E===`hot`?a(O):i(O),[O,E]),queryFn:async e=>{let t={page_size:10,cursor:e||void 0,tags:w.length?w:void 0},i=(E===`hot`?await r(t):await n(t)).data,a=Array.isArray(i?.videos)?i.videos:[];return{list:a,nextCursor:a.length<10?``:m(i)}},getNextPageParam:p,initialPageParam:``,options:{staleTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}),P=v(()=>k?.pages?.flatMap(e=>e.list)??[],[k?.pages]),F=(k?.pages?.length??0)>0,I=v(()=>F?j??!1:!0,[F,j]),L=P.length===0&&(!F||M||N);_(()=>{typeof window>`u`||window.scrollTo({top:0,behavior:`auto`})},[E]);function R(){T.back()}let z=v(()=>P.map(e=>{let t=e.id??e.mid??``;return b(h,{item:e,href:`/video/${t}/${e.name??``}`},t)}),[P]);return L?b(g,{}):x(c,{as:`main`,className:`min-h-[100dvh] bg-[linear-gradient(180deg,#160320_0%,#2a0a56_100%)] text-white`,children:[x(c,{className:`sticky top-0 z-20 bg-[linear-gradient(180deg,rgba(22,3,32,0.98)_0%,rgba(22,3,32,0.92)_100%)] px-[16px] pb-[12px] pt-[10px] backdrop-blur-[16px]`,children:[x(c,{as:`header`,className:`flex items-center justify-between`,children:[b(t,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:R,className:`h-[24px] w-[24px] rounded-none p-0 text-white hover:bg-transparent`,children:b(f,{className:`h-[16px] w-[16px]`})}),b(u,{as:`h1`,className:`min-w-0 flex-1 truncate px-[16px] text-center text-[18px] font-medium leading-[22px] text-white`,children:C}),b(c,{className:`h-[24px] w-[24px] shrink-0 opacity-0`,"aria-hidden":!0})]}),x(c,{as:`nav`,className:`mt-[12px] flex gap-[14px]`,children:[b(t,{type:`button`,variant:`ghost`,onClick:()=>D(`hot`),className:e(`h-[28px] min-w-[64px] rounded-[100px] px-[16px] text-[14px] font-normal leading-[20px] text-white`,E===`hot`?`bg-[linear-gradient(90deg,#9756e3_0%,#6c43ee_100%)] shadow-[0_8px_20px_rgba(122,76,255,0.35)] hover:bg-transparent`:`bg-white/20 hover:bg-white/25`),children:`最热`}),b(t,{type:`button`,variant:`ghost`,onClick:()=>D(`latest`),className:e(`h-[28px] min-w-[64px] rounded-[100px] px-[16px] text-[14px] font-normal leading-[20px] text-white`,E===`latest`?`bg-[linear-gradient(90deg,#9756e3_0%,#6c43ee_100%)] shadow-[0_8px_20px_rgba(122,76,255,0.35)] hover:bg-transparent`:`bg-white/20 hover:bg-white/25`),children:`最新`})]})]}),b(l,{loadMore:()=>A().then(()=>void 0),hasMore:I,noMoreText:`没有更多了`,threshold:300,className:`px-[16px] pb-[24px]`,children:b(c,{as:`section`,className:`flex flex-col gap-[16px]`,children:z})},E)]})}export{C as default};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "link" | "default" | "
|
|
9
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -7,8 +7,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
7
7
|
//#region components/ui/button.d.ts
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "link" | "default" | "
|
|
11
|
-
size?: "
|
|
10
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
11
|
+
size?: "icon" | "default" | "xs" | "sm" | "lg" | "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?: "icon" | "default" | null | undefined;
|
|
38
38
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
39
39
|
/** EmptyMedia 组件。 */
|
|
40
40
|
declare function EmptyMedia({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import Image from "next/image";
|
|
5
5
|
|
|
6
6
|
//#region components/ui/image.d.ts
|
|
7
7
|
/** BaseImageProps 属性定义。 */
|
|
8
|
-
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof
|
|
8
|
+
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
|
|
9
9
|
type CommonImageProps = BaseImageProps & {
|
|
10
10
|
/** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
|
|
11
11
|
alt?: string; /** 图片类名。 */
|
|
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
|
|
|
27
27
|
/** ImageProps 属性定义。 */
|
|
28
28
|
type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
|
|
29
29
|
/** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
|
|
30
|
-
declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
30
|
+
declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|
|
32
|
+
export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|
|
@@ -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?: "icon" | "default" | "image" | null | undefined;
|
|
86
86
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
87
87
|
/** ItemMedia 组件。 */
|
|
88
88
|
declare function ItemMedia({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import"react";import{jsx as e}from"react/jsx-runtime";import t from"next/link";function n({href:n,children:r,className:i=``,webviewNavMode:a=`auto
|
|
2
|
+
import"react";import{jsx as e}from"react/jsx-runtime";import t from"next/link";function n({href:n,children:r,className:i=``,webviewNavMode:a=`auto`,onClick:o,...s}){let c=i.trim(),l=a===`auto`?void 0:a;function u(e){if(o?.(e),!(typeof window>`u`)&&a!==`spa`&&a!==`auto`){if(e?.preventDefault?.(),window.isWebView!==!0){window.location.href=n;return}try{let e=new URL(n,window.location.href);if(e.origin!==window.location.origin){window.location.href=e.toString();return}let t=e.pathname.split(`/`).filter(Boolean),r=t.findIndex(e=>e===`video`);r>=0&&(t[r]=`webview`,e.pathname=`/${t.join(`/`)}`),window.location.href=e.toString()}catch{window.location.href=n}}}return e(t,{href:n,className:c,"data-webview-nav":l,...s,onClick:u,children:r})}export{n as default};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
|
|
2
|
+
//#region utils/tracking.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* page_click 事件 payload 中坐标来源(兼容 React 合成事件与原生 MouseEvent)。
|
|
5
|
+
*/
|
|
6
|
+
interface ClickPosition {
|
|
7
|
+
pageX: number;
|
|
8
|
+
pageY: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* app_page_view 事件 payload。
|
|
12
|
+
*/
|
|
13
|
+
interface AppPageViewPayload {
|
|
14
|
+
user_type?: string;
|
|
15
|
+
page_key: string;
|
|
16
|
+
page_name: string;
|
|
17
|
+
referrer_page_key?: string;
|
|
18
|
+
referrer_page_name?: string;
|
|
19
|
+
current_page_key?: string;
|
|
20
|
+
current_page_name?: string;
|
|
21
|
+
page_load_time?: number;
|
|
22
|
+
recommend_trace_id?: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 通用 page_click 上报。
|
|
27
|
+
* @param pageKey 页面标识(如 'page_user'、'login')。
|
|
28
|
+
* @param pageName 页面名称(如 '我的'、'登录注册')。
|
|
29
|
+
* @param pos 鼠标事件对象,用于提取点击坐标;无法获取时传 null。
|
|
30
|
+
* @param elementName 被点击元素标识。
|
|
31
|
+
* @param extraPayload 额外 payload 字段。
|
|
32
|
+
*/
|
|
33
|
+
declare function trackPageClick(pageKey: string, pageName: string, pos: ClickPosition | null, elementName: string, extraPayload?: Record<string, unknown>): void;
|
|
34
|
+
/**
|
|
35
|
+
* recommend_list_click 事件 payload。
|
|
36
|
+
*/
|
|
37
|
+
interface RecommendListClickPayload {
|
|
38
|
+
page_key: string;
|
|
39
|
+
page_name: string;
|
|
40
|
+
recommend_trace_id?: string;
|
|
41
|
+
recommend_id?: string;
|
|
42
|
+
recommend_trace_info?: string;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 通用 recommend_list_click 上报。
|
|
47
|
+
* @param payload 推荐列表点击 payload。
|
|
48
|
+
*/
|
|
49
|
+
declare function trackRecommendListClick(payload: RecommendListClickPayload): void;
|
|
50
|
+
/**
|
|
51
|
+
* ad_click 事件 payload。
|
|
52
|
+
*/
|
|
53
|
+
interface AdClickPayload {
|
|
54
|
+
/** 页面标识,如 home、detail、video_play。 */
|
|
55
|
+
page_key: string;
|
|
56
|
+
/** 页面名称,如 首页、详情页、播放页。 */
|
|
57
|
+
page_name: string;
|
|
58
|
+
/** 广告位标识,对应广告导入数据的 advertiseLocationCode。 */
|
|
59
|
+
ad_slot_key: string;
|
|
60
|
+
/** 广告位名称。 */
|
|
61
|
+
ad_slot_name: string;
|
|
62
|
+
/** 被点击的广告 ID,对应广告导入数据的 advertiseCode。 */
|
|
63
|
+
ad_id: string;
|
|
64
|
+
/** 广告类型,如 full-screen、small-cube、vertical-cube、banner-720300、pop-ups-600800。 */
|
|
65
|
+
ad_type: string;
|
|
66
|
+
/** 素材 ID(可选)。 */
|
|
67
|
+
creative_id?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* ad_impression 事件 payload。
|
|
71
|
+
*/
|
|
72
|
+
interface AdImpressionPayload {
|
|
73
|
+
/** 页面标识,如 home、detail、video_play。 */
|
|
74
|
+
page_key: string;
|
|
75
|
+
/** 页面名称,如 首页、详情页、播放页。 */
|
|
76
|
+
page_name: string;
|
|
77
|
+
/** 广告位标识,对应广告导入数据的 advertiseLocationCode,如 home_banner_1。 */
|
|
78
|
+
ad_slot_key: string;
|
|
79
|
+
/** 广告位名称,如 首页顶部Banner、第3条信息流广告。 */
|
|
80
|
+
ad_slot_name: string;
|
|
81
|
+
/** 广告 ID,多个广告 ID 以英文逗号分隔,对应广告导入数据的 advertiseCode。 */
|
|
82
|
+
ad_id: string;
|
|
83
|
+
/**
|
|
84
|
+
* 素材 ID,多个素材 ID 以英文逗号分隔,与 ad_id 一一对应;
|
|
85
|
+
* 没有素材 ID 的位置填空字符串,数量需与 ad_id 保持一致。
|
|
86
|
+
*/
|
|
87
|
+
creative_id?: string;
|
|
88
|
+
/** 广告类型:banner、feed、interstitial、reward_video 等。 */
|
|
89
|
+
ad_type: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 广告展示上报(ad_impression)。
|
|
93
|
+
*
|
|
94
|
+
* 去重规则:同一 ad_slot_key + ad_id 组合在页面生命周期内只上报一次。
|
|
95
|
+
* 支持批量:ad_id 传逗号分隔的多个 ID,函数会自动过滤已上报的部分,
|
|
96
|
+
* 仅将首次出现的 ID 上报,与之位置对应的 creative_id 同步过滤。
|
|
97
|
+
*
|
|
98
|
+
* @param payload 广告展示 payload。
|
|
99
|
+
*/
|
|
100
|
+
declare function trackAdImpression(payload: AdImpressionPayload): void;
|
|
101
|
+
/**
|
|
102
|
+
* advertising 事件 payload。
|
|
103
|
+
* APP 内部自己定义的活动弹窗等。
|
|
104
|
+
*/
|
|
105
|
+
interface AdvertisingPayload {
|
|
106
|
+
/** 事件类型:click(点击)、close(关闭)、show(展示)。 */
|
|
107
|
+
event_type: string;
|
|
108
|
+
/** 广告标识:home_popup(首页弹窗)、home_banner(首页Banner)、video_reward(激励视频)等。 */
|
|
109
|
+
advertising_key: string;
|
|
110
|
+
/** 广告标识名称:首页弹窗、首页Banner、激励视频。 */
|
|
111
|
+
advertising_name: string;
|
|
112
|
+
/** 广告 ID。 */
|
|
113
|
+
advertising_id: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 广告页面事件上报(advertising)。
|
|
117
|
+
* 用于 APP 内部自定义的活动弹窗等场景。
|
|
118
|
+
* @param payload 广告页面事件 payload。
|
|
119
|
+
*/
|
|
120
|
+
declare function trackAdvertising(payload: AdvertisingPayload): void;
|
|
121
|
+
/**
|
|
122
|
+
* navigation 事件 payload。
|
|
123
|
+
*/
|
|
124
|
+
interface NavigationPayload {
|
|
125
|
+
/** 导航标识:navigation_home(首页)、navigation_discover(发现)、navigation_user(我的)等。 */
|
|
126
|
+
navigation_key: string;
|
|
127
|
+
/** 导航标识名称:首页导航、发现导航、我的导航。 */
|
|
128
|
+
navigation_name: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 导航模块点击上报(navigation)。
|
|
132
|
+
* @param payload 导航点击 payload。
|
|
133
|
+
*/
|
|
134
|
+
declare function trackNavigation(payload: NavigationPayload): void;
|
|
135
|
+
/**
|
|
136
|
+
* video_event 事件 payload。
|
|
137
|
+
*/
|
|
138
|
+
interface VideoEventPayload {
|
|
139
|
+
/** 媒体资源 ID(接口返回的 id 字段)。 */
|
|
140
|
+
media_id: string;
|
|
141
|
+
/** 视频 ID。 */
|
|
142
|
+
video_id: string;
|
|
143
|
+
/** 视频标题。 */
|
|
144
|
+
video_title: string;
|
|
145
|
+
/** 视频分类 ID。 */
|
|
146
|
+
video_type_id: string;
|
|
147
|
+
/** 视频分类名称。 */
|
|
148
|
+
video_type_name: string;
|
|
149
|
+
/** 视频类型:video(长视频)、short_video(短视频)。 */
|
|
150
|
+
video_content_type: string;
|
|
151
|
+
/** 推荐引擎的 trace_id。 */
|
|
152
|
+
recommend_trace_id: string;
|
|
153
|
+
/** 标签 KEY,多个标签使用英文逗号分隔。 */
|
|
154
|
+
video_tag_key: string;
|
|
155
|
+
/** 标签名称,多个标签使用英文逗号分隔。 */
|
|
156
|
+
video_tag_name: string;
|
|
157
|
+
/** 视频总时长(秒)。 */
|
|
158
|
+
video_duration: number;
|
|
159
|
+
/** 本次播放时长(秒)。 */
|
|
160
|
+
play_duration: number;
|
|
161
|
+
/** 播放进度百分比(0-100)。 */
|
|
162
|
+
play_progress: number;
|
|
163
|
+
/** 视频行为标识:video_view(展示)、video_play(播放)、video_pause(暂停)、video_share(分享)、video_complete(播放完成)、video_forward(快进)、video_rewind(快退)等。 */
|
|
164
|
+
video_behavior_key: string;
|
|
165
|
+
/** 视频行为名称:视频展示、播放、暂停、分享、播放完成、快进、快退。 */
|
|
166
|
+
video_behavior_name: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 视频行为上报(video_event)。
|
|
170
|
+
* @param payload 视频事件 payload。
|
|
171
|
+
*/
|
|
172
|
+
declare function trackVideoEvent(payload: VideoEventPayload): void;
|
|
173
|
+
/**
|
|
174
|
+
* keyword_click 事件 payload。
|
|
175
|
+
*/
|
|
176
|
+
interface KeywordClickPayload {
|
|
177
|
+
/** 关联关键词。 */
|
|
178
|
+
keyword: string;
|
|
179
|
+
/** 点击项目 ID(视频ID/小说ID等)。 */
|
|
180
|
+
click_item_id: string;
|
|
181
|
+
/** 点击项目类型标识:video(视频)、novel(小说)、comic(漫画)。 */
|
|
182
|
+
click_item_type_key: string;
|
|
183
|
+
/** 点击项目类型名称:视频、小说、漫画。 */
|
|
184
|
+
click_item_type_name: string;
|
|
185
|
+
/** 点击位置(搜索结果中的排序位置)。 */
|
|
186
|
+
click_position: number;
|
|
187
|
+
/** 搜索引擎的 trace_id。 */
|
|
188
|
+
search_trace_id: string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* 关键词搜索结果点击上报(keyword_click)。
|
|
192
|
+
* @param payload 关键词点击 payload。
|
|
193
|
+
*/
|
|
194
|
+
declare function trackKeywordClick(payload: KeywordClickPayload): void;
|
|
195
|
+
/**
|
|
196
|
+
* 广告点击上报(ad_click)。
|
|
197
|
+
* P0 等级,从广告中心拉取的广告点击时上报。
|
|
198
|
+
* @param payload 广告点击 payload。
|
|
199
|
+
*/
|
|
200
|
+
declare function trackAdClick(payload: AdClickPayload): void;
|
|
201
|
+
declare function trackAppPageView(payload: AppPageViewPayload): void;
|
|
202
|
+
/**
|
|
203
|
+
* page_lifecycle 事件 payload。
|
|
204
|
+
*/
|
|
205
|
+
interface PageLifecyclePayload {
|
|
206
|
+
/** 生命周期状态:show(页面展示), hide(页面隐藏)。 */
|
|
207
|
+
lifecycle_status: 'show' | 'hide';
|
|
208
|
+
/** 页面标识键,如 page_home、page_user。 */
|
|
209
|
+
page_key: string;
|
|
210
|
+
/** 页面名称,如 首页、我的。 */
|
|
211
|
+
page_name: string;
|
|
212
|
+
/** 页面停留时长(秒);show 事件固定为 0。 */
|
|
213
|
+
duration: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 页面生命周期上报(page_lifecycle)。
|
|
217
|
+
* @param payload 页面生命周期 payload。
|
|
218
|
+
*/
|
|
219
|
+
declare function trackPageLifecycle(payload: PageLifecyclePayload): void;
|
|
220
|
+
/**
|
|
221
|
+
* 页面生命周期追踪 Hook。
|
|
222
|
+
* - 挂载时上报 show(duration: 0)
|
|
223
|
+
* - 页面可见期间每隔 1 分钟上报一次 show(附带当前累计停留秒数)
|
|
224
|
+
* - visibilitychange 隐藏时上报 hide;重新可见时重置计时并上报 show
|
|
225
|
+
* - 卸载时(页面仍可见)补报 hide
|
|
226
|
+
* @param pageKey 页面标识键。
|
|
227
|
+
* @param pageName 页面名称。
|
|
228
|
+
*/
|
|
229
|
+
declare function usePageLifecycle(pageKey: string, pageName: string): void;
|
|
230
|
+
//#endregion
|
|
231
|
+
export { AdClickPayload, AdImpressionPayload, AdvertisingPayload, AppPageViewPayload, ClickPosition, KeywordClickPayload, NavigationPayload, PageLifecyclePayload, RecommendListClickPayload, VideoEventPayload, trackAdClick, trackAdImpression, trackAdvertising, trackAppPageView, trackKeywordClick, trackNavigation, trackPageClick, trackPageLifecycle, trackRecommendListClick, trackVideoEvent, usePageLifecycle };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{useEffect as e}from"react";function t(e,t,n,r,i){if(typeof window>`u`)return;console.log(`trackPageClick${r}`);let a=n?.pageX??0,o=n?.pageY??0,s=window.innerWidth||1,c=window.innerHeight||1,l={page_key:e,page_name:t,element_name:r,click_page_x:Math.round(a),click_page_y:Math.round(o),click_x_percent:Math.round(a/s*100),click_y_percent:Math.round(o/c*100),screen_width:window.screen.width,screen_height:window.screen.height,recommend_trace_id:``,...i};window.WebSDK?.track?.({event:`page_click`,payload:l}),window.sensors?.track?.(`page_click`,l)}function n(e){if(console.log(`trackrecommend_list_click`,e.page_name),typeof window>`u`)return;let t={recommend_trace_id:``,recommend_id:``,recommend_trace_info:``,...e};window.WebSDK?.track?.({event:`recommend_list_click`,payload:t}),window.sensors?.track?.(`recommend_list_click`,t)}const r=new Set;function i(e){if(typeof window>`u`)return;let t=e.ad_id.split(`,`).map(e=>e.trim()).filter(Boolean),n=(e.creative_id??``).split(`,`).map(e=>e.trim()),i=t.reduce((t,n,i)=>(r.has(`${e.ad_slot_key}::${n}`)||t.push(i),t),[]);if(i.length===0)return;for(let n of i)r.add(`${e.ad_slot_key}::${t[n]}`);let a={...e,ad_id:i.map(e=>t[e]).join(`,`),creative_id:i.map(e=>n[e]??``).join(`,`)};window.WebSDK?.track?.({event:`ad_impression`,payload:a}),window.sensors?.track?.(`ad_impression`,a)}function a(e){typeof window>`u`||(window.WebSDK?.track?.({event:`advertising`,payload:e}),window.sensors?.track?.(`advertising`,e))}function o(e){typeof window>`u`||(console.log(`navigaition`,e.navigation_name),window.WebSDK?.track?.({event:`navigation`,payload:e}),window.sensors?.track?.(`navigation`,e))}function s(e){typeof window>`u`||(window.WebSDK?.track?.({event:`video_event`,payload:e}),window.sensors?.track?.(`video_event`,e))}function c(e){typeof window>`u`||(console.log(`keywordclick`,e.keyword),window.WebSDK?.track?.({event:`keyword_click`,payload:e}),window.sensors?.track?.(`keyword_click`,e))}function l(e){if(typeof window>`u`)return;let t={creative_id:``,...e};window.WebSDK?.track?.({event:`ad_click`,payload:t}),window.sensors?.track?.(`ad_click`,t)}function u(e){if(console.log(`trackPageView`,e.page_name),typeof window>`u`)return;let t={user_type:`normal`,referrer_page_key:``,referrer_page_name:``,page_load_time:0,recommend_trace_id:``,...e};window.WebSDK?.track?.({event:`app_page_view`,payload:t}),window.sensors?.track?.(`app_page_view`,t)}function d(e){typeof window>`u`||(console.log(`[trackPageLifecycle]`,e.page_name),window.WebSDK?.track?.({event:`page_lifecycle`,payload:e}),window.sensors?.track?.(`page_lifecycle`,e))}function f(t,n){e(()=>{let e=Date.now();d({lifecycle_status:`show`,page_key:t,page_name:n,duration:0});let r=setInterval(()=>{document.visibilityState!==`hidden`&&d({lifecycle_status:`show`,page_key:t,page_name:n,duration:Math.floor((Date.now()-e)/1e3)})},600*1e3);return()=>{clearInterval(r)}},[])}export{l as trackAdClick,i as trackAdImpression,a as trackAdvertising,u as trackAppPageView,c as trackKeywordClick,o as trackNavigation,t as trackPageClick,d as trackPageLifecycle,n as trackRecommendListClick,s as trackVideoEvent,f as usePageLifecycle};
|
package/dist/utils.d.mts
CHANGED
|
@@ -21,7 +21,8 @@ import { createInputAndSelectFile, getCoverImage, getImageResolutionFromFile } f
|
|
|
21
21
|
import { PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasswordValidationResult, PasswordValidationType, getFirstInvalidPasswordChar, getPasswordCharacterTypeCount, getPasswordValidationErrorText, validatePasswordPair } from "./utils/password-validator.mjs";
|
|
22
22
|
import { resolveRequestUserId } from "./utils/request-user-id.mjs";
|
|
23
23
|
import { PresignedUploadInfo, UploadToS3Options, UploadToS3Result, uploadToS3WithPresignedUrl } from "./utils/s3-uploader.mjs";
|
|
24
|
+
import { AdClickPayload, AdImpressionPayload, AdvertisingPayload, AppPageViewPayload, ClickPosition, KeywordClickPayload, NavigationPayload, PageLifecyclePayload, RecommendListClickPayload, VideoEventPayload, trackAdClick, trackAdImpression, trackAdvertising, trackAppPageView, trackKeywordClick, trackNavigation, trackPageClick, trackPageLifecycle, trackRecommendListClick, trackVideoEvent, usePageLifecycle } from "./utils/tracking.mjs";
|
|
24
25
|
import { base64ToUint8Array, uint8ArrayToBase64, uint8ArrayToNumberArray } from "./utils/uint8.mjs";
|
|
25
26
|
import { UploadFileResult, encryptBncBuffer, uploadFile } from "./utils/upload-file.mjs";
|
|
26
27
|
import { CompatibleRouter, useRouter } from "./utils/use-compatible-router.mjs";
|
|
27
|
-
export { CompatibleRouter, ComponentPropsSchemaBuilderHelpers, DefineMaterialOption, eventBus as EventBus, HttpClient, HttpError, INSPECTOR_META_KEY, ImageCompressionQualityRule, InferSchemaProps, MaterialCategory, MaterialComponentMode, MaterialComponentProps, MaterialMap, OverwriteMaterialOption, PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasswordValidationResult, PasswordValidationType, PresignedUploadInfo, RequestConfig, RequestMethod, ResponseData, SchemaHasDefaultValue, UploadFileResult, UploadToS3Options, UploadToS3Result, array, base64ToUint8Array, boolean, checkFollowStatus, clearMyChannelsFromStorage, cn, components, compressImage, createInputAndSelectFile, datetime, debounceFun, decryptImageToArrayBuffer, decryptImageToUint8Array, decryptImageUrl, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, defineComponentPropsSchema, defineMaterial, disablePageScroll, enablePageScroll, encryptBncBuffer, enumSchema as enum, enumSchema, followUser, formatVideoDuration, generateDynamicSign, generateMaterialMap, generateMaterialMapGroupByCategory, generateUUID, getAppId, getAtUserElement, getCookie, getCoverImage, getCurrentSecondTime, getCurrentUserId, getFirstInvalidPasswordChar, getImageCompressionQuality, getImageResolutionFromFile, getOrCreateBrowserFingerprint, getOrCreateDeviceId, getPasswordCharacterTypeCount, getPasswordValidationErrorText, getResUrl, getSchemaDefaultProps, getUserId, guessImageContentTypeFromUrl, hashPassword, httpClient, imageCompressionQualityRules, isClient, isEncryptedImageUrl, isMobileDevice, isValidEmail, loadComponent, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, normalizeClassName, numToString, number, object, overwriteMaterial, parseResolution, parseTextAtUserIds, pxToVw, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, resolveImageUrl, resolveRequestUserId, rewriteComponent, saveHiddenChannelIdsToStorage, secondToTime, setCookie, shouldProbeImageUrl, shouldUseApiResDirectly, string, stringToNumber, stripHtmlTags, timeRange, uint8ArrayToBase64, uint8ArrayToNumberArray, unfollowUser, updateUrlParams, uploadFile, uploadToS3WithPresignedUrl, useRouter, validatePasswordPair, withInspectorMeta };
|
|
28
|
+
export { AdClickPayload, AdImpressionPayload, AdvertisingPayload, AppPageViewPayload, ClickPosition, CompatibleRouter, ComponentPropsSchemaBuilderHelpers, DefineMaterialOption, eventBus as EventBus, HttpClient, HttpError, INSPECTOR_META_KEY, ImageCompressionQualityRule, InferSchemaProps, KeywordClickPayload, MaterialCategory, MaterialComponentMode, MaterialComponentProps, MaterialMap, NavigationPayload, OverwriteMaterialOption, PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PageLifecyclePayload, PasswordValidationResult, PasswordValidationType, PresignedUploadInfo, RecommendListClickPayload, RequestConfig, RequestMethod, ResponseData, SchemaHasDefaultValue, UploadFileResult, UploadToS3Options, UploadToS3Result, VideoEventPayload, array, base64ToUint8Array, boolean, checkFollowStatus, clearMyChannelsFromStorage, cn, components, compressImage, createInputAndSelectFile, datetime, debounceFun, decryptImageToArrayBuffer, decryptImageToUint8Array, decryptImageUrl, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, defineComponentPropsSchema, defineMaterial, disablePageScroll, enablePageScroll, encryptBncBuffer, enumSchema as enum, enumSchema, followUser, formatVideoDuration, generateDynamicSign, generateMaterialMap, generateMaterialMapGroupByCategory, generateUUID, getAppId, getAtUserElement, getCookie, getCoverImage, getCurrentSecondTime, getCurrentUserId, getFirstInvalidPasswordChar, getImageCompressionQuality, getImageResolutionFromFile, getOrCreateBrowserFingerprint, getOrCreateDeviceId, getPasswordCharacterTypeCount, getPasswordValidationErrorText, getResUrl, getSchemaDefaultProps, getUserId, guessImageContentTypeFromUrl, hashPassword, httpClient, imageCompressionQualityRules, isClient, isEncryptedImageUrl, isMobileDevice, isValidEmail, loadComponent, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, normalizeClassName, numToString, number, object, overwriteMaterial, parseResolution, parseTextAtUserIds, pxToVw, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, resolveImageUrl, resolveRequestUserId, rewriteComponent, saveHiddenChannelIdsToStorage, secondToTime, setCookie, shouldProbeImageUrl, shouldUseApiResDirectly, string, stringToNumber, stripHtmlTags, timeRange, trackAdClick, trackAdImpression, trackAdvertising, trackAppPageView, trackKeywordClick, trackNavigation, trackPageClick, trackPageLifecycle, trackRecommendListClick, trackVideoEvent, uint8ArrayToBase64, uint8ArrayToNumberArray, unfollowUser, updateUrlParams, uploadFile, uploadToS3WithPresignedUrl, usePageLifecycle, useRouter, validatePasswordPair, withInspectorMeta };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{cn as
|
|
2
|
+
import{cn as ee}from"./utils/cn.mjs";import{debounceFun as te,formatVideoDuration as ne,generateDynamicSign as e,generateUUID as t,getAtUserElement as n,getCookie as r,getCurrentSecondTime as i,getUserId as a,hashPassword as o,isClient as s,isMobileDevice as c,numToString as l,parseResolution as u,parseTextAtUserIds as d,randomString as f,removeCookie as p,replaceAtUserElement as m,replaceAtUserElementHtmlStr as h,secondToTime as g,setCookie as _,stringToNumber as v,stripHtmlTags as y,updateUrlParams as b}from"./utils/common.mjs";import{getOrCreateBrowserFingerprint as x}from"./utils/browser-fingerprint.mjs";import{clearMyChannelsFromStorage as S,loadHiddenChannelIdsFromStorage as C,loadMyChannelsFromStorage as w,saveHiddenChannelIdsToStorage as T}from"./utils/channel-storage.mjs";import E from"./utils/get-res-url.mjs";import{decryptImageToArrayBuffer as D,decryptImageToUint8Array as O,decryptImageUrl as k,guessImageContentTypeFromUrl as A,isEncryptedImageUrl as j,resolveImageUrl as M,shouldProbeImageUrl as N,shouldUseApiResDirectly as P}from"./utils/decrypt-image-client.mjs";import{getOrCreateDeviceId as F}from"./utils/device-id.mjs";import{isValidEmail as I}from"./utils/email-validator.mjs";import L from"./utils/event-bus.mjs";import{resolveRequestUserId as R}from"./utils/request-user-id.mjs";import z,{HttpClient as B,HttpError as V}from"./utils/http.mjs";import{checkFollowStatus as H,followUser as U,getAppId as W,getCurrentUserId as G,unfollowUser as K}from"./utils/follow-service.mjs";import{disablePageScroll as q,enablePageScroll as J,normalizeClassName as Y,pxToVw as X}from"./utils/helper.mjs";import{compressImage as Z,defaultImageCompressionMaxSizeMB as re,defaultImageCompressionQuality as Q,getImageCompressionQuality as ie,imageCompressionQualityRules as ae}from"./utils/image-compression.mjs";import{components as oe,loadComponent as se,rewriteComponent as ce}from"./utils/loaders.mjs";import{createInputAndSelectFile as le,getCoverImage as ue,getImageResolutionFromFile as de}from"./utils/media.mjs";import{PASSWORD_ALLOWED_SPECIAL_CHARS as fe,PASSWORD_MAX_LENGTH as pe,PASSWORD_MIN_LENGTH as me,getFirstInvalidPasswordChar as he,getPasswordCharacterTypeCount as ge,getPasswordValidationErrorText as _e,validatePasswordPair as ve}from"./utils/password-validator.mjs";import{uploadToS3WithPresignedUrl as ye}from"./utils/s3-uploader.mjs";import{defineMaterial as be,overwriteMaterial as xe}from"./utils/schema/material.mjs";import{INSPECTOR_META_KEY as Se,array as Ce,boolean as we,datetime as Te,defineComponentPropsSchema as Ee,enumSchema as $,getSchemaDefaultProps as De,number as Oe,object as ke,string as Ae,timeRange as je,withInspectorMeta as Me}from"./utils/schema/schema.mjs";import{generateMaterialMap as Ne,generateMaterialMapGroupByCategory as Pe}from"./utils/schema/utils.mjs";import{trackAdClick as Fe,trackAdImpression as Ie,trackAdvertising as Le,trackAppPageView as Re,trackKeywordClick as ze,trackNavigation as Be,trackPageClick as Ve,trackPageLifecycle as He,trackRecommendListClick as Ue,trackVideoEvent as We,usePageLifecycle as Ge}from"./utils/tracking.mjs";import{base64ToUint8Array as Ke,uint8ArrayToBase64 as qe,uint8ArrayToNumberArray as Je}from"./utils/uint8.mjs";import{encryptBncBuffer as Ye,uploadFile as Xe}from"./utils/upload-file.mjs";import{useRouter as Ze}from"./utils/use-compatible-router.mjs";export{L as EventBus,B as HttpClient,V as HttpError,Se as INSPECTOR_META_KEY,fe as PASSWORD_ALLOWED_SPECIAL_CHARS,pe as PASSWORD_MAX_LENGTH,me as PASSWORD_MIN_LENGTH,Ce as array,Ke as base64ToUint8Array,we as boolean,H as checkFollowStatus,S as clearMyChannelsFromStorage,ee as cn,oe as components,Z as compressImage,le as createInputAndSelectFile,Te as datetime,te as debounceFun,D as decryptImageToArrayBuffer,O as decryptImageToUint8Array,k as decryptImageUrl,re as defaultImageCompressionMaxSizeMB,Q as defaultImageCompressionQuality,Ee as defineComponentPropsSchema,be as defineMaterial,q as disablePageScroll,J as enablePageScroll,Ye as encryptBncBuffer,$ as enum,$ as enumSchema,U as followUser,ne as formatVideoDuration,e as generateDynamicSign,Ne as generateMaterialMap,Pe as generateMaterialMapGroupByCategory,t as generateUUID,W as getAppId,n as getAtUserElement,r as getCookie,ue as getCoverImage,i as getCurrentSecondTime,G as getCurrentUserId,he as getFirstInvalidPasswordChar,ie as getImageCompressionQuality,de as getImageResolutionFromFile,x as getOrCreateBrowserFingerprint,F as getOrCreateDeviceId,ge as getPasswordCharacterTypeCount,_e as getPasswordValidationErrorText,E as getResUrl,De as getSchemaDefaultProps,a as getUserId,A as guessImageContentTypeFromUrl,o as hashPassword,z as httpClient,ae as imageCompressionQualityRules,s as isClient,j as isEncryptedImageUrl,c as isMobileDevice,I as isValidEmail,se as loadComponent,C as loadHiddenChannelIdsFromStorage,w as loadMyChannelsFromStorage,Y as normalizeClassName,l as numToString,Oe as number,ke as object,xe as overwriteMaterial,u as parseResolution,d as parseTextAtUserIds,X as pxToVw,f as randomString,p as removeCookie,m as replaceAtUserElement,h as replaceAtUserElementHtmlStr,M as resolveImageUrl,R as resolveRequestUserId,ce as rewriteComponent,T as saveHiddenChannelIdsToStorage,g as secondToTime,_ as setCookie,N as shouldProbeImageUrl,P as shouldUseApiResDirectly,Ae as string,v as stringToNumber,y as stripHtmlTags,je as timeRange,Fe as trackAdClick,Ie as trackAdImpression,Le as trackAdvertising,Re as trackAppPageView,ze as trackKeywordClick,Be as trackNavigation,Ve as trackPageClick,He as trackPageLifecycle,Ue as trackRecommendListClick,We as trackVideoEvent,qe as uint8ArrayToBase64,Je as uint8ArrayToNumberArray,K as unfollowUser,b as updateUrlParams,Xe as uploadFile,ye as uploadToS3WithPresignedUrl,Ge as usePageLifecycle,Ze as useRouter,ve as validatePasswordPair,Me as withInspectorMeta};
|