@ad-execute-manager/helper 2.0.0-alpha.1 → 2.0.0-alpha.2

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,132 +0,0 @@
1
- export default AdAnalyticsJS;
2
- export type EventDict = {
3
- [x: string]: any;
4
- };
5
- export type IConstructorArgs = {
6
- /**
7
- * 初始化标识
8
- */
9
- sign: string;
10
- /**
11
- * 是否需要上报
12
- */
13
- needReport?: boolean;
14
- /**
15
- * 公共用户信息
16
- */
17
- commonConfig?: ICommonInfo;
18
- };
19
- export type ICommonInfo = {
20
- [x: string]: any;
21
- };
22
- /**
23
- * @typedef {Object.<string, object>} EventDict
24
- */
25
- /**
26
- * @typedef {object} IConstructorArgs
27
- * @property {string} sign 初始化标识
28
- * @property {boolean} [needReport] 是否需要上报
29
- * @property {ICommonInfo} [commonConfig] 公共用户信息
30
- *
31
- */
32
- /**
33
- * @typedef {Object.<string, object>} ICommonInfo
34
- *
35
- */
36
- declare class AdAnalyticsJS {
37
- static instance: any;
38
- /**
39
- *
40
- * @param {IConstructorArgs} args
41
- * @returns {AdAnalyticsJS}
42
- */
43
- static build(args: IConstructorArgs): AdAnalyticsJS;
44
- /**
45
- *
46
- * @returns {AdAnalyticsJS}
47
- */
48
- static getInstance(): AdAnalyticsJS;
49
- /**
50
- *
51
- * @param {IConstructorArgs} args
52
- * @returns {AdAnalyticsJS}
53
- */
54
- static "new"(args: IConstructorArgs): AdAnalyticsJS;
55
- /**
56
- * @param {IConstructorArgs} args
57
- */
58
- constructor(args: IConstructorArgs);
59
- _initSign: string;
60
- _needReport: boolean;
61
- /** @type {ICommonInfo | null} */
62
- _commonConfig: ICommonInfo | null;
63
- /**
64
- * 初始化 比如环境配置,api地址、日志等级等
65
- * @param {IConstructorArgs} args
66
- */
67
- initialize(args: IConstructorArgs): IConstructorArgs;
68
- /**
69
- * 追踪自定义事件
70
- * 用户交互,如点击、提交
71
- *
72
- * @template {keyof EventDict} K
73
- * @param {K} eventName - The name of the event to track.
74
- * @param {EventDict[K]} properties - The properties associated with the event.
75
- * @param {object} [debugParams] - The debug parameters.
76
- * @param {string} [debugParams.sign] - Whether to enable debug mode.
77
- */
78
- track<K extends keyof EventDict>(eventName: K, properties: EventDict[K], debugParams?: {
79
- sign?: string;
80
- }): void;
81
- /**
82
- * 获取公共用户信息
83
- * @public
84
- * @returns {ICommonInfo}
85
- */
86
- public getCommonInfo(): ICommonInfo;
87
- /**
88
- * 获取埋点公共用户信息
89
- * @protected
90
- * @returns {ICommonInfo}
91
- */
92
- protected getTrackCommonInfo(): ICommonInfo;
93
- /**
94
- * 识别用户身份
95
- * 用户登录后,关联用户信息
96
- * @param {string|number} user_id - 用户id
97
- * @param {ICommonInfo} info - 用户信息
98
- * @returns {AdAnalyticsJS} 返回实例本身,支持链式调用
99
- */
100
- identify(user_id: string | number, info: ICommonInfo): AdAnalyticsJS;
101
- /**
102
- * 合并用户身份
103
- * 匿名用户转为登录用户
104
- * @returns
105
- */
106
- alias(): any;
107
- /**
108
- * 追踪页面浏览
109
- * SPA 路由切换,或手动触发页面事件
110
- * @returns
111
- */
112
- pages(): any;
113
- /**
114
- * 追踪页面浏览 进入页面
115
- *
116
- * @template {'cpage'} K
117
- * @param {K} eventName - The name of the event to track.
118
- * @param {EventDict[K]} properties - The properties associated with the event.
119
- */
120
- page<K extends "cpage">(eventName: K, properties: EventDict[K]): void;
121
- /**
122
- *
123
- * @param {EventDict['cpage']} properties
124
- * @returns
125
- */
126
- cpage(properties: EventDict["cpage"]): void;
127
- /**
128
- * 站位方法,没有任何左右
129
- * @returns
130
- */
131
- placeholder(): any;
132
- }
@@ -1,233 +0,0 @@
1
- export default LovelUnlockManager;
2
- export type InitSign = "bookStore" | "reader" | "bookIntro";
3
- /**
4
- * @typedef {'bookStore'|'reader'|'bookIntro'} InitSign
5
- */
6
- declare class LovelUnlockManager {
7
- static instance: any;
8
- /**
9
- * @static
10
- * @param {object} args
11
- * @param {InitSign} args.sign 初始化标识
12
- * @param {number} args.unlockChapterThreshold 单次解锁章节阈值
13
- * @param {number} args.unlockChapterNum 解锁章节数
14
- * @param {number} args.unlockChapterWaterLevel 解锁章节水滴阈值
15
- */
16
- static build(args: {
17
- sign: InitSign;
18
- unlockChapterThreshold: number;
19
- unlockChapterNum: number;
20
- unlockChapterWaterLevel: number;
21
- }): any;
22
- /**
23
- * @static
24
- * @returns {LovelUnlockManager}
25
- */
26
- static getInstance(): LovelUnlockManager;
27
- /**
28
- * @param {object} args
29
- * @param {InitSign} args.sign 初始化标识
30
- * @param {number} args.unlockChapterThreshold 单次解锁章节阈值
31
- * @param {number} args.unlockChapterNum 解锁章节数
32
- * @param {number} args.unlockChapterWaterLevel 解锁章节水滴阈值
33
- */
34
- static "new"(args: {
35
- sign: InitSign;
36
- unlockChapterThreshold: number;
37
- unlockChapterNum: number;
38
- unlockChapterWaterLevel: number;
39
- }): LovelUnlockManager;
40
- /**
41
- * @param {object} args
42
- * @param {InitSign} args.sign 初始化标识
43
- * @param {number} args.unlockChapterThreshold 单次解锁章节阈值
44
- * @param {number} args.unlockChapterNum 解锁章节数
45
- * @param {number} args.unlockChapterWaterLevel 解锁章节水滴阈值
46
- */
47
- constructor(args: {
48
- sign: InitSign;
49
- unlockChapterThreshold: number;
50
- unlockChapterNum: number;
51
- unlockChapterWaterLevel: number;
52
- });
53
- /**
54
- * 初始化标识 'bookStore' | 'reader' | 'bookIntro'
55
- * @access private
56
- */
57
- _initSign: string;
58
- /**
59
- * 剧情详情数据
60
- * @access private
61
- * @type {Array.<DramaDetailRecord>}
62
- */
63
- _dramaDetailData: Array<{
64
- /**
65
- * 章节id
66
- */
67
- episodeId: string;
68
- /**
69
- * 1 已解锁 0 未解锁 null 未解锁
70
- */
71
- flagTag: number | null;
72
- /**
73
- * 章节名称
74
- */
75
- albumId: string;
76
- }>;
77
- /**
78
- * 单次解锁章节阈值
79
- * @access private
80
- */
81
- _unlockChapterThreshold: number;
82
- /**
83
- * 解锁章节数
84
- * @access private
85
- */
86
- _unlockChapterNum: number;
87
- /**
88
- * 解锁章节水滴阈值
89
- * @access private
90
- */
91
- _unlockChapterWaterLevel: number;
92
- /**
93
- * 是否达到阈值
94
- * @access private
95
- */
96
- _isReachThreshold: boolean;
97
- /**
98
- * 已经解锁的章节id数组
99
- * @access private
100
- * @type {Array.<string>}
101
- */
102
- _unlockedIdArr: Array<string>;
103
- /**
104
- * 设置剧情详情数据
105
- * @param {Array.<DramaDetailRecord>} value 剧情详情数据
106
- */
107
- set drama(value: Array<{
108
- /**
109
- * 章节id
110
- */
111
- episodeId: string;
112
- /**
113
- * 1 已解锁 0 未解锁 null 未解锁
114
- */
115
- flagTag: number | null;
116
- /**
117
- * 章节名称
118
- */
119
- albumId: string;
120
- }>);
121
- /**
122
- * @typedef {object} DramaDetailRecord
123
- * @property {string} episodeId 章节id
124
- * @property {number | null} flagTag 1 已解锁 0 未解锁 null 未解锁
125
- * @property {string} albumId 章节名称
126
- */
127
- /**
128
- * 获取剧情详情数据
129
- * @returns {Array.<DramaDetailRecord>} 剧情详情数据
130
- */
131
- get drama(): Array<{
132
- /**
133
- * 章节id
134
- */
135
- episodeId: string;
136
- /**
137
- * 1 已解锁 0 未解锁 null 未解锁
138
- */
139
- flagTag: number | null;
140
- /**
141
- * 章节名称
142
- */
143
- albumId: string;
144
- }>;
145
- /**
146
- * 设置是否达到阈值
147
- * @access private
148
- * @param {Array.<DramaDetailRecord>} value 剧情详情数据
149
- */
150
- _checkReachThreshold(v?: any[]): void;
151
- /**
152
- * 判断达到阈值
153
- * @access private
154
- * @returns
155
- */
156
- _isUnlockThreshold(): boolean;
157
- /**
158
- * 从指定chapterId开始解锁指定数量的章节,前后章节数量相等
159
- * @access private
160
- * @param {string} chapterId 章节id
161
- * @param {number} count 解锁章节数量
162
- * @returns {Array.<string>} 解锁的章节id数组
163
- */
164
- _unlockChapterIds(chapterId: string, count?: number): Array<string>;
165
- /**
166
- * 从指定chapterId开始解锁指定数量的章节,增加水位
167
- * @access private
168
- * @param {string} chapterId 章节id
169
- * @param {number} count 解锁章节数量
170
- * @returns {Array.<string> | undefined} 解锁的章节id数组
171
- */
172
- _unlockChapterIdsWithWater(chapterId: string, count?: number): Array<string> | undefined;
173
- /**
174
- * 判断是否达到解锁阈值,走不同的逻辑
175
- * @access public
176
- * @param {() => void} callback 原逻辑【达到阈值前】回调函数
177
- * @param {(ids: Array.<string>) => void} [callbackThreshold] 新逻辑【达到阈值后】回调函数
178
- * @param {string} [chapterId] 章节id
179
- */
180
- ready(callback: () => void, callbackThreshold?: (ids: Array<string>) => void, chapterId?: string): void;
181
- /**
182
- * @typedef {object} ProcessUpdateResult
183
- * @property {string} chapterId 章节id
184
- * @property {number} percent 当前章节的阅读进度
185
- */
186
- /**
187
- * 章节阅读进度更新
188
- * @access public
189
- * @param {ProcessUpdateResult} r 当前章节的阅读进度
190
- * @param {(ids: Array.<string>) => void} callback 达到阈值后回调函数
191
- */
192
- onProcessUpdate(r: {
193
- /**
194
- * 章节id
195
- */
196
- chapterId: string;
197
- /**
198
- * 当前章节的阅读进度
199
- */
200
- percent: number;
201
- }, callback: (ids: Array<string>) => void): void;
202
- /**
203
- * @typedef {object} ChapterChangeResult
204
- * @property {string} currentChapterId 变化前的章节ID
205
- * @property {string} nextChapterId 变化后的章节ID
206
- * @property {string} [nextOutChapterId] 开发者自己的章节ID
207
- */
208
- /**
209
- * 章节变化
210
- * @access public
211
- * @param {ChapterChangeResult} r 当前章节的阅读进度
212
- * @param {(ids: Array.<string>) => void} callback 达到阈值后回调函数
213
- */
214
- onChapterChange(r: {
215
- /**
216
- * 变化前的章节ID
217
- */
218
- currentChapterId: string;
219
- /**
220
- * 变化后的章节ID
221
- */
222
- nextChapterId: string;
223
- /**
224
- * 开发者自己的章节ID
225
- */
226
- nextOutChapterId?: string;
227
- }, callback: (ids: Array<string>) => void): void;
228
- /**
229
- * 解锁所有章节
230
- * @access public
231
- */
232
- unlockAll(): void;
233
- }
@@ -1,109 +0,0 @@
1
- export default RewardAdGlobalRecorder;
2
- export type RecordType = "halfway" | "finished" | "completed";
3
- /**
4
- * @typedef {'halfway' | 'finished' | 'completed'} RecordType
5
- */
6
- declare class RewardAdGlobalRecorder {
7
- static instance: any;
8
- /**
9
- *
10
- * @param {object} args
11
- * @param {string} args.sign 初始化标识
12
- * @returns {RewardAdGlobalRecorder}
13
- */
14
- static build(args: {
15
- sign: string;
16
- }): RewardAdGlobalRecorder;
17
- /**
18
- *
19
- * @returns {RewardAdGlobalRecorder}
20
- */
21
- static getInstance(): RewardAdGlobalRecorder;
22
- /**
23
- * @param {object} args
24
- * @param {string} args.sign 初始化标识
25
- */
26
- constructor(args: {
27
- sign: string;
28
- });
29
- _initSign: string;
30
- /** @type {import('../typings/ad.js').SceneTextMap} */
31
- _halfway: import("../typings/ad.js").SceneTextMap;
32
- _finished: {
33
- scene: number;
34
- count: number;
35
- }[];
36
- /**
37
- * @param {object} args
38
- * @param {string} args.sign 初始化标识
39
- */
40
- initialize(args: {
41
- sign: string;
42
- }): void;
43
- /**
44
- * 找到相同的场景值,如果没有则新增
45
- * @param {object} args
46
- * @param {RecordType} args.type
47
- * @param {number} args.scene
48
- */
49
- _halfwayUpdate(args: {
50
- type: RecordType;
51
- scene: number;
52
- }): void;
53
- /**
54
- * @param {object} args
55
- * @param {number[]} args.scenes
56
- * @returns
57
- */
58
- _halfwayGet(args: {
59
- scenes: number[];
60
- }): any;
61
- _halfwayReset(): void;
62
- /**
63
- * 找到相同的场景值,如果没有则新增
64
- * @param {object} args
65
- * @param {RecordType} args.type
66
- * @param {number} args.scene
67
- */
68
- _finishedUpdate(args: {
69
- type: RecordType;
70
- scene: number;
71
- }): void;
72
- /**
73
- * @param {object} args
74
- * @param {number[]} args.scenes
75
- * @returns
76
- */
77
- _finishedGet(args: {
78
- scenes: number[];
79
- }): number;
80
- _finishedReset(): void;
81
- /**
82
- * @param {object} args
83
- * @param {RecordType} args.type
84
- * @param {number} args.scene
85
- */
86
- record(args: {
87
- type: RecordType;
88
- scene: number;
89
- }): void;
90
- /**
91
- *
92
- * @param {RecordType} type
93
- */
94
- rest(type: RecordType): void;
95
- /**
96
- * @param {object} args
97
- * @param {number[]} [args.scenes]
98
- * @param {RecordType} args.type
99
- */
100
- get(args: {
101
- scenes?: number[];
102
- type: RecordType;
103
- }): any;
104
- /**
105
- * 站位方法,没有任何左右
106
- * @returns
107
- */
108
- placeholder(): any;
109
- }
@@ -1,71 +0,0 @@
1
- export default RewardAdSceneTriggerManager;
2
- /**
3
- * 场景值枚举 可持续添加
4
- */
5
- export type RewardAdTriggerScene = import("../typings/ad.js").RewardAdTriggerScene;
6
- /**
7
- * 场景值枚举 可持续添加
8
- * @typedef {import('../typings/ad.js').RewardAdTriggerScene} RewardAdTriggerScene
9
- */
10
- declare class RewardAdSceneTriggerManager {
11
- static instance: any;
12
- /**
13
- *
14
- * @param {object} args
15
- * @param {string} args.sign 初始化标识
16
- * @param {import('../typings/ad.js').SceneTypeMap} args.sceneTypeObj 当前场景sceneTypeMap 场景值类型映射表
17
- * @returns {RewardAdSceneTriggerManager}
18
- */
19
- static build(args: {
20
- sign: string;
21
- sceneTypeObj: import("../typings/ad.js").SceneTypeMap;
22
- }): RewardAdSceneTriggerManager;
23
- /**
24
- *
25
- * @returns {RewardAdSceneTriggerManager}
26
- */
27
- static getInstance(): RewardAdSceneTriggerManager;
28
- /**
29
- * @param {object} args
30
- * @param {string} args.sign 初始化标识
31
- * @param {import('../typings/ad.js').SceneTypeMap} args.sceneTypeObj 当前场景sceneTypeMap 场景值类型映射表
32
- */
33
- constructor(args: {
34
- sign: string;
35
- sceneTypeObj: import("../typings/ad.js").SceneTypeMap;
36
- });
37
- _initSign: string;
38
- /** @type {RewardAdTriggerScene} */
39
- _currScene: RewardAdTriggerScene;
40
- /** @type {import('../typings/ad.js').SceneTypeMap} */
41
- _sceneTypeObj: import("../typings/ad.js").SceneTypeMap;
42
- /**
43
- * @param {object} args
44
- * @param {string} args.sign 初始化标识
45
- */
46
- initialize(args: {
47
- sign: string;
48
- }): void;
49
- /**
50
- * 获取场景值
51
- * @param {RewardAdTriggerScene} value 场景值
52
- * @returns
53
- */
54
- addScene(value: RewardAdTriggerScene): this;
55
- /**
56
- * 获取场景值
57
- * @param {import('../typings/ad.js').RewardAdTriggerSceneType} value 场景值类型
58
- * @returns
59
- */
60
- addSceneType(value?: import("../typings/ad.js").RewardAdTriggerSceneType): this;
61
- /**
62
- * 获取当前场景值
63
- * @returns
64
- */
65
- getCurrentScene(): string;
66
- /**
67
- * 站位方法,没有任何左右
68
- * @returns
69
- */
70
- placeholder(): any;
71
- }
@@ -1,10 +0,0 @@
1
- export { CountRecorder } from "./CountRecorder.js";
2
- export { Logger } from "./Logger.js";
3
- export { SerializableError } from "./SerializableError.js";
4
- export { default as Storage } from "./Storage.js";
5
- export { default as PubSub } from "./PubSub.js";
6
- export { EventEmitter } from "./EventEmitter.js";
7
- export { default as AdAnalyticsJS } from "./AdAnalyticsJS.js";
8
- export { default as LovelUnlockManager } from "./LovelUnlockManager.js";
9
- export { default as RewardAdGlobalRecorder } from "./RewardAdGlobalRecorder.js";
10
- export { default as RewardAdSceneTriggerManager } from "./RewardAdSceneTriggerManager.js";