@funhub/platform 0.1.106 → 0.1.107

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,2 +1,2 @@
1
1
 
2
- "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pCommunityMoveCollectionContent as t}from"../../../../../service/generated/client.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import{useLoginModalStore as i}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as a}from"../../../../../hooks/query/use-query.mjs";import{debounceFun as o}from"../../../../../utils/tools.mjs";import s from"../../../../common/interaction-animations.module.mjs";import c from"../../../../common/collection-popup/index.mjs";import l from"../../../../common/share-popup/share-popup.mjs";import{useContentOperate as u}from"../../../../../hooks/use-content-operate.mjs";import d from"../../../../../assets/icons/detail/check-ok.mjs";import f from"../../../../../assets/icons/detail/collect_nor.mjs";import p from"../../../../../assets/icons/detail/collect_sel.mjs";import ee from"../../../../../assets/icons/detail/give_like.mjs";import m from"../../../../../assets/icons/detail/give_like_sel.mjs";import te from"../../../../../assets/icons/detail/share.mjs";import{useCallback as h,useEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";import{usePathname as w,useSearchParams as ne}from"next/navigation";function T({mode:T=`renderer`,information:O,onUpdate:k}){let A=T===`editor`||!O?.id||O.id.startsWith(`preview-`),j=`${w()}?${ne()?.toString()||``}`,M=v(j),N=C(`components.biz.business.detail`),[P,F]=y(!1),[I,L]=y(!1),R=v(0),z=e(e=>e.userId),B=e(e=>e.isLogin),V=a();g(()=>{M.current!==j&&(l.clear(),M.current=j)},[j]),g(()=>()=>{l.clear()},[]);let H=h(()=>{z&&(V([`user-profile`,`mine`,z,`user-like-video`]),V([`user-profile`,`mine`,z,`user-like-post`]),V([`user-profile`,`mine`,z,`user-collect-video`,z]),V([`user-profile`,`mine`,z,`user-collect-post`,z]))},[V,z]),{likeAnimation:U,handleLikeOperate:W,handleDefaultCollectionOperate:G,handleShareOperate:K}=u({id:O.id,isLike:O.like||!1,isDislike:O.dislike||!1,isCollect:O.collect||!1,likeCnt:D(O.static?.like_cnt),dislikeCnt:D(O.static?.dislike_cnt),contentType:O.content_type,prefetchDefaultCollection:!A,animationClasses:{like:s.likeShakeAnimation,dislike:s.dislikeShakeAnimation}}),q=h(e=>{k?.({...e})},[k]),J=h(async()=>{if(P)return;if(!B){i.getState().open();return}let e=Date.now();if(e-R.current<300)return;R.current=e,F(!0);let t=O.like||!1,n=O.dislike||!1,r=D(O.static?.like_cnt),a=D(O.static?.dislike_cnt),o=!t,s=Math.max(0,r+(o?1:-1)),c=o?!1:n,l=o&&n?Math.max(0,a-1):a;q({like:o,dislike:c,static:{...O.static,like_cnt:s,dislike_cnt:l}});try{let e=await W();if(!e){q({like:t,dislike:n,static:{...O.static,like_cnt:r,dislike_cnt:a}});return}q({like:e.isLike,dislike:e.isDislike??c,static:{...O.static,like_cnt:e.likeCnt,dislike_cnt:e.dislikeCnt??l}}),H(),window.sensors?.track?.(`detail_like_click`,{object_id:O.id,action:e.isLike?`点赞`:`取消点赞`,like_count:e.likeCnt})}catch(e){console.error(`点赞操作失败:`,e),S.error(N(`detailOperate.operateFailed`))}finally{F(!1)}},[W,O,H,P,B,N,q]),Y=_(()=>O.id,[O.id]),X=h(()=>{K(({isCollect:e})=>{q({collect:e})},Y)},[K,Y,q]),Z=h(()=>{c.show({mode:`select`,onCollect:async e=>{try{let n=await t({new_collection_id:e,content_id:O.id});if(n.code!==0)throw Error(n.message||N(`detailOperate.collectFailed`));q({collect:!0}),H(),S.success(N(`detailOperate.modifyCollectionSuccess`))}catch(e){console.error(`修改收藏夹失败:`,e),S.error(N(`detailOperate.collectFailed`))}}})},[O.id,H,N,q]),Q=h(e=>{let t=e||N(`detailOperate.defaultCollection`);S.custom(e=>x(`div`,{className:`flex items-center justify-between gap-[16px] px-[16px] py-[12px] rounded-[12px] bg-black text-white shadow-lg min-w-[280px]`,children:[x(`div`,{className:`flex items-center gap-[10px]`,children:[b(`div`,{className:`w-[24px] h-[24px] rounded-full bg-white flex items-center justify-center`,children:b(d,{className:`w-[14px] h-[14px]`})}),x(`div`,{className:`flex items-center gap-[6px]`,children:[b(`span`,{className:`text-[14px] leading-[20px]`,children:N(`detailOperate.collectAdded`)}),b(`span`,{className:`text-[14px] leading-[20px] font-semibold`,children:t})]})]}),b(`button`,{type:`button`,className:`text-[14px] text-theme5 font-semibold`,onClick:()=>{S.dismiss(e),Z()},children:N(`detailOperate.modifyCollection`)})]}))},[Z,N]),$=h(async()=>{if(I)return;if(!B){i.getState().open();return}let e=O.collect||!1;L(!0),window.sensors?.track?.(`detail_fav_click`,{object_id:O.id,action:e?`取消收藏`:`收藏`});try{let t=await G({currentCollect:e,onUpdate:({isCollect:e})=>{q({collect:e})}});if(!t?.success){S.error(t?.message||N(`detailOperate.collectFailed`));return}H(),window.sensors?.track?.(`detail_fav_click`,{object_id:O.id,action:t.isCollect?`收藏`:`取消收藏`}),!e&&t.isCollect&&Q(t.collectionTitle),e&&t.isCollect===!1&&S.success(N(`detailOperate.uncollectSuccess`))}catch(e){console.error(`收藏操作失败:`,e),S.error(e?.message||N(`detailOperate.collectFailed`))}finally{L(!1)}},[G,O.collect,O.id,H,I,B,Q,N,q]),re=_(()=>o($,300),[$]);return x(n,{className:`w-full h-[42px] mt-[16px] flex items-center justify-between ${A?`pointer-events-none`:``}`,children:[x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${P?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:J,children:[O.like?b(m,{className:`w-[20px] h-[20px] ${U.animationClass}`}):b(ee,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:O.static?O.static.like_cnt===0?N(`detailOperate.like`):E(O.static?.like_cnt):N(`detailOperate.like`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${I?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:re,children:[O.collect?b(p,{className:`w-[20px] h-[20px]`}):b(f,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:N(`detailOperate.collection`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center cursor-pointer`,onClick:X,children:[b(te,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:N(`detailOperate.share`)})]})]})}function E(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function D(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}export{T as DetailOperate};
2
+ "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pCommunityMoveCollectionContent as t}from"../../../../../service/generated/client.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import{useLoginModalStore as i}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as a}from"../../../../../hooks/query/use-query.mjs";import{debounceFun as o}from"../../../../../utils/tools.mjs";import s from"../../../../common/interaction-animations.module.mjs";import c from"../../../../common/collection-popup/index.mjs";import l from"../../../../common/share-popup/share-popup.mjs";import{useContentOperate as u}from"../../../../../hooks/use-content-operate.mjs";import d from"../../../../../assets/icons/detail/check-ok.mjs";import f from"../../../../../assets/icons/detail/collect_nor.mjs";import p from"../../../../../assets/icons/detail/collect_sel.mjs";import ee from"../../../../../assets/icons/detail/give_like.mjs";import m from"../../../../../assets/icons/detail/give_like_sel.mjs";import te from"../../../../../assets/icons/detail/share.mjs";import{useCallback as h,useEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";import{usePathname as w,useSearchParams as ne}from"next/navigation";function T({mode:T=`renderer`,information:O,onUpdate:k}){let A=T===`editor`||!O?.id||O.id.startsWith(`preview-`),j=`${w()}?${ne()?.toString()||``}`,M=v(j),N=C(`components.biz.business.detail`),[P,F]=y(!1),[I,L]=y(!1),R=v(0),z=e(e=>e.userId),B=e(e=>e.isLogin),V=a();g(()=>{M.current!==j&&(l.clear(),M.current=j)},[j]),g(()=>()=>{l.clear()},[]);let H=h(()=>{z&&(V([`user-profile`,`mine`,z,`user-like-video`]),V([`user-profile`,`mine`,z,`user-like-post`]),V([`user-profile`,`mine`,z,`user-collect-video`,z]),V([`user-profile`,`mine`,z,`user-collect-post`,z]))},[V,z]),{likeAnimation:U,handleLikeOperate:W,handleDefaultCollectionOperate:G,handleShareOperate:K}=u({id:O.id,isLike:O.like||!1,isDislike:O.dislike||!1,isCollect:O.collect||!1,likeCnt:D(O.static?.like_cnt),dislikeCnt:D(O.static?.dislike_cnt),contentType:1,prefetchDefaultCollection:!A,animationClasses:{like:s.likeShakeAnimation,dislike:s.dislikeShakeAnimation}}),q=h(e=>{k?.({...e})},[k]),J=h(async()=>{if(P)return;if(!B){i.getState().open();return}let e=Date.now();if(e-R.current<300)return;R.current=e,F(!0);let t=O.like||!1,n=O.dislike||!1,r=D(O.static?.like_cnt),a=D(O.static?.dislike_cnt),o=!t,s=Math.max(0,r+(o?1:-1)),c=o?!1:n,l=o&&n?Math.max(0,a-1):a;q({like:o,dislike:c,static:{...O.static,like_cnt:s,dislike_cnt:l}});try{let e=await W();if(!e){q({like:t,dislike:n,static:{...O.static,like_cnt:r,dislike_cnt:a}});return}q({like:e.isLike,dislike:e.isDislike??c,static:{...O.static,like_cnt:e.likeCnt,dislike_cnt:e.dislikeCnt??l}}),H(),window.sensors?.track?.(`detail_like_click`,{object_id:O.id,action:e.isLike?`点赞`:`取消点赞`,like_count:e.likeCnt})}catch(e){console.error(`点赞操作失败:`,e),S.error(N(`detailOperate.operateFailed`))}finally{F(!1)}},[W,O,H,P,B,N,q]),Y=_(()=>O.id,[O.id]),X=h(()=>{K(({isCollect:e})=>{q({collect:e})},Y)},[K,Y,q]),Z=h(()=>{c.show({mode:`select`,onCollect:async e=>{try{let n=await t({new_collection_id:e,content_id:O.id});if(n.code!==0)throw Error(n.message||N(`detailOperate.collectFailed`));q({collect:!0}),H(),S.success(N(`detailOperate.modifyCollectionSuccess`))}catch(e){console.error(`修改收藏夹失败:`,e),S.error(N(`detailOperate.collectFailed`))}}})},[O.id,H,N,q]),Q=h(e=>{let t=e||N(`detailOperate.defaultCollection`);S.custom(e=>x(`div`,{className:`flex items-center justify-between gap-[16px] px-[16px] py-[12px] rounded-[12px] bg-black text-white shadow-lg min-w-[280px]`,children:[x(`div`,{className:`flex items-center gap-[10px]`,children:[b(`div`,{className:`w-[24px] h-[24px] rounded-full bg-white flex items-center justify-center`,children:b(d,{className:`w-[14px] h-[14px]`})}),x(`div`,{className:`flex items-center gap-[6px]`,children:[b(`span`,{className:`text-[14px] leading-[20px]`,children:N(`detailOperate.collectAdded`)}),b(`span`,{className:`text-[14px] leading-[20px] font-semibold`,children:t})]})]}),b(`button`,{type:`button`,className:`text-[14px] text-theme5 font-semibold`,onClick:()=>{S.dismiss(e),Z()},children:N(`detailOperate.modifyCollection`)})]}))},[Z,N]),$=h(async()=>{if(I)return;if(!B){i.getState().open();return}let e=O.collect||!1;L(!0),window.sensors?.track?.(`detail_fav_click`,{object_id:O.id,action:e?`取消收藏`:`收藏`});try{let t=await G({currentCollect:e,onUpdate:({isCollect:e})=>{q({collect:e})}});if(!t?.success){S.error(t?.message||N(`detailOperate.collectFailed`));return}H(),window.sensors?.track?.(`detail_fav_click`,{object_id:O.id,action:t.isCollect?`收藏`:`取消收藏`}),!e&&t.isCollect&&Q(t.collectionTitle),e&&t.isCollect===!1&&S.success(N(`detailOperate.uncollectSuccess`))}catch(e){console.error(`收藏操作失败:`,e),S.error(e?.message||N(`detailOperate.collectFailed`))}finally{L(!1)}},[G,O.collect,O.id,H,I,B,Q,N,q]),re=_(()=>o($,300),[$]);return x(n,{className:`w-full h-[42px] mt-[16px] flex items-center justify-between ${A?`pointer-events-none`:``}`,children:[x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${P?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:J,children:[O.like?b(m,{className:`w-[20px] h-[20px] ${U.animationClass}`}):b(ee,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:O.static?O.static.like_cnt===0?N(`detailOperate.like`):E(O.static?.like_cnt):N(`detailOperate.like`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center ${I?`opacity-50 cursor-not-allowed`:`cursor-pointer`}`,onClick:re,children:[O.collect?b(p,{className:`w-[20px] h-[20px]`}):b(f,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:N(`detailOperate.collection`)})]}),x(n,{className:`w-[25%] h-full flex flex-col items-center justify-center cursor-pointer`,onClick:X,children:[b(te,{className:`w-[20px] h-[20px] text-text2`}),b(r,{className:`text-[12px] text-text2 leading-[20px]`,children:N(`detailOperate.share`)})]})]})}function E(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function D(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}export{T as DetailOperate};
@@ -58,13 +58,13 @@ declare const videoDetailMaterials: MaterialMap<readonly [DefineMaterialOption<t
58
58
  items: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
59
59
  contentId: z$1.ZodString;
60
60
  coverMode: z$1.ZodOptional<z$1.ZodEnum<{
61
- upload: "upload";
62
61
  content: "content";
62
+ upload: "upload";
63
63
  }>>;
64
64
  coverUrl: z$1.ZodOptional<z$1.ZodString>;
65
65
  titleMode: z$1.ZodOptional<z$1.ZodEnum<{
66
- custom: "custom";
67
66
  content: "content";
67
+ custom: "custom";
68
68
  }>>;
69
69
  title: z$1.ZodOptional<z$1.ZodString>;
70
70
  description: z$1.ZodOptional<z$1.ZodString>;
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRequest as t}from"../../../../../hooks/query/use-query.mjs";import{createContext as n,use as r,useCallback as i,useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";import{useParams as s,useRouter as c}from"next/navigation";const l=n(void 0);function u(e,t){if(!(!e&&!t))return{information:e?.information??t?.information,currentSeriesNum:e?.currentSeriesNum??t?.currentSeriesNum,onEpisodeChange:e?.onEpisodeChange??t?.onEpisodeChange,onUpdateInformation:e?.onUpdateInformation??t?.onUpdateInformation,detailId:e?.detailId??t?.detailId,episodeIndex:e?.episodeIndex??t?.episodeIndex,resumeProgressSeconds:e?.resumeProgressSeconds??t?.resumeProgressSeconds,isShow:e?.isShow??t?.isShow,isWebView:e?.isWebView??t?.isWebView,isInformationLoading:e?.isInformationLoading??t?.isInformationLoading,isInformationResolved:e?.isInformationResolved??t?.isInformationResolved}}function d({value:e,children:t}){let n=r(l);return o(l,{value:a(()=>u(n,e)??e,[n,e]),children:t})}function f(){let e=r(l),t=p({enabled:e===void 0||e.onEpisodeChange===void 0||e.detailId===void 0||e.currentSeriesNum===void 0||e.episodeIndex===void 0||e.isInformationLoading===void 0||e.isInformationResolved===void 0,shouldRequestInformation:!e?.information});return a(()=>{let n=u(e,t);return n&&(e&&t&&e.onEpisodeChange===void 0?{...n,currentSeriesNum:t.currentSeriesNum??n.currentSeriesNum,episodeIndex:t.episodeIndex??n.episodeIndex,onEpisodeChange:t.onEpisodeChange??n.onEpisodeChange}:n)},[e,t])}function p(n){let{enabled:r,shouldRequestInformation:o}=n,l=s(),u=c(),d=l.level,f=Array.isArray(d)?d:typeof d==`string`?[d]:[],p=f[0]||``,m=f.findIndex(e=>e===`episode`),h=m>=0?f[m+1]:f[2],g=Math.max(1,Number(h)||1),_=Math.max(0,g-1),v=f[1]||``,y=typeof window<`u`&&(window.isWebView===!0||window.isWebview===!0),{data:b,isPending:x,isFetching:S,isError:C,isSuccess:w}=t([`video-detail-material-fallback`,p],async()=>p?await e({id:p}):null,{enabled:r&&o&&!!p}),T=a(()=>{let e=b?.data?.video;if(!(!e||typeof e!=`object`))return{...e,content_type:0,episode_cnt:e.links?.length||0}},[b?.data?.video]),E=i(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(!p||typeof window>`u`)return;let n=`${y?`/webview`:`/video`}/${p}/${encodeURIComponent(v)}/episode/${t}`,{search:r,hash:i,pathname:a}=window.location,o=`${a}${r}${i}`,s=`${n}${r}${i}`;o!==s&&u.replace(s,{scroll:!1})},[p,y,v,u]);if(r)return{information:T,currentSeriesNum:g,onEpisodeChange:E,detailId:p,episodeIndex:_,resumeProgressSeconds:0,isShow:!0,isWebView:y,isInformationLoading:o?!!p&&!T&&(x||S):!1,isInformationResolved:!p||!!T||!o||C||w}}export{d as VideoDetailMaterialRuntimeProvider,f as useVideoDetailMaterialRuntimeContext};
2
+ "use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRequest as t}from"../../../../../hooks/query/use-query.mjs";import{createContext as n,use as r,useCallback as i,useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";import{useParams as s,useRouter as c}from"next/navigation";const l=n(void 0);function u(e,t){if(!(!e&&!t))return{information:e?.information??t?.information,currentSeriesNum:e?.currentSeriesNum??t?.currentSeriesNum,onEpisodeChange:e?.onEpisodeChange??t?.onEpisodeChange,onUpdateInformation:e?.onUpdateInformation??t?.onUpdateInformation,detailId:e?.detailId??t?.detailId,episodeIndex:e?.episodeIndex??t?.episodeIndex,resumeProgressSeconds:e?.resumeProgressSeconds??t?.resumeProgressSeconds,isShow:e?.isShow??t?.isShow,isWebView:e?.isWebView??t?.isWebView,isInformationLoading:e?.isInformationLoading??t?.isInformationLoading,isInformationResolved:e?.isInformationResolved??t?.isInformationResolved}}function d({value:e,children:t}){let n=r(l);return o(l,{value:a(()=>u(n,e)??e,[n,e]),children:t})}function f(){let e=r(l),t=p({enabled:e===void 0||e.onEpisodeChange===void 0||e.detailId===void 0||e.currentSeriesNum===void 0||e.episodeIndex===void 0||e.isInformationLoading===void 0||e.isInformationResolved===void 0,shouldRequestInformation:!e?.information});return a(()=>{let n=u(e,t);return n&&(e&&t&&e.onEpisodeChange===void 0?{...n,currentSeriesNum:t.currentSeriesNum??n.currentSeriesNum,episodeIndex:t.episodeIndex??n.episodeIndex,onEpisodeChange:t.onEpisodeChange??n.onEpisodeChange}:n)},[e,t])}function p(n){let{enabled:r,shouldRequestInformation:o}=n,l=s(),u=c(),d=l.level,f=Array.isArray(d)?d:typeof d==`string`?[d]:[],p=f[0]||``,m=f.findIndex(e=>e===`episode`),h=m>=0?f[m+1]:f[2],g=Math.max(1,Number(h)||1),_=Math.max(0,g-1),v=f[1]||``,y=typeof window<`u`&&(window.isWebView===!0||window.isWebview===!0),{data:b,isPending:x,isFetching:S,isError:C,isSuccess:w}=t([`video-detail-material-fallback`,p],async()=>p?await e({id:p}):null,{enabled:r&&o&&!!p}),T=a(()=>{let e=b?.data?.video;if(!(!e||typeof e!=`object`))return{...e,content_type:1,episode_cnt:e.links?.length||0}},[b?.data?.video]),E=i(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(!p||typeof window>`u`)return;let n=`${y?`/webview`:`/video`}/${p}/${encodeURIComponent(v)}/episode/${t}`,{search:r,hash:i,pathname:a}=window.location,o=`${a}${r}${i}`,s=`${n}${r}${i}`;o!==s&&u.replace(s,{scroll:!1})},[p,y,v,u]);if(r)return{information:T,currentSeriesNum:g,onEpisodeChange:E,detailId:p,episodeIndex:_,resumeProgressSeconds:0,isShow:!0,isWebView:y,isInformationLoading:o?!!p&&!T&&(x||S):!1,isInformationResolved:!p||!!T||!o||C||w}}export{d as VideoDetailMaterialRuntimeProvider,f as useVideoDetailMaterialRuntimeContext};
@@ -1,2 +1,2 @@
1
1
 
2
- import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{cache as t}from"react";function n(e){if(!e||typeof e!=`object`)return null;let t=e,n=Array.isArray(t.links)?t.links:[];return{...t,mid:String(t.mid||t.id||``),content_type:0,episode_cnt:n.length}}const r=t(async t=>{let r=String(t||``).trim();if(!r)return null;try{return n((await e({id:r},{revalidate:86400,tags:[`video-detail:ssr:${r}`]})).data?.video)}catch(e){return console.error(`详情物料服务端获取视频详情失败`,e),null}});async function i(e){let t=String(e||``).trim();return t?await r(t):null}export{i as getVideoDetailServerInformation};
2
+ import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{cache as t}from"react";function n(e){if(!e||typeof e!=`object`)return null;let t=e,n=Array.isArray(t.links)?t.links:[];return{...t,mid:String(t.mid||t.id||``),content_type:1,episode_cnt:n.length}}const r=t(async t=>{let r=String(t||``).trim();if(!r)return null;try{return n((await e({id:r},{revalidate:86400,tags:[`video-detail:ssr:${r}`]})).data?.video)}catch(e){return console.error(`详情物料服务端获取视频详情失败`,e),null}});async function i(e){let t=String(e||``).trim();return t?await r(t):null}export{i as getVideoDetailServerInformation};
@@ -21,13 +21,13 @@ declare const videoDetailRecommendMaterial: DefineMaterialOption<typeof VideoDet
21
21
  items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
22
22
  contentId: zod.ZodString;
23
23
  coverMode: zod.ZodOptional<zod.ZodEnum<{
24
- upload: "upload";
25
24
  content: "content";
25
+ upload: "upload";
26
26
  }>>;
27
27
  coverUrl: zod.ZodOptional<zod.ZodString>;
28
28
  titleMode: zod.ZodOptional<zod.ZodEnum<{
29
- custom: "custom";
30
29
  content: "content";
30
+ custom: "custom";
31
31
  }>>;
32
32
  title: zod.ZodOptional<zod.ZodString>;
33
33
  description: zod.ZodOptional<zod.ZodString>;
@@ -17,13 +17,13 @@ declare const videoDetailRecommendInspectorPropsSchema: z$1.ZodObject<{
17
17
  items: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
18
18
  contentId: z$1.ZodString;
19
19
  coverMode: z$1.ZodOptional<z$1.ZodEnum<{
20
- upload: "upload";
21
20
  content: "content";
21
+ upload: "upload";
22
22
  }>>;
23
23
  coverUrl: z$1.ZodOptional<z$1.ZodString>;
24
24
  titleMode: z$1.ZodOptional<z$1.ZodEnum<{
25
- custom: "custom";
26
25
  content: "content";
26
+ custom: "custom";
27
27
  }>>;
28
28
  title: z$1.ZodOptional<z$1.ZodString>;
29
29
  description: z$1.ZodOptional<z$1.ZodString>;
@@ -23,14 +23,14 @@ declare const homeRecommendGridInspectorPropsSchema: z$1.ZodObject<{
23
23
  items: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
24
24
  contentId: z$1.ZodString;
25
25
  coverMode: z$1.ZodOptional<z$1.ZodEnum<{
26
- upload: "upload";
27
26
  content: "content";
27
+ upload: "upload";
28
28
  }>>;
29
29
  coverUrl: z$1.ZodOptional<z$1.ZodString>;
30
30
  badge_url: z$1.ZodOptional<z$1.ZodString>;
31
31
  titleMode: z$1.ZodOptional<z$1.ZodEnum<{
32
- custom: "custom";
33
32
  content: "content";
33
+ custom: "custom";
34
34
  }>>;
35
35
  title: z$1.ZodOptional<z$1.ZodString>;
36
36
  description: z$1.ZodOptional<z$1.ZodString>;
@@ -23,14 +23,14 @@ declare const homeRecommendGridMaterial: DefineMaterialOption<typeof HomeRecomme
23
23
  items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
24
24
  contentId: zod.ZodString;
25
25
  coverMode: zod.ZodOptional<zod.ZodEnum<{
26
- upload: "upload";
27
26
  content: "content";
27
+ upload: "upload";
28
28
  }>>;
29
29
  coverUrl: zod.ZodOptional<zod.ZodString>;
30
30
  badge_url: zod.ZodOptional<zod.ZodString>;
31
31
  titleMode: zod.ZodOptional<zod.ZodEnum<{
32
- custom: "custom";
33
32
  content: "content";
33
+ custom: "custom";
34
34
  }>>;
35
35
  title: zod.ZodOptional<zod.ZodString>;
36
36
  description: zod.ZodOptional<zod.ZodString>;
@@ -21,14 +21,14 @@ declare const homeRecommendWaterfallInspectorPropsSchema: z$1.ZodObject<{
21
21
  items: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
22
22
  contentId: z$1.ZodString;
23
23
  coverMode: z$1.ZodOptional<z$1.ZodEnum<{
24
- upload: "upload";
25
24
  content: "content";
25
+ upload: "upload";
26
26
  }>>;
27
27
  coverUrl: z$1.ZodOptional<z$1.ZodString>;
28
28
  badge_url: z$1.ZodOptional<z$1.ZodString>;
29
29
  titleMode: z$1.ZodOptional<z$1.ZodEnum<{
30
- custom: "custom";
31
30
  content: "content";
31
+ custom: "custom";
32
32
  }>>;
33
33
  title: z$1.ZodOptional<z$1.ZodString>;
34
34
  showPlayCount: z$1.ZodOptional<z$1.ZodBoolean>;
@@ -21,14 +21,14 @@ declare const homeRecommendWaterfallMaterial: DefineMaterialOption<typeof HomeRe
21
21
  items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
22
22
  contentId: zod.ZodString;
23
23
  coverMode: zod.ZodOptional<zod.ZodEnum<{
24
- upload: "upload";
25
24
  content: "content";
25
+ upload: "upload";
26
26
  }>>;
27
27
  coverUrl: zod.ZodOptional<zod.ZodString>;
28
28
  badge_url: zod.ZodOptional<zod.ZodString>;
29
29
  titleMode: zod.ZodOptional<zod.ZodEnum<{
30
- custom: "custom";
31
30
  content: "content";
31
+ custom: "custom";
32
32
  }>>;
33
33
  title: zod.ZodOptional<zod.ZodString>;
34
34
  showPlayCount: zod.ZodOptional<zod.ZodBoolean>;
@@ -19,7 +19,7 @@ declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof
19
19
  }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
20
20
  click: zod.ZodObject<{
21
21
  readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
22
- readonly redirectType: zod.ZodOptional<zod.ZodType<"link" | "content" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"link" | "content" | "content_list", unknown>>> & SchemaHasDefaultValue;
22
+ readonly redirectType: zod.ZodOptional<zod.ZodType<"content" | "link" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
23
23
  readonly link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
24
24
  }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
25
25
  close: zod.ZodObject<{
@@ -23,7 +23,7 @@ declare const marqueeInspectorPropsSchema: z.ZodObject<{
23
23
  }, z.core.$strip>> & SchemaHasDefaultValue;
24
24
  click: z.ZodObject<{
25
25
  readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
26
- readonly redirectType: z.ZodOptional<z.ZodType<"link" | "content" | "content_list", unknown, z.core.$ZodTypeInternals<"link" | "content" | "content_list", unknown>>> & SchemaHasDefaultValue;
26
+ readonly redirectType: z.ZodOptional<z.ZodType<"content" | "link" | "content_list", unknown, z.core.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
27
27
  readonly link: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
28
28
  }, z.core.$strip> & SchemaHasDefaultValue;
29
29
  close: z.ZodObject<{
@@ -210,7 +210,6 @@ import e from"../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-
210
210
 
211
211
  .style-module_videoBox__4Gmdw .xg-time-left {
212
212
  margin-right: 0 !important;
213
- line-height: 40px !important;
214
213
  }
215
214
 
216
215
  .style-module_videoBox__4Gmdw .xg-time-left::after {
@@ -220,7 +219,6 @@ import e from"../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-
220
219
  .style-module_videoBox__4Gmdw .xg-time-right {
221
220
  margin-right: 16px !important;
222
221
  margin-left: 0 !important;
223
- line-height: 40px !important;
224
222
  }
225
223
 
226
224
  .style-module_videoBox__4Gmdw .xg-seek-icon {
@@ -1,2 +1,2 @@
1
1
 
2
- import{gContentGetVideoDetail as e}from"../../../service/generated/client.mjs";import{normalizeEpisodeNumber as t,warmupProcessM3u8Auto as n}from"../../common/video-player/process-m3u8-cache.mjs";import{HydrationBoundary as r}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as i}from"../../../constants/revalidate.mjs";import{DetailStructuredData as a}from"../../biz/business/detail/shared/detail-structured-data.mjs";import o from"./video-detail-client.mjs";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";async function u({params:u,isWebView:d=!1,materialConfig:f}){let{level:p}=await u,m=p?.[0]||``,h=p.findIndex(e=>e===`episode`),g=t(h>=0?p?.[h+1]:void 0,1),_=null,v=null;if(m){_=await e({id:m},{revalidate:i.TIME});let t=_?.data?.video;t&&typeof t==`object`&&(await n(t.links,g),v={...t,mid:t.mid||t.id||``,content_type:0,episode_cnt:t.links?.length||0})}return l(s,{children:[v&&c(a,{information:v,detailId:m}),c(r,{prefetch:m&&_?[{queryKey:[`video-detail`,m],queryFn:()=>Promise.resolve(_)}]:[],children:c(o,{detailId:m,isWebView:d,materialConfig:f})})]})}export{u as default};
2
+ import{gContentGetVideoDetail as e}from"../../../service/generated/client.mjs";import{normalizeEpisodeNumber as t,warmupProcessM3u8Auto as n}from"../../common/video-player/process-m3u8-cache.mjs";import{HydrationBoundary as r}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as i}from"../../../constants/revalidate.mjs";import{DetailStructuredData as a}from"../../biz/business/detail/shared/detail-structured-data.mjs";import o from"./video-detail-client.mjs";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";async function u({params:u,isWebView:d=!1,materialConfig:f}){let{level:p}=await u,m=p?.[0]||``,h=p.findIndex(e=>e===`episode`),g=t(h>=0?p?.[h+1]:void 0,1),_=null,v=null;if(m){_=await e({id:m},{revalidate:i.TIME});let t=_?.data?.video;t&&typeof t==`object`&&(await n(t.links,g),v={...t,mid:t.mid||t.id||``,content_type:1,episode_cnt:t.links?.length||0})}return l(s,{children:[v&&c(a,{information:v,detailId:m}),c(r,{prefetch:m&&_?[{queryKey:[`video-detail`,m],queryFn:()=>Promise.resolve(_)}]:[],children:c(o,{detailId:m,isWebView:d,materialConfig:f})})]})}export{u as default};
@@ -1,2 +1,2 @@
1
1
 
2
- import{useUserStore as e}from"../store/modules/user-store.mjs";import{gCommunityGetUserCollections as t,pCommunityAddContentToCollection as n,pInteractionBatchQueryContentInteractions as r,pInteractionCancelDislike as i,pInteractionCancelLike as a,pInteractionDislike as o,pInteractionLike as s,pInteractionRemoveCollect as c}from"../service/generated/client.mjs";import{useLoginModalStore as l}from"../store/modules/login-modal-store.mjs";import u from"../components/common/collection-popup/index.mjs";import d from"../components/common/share-popup/share-popup.mjs";import{useInteractionAnimation as f}from"./use-interaction-animation.mjs";import{useCallback as p,useEffect as m,useMemo as h,useState as g}from"react";import{toast as _}from"sonner";import{usePathname as v,useRouter as y,useSearchParams as b}from"next/navigation";function x(e){let t=Number(e);if(Number.isFinite(t))return t===0?1:t}function S(){let t=e.getState().userId||e.getState().userInfo?.userId;if(!t){let{open:e}=l.getState();return e(),null}return t}async function C(t,n){try{let i=e.getState().userId||e.getState().userInfo?.userId;if(!i)return console.warn(`用户未登录,无法查询交互状态`),null;let a=await r({app_id:0,user_id:i,content_ids:t,content_type:n});return a.code===0?a.data:(console.error(`查询交互状态失败:`,a.message),null)}catch(e){return console.error(`查询交互状态异常:`,e),null}}async function ee(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await s({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`点赞失败`}}catch(e){return console.error(`点赞失败:`,e),{success:!1,message:`点赞失败`}}}async function w(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await a({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`取消点赞失败`}}catch(e){return console.error(`取消点赞失败:`,e),{success:!1,message:`取消点赞失败`}}}async function T(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await o({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`点踩失败`}}catch(e){return console.error(`点踩异常:`,e),{success:!1,message:`点踩异常`}}}async function E(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await i({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`取消点踩失败`}}catch(e){return console.error(`取消点踩异常:`,e),{success:!1,message:`取消点踩异常`}}}function D({id:r,isLike:i,isDislike:a,isCollect:o,likeCnt:s,dislikeCnt:S,contentType:C,animationClasses:D,copyUrl:O,prefetchDefaultCollection:k=!1}){let{isLogin:A,userInfo:j,userId:M}=e(),N=y(),P=v(),F=b()?.toString()||``,[I,L]=g(void 0),R=D?.like||`like-shake-animation`,z=D?.dislike||`dislike-shake-animation`,B=h(()=>String(M||j?.userId||``),[M,j?.userId]);m(()=>{L(void 0)},[B]);let[V,H]=g(!1),[U,W]=g(!1);m(()=>{d.clear(),u.clear()},[P,F]),m(()=>()=>{d.clear(),u.clear()},[]);let G=p(async()=>{if(!A||!B)return null;try{let e=await t({page:1,page_size:40});if(e.code!==0)return L(null),null;let n=(e.data?.data?.collections??[]).find(e=>e?.is_default),r=(typeof n?.title==`string`?n.title.trim():``)||null;return L(r),r}catch(e){return console.error(`获取默认收藏夹失败:`,e),L(null),null}},[A,B]);m(()=>{!A||!B||k&&I===void 0&&G()},[I,G,A,k,B]);let K=p(()=>{if(!A){let{open:e}=l.getState();return e(),!1}return!0},[A]),q=f(),J=f(),Y=p(async e=>{try{return e?await ee(r,C):await w(r,C)}catch(e){return console.error(`点赞操作失败`,e),{success:!1,message:`点赞操作失败`}}},[r,C]),X=p(async()=>{if(!(!K()||V)){H(!0);try{let e=!i;e&&q.trigger(R);let t={isLike:e,likeCnt:Math.max(0,s+(e?1:-1))};e&&a&&(t.isDislike=!1,t.dislikeCnt=Math.max(0,S-1));let n=await Y(e);if(!n.success){_.error(n.message||`点赞失败`);return}return t}finally{H(!1)}}},[q,i,a,s,S,Y,K,V,R]),Z=p(async e=>{try{return e?await T(r,C):await E(r,C)}catch(e){return console.error(`点踩操作失败`,e),{success:!1,message:`点踩操作失败`}}},[r,C]),te=p(async()=>{if(!(!K()||U)){W(!0);try{let e=!a;e&&J.trigger(z);let t={isDislike:e,dislikeCnt:Math.max(0,S+(e?1:-1))};e&&i&&(t.isLike=!1,t.likeCnt=Math.max(0,s-1));let n=await Z(e);if(!n.success){_.error(n.message||`操作失败`);return}return t}finally{W(!1)}}},[J,i,a,s,S,Z,K,U,z]),Q=p(async({currentId:e,isCancel:t,collectionIds:r})=>{try{if(t){let t=String(M||j?.userId||``);if(!t)return{success:!1};let n=await c({app_id:0,user_id:t,content_id:e,content_type:C});return n.code===0?{success:!0}:{success:!1,message:n.message}}if(!String(M||j?.userId||``))return{success:!1};let i=r?.[0],a=x(C),o=await n({...i?{collection_id:i}:{},content_id:e,...a===void 0?{}:{source_type:a}});return o.code===0?{success:!0}:{success:!1,message:o.message}}catch(e){return console.error(`取消收藏操作失败`,e),{success:!1,message:e?.message}}},[M,j?.userId,C]),$=p(({currentCollect:e,onUpdate:t})=>K()?(e?(async()=>{let e=await Q({currentId:r,isCancel:!0});if(!e?.success){_.error(e?.message||`操作失败`);return}t({isCollect:!1})})():(d.clear(),u.show({toCreateCollection:()=>{N.push(`/collection/create?information_id=${r}`)},onCollect:e=>{(async()=>{let n=await Q({currentId:r,isCancel:!1,collectionIds:[e]});if(!n?.success){_.error(n?.message||`操作失败`);return}t({isCollect:!0})})()}})),!0):!1,[r,N,K,Q]),ne=p(async({currentCollect:e,onUpdate:t})=>{if(!K())return;if(e){let e=await Q({currentId:r,isCancel:!0});return e?.success?(t({isCollect:!1}),{success:!0,isCollect:!1}):{success:!1,message:e?.message}}d.clear(),u.clear();let n=await Q({currentId:r,isCancel:!1});if(!n?.success)return{success:!1,message:n?.message};let i=I===void 0?await G():I;return t({isCollect:!0}),{success:!0,isCollect:!0,collectionTitle:i||void 0}},[I,G,Q,r,K]);return{likeAnimation:q,dislikeAnimation:J,handleLikeOperate:X,handleDislikeOperate:te,handleShareOperate:p((e,t)=>{let n=typeof t==`string`?{otherId:t}:t,i=n?.otherId||r,a=n?.shareUrl;d.show({copyUrl:O,data:{id:r,isCollect:o,parentId:i},...a?{shareUrl:a}:{},onCollect:t=>{$({currentCollect:t,onUpdate:e})}})},[r,o,$,O]),handleToCollectionOperate:$,handleDefaultCollectionOperate:ne}}export{C as batchQueryContentInteractions,D as useContentOperate};
2
+ import{useUserStore as e}from"../store/modules/user-store.mjs";import{gCommunityGetUserCollections as t,pCommunityAddContentToCollection as n,pInteractionBatchQueryContentInteractions as r,pInteractionCancelDislike as i,pInteractionCancelLike as a,pInteractionDislike as o,pInteractionLike as s,pInteractionRemoveCollect as c}from"../service/generated/client.mjs";import{useLoginModalStore as l}from"../store/modules/login-modal-store.mjs";import u from"../components/common/collection-popup/index.mjs";import d from"../components/common/share-popup/share-popup.mjs";import{useInteractionAnimation as f}from"./use-interaction-animation.mjs";import{useCallback as p,useEffect as m,useMemo as h,useState as g}from"react";import{toast as _}from"sonner";import{usePathname as v,useRouter as y,useSearchParams as b}from"next/navigation";function x(e){let t=Number(e);if(Number.isFinite(t))return t===0?1:t}function S(){let t=e.getState().userId||e.getState().userInfo?.userId;if(!t){let{open:e}=l.getState();return e(),null}return t}async function C(t,n){try{let i=e.getState().userId||e.getState().userInfo?.userId;if(!i)return console.warn(`用户未登录,无法查询交互状态`),null;let a=await r({app_id:0,user_id:i,content_ids:t,content_type:n});return a.code===0?a.data:(console.error(`查询交互状态失败:`,a.message),null)}catch(e){return console.error(`查询交互状态异常:`,e),null}}async function ee(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await s({user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`点赞失败`}}catch(e){return console.error(`点赞失败:`,e),{success:!1,message:`点赞失败`}}}async function w(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await a({user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`取消点赞失败`}}catch(e){return console.error(`取消点赞失败:`,e),{success:!1,message:`取消点赞失败`}}}async function T(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await o({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`点踩失败`}}catch(e){return console.error(`点踩异常:`,e),{success:!1,message:`点踩异常`}}}async function E(e,t){try{let n=S();if(!n)return{success:!1,message:`请先登录`};let r=await i({app_id:0,user_id:n,id:e,content_type:t});return r.code===0?{success:!0,data:r.data}:{success:!1,message:r.message||`取消点踩失败`}}catch(e){return console.error(`取消点踩异常:`,e),{success:!1,message:`取消点踩异常`}}}function D({id:r,isLike:i,isDislike:a,isCollect:o,likeCnt:s,dislikeCnt:S,contentType:C,animationClasses:D,copyUrl:O,prefetchDefaultCollection:k=!1}){let{isLogin:A,userInfo:j,userId:M}=e(),N=y(),P=v(),F=b()?.toString()||``,[I,L]=g(void 0),R=D?.like||`like-shake-animation`,z=D?.dislike||`dislike-shake-animation`,B=h(()=>String(M||j?.userId||``),[M,j?.userId]);m(()=>{L(void 0)},[B]);let[V,H]=g(!1),[U,W]=g(!1);m(()=>{d.clear(),u.clear()},[P,F]),m(()=>()=>{d.clear(),u.clear()},[]);let G=p(async()=>{if(!A||!B)return null;try{let e=await t({page:1,page_size:40});if(e.code!==0)return L(null),null;let n=(e.data?.data?.collections??[]).find(e=>e?.is_default),r=(typeof n?.title==`string`?n.title.trim():``)||null;return L(r),r}catch(e){return console.error(`获取默认收藏夹失败:`,e),L(null),null}},[A,B]);m(()=>{!A||!B||k&&I===void 0&&G()},[I,G,A,k,B]);let K=p(()=>{if(!A){let{open:e}=l.getState();return e(),!1}return!0},[A]),q=f(),J=f(),Y=p(async e=>{try{return e?await ee(r,C):await w(r,C)}catch(e){return console.error(`点赞操作失败`,e),{success:!1,message:`点赞操作失败`}}},[r,C]),X=p(async()=>{if(!(!K()||V)){H(!0);try{let e=!i;e&&q.trigger(R);let t={isLike:e,likeCnt:Math.max(0,s+(e?1:-1))};e&&a&&(t.isDislike=!1,t.dislikeCnt=Math.max(0,S-1));let n=await Y(e);if(!n.success){_.error(n.message||`点赞失败`);return}return t}finally{H(!1)}}},[q,i,a,s,S,Y,K,V,R]),Z=p(async e=>{try{return e?await T(r,C):await E(r,C)}catch(e){return console.error(`点踩操作失败`,e),{success:!1,message:`点踩操作失败`}}},[r,C]),te=p(async()=>{if(!(!K()||U)){W(!0);try{let e=!a;e&&J.trigger(z);let t={isDislike:e,dislikeCnt:Math.max(0,S+(e?1:-1))};e&&i&&(t.isLike=!1,t.likeCnt=Math.max(0,s-1));let n=await Z(e);if(!n.success){_.error(n.message||`操作失败`);return}return t}finally{W(!1)}}},[J,i,a,s,S,Z,K,U,z]),Q=p(async({currentId:e,isCancel:t,collectionIds:r})=>{try{if(t){let t=String(M||j?.userId||``);if(!t)return{success:!1};let n=await c({app_id:0,user_id:t,content_id:e,content_type:C});return n.code===0?{success:!0}:{success:!1,message:n.message}}if(!String(M||j?.userId||``))return{success:!1};let i=r?.[0],a=x(C),o=await n({...i?{collection_id:i}:{},content_id:e,...a===void 0?{}:{source_type:a}});return o.code===0?{success:!0}:{success:!1,message:o.message}}catch(e){return console.error(`取消收藏操作失败`,e),{success:!1,message:e?.message}}},[M,j?.userId,C]),$=p(({currentCollect:e,onUpdate:t})=>K()?(e?(async()=>{let e=await Q({currentId:r,isCancel:!0});if(!e?.success){_.error(e?.message||`操作失败`);return}t({isCollect:!1})})():(d.clear(),u.show({toCreateCollection:()=>{N.push(`/collection/create?information_id=${r}`)},onCollect:e=>{(async()=>{let n=await Q({currentId:r,isCancel:!1,collectionIds:[e]});if(!n?.success){_.error(n?.message||`操作失败`);return}t({isCollect:!0})})()}})),!0):!1,[r,N,K,Q]),ne=p(async({currentCollect:e,onUpdate:t})=>{if(!K())return;if(e){let e=await Q({currentId:r,isCancel:!0});return e?.success?(t({isCollect:!1}),{success:!0,isCollect:!1}):{success:!1,message:e?.message}}d.clear(),u.clear();let n=await Q({currentId:r,isCancel:!1});if(!n?.success)return{success:!1,message:n?.message};let i=I===void 0?await G():I;return t({isCollect:!0}),{success:!0,isCollect:!0,collectionTitle:i||void 0}},[I,G,Q,r,K]);return{likeAnimation:q,dislikeAnimation:J,handleLikeOperate:X,handleDislikeOperate:te,handleShareOperate:p((e,t)=>{let n=typeof t==`string`?{otherId:t}:t,i=n?.otherId||r,a=n?.shareUrl;d.show({copyUrl:O,data:{id:r,isCollect:o,parentId:i},...a?{shareUrl:a}:{},onCollect:t=>{$({currentCollect:t,onUpdate:e})}})},[r,o,$,O]),handleToCollectionOperate:$,handleDefaultCollectionOperate:ne}}export{C as batchQueryContentInteractions,D as useContentOperate};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.106",
4
+ "version": "0.1.107",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"