@singcl/ad-execute-manager 2.1.2 → 2.2.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.
@@ -85,6 +85,14 @@ declare class RewardAdNovel extends RewardAdFather {
85
85
  _finishedCallback: any;
86
86
  _resolve: any;
87
87
  _next: any;
88
+ /** @type {{options: import('./typings/ad.js').IAdOptions, collection: import('./typings/ad.js').CallbackCollection, recovered: import('./typings/ad.js').RecoveredInfo}} */
89
+ _adExecuteArgs: {
90
+ options: import("./typings/ad.js").IAdOptions;
91
+ collection: import("./typings/ad.js").CallbackCollection;
92
+ recovered: import("./typings/ad.js").RecoveredInfo;
93
+ };
94
+ /** @type {Function} */
95
+ _adNext: Function;
88
96
  /** @type {number} 广告执行场景 */
89
97
  _scene: number;
90
98
  _adTypeR: 1;
@@ -147,6 +155,7 @@ declare class RewardAdNovel extends RewardAdFather {
147
155
  }): void;
148
156
  novelConfig: RewardAdNovelConfig;
149
157
  _onInnerExecuteBefore(): any;
158
+ _onAdExecuteBefore(): any;
150
159
  /**
151
160
  * @param {object} _args
152
161
  * @param {string} _args.scene 广告执行场景 必填
@@ -160,6 +169,7 @@ declare class RewardAdNovel extends RewardAdFather {
160
169
  recovered?: import("./typings/ad.js").RecoveredInfo;
161
170
  }): any;
162
171
  /**
172
+ * @private
163
173
  * 广告展示超时设置
164
174
  * @param {object} args
165
175
  * @param {string} args.scene 广告执行场景 必填
@@ -167,12 +177,7 @@ declare class RewardAdNovel extends RewardAdFather {
167
177
  * @param {Function} args.end 结束当前广告任务的回调函数 必填
168
178
  * @param {boolean} [args.preserved] 是否在超时情况下保留广告实例 - 自用参数,非tt API要求的参数
169
179
  */
170
- _setAdTimeout(args: {
171
- scene: string;
172
- timeout?: number;
173
- end: Function;
174
- preserved?: boolean;
175
- }): void;
180
+ private _setAdTimeout;
176
181
  /**
177
182
  * 子类可以选择覆盖此方法
178
183
  * 添加超时情况下结束任务前的回调
@@ -314,29 +319,46 @@ declare class RewardAdNovel extends RewardAdFather {
314
319
  _recovered: import("./typings/ad.js").RecoveredInfo;
315
320
  _preservedOnTimeout: boolean;
316
321
  /**
322
+ * ATTENTION: 广告循环执行内部函数,如果需要循环执行,请使用adCircleInner()函数, 不要直接调用此函数
323
+ * @private
317
324
  * @param {object} [ctx] 广告执行上下文
318
325
  * @param {object} [ctx.options] 广告执行选项
319
326
  * @param {number} [ctx.options.scene] 广告执行场景 必填
320
327
  * @param {number} [ctx.options.timeout] 广告超时时间 单位ms
321
328
  * @param {object} ctx.collection 回调集合
322
- * @param {import('./typings/ad.js').RecoveredInfo} [ctx.recovered] 恢复重试信息
323
329
  * @param {(v?: unknown) => void} ctx.collection.resolve 广告执行成功的回调函数
324
- * @param {(v?: unknown) => void} [ctx.collection.reject] 广告执行失败的回调函数
325
330
  * @param {(v?: unknown) => void} [ctx.collection.before] 广告执行前的回调函数
326
331
  * @param {(v?: unknown) => void} [ctx.collection.success] 广告执行成功的回调函数
327
332
  * @param {(v?: unknown) => void} [ctx.collection.prelude] 拉起广告前计时的回调函数
333
+ * @param {import('./typings/ad.js').RecoveredInfo} [ctx.recovered] 恢复重试信息
328
334
  * @param {Function} next 执行下一个任务的回调函数,手动调用以继续执行流程
329
335
  */
330
- _adInner(ctx?: {
336
+ private _adInner;
337
+ _before: (v?: unknown) => void;
338
+ _success: (v?: unknown) => void;
339
+ /**
340
+ * 广告循环执行
341
+ * @public
342
+ * @param {object} [ctx] 广告执行上下文
343
+ * @param {object} [ctx.options] 广告执行选项
344
+ * @param {number} [ctx.options.scene] 广告执行场景 必填
345
+ * @param {number} [ctx.options.timeout] 广告超时时间 单位ms
346
+ * @param {object} ctx.collection 回调集合
347
+ * @param {(v?: unknown) => void} [ctx.collection.before] 广告执行前的回调函数
348
+ * @param {(v?: unknown) => void} [ctx.collection.success] 广告执行成功的回调函数
349
+ * @param {(v?: unknown) => void} [ctx.collection.prelude] 拉起广告前计时的回调函数
350
+ */
351
+ public adCircleInner(ctx?: {
331
352
  options?: {
332
353
  scene?: number;
333
354
  timeout?: number;
334
355
  };
335
- collection: object;
336
- recovered?: import("./typings/ad.js").RecoveredInfo;
337
- }, next?: Function): void;
338
- _before: any;
339
- _success: any;
356
+ collection: {
357
+ before?: (v?: unknown) => void;
358
+ success?: (v?: unknown) => void;
359
+ prelude?: (v?: unknown) => void;
360
+ };
361
+ }): void;
340
362
  /**
341
363
  * 广告加载
342
364
  * @returns
@@ -33,6 +33,19 @@ export class CountRecorder {
33
33
  _initLocalTimes(): void;
34
34
  updateToday(): void;
35
35
  remain(): number;
36
+ /**
37
+ * 保存指定次数
38
+ * @param {number} count 次数
39
+ */
40
+ save(count: number): void;
41
+ /**
42
+ * 清除当前类的本地存储
43
+ */
44
+ clear(): void;
45
+ /**
46
+ * 重置当前类的本地存储
47
+ */
48
+ reset(): void;
36
49
  }
37
50
  export type IConstructorArgs = {
38
51
  /**
@@ -106,6 +106,11 @@ declare class Storage {
106
106
  * @param {number|'today'} expire 过期时间(毫秒)或'today'表示当天有效,可选
107
107
  */
108
108
  setUserItem(key: string, value: any, expire: number | "today"): void;
109
+ /**
110
+ * 删除用户维度的存储项
111
+ * @param {string} key 存储键
112
+ */
113
+ removeUserItem(key: string): void;
109
114
  /**
110
115
  * 删除存储项
111
116
  * @param {string} key 存储键
package/package.json CHANGED
@@ -1,97 +1,97 @@
1
- {
2
- "name": "@singcl/ad-execute-manager",
3
- "version": "2.1.2",
4
- "description": "A powerful and flexible ad execution management library for handling reward-based ads, interstitial ads, and other advertising formats in JavaScript applications.",
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "import": "./dist/index.js",
9
- "require": "./dist/index.cjs",
10
- "types": "./dist/index.d.ts"
11
- }
12
- },
13
- "main": "./dist/index.cjs",
14
- "types": "./dist/index.d.ts",
15
- "files": [
16
- "dist"
17
- ],
18
- "author": {
19
- "name": "singcl",
20
- "email": "iambabyer@gmail.com",
21
- "url": "https://github.com/singcl"
22
- },
23
- "license": "MIT",
24
- "homepage": "https://npmx.dev/package/@singcl/ad-execute-manager",
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/singcl/ad-execute-manager.git"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/singcl/ad-execute-manager/issues"
31
- },
32
- "engines": {
33
- "node": ">=8.0.0",
34
- "npm": ">=6.0.0",
35
- "yarn": ">=1.0.0",
36
- "pnpm": ">=8.0.0"
37
- },
38
- "publishConfig": {
39
- "access": "public"
40
- },
41
- "keywords": [
42
- "ad",
43
- "advertisement",
44
- "reward-ad",
45
- "interstitial-ad",
46
- "ad-manager",
47
- "ad-execution",
48
- "javascript",
49
- "nodejs"
50
- ],
51
- "scripts": {
52
- "build": "rslib build && tsc",
53
- "dev": "rslib build --watch",
54
- "format": "prettier --write .",
55
- "lint": "eslint .",
56
- "test": "rstest",
57
- "prepublishOnly": "npm i && npm run build",
58
- "packages:install": "node build-packages.js install",
59
- "packages:build": "node build-packages.js build",
60
- "packages:publish": "node build-packages.js publish",
61
- "packages:publish:patch": "node build-packages.js publish patch",
62
- "packages:publish:minor": "node build-packages.js publish minor",
63
- "packages:publish:major": "node build-packages.js publish major",
64
- "packages:lint": "node build-packages.js lint",
65
- "packages:format": "node build-packages.js format",
66
- "packages:clean": "node build-packages.js clean",
67
- "packages:all": "node build-packages.js all",
68
- "packages:all:patch": "node build-packages.js all patch",
69
- "packages:all:minor": "node build-packages.js all minor",
70
- "packages:all:major": "node build-packages.js all major"
71
- },
72
- "devDependencies": {
73
- "@babel/eslint-parser": "^7.28.5",
74
- "@babel/preset-env": "^7.28.5",
75
- "@douyin-microapp/typings": "^1.3.1",
76
- "@eslint/js": "^9.39.1",
77
- "@rslib/core": "^0.18.5",
78
- "@rstest/core": "^0.7.2",
79
- "@singcl/ad-execute-manager": "^1.11.12",
80
- "eslint": "^9.39.2",
81
- "eslint-plugin-import": "^2.32.0",
82
- "globals": "^16.5.0",
83
- "prettier": "^3.7.3",
84
- "typescript": "^5.9.3"
85
- },
86
- "dependencies": {
87
- "@ad-execute-manager/core": "^2.0.6",
88
- "@ad-execute-manager/logger": "^2.0.5",
89
- "@ad-execute-manager/ad-reward": "^2.1.1",
90
- "@ad-execute-manager/ad-interstitial": "^2.0.6",
91
- "@ad-execute-manager/count-recorder": "^2.0.5",
92
- "@ad-execute-manager/serializable-error": "^2.0.5",
93
- "@ad-execute-manager/storage": "^2.0.5",
94
- "@ad-execute-manager/event": "^2.0.5",
95
- "@ad-execute-manager/analytics": "^2.0.5"
96
- }
97
- }
1
+ {
2
+ "name": "@singcl/ad-execute-manager",
3
+ "version": "2.2.0",
4
+ "description": "A powerful and flexible ad execution management library for handling reward-based ads, interstitial ads, and other advertising formats in JavaScript applications.",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "main": "./dist/index.cjs",
14
+ "types": "./dist/index.d.ts",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "author": {
19
+ "name": "singcl",
20
+ "email": "iambabyer@gmail.com",
21
+ "url": "https://github.com/singcl"
22
+ },
23
+ "license": "MIT",
24
+ "homepage": "https://npmx.dev/package/@singcl/ad-execute-manager",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/singcl/ad-execute-manager.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/singcl/ad-execute-manager/issues"
31
+ },
32
+ "engines": {
33
+ "node": ">=8.0.0",
34
+ "npm": ">=6.0.0",
35
+ "yarn": ">=1.0.0",
36
+ "pnpm": ">=8.0.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "keywords": [
42
+ "ad",
43
+ "advertisement",
44
+ "reward-ad",
45
+ "interstitial-ad",
46
+ "ad-manager",
47
+ "ad-execution",
48
+ "javascript",
49
+ "nodejs"
50
+ ],
51
+ "scripts": {
52
+ "build": "rslib build && tsc",
53
+ "dev": "rslib build --watch",
54
+ "format": "prettier --write .",
55
+ "lint": "eslint .",
56
+ "test": "rstest",
57
+ "prepublishOnly": "npm i && npm run build",
58
+ "packages:install": "node build-packages.js install",
59
+ "packages:build": "node build-packages.js build",
60
+ "packages:publish": "node build-packages.js publish",
61
+ "packages:publish:patch": "node build-packages.js publish patch",
62
+ "packages:publish:minor": "node build-packages.js publish minor",
63
+ "packages:publish:major": "node build-packages.js publish major",
64
+ "packages:lint": "node build-packages.js lint",
65
+ "packages:format": "node build-packages.js format",
66
+ "packages:clean": "node build-packages.js clean",
67
+ "packages:all": "node build-packages.js all",
68
+ "packages:all:patch": "node build-packages.js all patch",
69
+ "packages:all:minor": "node build-packages.js all minor",
70
+ "packages:all:major": "node build-packages.js all major"
71
+ },
72
+ "devDependencies": {
73
+ "@babel/eslint-parser": "^7.28.5",
74
+ "@babel/preset-env": "^7.28.5",
75
+ "@douyin-microapp/typings": "^1.3.1",
76
+ "@eslint/js": "^9.39.1",
77
+ "@rslib/core": "^0.18.5",
78
+ "@rstest/core": "^0.7.2",
79
+ "@singcl/ad-execute-manager": "^1.11.12",
80
+ "eslint": "^9.39.2",
81
+ "eslint-plugin-import": "^2.32.0",
82
+ "globals": "^16.5.0",
83
+ "prettier": "^3.7.3",
84
+ "typescript": "^5.9.3"
85
+ },
86
+ "dependencies": {
87
+ "@ad-execute-manager/core": "^2.0.6",
88
+ "@ad-execute-manager/logger": "^2.0.5",
89
+ "@ad-execute-manager/ad-reward": "^2.1.1",
90
+ "@ad-execute-manager/ad-interstitial": "^2.0.6",
91
+ "@ad-execute-manager/count-recorder": "^2.1.0",
92
+ "@ad-execute-manager/serializable-error": "^2.0.5",
93
+ "@ad-execute-manager/storage": "^2.1.0",
94
+ "@ad-execute-manager/event": "^2.0.5",
95
+ "@ad-execute-manager/analytics": "^2.0.5"
96
+ }
97
+ }