@funhub/platform 0.1.158 → 0.1.160-beta.0
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.d.mts +22 -1
- package/dist/biz.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-match.d.mts +98 -0
- package/dist/components/biz/business/advertisement/ad-match.mjs +2 -0
- package/dist/components/biz/business/advertisement/ad-provider.d.mts +33 -0
- package/dist/components/biz/business/advertisement/ad-provider.mjs +2 -0
- package/dist/components/biz/business/advertisement/ad-query.d.mts +27 -0
- package/dist/components/biz/business/advertisement/ad-query.mjs +2 -0
- package/dist/components/biz/business/advertisement/ad-runtime-provider.d.mts +25 -0
- package/dist/components/biz/business/advertisement/ad-runtime-provider.mjs +2 -0
- package/dist/components/biz/business/advertisement/banner-ad/client.d.mts +18 -0
- package/dist/components/biz/business/advertisement/banner-ad/client.mjs +2 -0
- package/dist/components/biz/business/advertisement/banner-ad/index.d.mts +5 -0
- package/dist/components/biz/business/advertisement/banner-ad/material.d.mts +30 -0
- package/dist/components/biz/business/advertisement/banner-ad/material.mjs +2 -0
- package/dist/components/biz/business/advertisement/banner-ad/schema.d.mts +75 -0
- package/dist/components/biz/business/advertisement/banner-ad/schema.mjs +2 -0
- package/dist/components/biz/business/advertisement/banner-ad/server.d.mts +11 -0
- package/dist/components/biz/business/advertisement/banner-ad/server.mjs +2 -0
- package/dist/components/biz/business/advertisement/feed-ad/index.d.mts +39 -0
- package/dist/components/biz/business/advertisement/feed-ad/index.mjs +2 -0
- package/dist/components/biz/business/advertisement/floating-ad/client.d.mts +21 -0
- package/dist/components/biz/business/advertisement/floating-ad/client.mjs +2 -0
- package/dist/components/biz/business/advertisement/floating-ad/index.d.mts +5 -0
- package/dist/components/biz/business/advertisement/floating-ad/material.d.mts +25 -0
- package/dist/components/biz/business/advertisement/floating-ad/material.mjs +2 -0
- package/dist/components/biz/business/advertisement/floating-ad/schema.d.mts +75 -0
- package/dist/components/biz/business/advertisement/floating-ad/schema.mjs +2 -0
- package/dist/components/biz/business/advertisement/floating-ad/server.d.mts +11 -0
- package/dist/components/biz/business/advertisement/floating-ad/server.mjs +2 -0
- package/dist/components/biz/business/advertisement/icon-ad/client.d.mts +16 -0
- package/dist/components/biz/business/advertisement/icon-ad/client.mjs +2 -0
- package/dist/components/biz/business/advertisement/icon-ad/index.d.mts +5 -0
- package/dist/components/biz/business/advertisement/icon-ad/material.d.mts +29 -0
- package/dist/components/biz/business/advertisement/icon-ad/material.mjs +2 -0
- package/dist/components/biz/business/advertisement/icon-ad/schema.d.mts +69 -0
- package/dist/components/biz/business/advertisement/icon-ad/schema.mjs +2 -0
- package/dist/components/biz/business/advertisement/icon-ad/server.d.mts +11 -0
- package/dist/components/biz/business/advertisement/icon-ad/server.mjs +2 -0
- package/dist/components/biz/business/advertisement/index.d.mts +26 -0
- package/dist/components/biz/business/advertisement/text-ad/client.d.mts +15 -0
- package/dist/components/biz/business/advertisement/text-ad/client.mjs +2 -0
- package/dist/components/biz/business/advertisement/text-ad/index.d.mts +5 -0
- package/dist/components/biz/business/advertisement/text-ad/material.d.mts +27 -0
- package/dist/components/biz/business/advertisement/text-ad/material.mjs +2 -0
- package/dist/components/biz/business/advertisement/text-ad/schema.d.mts +53 -0
- package/dist/components/biz/business/advertisement/text-ad/schema.mjs +2 -0
- package/dist/components/biz/business/advertisement/text-ad/server.d.mts +11 -0
- package/dist/components/biz/business/advertisement/text-ad/server.mjs +2 -0
- package/dist/components/biz/business/detail/shared/detail-follow-action.mjs +1 -1
- package/dist/components/biz/business/detail/shared/runtime-context-provider.mjs +1 -1
- package/dist/components/biz/business/detail/shared/use-video-detail-webview-bridge.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/client.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/index.d.mts +22 -0
- package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
- package/dist/components/common/series-episodes/index.mjs +1 -1
- package/dist/components/pages/home/client.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/pages/video-list/index.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.mjs +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/materials.d.mts +6 -1
- package/dist/materials.mjs +1 -1
- package/dist/service/advertisement.d.mts +172 -0
- package/dist/service/advertisement.mjs +2 -0
- package/dist/service.d.mts +2 -1
- package/dist/service.mjs +1 -1
- package/dist/utils/schema/inspector.d.mts +2 -2
- package/dist/utils/schema/material.d.mts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { FloatingAdProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/advertisement/floating-ad/client.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 悬浮广告组件。
|
|
8
|
+
*/
|
|
9
|
+
declare function FloatingAd({
|
|
10
|
+
mode: _mode,
|
|
11
|
+
ad,
|
|
12
|
+
materialUrl,
|
|
13
|
+
jumpUrl,
|
|
14
|
+
name,
|
|
15
|
+
bottomOffset,
|
|
16
|
+
rightOffset,
|
|
17
|
+
pointerEventsDisabled,
|
|
18
|
+
onClick
|
|
19
|
+
}: FloatingAdProps): react_jsx_runtime0.JSX.Element | null;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { FloatingAd };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{Image as e}from"../../../../ui/image.mjs";import{Box as t}from"../../../../ui/box.mjs";import n from"../../../../ui/link.mjs";import{adaptFloatingAdItem as r}from"../ad-match.mjs";import{useAdProvider as i}from"../ad-provider.mjs";import{useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";function s({mode:s=`renderer`,ad:c,materialUrl:l,jumpUrl:u,name:d,bottomOffset:f=100,rightOffset:p=20,pointerEventsDisabled:m=!1,onClick:h}){let g=i(),_=a(()=>{let e=c??{materialUrl:l||``,jumpUrl:u||``,name:d};return r(g?.matchData)??e},[c,g?.matchData,u,l,d]);if(!_.materialUrl||!_.jumpUrl)return null;let v=o(t,{className:`relative flex h-full w-full shadow-lg`,"aria-label":_.name||`悬浮广告`,children:o(e,{src:_.materialUrl,alt:_.name||`悬浮广告`,fill:!0,className:`object-cover`})}),y={bottom:`${f}px`,right:`${p}px`,pointerEvents:m?`none`:void 0};return h?o(t,{className:`fixed z-50 block h-[50px] w-[50px] overflow-hidden rounded-[16px] cursor-pointer`,style:y,onClick:h,children:v}):o(n,{href:_.jumpUrl,className:`fixed z-50 block h-[50px] w-[50px] overflow-hidden rounded-[16px]`,style:y,children:v})}export{s as FloatingAd};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
import { FloatingAdEditableProps, FloatingAdInspectorProps, FloatingAdItem, FloatingAdProps, floatingAdInspectorDefaultProps, floatingAdInspectorPropsSchema } from "./schema.mjs";
|
|
3
|
+
import { FloatingAd } from "./client.mjs";
|
|
4
|
+
import { FloatingAdServer } from "./server.mjs";
|
|
5
|
+
import { floatingAdMaterial } from "./material.mjs";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import { DefineMaterialOption } from "../../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../../utils.mjs";
|
|
5
|
+
import { FloatingAd } from "./client.mjs";
|
|
6
|
+
import { FloatingAdServer } from "./server.mjs";
|
|
7
|
+
import * as zod from "zod";
|
|
8
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
|
+
|
|
10
|
+
//#region components/biz/business/advertisement/floating-ad/material.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* 悬浮广告物料定义。
|
|
13
|
+
*/
|
|
14
|
+
declare const floatingAdMaterial: DefineMaterialOption<typeof FloatingAdServer, typeof FloatingAd, zod.ZodObject<{
|
|
15
|
+
readonly materialUrl: zod.ZodString & SchemaHasDefaultValue;
|
|
16
|
+
readonly jumpUrl: zod.ZodString & SchemaHasDefaultValue;
|
|
17
|
+
readonly name: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
18
|
+
} & {
|
|
19
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
20
|
+
renderer: "renderer";
|
|
21
|
+
editor: "editor";
|
|
22
|
+
}>>;
|
|
23
|
+
}, zod_v4_core0.$strip>, "floating-ad", "广告组件">;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { floatingAdMaterial };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{FloatingAd as t}from"./client.mjs";import{floatingAdInspectorPropsSchema as n}from"./schema.mjs";import{FloatingAdServer as r}from"./server.mjs";const i=e({type:`floating-ad`,name:`悬浮广告`,icon:`/static/components-thumb/floating_action_button.png`,category:`广告组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as floatingAdMaterial};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
import { InferSchemaProps, MaterialComponentMode, SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../../utils.mjs";
|
|
4
|
+
import * as zod from "zod";
|
|
5
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
6
|
+
|
|
7
|
+
//#region components/biz/business/advertisement/floating-ad/schema.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* 悬浮广告单条数据。
|
|
10
|
+
*/
|
|
11
|
+
interface FloatingAdItem {
|
|
12
|
+
/**
|
|
13
|
+
* 广告素材地址。
|
|
14
|
+
*/
|
|
15
|
+
materialUrl: string;
|
|
16
|
+
/**
|
|
17
|
+
* 广告跳转链接。
|
|
18
|
+
*/
|
|
19
|
+
jumpUrl: string;
|
|
20
|
+
/**
|
|
21
|
+
* 广告名称。
|
|
22
|
+
*/
|
|
23
|
+
name?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 悬浮广告物料属性。
|
|
27
|
+
*/
|
|
28
|
+
declare const floatingAdInspectorPropsSchema: zod.ZodObject<{
|
|
29
|
+
readonly materialUrl: zod.ZodString & SchemaHasDefaultValue;
|
|
30
|
+
readonly jumpUrl: zod.ZodString & SchemaHasDefaultValue;
|
|
31
|
+
readonly name: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
32
|
+
} & {
|
|
33
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
34
|
+
renderer: "renderer";
|
|
35
|
+
editor: "editor";
|
|
36
|
+
}>>;
|
|
37
|
+
}, zod_v4_core0.$strip>;
|
|
38
|
+
declare const floatingAdInspectorDefaultProps: {
|
|
39
|
+
readonly materialUrl: string;
|
|
40
|
+
readonly jumpUrl: string;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
};
|
|
43
|
+
type FloatingAdInspectorProps<T extends object = object> = InferSchemaProps<typeof floatingAdInspectorPropsSchema> & T;
|
|
44
|
+
type FloatingAdEditableProps = InferSchemaProps<typeof floatingAdInspectorPropsSchema>;
|
|
45
|
+
/**
|
|
46
|
+
* 悬浮广告组件 props。
|
|
47
|
+
*/
|
|
48
|
+
type FloatingAdProps = Partial<FloatingAdEditableProps> & {
|
|
49
|
+
/**
|
|
50
|
+
* 渲染模式。
|
|
51
|
+
*/
|
|
52
|
+
mode?: MaterialComponentMode;
|
|
53
|
+
/**
|
|
54
|
+
* 广告数据。
|
|
55
|
+
*/
|
|
56
|
+
ad?: FloatingAdItem;
|
|
57
|
+
/**
|
|
58
|
+
* 距离底部的偏移量。
|
|
59
|
+
*/
|
|
60
|
+
bottomOffset?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 距离右侧的偏移量。
|
|
63
|
+
*/
|
|
64
|
+
rightOffset?: number;
|
|
65
|
+
/**
|
|
66
|
+
* 编辑态下禁用交互。
|
|
67
|
+
*/
|
|
68
|
+
pointerEventsDisabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 自定义点击事件。
|
|
71
|
+
*/
|
|
72
|
+
onClick?: () => void;
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { FloatingAdEditableProps, FloatingAdInspectorProps, FloatingAdItem, FloatingAdProps, floatingAdInspectorDefaultProps, floatingAdInspectorPropsSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";const n=e(e=>({materialUrl:e.string(``,{label:`广告素材`,required:!0}),jumpUrl:e.string(``,{label:`跳转链接`,required:!0}),name:e.string(`悬浮广告`,{label:`广告名称`,required:!1})})),r=t(n);export{r as floatingAdInspectorDefaultProps,n as floatingAdInspectorPropsSchema};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { FloatingAdProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/advertisement/floating-ad/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 悬浮广告服务端组件。
|
|
8
|
+
*/
|
|
9
|
+
declare function FloatingAdServer(props: FloatingAdProps): Promise<react_jsx_runtime0.JSX.Element>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FloatingAdServer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{resolveAdsAppCode as e}from"../ad-match.mjs";import{AdRuntimeProvider as t}from"../ad-runtime-provider.mjs";import{FloatingAd as n}from"./client.mjs";import{jsx as r}from"react/jsx-runtime";async function i(i){let{mode:a=`renderer`,...o}=i;return r(t,{adType:`floating`,appCode:e(),mode:a,children:r(n,{...o,mode:a})})}export{i as FloatingAdServer};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconAdProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/advertisement/icon-ad/client.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 图标广告组件。
|
|
8
|
+
*/
|
|
9
|
+
declare function IconAd({
|
|
10
|
+
mode: _mode,
|
|
11
|
+
displayCount,
|
|
12
|
+
items,
|
|
13
|
+
pointerEventsDisabled
|
|
14
|
+
}: IconAdProps): react_jsx_runtime0.JSX.Element | null;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { IconAd };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{Image as e}from"../../../../ui/image.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import r from"../../../../ui/link.mjs";import{adaptIconAdProps as i,hasMatchedAds as a}from"../ad-match.mjs";import{useAdProvider as o}from"../ad-provider.mjs";import{useMemo as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";function u({mode:u=`renderer`,displayCount:d,items:f,pointerEventsDisabled:p=!1}){let m=o(),h=s(()=>a(m?.matchData)?i(m?.matchData):{displayCount:d,items:f},[m?.matchData,d,f]),g=Math.min(Math.max(h.displayCount,0),Math.min(h.items.length,5)),_=h.items.slice(0,g);return _.length===0?null:c(t,{as:`section`,className:`w-full px-[12px] py-[12px]`,"aria-label":`图标广告`,style:{pointerEvents:p?`none`:void 0},children:c(t,{className:`flex justify-around gap-[8px]`,children:_.map((i,a)=>c(r,{href:i.jumpUrl,className:`block flex-1`,children:l(t,{className:`flex flex-col items-center gap-[8px]`,children:[c(t,{className:`relative h-[52px] w-[52px] overflow-hidden rounded-[12px] bg-bg2`,children:c(e,{src:i.icon,alt:i.title||`图标广告`,fill:!0,className:`object-cover`,unoptimized:!0})}),c(n,{className:`w-full truncate text-center text-[12px] leading-[18px] text-text1`,children:i.title}),c(n,{className:`text-[10px] leading-[14px] text-text3`,children:i.badgeText||`广告`})]})},`${i.jumpUrl}-${a}`))})})}export{u as IconAd};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconAdInspectorProps, IconAdItem, IconAdProps, iconAdInspectorDefaultProps, iconAdInspectorPropsSchema } from "./schema.mjs";
|
|
3
|
+
import { IconAd } from "./client.mjs";
|
|
4
|
+
import { IconAdServer } from "./server.mjs";
|
|
5
|
+
import { iconAdMaterial } from "./material.mjs";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import { DefineMaterialOption } from "../../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../../utils.mjs";
|
|
5
|
+
import { IconAd } from "./client.mjs";
|
|
6
|
+
import { IconAdServer } from "./server.mjs";
|
|
7
|
+
import * as zod from "zod";
|
|
8
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
|
+
|
|
10
|
+
//#region components/biz/business/advertisement/icon-ad/material.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* 图标广告物料定义。
|
|
13
|
+
*/
|
|
14
|
+
declare const iconAdMaterial: DefineMaterialOption<typeof IconAdServer, typeof IconAd, zod.ZodObject<{
|
|
15
|
+
readonly displayCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
16
|
+
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
17
|
+
title: zod.ZodString & SchemaHasDefaultValue;
|
|
18
|
+
icon: zod.ZodString & SchemaHasDefaultValue;
|
|
19
|
+
jumpUrl: zod.ZodString & SchemaHasDefaultValue;
|
|
20
|
+
badgeText: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
21
|
+
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
22
|
+
} & {
|
|
23
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
24
|
+
renderer: "renderer";
|
|
25
|
+
editor: "editor";
|
|
26
|
+
}>>;
|
|
27
|
+
}, zod_v4_core0.$strip>, "icon-ad", "广告组件">;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { iconAdMaterial };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{IconAd as t}from"./client.mjs";import{iconAdInspectorPropsSchema as n}from"./schema.mjs";import{IconAdServer as r}from"./server.mjs";const i=e({type:`icon-ad`,name:`图标广告`,icon:`/static/components-thumb/shortcut_grid_5.png`,category:`广告组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as iconAdMaterial};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
import { InferSchemaProps, MaterialComponentMode, SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../../utils.mjs";
|
|
4
|
+
import z$1 from "zod";
|
|
5
|
+
|
|
6
|
+
//#region components/biz/business/advertisement/icon-ad/schema.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 图标广告单条数据。
|
|
9
|
+
*/
|
|
10
|
+
interface IconAdItem {
|
|
11
|
+
/**
|
|
12
|
+
* 广告标题。
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* 广告图标。
|
|
17
|
+
*/
|
|
18
|
+
icon: string;
|
|
19
|
+
/**
|
|
20
|
+
* 广告跳转链接。
|
|
21
|
+
*/
|
|
22
|
+
jumpUrl: string;
|
|
23
|
+
/**
|
|
24
|
+
* 广告标识文案。
|
|
25
|
+
*/
|
|
26
|
+
badgeText?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 图标广告物料属性。
|
|
30
|
+
*/
|
|
31
|
+
declare const iconAdInspectorPropsSchema: z$1.ZodObject<{
|
|
32
|
+
readonly displayCount: z$1.ZodNumber & SchemaHasDefaultValue;
|
|
33
|
+
readonly items: z$1.ZodArray<z$1.ZodObject<{
|
|
34
|
+
title: z$1.ZodString & SchemaHasDefaultValue;
|
|
35
|
+
icon: z$1.ZodString & SchemaHasDefaultValue;
|
|
36
|
+
jumpUrl: z$1.ZodString & SchemaHasDefaultValue;
|
|
37
|
+
badgeText: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
38
|
+
}, z$1.core.$strip>> & SchemaHasDefaultValue;
|
|
39
|
+
} & {
|
|
40
|
+
mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
41
|
+
renderer: "renderer";
|
|
42
|
+
editor: "editor";
|
|
43
|
+
}>>;
|
|
44
|
+
}, z$1.core.$strip>;
|
|
45
|
+
declare const iconAdInspectorDefaultProps: {
|
|
46
|
+
readonly displayCount: number;
|
|
47
|
+
readonly items: {
|
|
48
|
+
title: string;
|
|
49
|
+
icon: string;
|
|
50
|
+
jumpUrl: string;
|
|
51
|
+
badgeText?: string | undefined;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
type IconAdInspectorProps<T extends object = object> = InferSchemaProps<typeof iconAdInspectorPropsSchema> & T;
|
|
55
|
+
/**
|
|
56
|
+
* 图标广告组件 props。
|
|
57
|
+
*/
|
|
58
|
+
type IconAdProps = IconAdInspectorProps<{
|
|
59
|
+
/**
|
|
60
|
+
* 渲染模式。
|
|
61
|
+
*/
|
|
62
|
+
mode?: MaterialComponentMode;
|
|
63
|
+
/**
|
|
64
|
+
* 编辑态下禁用交互。
|
|
65
|
+
*/
|
|
66
|
+
pointerEventsDisabled?: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { IconAdInspectorProps, IconAdItem, IconAdProps, iconAdInspectorDefaultProps, iconAdInspectorPropsSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";import n from"zod";const r=e(e=>({displayCount:e.number(5,{label:`数量选择`,required:!0}).refine(e=>e>=1&&e<=5,`数量选择必须为 1-5`),items:e.array(n.object({title:e.string(`广告标题`,{label:`标题`,required:!0}),icon:e.string(``,{label:`素材`,required:!0}),jumpUrl:e.string(``,{label:`跳转链接`,required:!0}),badgeText:e.string(`广告`,{label:`广告标识`,required:!1})}),{label:`广告列表`,required:!0,defaultValue:[{title:`图标广告1`,icon:`/static/components-resource/banner.png`,jumpUrl:`/search`,badgeText:`广告`},{title:`图标广告2`,icon:`/static/components-resource/banner.png`,jumpUrl:`/search`,badgeText:`广告`},{title:`图标广告3`,icon:`/static/components-resource/banner.png`,jumpUrl:`/search`,badgeText:`广告`}]})})),i=t(r);export{i as iconAdInspectorDefaultProps,r as iconAdInspectorPropsSchema};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconAdProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/advertisement/icon-ad/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 图标广告服务端组件。
|
|
8
|
+
*/
|
|
9
|
+
declare function IconAdServer(props: IconAdProps): Promise<react_jsx_runtime0.JSX.Element>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { IconAdServer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{resolveAdsAppCode as e}from"../ad-match.mjs";import{AdRuntimeProvider as t}from"../ad-runtime-provider.mjs";import{IconAd as n}from"./client.mjs";import{jsx as r}from"react/jsx-runtime";async function i(i){let{mode:a=`renderer`,...o}=i;return r(t,{adType:`icon`,appCode:e(),mode:a,children:r(n,{...o,mode:a})})}export{i as IconAdServer};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { BannerAdInspectorProps, BannerAdItem, BannerAdProps, BannerAdStyleSize, bannerAdInspectorDefaultProps, bannerAdInspectorPropsSchema, bannerAdStyleSizeOptions } from "./banner-ad/schema.mjs";
|
|
3
|
+
import { FloatingAdEditableProps, FloatingAdInspectorProps, FloatingAdItem, FloatingAdProps, floatingAdInspectorDefaultProps, floatingAdInspectorPropsSchema } from "./floating-ad/schema.mjs";
|
|
4
|
+
import { IconAdInspectorProps, IconAdItem, IconAdProps, iconAdInspectorDefaultProps, iconAdInspectorPropsSchema } from "./icon-ad/schema.mjs";
|
|
5
|
+
import { TextAdInspectorProps, TextAdItem, TextAdProps, textAdInspectorDefaultProps, textAdInspectorPropsSchema } from "./text-ad/schema.mjs";
|
|
6
|
+
import { AdsMatchExtData, adaptBannerAdProps, adaptFloatingAdItem, adaptIconAdProps, adaptPopupAdMaterials, adaptTextAdProps, buildAdsMatchRequest, getFirstMatchedMaterial, hasMatchedAds, parseAdsMatchExtData, resolveAdsAppCode, sortAdsMatchMaterials } from "./ad-match.mjs";
|
|
7
|
+
import { AdProvider, AdProviderProps, AdProviderValue, useAdProvider } from "./ad-provider.mjs";
|
|
8
|
+
import { AdsMatchQueryOptions, createAdsMatchPrefetchItem, createAdsMatchQueryFn, getAdsMatchQueryKey } from "./ad-query.mjs";
|
|
9
|
+
import { AdRuntimeProvider, AdRuntimeProviderProps } from "./ad-runtime-provider.mjs";
|
|
10
|
+
import { BannerAd } from "./banner-ad/client.mjs";
|
|
11
|
+
import { BannerAdServer } from "./banner-ad/server.mjs";
|
|
12
|
+
import { bannerAdMaterial } from "./banner-ad/material.mjs";
|
|
13
|
+
import "./banner-ad/index.mjs";
|
|
14
|
+
import { FeedAdBadge, FeedAdItemLike, getFeedAdIcon, getFeedAdJumpUrl, isFeedAdItem } from "./feed-ad/index.mjs";
|
|
15
|
+
import { FloatingAd } from "./floating-ad/client.mjs";
|
|
16
|
+
import { FloatingAdServer } from "./floating-ad/server.mjs";
|
|
17
|
+
import { floatingAdMaterial } from "./floating-ad/material.mjs";
|
|
18
|
+
import "./floating-ad/index.mjs";
|
|
19
|
+
import { IconAd } from "./icon-ad/client.mjs";
|
|
20
|
+
import { IconAdServer } from "./icon-ad/server.mjs";
|
|
21
|
+
import { iconAdMaterial } from "./icon-ad/material.mjs";
|
|
22
|
+
import "./icon-ad/index.mjs";
|
|
23
|
+
import { TextAd } from "./text-ad/client.mjs";
|
|
24
|
+
import { TextAdServer } from "./text-ad/server.mjs";
|
|
25
|
+
import { textAdMaterial } from "./text-ad/material.mjs";
|
|
26
|
+
import "./text-ad/index.mjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextAdProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/advertisement/text-ad/client.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 文字广告组件。
|
|
8
|
+
*/
|
|
9
|
+
declare function TextAd({
|
|
10
|
+
displayCount,
|
|
11
|
+
items,
|
|
12
|
+
mode: _mode
|
|
13
|
+
}: TextAdProps): react_jsx_runtime0.JSX.Element | null;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { TextAd };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{adaptTextAdProps as e,hasMatchedAds as t}from"../ad-match.mjs";import{useAdProvider as n}from"../ad-provider.mjs";import{MarqueeClient as r}from"../../marquee/client.mjs";import{useMemo as i}from"react";import{jsx as a}from"react/jsx-runtime";function o({displayCount:o,items:s,mode:c=`renderer`}){let l=n(),u=i(()=>t(l?.matchData)?e(l?.matchData):{displayCount:o,items:s},[l?.matchData,o,s]),d=i(()=>{let e=u.items.filter(e=>e.text?.trim());return typeof u.displayCount==`number`?e.slice(0,Math.max(u.displayCount,0)):e},[u]),f=i(()=>d.map(e=>`${e.text}:${e.jumpUrl||``}`).join(`|`),[d]);return d.length===0?null:a(r,{marqueeKey:f||`text-ad`,mode,contents:d.map(e=>({text:e.text,link:e.jumpUrl||``})),click:{enabled:!0,redirectType:`link`,link:``},close:{enabled:!0},displayStrategy:{rule:`daily`}})}export{o as TextAd};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextAdInspectorProps, TextAdItem, TextAdProps, textAdInspectorDefaultProps, textAdInspectorPropsSchema } from "./schema.mjs";
|
|
3
|
+
import { TextAd } from "./client.mjs";
|
|
4
|
+
import { TextAdServer } from "./server.mjs";
|
|
5
|
+
import { textAdMaterial } from "./material.mjs";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import { DefineMaterialOption } from "../../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../../utils.mjs";
|
|
5
|
+
import { TextAd } from "./client.mjs";
|
|
6
|
+
import { TextAdServer } from "./server.mjs";
|
|
7
|
+
import * as zod from "zod";
|
|
8
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
|
+
|
|
10
|
+
//#region components/biz/business/advertisement/text-ad/material.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* 文字广告物料定义。
|
|
13
|
+
*/
|
|
14
|
+
declare const textAdMaterial: DefineMaterialOption<typeof TextAdServer, typeof TextAd, zod.ZodObject<{
|
|
15
|
+
readonly displayCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
16
|
+
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
17
|
+
text: zod.ZodString & SchemaHasDefaultValue;
|
|
18
|
+
jumpUrl: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
19
|
+
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
20
|
+
} & {
|
|
21
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
22
|
+
renderer: "renderer";
|
|
23
|
+
editor: "editor";
|
|
24
|
+
}>>;
|
|
25
|
+
}, zod_v4_core0.$strip>, "text-ad", "广告组件">;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { textAdMaterial };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineMaterial as e}from"../../../../../utils/schema/material.mjs";import{TextAd as t}from"./client.mjs";import{textAdInspectorPropsSchema as n}from"./schema.mjs";import{TextAdServer as r}from"./server.mjs";const i=e({type:`text-ad`,name:`文字广告`,icon:`/static/components-thumb/marquee_clickable_closable.png`,category:`广告组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as textAdMaterial};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { InferSchemaProps, MaterialComponentMode, SchemaHasDefaultValue } from "../../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../../utils.mjs";
|
|
4
|
+
import z$1 from "zod";
|
|
5
|
+
|
|
6
|
+
//#region components/biz/business/advertisement/text-ad/schema.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 文字广告单条数据。
|
|
9
|
+
*/
|
|
10
|
+
interface TextAdItem {
|
|
11
|
+
/**
|
|
12
|
+
* 广告文案。
|
|
13
|
+
*/
|
|
14
|
+
text: string;
|
|
15
|
+
/**
|
|
16
|
+
* 跳转链接。
|
|
17
|
+
*/
|
|
18
|
+
jumpUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 文字广告物料属性。
|
|
22
|
+
*/
|
|
23
|
+
declare const textAdInspectorPropsSchema: z$1.ZodObject<{
|
|
24
|
+
readonly displayCount: z$1.ZodNumber & SchemaHasDefaultValue;
|
|
25
|
+
readonly items: z$1.ZodArray<z$1.ZodObject<{
|
|
26
|
+
text: z$1.ZodString & SchemaHasDefaultValue;
|
|
27
|
+
jumpUrl: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
28
|
+
}, z$1.core.$strip>> & SchemaHasDefaultValue;
|
|
29
|
+
} & {
|
|
30
|
+
mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
31
|
+
renderer: "renderer";
|
|
32
|
+
editor: "editor";
|
|
33
|
+
}>>;
|
|
34
|
+
}, z$1.core.$strip>;
|
|
35
|
+
declare const textAdInspectorDefaultProps: {
|
|
36
|
+
readonly displayCount: number;
|
|
37
|
+
readonly items: {
|
|
38
|
+
text: string;
|
|
39
|
+
jumpUrl?: string | undefined;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
type TextAdInspectorProps<T extends object = object> = InferSchemaProps<typeof textAdInspectorPropsSchema> & T;
|
|
43
|
+
/**
|
|
44
|
+
* 文字广告组件 props。
|
|
45
|
+
*/
|
|
46
|
+
type TextAdProps = TextAdInspectorProps<{
|
|
47
|
+
/**
|
|
48
|
+
* 渲染模式。
|
|
49
|
+
*/
|
|
50
|
+
mode?: MaterialComponentMode;
|
|
51
|
+
}>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { TextAdInspectorProps, TextAdItem, TextAdProps, textAdInspectorDefaultProps, textAdInspectorPropsSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";import n from"zod";const r=e(e=>({displayCount:e.number(1,{label:`广告展示数量选择`,required:!0}).refine(e=>e>=1&&e<=5,`广告展示数量必须为 1-5`),items:e.array(n.object({text:e.string(`请输入广告文案`,{label:`广告文案`,required:!0}),jumpUrl:e.string(``,{label:`跳转链接`,required:!1})}),{label:`广告列表`,required:!0,defaultValue:[{text:`这是第一条文字广告`,jumpUrl:`/search`},{text:`这是第二条文字广告`,jumpUrl:`/search`}]})})),i=t(r);export{i as textAdInspectorDefaultProps,r as textAdInspectorPropsSchema};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { TextAdProps } from "./schema.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/advertisement/text-ad/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 文字广告服务端组件。
|
|
8
|
+
*/
|
|
9
|
+
declare function TextAdServer(props: TextAdProps): Promise<react_jsx_runtime0.JSX.Element>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TextAdServer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{resolveAdsAppCode as e}from"../ad-match.mjs";import{AdRuntimeProvider as t}from"../ad-runtime-provider.mjs";import{TextAd as n}from"./client.mjs";import{jsx as r}from"react/jsx-runtime";async function i(i){let{mode:a=`renderer`,...o}=i;return r(t,{adType:`text`,appCode:e(),mode:a,children:r(n,{...o,mode:a})})}export{i as TextAdServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{useFollowIdsState as t}from"../../../../../store/modules/follow-ids-store.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{followUser as r,unfollowUser as i}from"../../../../../utils/follow-service.mjs";import
|
|
2
|
+
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{useFollowIdsState as t}from"../../../../../store/modules/follow-ids-store.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{followUser as r,unfollowUser as i}from"../../../../../utils/follow-service.mjs";import a from"../../../../../assets/icons/common/follow_sel.mjs";import o from"../../../../../assets/icons/common/follow_user.mjs";import{UnfollowConfirmDialog as s}from"../../../../common/follow-button/unfollow-confirm-dialog.mjs";import{useEffect as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";function m({information:e,onUpdate:a}){let{userId:o,userInfo:p}=n(),m=o||p?.userId||``,g=e.author,_=e.up_user||g?.user_id||``,v=!!(m&&_&&m===_),[y,b]=l(!!e.is_followed),[x,S]=l(!1),[C,w]=l(!1);c(()=>{b(!!e.is_followed)},[e.id,e.is_followed]);async function T(){if(!_){console.warn(`用户信息不完整,无法执行关注操作`);return}w(!0);let e=!y;try{let n;if(n=e?await r({app_id:0,follower_id:m,followee_id:_}):await i({app_id:0,follower_id:m,followee_id:_}),n.success){b(e),a({is_followed:e});let{followIds:n,setFollowIds:r}=t.getState(),i=new Set(n);e?i.add(_):i.delete(_),r(Array.from(i))}else console.error(`关注操作失败:`,n.message)}catch(e){console.error(`关注操作异常:`,e)}finally{w(!1)}}function E(){if(!C){if(y){S(!0);return}T()}}function D(){S(!1),T()}function O(){S(!1)}return f(u,{children:[e.up_user&&_&&!v?d(h,{followed:y,loading:C,onToggle:E}):null,d(s,{open:x,onOpenChange:S,onCancel:O,onConfirm:D})]})}function h({followed:t,loading:n=!1,onToggle:r}){let i=p(`components.biz.business.detail`);return d(`button`,{type:`button`,disabled:n,className:e(`flex h-7 items-center rounded-full border border-solid px-3 text-xs font-medium transition-colors`,n&&`opacity-50 cursor-not-allowed`,t?`border-text3 text-text3`:`border-theme5 text-theme5`),onClick:r,children:t?f(u,{children:[d(a,{className:`w-[12px] h-[12px] text-text3 shrink-0`}),d(`span`,{className:`text-text3 text-[12px] leading-[18px] ml-[4px] shrink-0`,children:i(`detailFollowAction.following`)})]}):f(u,{children:[d(o,{className:`block w-[12px] h-[12px] text-theme5 shrink-0`}),d(`span`,{className:`block text-theme5 text-[12px] leading-[18px] ml-[4px] shrink-0`,children:i(`detailFollowAction.follow`)})]})})}export{m as DetailFollowAction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRouter as t}from"../../../../../utils/use-compatible-router.mjs";import{
|
|
2
|
+
"use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRouter as t}from"../../../../../utils/use-compatible-router.mjs";import{notifyBridgeEpisodeChanged as n}from"../../../../../utils/login-modal-bridge.mjs";import{useRequest as r}from"../../../../../hooks/query/use-query.mjs";import{useKeepAliveState as i}from"../../../../common/keep-scroll-position/index.mjs";import{createContext as a,use as o,useCallback as s,useEffect as c,useMemo as l}from"react";import{jsx as u}from"react/jsx-runtime";import{useParams as d}from"next/navigation";const f=a(void 0),p=`funhub:video-detail-episode-sync`;function m(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 h(e){let t=Math.floor(Number(e)||1);return t>0?t:1}function g(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(p,{detail:e}))}function _(e){return e.type===p&&e instanceof CustomEvent}function v(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 y({value:e,children:t}){let n=o(f);return u(f,{value:l(()=>v(n,e)??e,[n,e]),children:t})}function b(){let e=o(f),t=x({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 l(()=>{let n=v(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 x(a){let{enabled:o,shouldRequestInformation:u}=a,f=d(),v=t(),y=f.level,b=Array.isArray(y)?y:typeof y==`string`?[y]:[],x=b[0]||``,S=b.findIndex(e=>e===`episode`),C=S>=0?b[S+1]:b[2],w=Math.max(1,Number(C)||1),[T,E]=i(`video-detail-material-series-num-${x}`,w);c(()=>{E(w)},[w,E]),c(()=>{if(!x||typeof window>`u`)return;let e=e=>{if(!_(e))return;let t=e.detail;if(!t||t.detailId!==x)return;let n=h(t.seriesNum);E(e=>e===n?e:n)};return window.addEventListener(p,e),()=>{window.removeEventListener(p,e)}},[x,E]);let D=s(e=>{if(!x)return;let t=h(e);E(t),g({detailId:x,seriesNum:t})},[x,E]),O=Math.max(1,Number(T)||1),k=Math.max(0,O-1),A=b[1]||``,j=typeof window<`u`&&window.isWebView===!0,{data:M,isPending:N,isFetching:P,isError:F,isSuccess:I}=r([`video-detail-material-fallback`,x],async()=>x?await e({id:x}):null,{enabled:o&&u&&!!x}),L=l(()=>{let e=M?.data?.video;if(!(!e||typeof e!=`object`))return{...e,content_type:1,episode_cnt:e.links?.length||0}},[M?.data?.video]),R=s(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(!x||typeof window>`u`)return;let r=`/video/${x}/${encodeURIComponent(A)}/episode/${t}`,{search:i,hash:a,pathname:o}=window.location,s=`${o}${i}${a}`,c=`${r}${i}${a}`,l=m(o,x);if(s!==c){j&&n({title:L?.title||``,detailId:x,seriesNum:t,nextPath:r}),l&&typeof window.history?.replaceState==`function`?(window.history.replaceState(window.history.state,``,c),D(t)):v.replace(c,{scroll:!1});return}O!==t&&D(t)},[O,x,L?.title,j,A,v,D]);if(o)return{information:L,currentSeriesNum:O,onEpisodeChange:R,detailId:x,episodeIndex:k,resumeProgressSeconds:0,isShow:!0,isWebView:j,isInformationLoading:u?!!x&&!L&&(N||P):!1,isInformationResolved:!x||!!L||!u||F||I}}export{y as VideoDetailMaterialRuntimeProvider,b as useVideoDetailMaterialRuntimeContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{decryptImageToUint8Array as e}from"../../../../../utils/decrypt-image-client.mjs";import{
|
|
2
|
+
"use client";import{decryptImageToUint8Array as e}from"../../../../../utils/decrypt-image-client.mjs";import{gContentGetVideoDetail as t,pInteractionBrowse as n}from"../../../../../service/generated/client.mjs";import{uint8ArrayToBase64 as r}from"../../../../../utils/uint8.mjs";import{resolveM3u8Urls as i,resolveVideoPlayerSrc as a}from"../../../../common/video-player/process-m3u8-cache.mjs";import{batchQueryContentInteractions as o}from"../../../../../hooks/use-content-operate.mjs";import{useCallback as s,useEffect as c,useRef as l}from"react";import{usePathname as u}from"next/navigation";function d(e){let t=Math.floor(Number(e)||1);return t>0?t:1}function f(e){let t=typeof e==`string`?e:typeof window>`u`?``:window.location.pathname,n=String(t||``).split(`/`).filter(Boolean),r=n.findIndex(e=>e===`video`||e===`webview`);if(r<0)return{detailId:``,currentSeriesNum:1,episodeIndex:0};let i=n[r+1]||``;try{let e=decodeURIComponent(i),t=n.slice(r+1),a=t.findIndex(e=>e===`episode`),o=d(a>=0?t[a+1]:t[2]);return{detailId:e,currentSeriesNum:o,episodeIndex:Math.max(0,o-1)}}catch{let e=n.slice(r+1),t=e.findIndex(e=>e===`episode`),a=d(t>=0?e[t+1]:e[2]);return{detailId:i,currentSeriesNum:a,episodeIndex:Math.max(0,a-1)}}}function p(d){let{enabled:p=!0}=d,m=f(u()).detailId,h=l({detailId:``}),g=l(null);c(()=>{h.current={detailId:m},g.current=null},[m]);let _=s(async e=>{let n=String(e||``).trim();if(!n)return;if(h.current.detailId===n&&h.current.information)return h.current.information;if(g.current?.detailId===n)return await g.current.promise;let r=t({id:n}).then(e=>{let t=e?.data?.video;if(!t||typeof t!=`object`)return;let r={...t,content_type:1,episode_cnt:t.links?.length||0};return h.current={detailId:n,information:r},r});g.current={detailId:n,promise:r};try{return await r}finally{g.current?.detailId===n&&(g.current=null)}},[]),v=s(async()=>{let t;for(let e=0;e<2;e++){let e=f();if(t=await _(e.detailId),f().detailId===e.detailId)break}let n=f(),o=i(Array.isArray(t?.links)?t.links:[],n.currentSeriesNum),s=o[0]?await a(o[0]):``,c=t?.name||``,l=t?.img_y||t?.img_x||t?.preview_images?.[0]||``,u=``;if(l)try{let t=await e(l);t&&(u=r(t.bytes))}catch(e){console.warn(`[webview bridge] getVideoInfoAsync poster failed:`,e)}return{poster:u,src:s,title:c}},[_]),y=s(async()=>{let e=f();if(!e.detailId)return null;let t=await o([e.detailId],1);return t?.interaction_list?.[0]?t.interaction_list[0].browse_record:null},[]),b=s(async e=>{let t=f();if(!t.detailId)return;let r=e.browse_episode||t.currentSeriesNum,i=Date.now(),a=String(e.browse_key||i);try{await n({app_id:0,content_type:1,content_id:t.detailId,browse_duration:Number(e.browse_duration||0),browse_episode:String(r),browse_key:a,browse_page_ts:i})}catch(e){console.error(`上报播放进度失败:`,e)}},[]);c(()=>{if(!p||typeof window>`u`)return;let e=window;return e.getVideoInfoAsync=v,e.getVideoBrowseRecordAsync=y,e.reportVideoBrowse=b,()=>{e.getVideoInfoAsync===v&&delete e.getVideoInfoAsync,e.getVideoBrowseRecordAsync===y&&delete e.getVideoBrowseRecordAsync,e.reportVideoBrowse===b&&delete e.reportVideoBrowse}},[y,v,p,b])}export{p as useVideoDetailWebViewBridge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRequest as e}from"../../../../../hooks/query/use-query.mjs";import{batchQueryContentInteractions as t}from"../../../../../hooks/use-content-operate.mjs";import{DetailOperate as n}from"../shared/detail-operate.mjs";import{editorPreviewInformation as r}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as i}from"../shared/runtime-context-provider.mjs";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";function u({mode:u=`renderer`}){let d=i(),f=d?.information,p=d?.onUpdateInformation,m=u===`editor`,
|
|
2
|
+
"use client";import{useRequest as e}from"../../../../../hooks/query/use-query.mjs";import{batchQueryContentInteractions as t}from"../../../../../hooks/use-content-operate.mjs";import{DetailOperate as n}from"../shared/detail-operate.mjs";import{editorPreviewInformation as r}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as i}from"../shared/runtime-context-provider.mjs";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";function u({mode:u=`renderer`}){let d=i(),f=d?.information,p=d?.onUpdateInformation,m=!!d?.isWebView,h=u===`editor`,g=u===`renderer`,_=h,v=_?r:f,[y,b]=c(v),x=s(v),S=s(``);o(()=>{b(v)},[v]);let C=p?v:y;o(()=>{x.current=C},[C]);let w=g&&!m&&!!v?.id,{data:T}=e([`video-detail-actions-interaction`,v?.id],async()=>v?.id?await t([v.id],1):null,{enabled:w,staleTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1}),E=a(e=>{if(!_){if(p){p(e);return}b(t=>{if(!t)return t;let n=e.static?{...t.static||{},...e.static||{}}:t.static;return{...t,...e,static:n}})}},[p,_]);return o(()=>{let e=T?.interaction_list?.[0],t=x.current;if(!e||!t)return;let n=`${e.is_liked?1:0}-${e.is_disliked?1:0}-${e.is_collected?1:0}`;if(S.current===n)return;S.current=n;let r=e.is_liked||!1,i=e.is_disliked||!1,a=e.is_collected||!1,o=!!t.like,s=!!t.dislike,c=!!t.collect,l=t.static?.like_cnt,u=typeof l==`number`?l:Number(l||0),d=u;!r&&u>0?d=Math.max(0,u-1):o===r?r&&u===0&&(d=1):d=Math.max(0,u+(r?1:-1));let f=d!==u;o===r&&s===i&&c===a&&!f||E({like:r,dislike:i,collect:a,...f?{static:{...t.static||{},like_cnt:d}}:{}})},[E,T]),C?l(`div`,{className:_?`pointer-events-none`:void 0,children:l(n,{mode:u,information:C,onUpdate:E})}):null}export{u as VideoDetailActionsClient};
|