@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.
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/{helper/PubSub.d.ts → PubSub.d.ts} +1 -1
- package/dist/{helper/SerializableError.d.ts → SerializableError.d.ts} +5 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -15
- package/dist/index.js +1 -1
- package/package.json +54 -11
- package/dist/ad/InterstitialAdFather.d.ts +0 -131
- package/dist/ad/InterstitialAdNovel.d.ts +0 -457
- package/dist/ad/RewardAdFather.d.ts +0 -131
- package/dist/ad/RewardAdNovel.d.ts +0 -464
- package/dist/ad/index.d.ts +0 -4
- package/dist/const/const.d.ts +0 -20
- package/dist/core/AdExecuteManager.d.ts +0 -129
- package/dist/core/compose.d.ts +0 -12
- package/dist/core/index.d.ts +0 -2
- package/dist/helper/AdAnalyticsJS.d.ts +0 -132
- package/dist/helper/LovelUnlockManager.d.ts +0 -233
- package/dist/helper/RewardAdGlobalRecorder.d.ts +0 -109
- package/dist/helper/RewardAdSceneTriggerManager.d.ts +0 -71
- package/dist/helper/index.d.ts +0 -10
- package/dist/typings/ad.d.ts +0 -188
- package/dist/typings/common.d.ts +0 -14
- package/dist/typings/tracker.d.ts +0 -1
- package/dist/utils/functional.d.ts +0 -13
- /package/dist/{helper/CountRecorder.d.ts → CountRecorder.d.ts} +0 -0
- /package/dist/{helper/EventEmitter.d.ts → EventEmitter.d.ts} +0 -0
- /package/dist/{helper/Logger.d.ts → Logger.d.ts} +0 -0
- /package/dist/{helper/Storage.d.ts → Storage.d.ts} +0 -0
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
export default RewardAdNovel;
|
|
2
|
-
export type IRewordAdConfig = import("../typings/ad.js").IRewordAdConfig;
|
|
3
|
-
export type ICallbackArgs = {
|
|
4
|
-
/**
|
|
5
|
-
* 广告执行场景
|
|
6
|
-
*/
|
|
7
|
-
scene: number;
|
|
8
|
-
/**
|
|
9
|
-
* 是否看完
|
|
10
|
-
*/
|
|
11
|
-
isEnded: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* 完整观看次数
|
|
14
|
-
*/
|
|
15
|
-
count: number;
|
|
16
|
-
/**
|
|
17
|
-
* 执行下一个任务的回调函数,手动调用以继续执行流程[end]
|
|
18
|
-
*/
|
|
19
|
-
end?: () => void;
|
|
20
|
-
/**
|
|
21
|
-
* 执行下一个任务的回调函数, 手动调用以继续执行流程[circle]
|
|
22
|
-
*/
|
|
23
|
-
circle?: (args: {
|
|
24
|
-
ignoreRemain: boolean;
|
|
25
|
-
scene: number;
|
|
26
|
-
}) => void;
|
|
27
|
-
};
|
|
28
|
-
export type IConnection = {
|
|
29
|
-
/**
|
|
30
|
-
* 广告中途退出回调
|
|
31
|
-
*/
|
|
32
|
-
onHalfway?: (args: ICallbackArgs) => void;
|
|
33
|
-
/**
|
|
34
|
-
* 广告展示回调
|
|
35
|
-
*/
|
|
36
|
-
onShow?: (args: ICallbackArgs) => void;
|
|
37
|
-
/**
|
|
38
|
-
* 广告执行成功回调
|
|
39
|
-
*/
|
|
40
|
-
onFinish?: (args: ICallbackArgs) => void;
|
|
41
|
-
/**
|
|
42
|
-
* 广告执行成功回调
|
|
43
|
-
*/
|
|
44
|
-
onAlways?: (args: ICallbackArgs) => void;
|
|
45
|
-
/**
|
|
46
|
-
* 广告执行失败回调
|
|
47
|
-
*/
|
|
48
|
-
onError?: (e: unknown) => void;
|
|
49
|
-
};
|
|
50
|
-
export type IConstructArgs = {
|
|
51
|
-
/**
|
|
52
|
-
* 初始化标识
|
|
53
|
-
*/
|
|
54
|
-
sign?: string;
|
|
55
|
-
/**
|
|
56
|
-
* 是否保留tt激励视频广告实例
|
|
57
|
-
*/
|
|
58
|
-
preserveOnEnd?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* 是否需要在超时情况下结束广告
|
|
61
|
-
*/
|
|
62
|
-
needEndOnTimeout?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* 激励视频参数 (可选)
|
|
65
|
-
*/
|
|
66
|
-
adConfig?: IRewordAdConfig | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* 回调集合
|
|
69
|
-
*/
|
|
70
|
-
collection?: IConnection | undefined;
|
|
71
|
-
};
|
|
72
|
-
export type ICloseArgs = {
|
|
73
|
-
/**
|
|
74
|
-
* 是否看完
|
|
75
|
-
*/
|
|
76
|
-
isEnded: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* 完整观看次数
|
|
79
|
-
*/
|
|
80
|
-
count: number;
|
|
81
|
-
};
|
|
82
|
-
export type IEndArgs = {
|
|
83
|
-
/**
|
|
84
|
-
* 是否解锁全部
|
|
85
|
-
*/
|
|
86
|
-
can_unlock_all?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* 是否解锁小说
|
|
89
|
-
*/
|
|
90
|
-
can_unlock_novel?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* 剩余次数
|
|
93
|
-
*/
|
|
94
|
-
remain?: number;
|
|
95
|
-
/**
|
|
96
|
-
* 结束类型
|
|
97
|
-
*/
|
|
98
|
-
end_type?: "halfway" | "finished";
|
|
99
|
-
};
|
|
100
|
-
export type IRewardedVideoAd = {
|
|
101
|
-
/**
|
|
102
|
-
* 显示激励视频广告
|
|
103
|
-
*/
|
|
104
|
-
show: () => Promise<void>;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* @typedef {import('../typings/ad.js').IRewordAdConfig} IRewordAdConfig
|
|
108
|
-
*/
|
|
109
|
-
/**
|
|
110
|
-
* @typedef ICallbackArgs
|
|
111
|
-
* @property {number} scene 广告执行场景
|
|
112
|
-
* @property {boolean} isEnded 是否看完
|
|
113
|
-
* @property {number} count 完整观看次数
|
|
114
|
-
* @property {() => void} [end] 执行下一个任务的回调函数,手动调用以继续执行流程[end]
|
|
115
|
-
* @property {(args: {ignoreRemain: boolean, scene: number}) => void} [circle] 执行下一个任务的回调函数, 手动调用以继续执行流程[circle]
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
/**
|
|
119
|
-
* @typedef IConnection
|
|
120
|
-
* @property {(args: ICallbackArgs) => void} [onHalfway] 广告中途退出回调
|
|
121
|
-
* @property {(args: ICallbackArgs) => void} [onShow] 广告展示回调
|
|
122
|
-
* @property {(args: ICallbackArgs) => void} [onFinish] 广告执行成功回调
|
|
123
|
-
* @property {(args: ICallbackArgs) => void} [onAlways] 广告执行成功回调
|
|
124
|
-
* @property {(e:unknown) => void} [onError] 广告执行失败回调
|
|
125
|
-
*/
|
|
126
|
-
/**
|
|
127
|
-
* @typedef IConstructArgs
|
|
128
|
-
* @property {string} [sign] 初始化标识
|
|
129
|
-
* @property {boolean} [preserveOnEnd] 是否保留tt激励视频广告实例
|
|
130
|
-
* @property {boolean} [needEndOnTimeout] 是否需要在超时情况下结束广告
|
|
131
|
-
* @property {IRewordAdConfig=} [adConfig] 激励视频参数 (可选)
|
|
132
|
-
* @property {IConnection=} [collection] 回调集合
|
|
133
|
-
*/
|
|
134
|
-
/**
|
|
135
|
-
* @typedef ICloseArgs
|
|
136
|
-
* @property {boolean} isEnded 是否看完
|
|
137
|
-
* @property {number} count 完整观看次数
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* @typedef IEndArgs
|
|
141
|
-
* @property {boolean} [can_unlock_all] 是否解锁全部
|
|
142
|
-
* @property {boolean} [can_unlock_novel] 是否解锁小说
|
|
143
|
-
* @property {number} [remain] 剩余次数
|
|
144
|
-
* @property {'halfway' | 'finished'} [end_type] 结束类型
|
|
145
|
-
*
|
|
146
|
-
*/
|
|
147
|
-
/**
|
|
148
|
-
* @typedef IRewardedVideoAd
|
|
149
|
-
* @property {() => Promise.<void>} show 显示激励视频广告
|
|
150
|
-
*/
|
|
151
|
-
declare class RewardAdNovel extends RewardAdFather {
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
* @param {IConstructArgs} args
|
|
155
|
-
* @returns {RewardAdNovel}
|
|
156
|
-
*/
|
|
157
|
-
static build(args: IConstructArgs): RewardAdNovel;
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
160
|
-
* @returns {RewardAdNovel}
|
|
161
|
-
*/
|
|
162
|
-
static getInstance(): RewardAdNovel;
|
|
163
|
-
/**
|
|
164
|
-
*
|
|
165
|
-
* @param {IConstructArgs} args
|
|
166
|
-
* @returns {RewardAdNovel}
|
|
167
|
-
*/
|
|
168
|
-
static "new"(args: IConstructArgs): RewardAdNovel;
|
|
169
|
-
/**
|
|
170
|
-
* @param {IConstructArgs} args
|
|
171
|
-
*
|
|
172
|
-
*/
|
|
173
|
-
constructor(args: IConstructArgs);
|
|
174
|
-
_onHalfway: any;
|
|
175
|
-
_onShow: any;
|
|
176
|
-
_onFinish: any;
|
|
177
|
-
_onAlways: any;
|
|
178
|
-
_onError: any;
|
|
179
|
-
_alwaysCallback: any;
|
|
180
|
-
_halfwayCallback: any;
|
|
181
|
-
_finishedCallback: any;
|
|
182
|
-
_resolve: any;
|
|
183
|
-
_next: any;
|
|
184
|
-
/** @type {number} 广告执行场景 */
|
|
185
|
-
_scene: number;
|
|
186
|
-
_adTypeR: 1;
|
|
187
|
-
_adTimeout: any;
|
|
188
|
-
_adTimeoutTime: number;
|
|
189
|
-
_adBeforeShowTimer: any;
|
|
190
|
-
_adBeforeShowTime: number;
|
|
191
|
-
_adSpeedCloseTimer: any;
|
|
192
|
-
_adSpeedCloseTime: number;
|
|
193
|
-
_needEndOnTimeout: boolean;
|
|
194
|
-
/** @deprecated TODO 移除 */
|
|
195
|
-
_needSpeedEndOnTimeout: boolean;
|
|
196
|
-
bindAdCloseLister: any;
|
|
197
|
-
bindAdErrorLister: any;
|
|
198
|
-
bindAdLoadLister: any;
|
|
199
|
-
bindApiAdErrorLister: any;
|
|
200
|
-
_bindShiftCloseLister: any;
|
|
201
|
-
_bindShiftErrorLister: any;
|
|
202
|
-
/**
|
|
203
|
-
* 初始化
|
|
204
|
-
* 子类可以选择覆盖此方法,或使用默认实现
|
|
205
|
-
* @param {IRewordAdConfig} args
|
|
206
|
-
* @param {(v: IRewardedVideoAd) => void} [callback] 初始化成功回调
|
|
207
|
-
* @returns {this} 当前实例
|
|
208
|
-
*/
|
|
209
|
-
initialize(args: IRewordAdConfig, callback?: (v: IRewardedVideoAd) => void): this;
|
|
210
|
-
_initAdLister(): void;
|
|
211
|
-
/**
|
|
212
|
-
* @param {object} args
|
|
213
|
-
* @param {number} [args.retry] 重试次数
|
|
214
|
-
*/
|
|
215
|
-
_initNovelConfig(args: {
|
|
216
|
-
retry?: number;
|
|
217
|
-
}): void;
|
|
218
|
-
novelConfig: RewardAdNovelConfig;
|
|
219
|
-
_onInnerExecuteBefore(): any;
|
|
220
|
-
_onInnerAdShowSuccess(): any;
|
|
221
|
-
/**
|
|
222
|
-
* 广告展示超时设置
|
|
223
|
-
* @param {object} args
|
|
224
|
-
* @param {string} args.scene 广告执行场景 必填
|
|
225
|
-
* @param {number} [args.timeout] 广告超时时间 单位ms
|
|
226
|
-
* @param {Function} args.end 结束当前广告任务的回调函数 必填
|
|
227
|
-
*/
|
|
228
|
-
_setAdTimeout(args: {
|
|
229
|
-
scene: string;
|
|
230
|
-
timeout?: number;
|
|
231
|
-
end: Function;
|
|
232
|
-
}): void;
|
|
233
|
-
/**
|
|
234
|
-
* 广告展示前定时器
|
|
235
|
-
* @param {object} args
|
|
236
|
-
* @param {string} args.scene 广告执行场景 必填
|
|
237
|
-
* @param {Function} args.prelude 广告展示前回调函数 可选
|
|
238
|
-
*/
|
|
239
|
-
_adPreludeInterval(args: {
|
|
240
|
-
scene: string;
|
|
241
|
-
prelude: Function;
|
|
242
|
-
}): void;
|
|
243
|
-
_clearAdTimeout(): void;
|
|
244
|
-
/**
|
|
245
|
-
* 广告展示成功前分析
|
|
246
|
-
* 子类需要埋点可以选择覆盖此方法
|
|
247
|
-
* @protected
|
|
248
|
-
* @param {object} _args
|
|
249
|
-
* @param {string} _args.scene 广告执行场景 必填
|
|
250
|
-
* @returns
|
|
251
|
-
*/
|
|
252
|
-
protected _adShowBeforeAnalytics(_args: {
|
|
253
|
-
scene: string;
|
|
254
|
-
}): any;
|
|
255
|
-
/**
|
|
256
|
-
* 广告展示成功分析
|
|
257
|
-
* 子类需要埋点可以选择覆盖此方法
|
|
258
|
-
* @protected
|
|
259
|
-
* @param {object} _args
|
|
260
|
-
* @param {string} _args.scene 广告执行场景 必填
|
|
261
|
-
* @param {string} [_args.msg] 广告执行成功原因
|
|
262
|
-
* @param {0|1} _args.result 广告执行成功结果
|
|
263
|
-
* @returns
|
|
264
|
-
*/
|
|
265
|
-
protected _adShowSuccessAnalytics(_args: {
|
|
266
|
-
scene: string;
|
|
267
|
-
msg?: string;
|
|
268
|
-
result: 0 | 1;
|
|
269
|
-
}): any;
|
|
270
|
-
/**
|
|
271
|
-
* 广告展示失败分析
|
|
272
|
-
* 子类需要埋点可以选择覆盖此方法
|
|
273
|
-
* @protected
|
|
274
|
-
* @param {object} _args
|
|
275
|
-
* @param {string} _args.scene 广告执行场景 必填
|
|
276
|
-
* @param {string} _args.msg 广告执行失败原因 必填
|
|
277
|
-
* @param {number} _args.errorCode 广告执行失败错误码 必填
|
|
278
|
-
* @param {0|1} _args.result 广告执行失败结果
|
|
279
|
-
* @returns
|
|
280
|
-
*/
|
|
281
|
-
protected _adShowFailureAnalytics(_args: {
|
|
282
|
-
scene: string;
|
|
283
|
-
msg: string;
|
|
284
|
-
errorCode: number;
|
|
285
|
-
result: 0 | 1;
|
|
286
|
-
}): any;
|
|
287
|
-
/**
|
|
288
|
-
* 广告加载成功分析
|
|
289
|
-
* 子类需要埋点可以选择覆盖此方法
|
|
290
|
-
* @protected
|
|
291
|
-
* @param {object} _args
|
|
292
|
-
* @param {string} _args.scene 广告执行场景 必填
|
|
293
|
-
* @param {string} [_args.msg] 广告执行成功原因
|
|
294
|
-
* @param {0|1} _args.result 广告执行成功结果
|
|
295
|
-
* @returns
|
|
296
|
-
*/
|
|
297
|
-
protected _adLoadSuccessAnalytics(_args: {
|
|
298
|
-
scene: string;
|
|
299
|
-
msg?: string;
|
|
300
|
-
result: 0 | 1;
|
|
301
|
-
}): any;
|
|
302
|
-
/**
|
|
303
|
-
* 广告加载失败分析
|
|
304
|
-
* 子类需要埋点可以选择覆盖此方法
|
|
305
|
-
* @protected
|
|
306
|
-
* @param {object} _args
|
|
307
|
-
* @param {string} _args.scene 广告执行场景 必填
|
|
308
|
-
* @param {string} _args.msg 广告执行失败原因 必填
|
|
309
|
-
* @param {0|1} _args.result 广告执行失败结果
|
|
310
|
-
* @returns
|
|
311
|
-
*/
|
|
312
|
-
protected _adLoadFailureAnalytics(_args: {
|
|
313
|
-
scene: string;
|
|
314
|
-
msg: string;
|
|
315
|
-
result: 0 | 1;
|
|
316
|
-
}): any;
|
|
317
|
-
/**
|
|
318
|
-
* 广告关闭成功分析
|
|
319
|
-
* 子类需要埋点可以选择覆盖此方法
|
|
320
|
-
* @protected
|
|
321
|
-
* @param {object} _args
|
|
322
|
-
* @param {string} _args.scene 广告执行场景 必填
|
|
323
|
-
* @param {number} _args.ad_is_completed 广告是否完成 必填
|
|
324
|
-
* @param {number} _args.ad_count 广告执行次数 必填
|
|
325
|
-
* @returns
|
|
326
|
-
*/
|
|
327
|
-
protected _adCloseSuccessAnalytics(_args: {
|
|
328
|
-
scene: string;
|
|
329
|
-
ad_is_completed: number;
|
|
330
|
-
ad_count: number;
|
|
331
|
-
}): any;
|
|
332
|
-
get rewardAd(): any;
|
|
333
|
-
/**
|
|
334
|
-
* 确保广告按顺序执行
|
|
335
|
-
* @override
|
|
336
|
-
* @param {Object} [ctx] 上下文对象,用于传递数据和状态
|
|
337
|
-
* @param {IRewordAdConfig} [ctx.options] 广告执行选项
|
|
338
|
-
* @param {import('../typings/ad.js').CallbackCollection} [ctx.collection] 回调集合
|
|
339
|
-
* @returns {Promise.<IEndArgs & ICloseArgs | Undefined>}
|
|
340
|
-
*/
|
|
341
|
-
override addExecuteManager(ctx?: {
|
|
342
|
-
options?: IRewordAdConfig;
|
|
343
|
-
collection?: import("../typings/ad.js").CallbackCollection;
|
|
344
|
-
}): Promise<(IEndArgs & ICloseArgs) | undefined>;
|
|
345
|
-
/**
|
|
346
|
-
* @override
|
|
347
|
-
* @param {object} [ctx] 广告执行上下文
|
|
348
|
-
* @param {import('../typings/ad.js').IRewordAdConfig} [ctx.options] 广告执行选项
|
|
349
|
-
* @param {import('../typings/ad.js').CallbackCollection} [ctx.collection] 回调集合
|
|
350
|
-
* @param {Function} next 执行下一个任务的回调函数,手动调用以继续执行流程
|
|
351
|
-
* @returns {Promise.<IEndArgs & ICloseArgs | Undefined>}
|
|
352
|
-
*/
|
|
353
|
-
override ad(ctx?: {
|
|
354
|
-
options?: import("../typings/ad.js").IRewordAdConfig;
|
|
355
|
-
collection?: import("../typings/ad.js").CallbackCollection;
|
|
356
|
-
}, next?: Function): Promise<(IEndArgs & ICloseArgs) | undefined>;
|
|
357
|
-
/**
|
|
358
|
-
* @param {object} [ctx] 广告执行上下文
|
|
359
|
-
* @param {object} [ctx.options] 广告执行选项
|
|
360
|
-
* @param {number} [ctx.options.scene] 广告执行场景 必填
|
|
361
|
-
* @param {number} [ctx.options.timeout] 广告超时时间 单位ms
|
|
362
|
-
* @param {object} ctx.collection 回调集合
|
|
363
|
-
* @param {(v?: unknown) => void} ctx.collection.resolve 广告执行成功的回调函数
|
|
364
|
-
* @param {(v?: unknown) => void} [ctx.collection.reject] 广告执行失败的回调函数
|
|
365
|
-
* @param {(v?: unknown) => void} [ctx.collection.before] 广告执行前的回调函数
|
|
366
|
-
* @param {(v?: unknown) => void} [ctx.collection.success] 广告执行成功的回调函数
|
|
367
|
-
* @param {(v?: unknown) => void} [ctx.collection.prelude] 拉起广告前计时的回调函数
|
|
368
|
-
* @param {Function} next 执行下一个任务的回调函数,手动调用以继续执行流程
|
|
369
|
-
*/
|
|
370
|
-
_adInner(ctx?: {
|
|
371
|
-
options?: {
|
|
372
|
-
scene?: number;
|
|
373
|
-
timeout?: number;
|
|
374
|
-
};
|
|
375
|
-
collection: {
|
|
376
|
-
resolve: (v?: unknown) => void;
|
|
377
|
-
reject?: (v?: unknown) => void;
|
|
378
|
-
before?: (v?: unknown) => void;
|
|
379
|
-
success?: (v?: unknown) => void;
|
|
380
|
-
prelude?: (v?: unknown) => void;
|
|
381
|
-
};
|
|
382
|
-
}, next?: Function): void;
|
|
383
|
-
_before: (v?: unknown) => void;
|
|
384
|
-
_success: (v?: unknown) => void;
|
|
385
|
-
/**
|
|
386
|
-
* 广告加载
|
|
387
|
-
* @returns
|
|
388
|
-
*/
|
|
389
|
-
adLoad(): Promise<void>;
|
|
390
|
-
/**
|
|
391
|
-
* 广告展示
|
|
392
|
-
* @returns
|
|
393
|
-
*/
|
|
394
|
-
adShow(): Promise<void>;
|
|
395
|
-
_outerCloseCallback(args: any): void;
|
|
396
|
-
_outerHalfwayCallback(args: any): void;
|
|
397
|
-
_outerFinishedCallback(args: any): void;
|
|
398
|
-
/**
|
|
399
|
-
* 关闭激励视频
|
|
400
|
-
* 子类重写该方法时,必须调用this._clearAdTimeout();清除超时定时器
|
|
401
|
-
* @param {ICloseArgs} args
|
|
402
|
-
*/
|
|
403
|
-
adCloseLister(args: ICloseArgs): void;
|
|
404
|
-
adErrorLister(e: any): void;
|
|
405
|
-
apiAdErrorLister(e: any): void;
|
|
406
|
-
/**
|
|
407
|
-
* 激励视频广告组件**成功**拉取广告素材时会触发
|
|
408
|
-
* 创建激励时候后会自动拉取广告素材,如果广告拉取成功,也会触发此事件,不管是否调用show方法
|
|
409
|
-
* @param {unknown} e
|
|
410
|
-
*/
|
|
411
|
-
adLoadLister(e: unknown): void;
|
|
412
|
-
adDestroy(): void;
|
|
413
|
-
_shiftCloseLister(args: any): void;
|
|
414
|
-
_shiftErrorLister(args: any): void;
|
|
415
|
-
/**
|
|
416
|
-
* 手动出栈
|
|
417
|
-
*/
|
|
418
|
-
shift(): void;
|
|
419
|
-
}
|
|
420
|
-
import RewardAdFather from './RewardAdFather.js';
|
|
421
|
-
declare class RewardAdNovelConfig {
|
|
422
|
-
/**
|
|
423
|
-
*
|
|
424
|
-
* @param {object} args
|
|
425
|
-
* @param {string} args.sign 初始化标识
|
|
426
|
-
* @param {number} [args.retry] 重试次数
|
|
427
|
-
* @returns {RewardAdNovelConfig}
|
|
428
|
-
*/
|
|
429
|
-
static "new"(args: {
|
|
430
|
-
sign: string;
|
|
431
|
-
retry?: number;
|
|
432
|
-
}): RewardAdNovelConfig;
|
|
433
|
-
/**
|
|
434
|
-
*
|
|
435
|
-
* @param {object} [args]
|
|
436
|
-
* @param {number} [args.retry]
|
|
437
|
-
*/
|
|
438
|
-
constructor(args?: {
|
|
439
|
-
retry?: number;
|
|
440
|
-
});
|
|
441
|
-
frequency: {
|
|
442
|
-
total: number;
|
|
443
|
-
current: number;
|
|
444
|
-
};
|
|
445
|
-
/**
|
|
446
|
-
*
|
|
447
|
-
* @param {object} [args]
|
|
448
|
-
* @param {number} [args.retry]
|
|
449
|
-
*/
|
|
450
|
-
_init(args?: {
|
|
451
|
-
retry?: number;
|
|
452
|
-
}): void;
|
|
453
|
-
/**
|
|
454
|
-
*
|
|
455
|
-
* @param {object} [args]
|
|
456
|
-
* @param {number} [args.retry]
|
|
457
|
-
*/
|
|
458
|
-
_adTimes(args?: {
|
|
459
|
-
retry?: number;
|
|
460
|
-
}): void;
|
|
461
|
-
reset(): void;
|
|
462
|
-
updateRetry(): void;
|
|
463
|
-
remain(): number;
|
|
464
|
-
}
|
package/dist/ad/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { default as RewardAdFather } from "./RewardAdFather.js";
|
|
2
|
-
export { default as RewardAdNovel } from "./RewardAdNovel.js";
|
|
3
|
-
export { default as InterstitialAdFather } from "./InterstitialAdFather.js";
|
|
4
|
-
export { default as InterstitialAdNovel } from "./InterstitialAdNovel.js";
|
package/dist/const/const.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 广告场景类型映射对象
|
|
3
|
-
* @type {import('../typings/ad.js').SceneTypeMap}
|
|
4
|
-
*/
|
|
5
|
-
export const DEFAULT_SCENT_TYPE_OBJ: import("../typings/ad.js").SceneTypeMap;
|
|
6
|
-
/**
|
|
7
|
-
* 广告场景文本映射对象
|
|
8
|
-
* @type {import('../typings/ad.js').SceneTextMap}
|
|
9
|
-
*/
|
|
10
|
-
export const DEFAULT_SCENT_TEXT_OBJ: import("../typings/ad.js").SceneTextMap;
|
|
11
|
-
/**
|
|
12
|
-
* 用户类型文本映射对象(反向映射)
|
|
13
|
-
* @type {import('../typings/common.js').IAdType}
|
|
14
|
-
*/
|
|
15
|
-
export const AD_TYPE_ENUM: import("../typings/common.js").IAdType;
|
|
16
|
-
/**
|
|
17
|
-
* 广告类型文本映射对象(反向映射)
|
|
18
|
-
* @type {import('../typings/common.js').IAdTypeReverse}
|
|
19
|
-
*/
|
|
20
|
-
export const AD_TYPE_ENUM_REVERSE: import("../typings/common.js").IAdTypeReverse;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
export default AdExecuteManager;
|
|
2
|
-
export type AdTask = {
|
|
3
|
-
/**
|
|
4
|
-
* RewardAdFather的子类实例
|
|
5
|
-
*/
|
|
6
|
-
adInstance: import("../ad/RewardAdFather.js").default;
|
|
7
|
-
/**
|
|
8
|
-
* 广告执行选项
|
|
9
|
-
*/
|
|
10
|
-
options: import("../typings/ad.js").IRewordAdConfig;
|
|
11
|
-
/**
|
|
12
|
-
* 回调集合
|
|
13
|
-
*/
|
|
14
|
-
callbackCollection: import("../typings/ad.js").CallbackCollection;
|
|
15
|
-
/**
|
|
16
|
-
* 广告执行成功的回调函数
|
|
17
|
-
*/
|
|
18
|
-
resolve: Function;
|
|
19
|
-
/**
|
|
20
|
-
* 广告执行失败的回调函数
|
|
21
|
-
*/
|
|
22
|
-
reject: Function;
|
|
23
|
-
/**
|
|
24
|
-
* 广告任务的唯一标识符
|
|
25
|
-
*/
|
|
26
|
-
id: string;
|
|
27
|
-
/**
|
|
28
|
-
* 广告任务是否已成功解决
|
|
29
|
-
*/
|
|
30
|
-
_isResolved: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* 广告任务是否已被拒绝
|
|
33
|
-
*/
|
|
34
|
-
_isRejected: boolean;
|
|
35
|
-
};
|
|
36
|
-
export type IConstructArgs = {
|
|
37
|
-
/**
|
|
38
|
-
* 广告执行选项
|
|
39
|
-
*/
|
|
40
|
-
options?: object;
|
|
41
|
-
/**
|
|
42
|
-
* 是否打印日志
|
|
43
|
-
*/
|
|
44
|
-
log?: boolean;
|
|
45
|
-
};
|
|
46
|
-
declare class AdExecuteManager {
|
|
47
|
-
/**
|
|
48
|
-
* 单例实例
|
|
49
|
-
* @type {AdExecuteManager|null}
|
|
50
|
-
*/
|
|
51
|
-
static _instance: AdExecuteManager | null;
|
|
52
|
-
/**
|
|
53
|
-
* 获取单例实例
|
|
54
|
-
* @param {IConstructArgs} [args]
|
|
55
|
-
* @returns {AdExecuteManager}
|
|
56
|
-
*/
|
|
57
|
-
static getInstance(args?: IConstructArgs): AdExecuteManager;
|
|
58
|
-
/**
|
|
59
|
-
* 获取单例实例
|
|
60
|
-
* @returns {AdExecuteManager}
|
|
61
|
-
*/
|
|
62
|
-
static getSafeInstance(): AdExecuteManager;
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @param {IConstructArgs} args
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
constructor(args: IConstructArgs);
|
|
69
|
-
/**
|
|
70
|
-
* @type {Array.<AdTask>}
|
|
71
|
-
*/
|
|
72
|
-
_taskStack: Array<AdTask>;
|
|
73
|
-
/**
|
|
74
|
-
* @type {Array.<AdTask>}
|
|
75
|
-
*/
|
|
76
|
-
_currentBatchTasks: Array<AdTask>;
|
|
77
|
-
/**
|
|
78
|
-
* @type {boolean}
|
|
79
|
-
*/
|
|
80
|
-
_isRunning: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* @type {AdTask|null}
|
|
83
|
-
*/
|
|
84
|
-
_currentTask: AdTask | null;
|
|
85
|
-
logger: Logger;
|
|
86
|
-
/**
|
|
87
|
-
* 添加广告任务
|
|
88
|
-
* @param {import('../ad/RewardAdFather.js').default} adInstance RewardAdFather的子类实例
|
|
89
|
-
* @param {Object} ctx 广告执行上下文
|
|
90
|
-
* @param {import('../typings/ad.js').IRewordAdConfig} ctx.options 广告执行选项
|
|
91
|
-
* @param {import('../typings/ad.js').CallbackCollection} ctx.collection 回调集合
|
|
92
|
-
* @returns {Promise} 广告执行结果的Promise
|
|
93
|
-
*/
|
|
94
|
-
addTask(adInstance: import("../ad/RewardAdFather.js").default, ctx: {
|
|
95
|
-
options: import("../typings/ad.js").IRewordAdConfig;
|
|
96
|
-
collection: import("../typings/ad.js").CallbackCollection;
|
|
97
|
-
}): Promise<any>;
|
|
98
|
-
/**
|
|
99
|
-
* 组合所有任务
|
|
100
|
-
* @private
|
|
101
|
-
*/
|
|
102
|
-
private _compose;
|
|
103
|
-
/**
|
|
104
|
-
* 清空任务栈并取消所有任务(包括正在执行的任务和middleware链中等待执行的任务)
|
|
105
|
-
*/
|
|
106
|
-
clearTasks(): void;
|
|
107
|
-
/**
|
|
108
|
-
* 获取当前未完成的任务总数
|
|
109
|
-
* 包括任务栈中待执行的任务和中间件链中未完成的任务
|
|
110
|
-
* @returns {number} 未完成的任务数量
|
|
111
|
-
*/
|
|
112
|
-
getTaskCount(): number;
|
|
113
|
-
/**
|
|
114
|
-
* 是否有任务正在运行
|
|
115
|
-
* @returns {boolean}
|
|
116
|
-
*/
|
|
117
|
-
isRunning(): boolean;
|
|
118
|
-
/**
|
|
119
|
-
* 获取当前执行的任务ID
|
|
120
|
-
* @returns {string|null} 当前任务ID
|
|
121
|
-
*/
|
|
122
|
-
getCurrentTaskId(): string | null;
|
|
123
|
-
/**
|
|
124
|
-
* 返回一个Promise,当任务队列中的所有任务都完成时resolve
|
|
125
|
-
* @returns {Promise<void>} 当所有任务完成时resolve的Promise
|
|
126
|
-
*/
|
|
127
|
-
whenAllTasksComplete(): Promise<void>;
|
|
128
|
-
}
|
|
129
|
-
import { Logger } from '../helper/Logger';
|
package/dist/core/compose.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default compose;
|
|
2
|
-
/**
|
|
3
|
-
* Koa中间件核心处理机制
|
|
4
|
-
* @see https://github.com/singcl/koa/blob/master/src/compose-es7.js
|
|
5
|
-
* @param {Array.<Function>} middlewares KOA中间件数组,每个中间件函数接收ctx和next参数
|
|
6
|
-
* @returns {Function} 返回一个组合后的中间件函数,接收ctx参数并按顺序执行所有中间件
|
|
7
|
-
* @version 0.0.1
|
|
8
|
-
* @since 0.0.1
|
|
9
|
-
* @author singcl 24661881@qq.com
|
|
10
|
-
* @description 将多个中间件函数组合成一个单一的中间件函数,形成洋葱模型的调用链
|
|
11
|
-
*/
|
|
12
|
-
declare function compose(middlewares: Array<Function>): Function;
|
package/dist/core/index.d.ts
DELETED