@funhub/platform 0.2.12 → 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/home-recommend/shared/home-recommend-server-data.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/client.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/client.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/index.d.mts +2 -0
- package/dist/components/common/video-player/index.mjs +3 -3
- 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 +2 -0
- 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 +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/components/ui/link.mjs +1 -1
- package/dist/types.d.mts +166 -33
- 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
|
@@ -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};
|