@singcl/ad-execute-manager 2.0.12 → 2.0.13
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.
|
@@ -4,6 +4,8 @@ export type CallbackCollection = import("./typings/ad.js").CallbackCollection;
|
|
|
4
4
|
export type RecoveredInfo = import("./typings/ad.js").RecoveredInfo;
|
|
5
5
|
export type IConstructArgs = import("./typings/ad.js").IConstructArgs;
|
|
6
6
|
export type RewardedVideoAd = import("./typings/create-rewarded-video-ad.js").RewardedVideoAd;
|
|
7
|
+
export type ITaskResult = import("./typings/ad.js").ITaskResult;
|
|
8
|
+
export type ITaskResultGeneric<T extends unknown> = ITaskResult & T;
|
|
7
9
|
export type IRewardedVideoAd = {
|
|
8
10
|
/**
|
|
9
11
|
* 显示激励视频广告
|
|
@@ -22,18 +24,18 @@ declare class RewardAdFather {
|
|
|
22
24
|
*/
|
|
23
25
|
static buildArgs(args: IRewordAdConfig): void;
|
|
24
26
|
/**
|
|
27
|
+
* @template {object} T
|
|
25
28
|
* 使用管理器执行广告
|
|
26
29
|
* @param {Object} adInstance 广告实例
|
|
27
30
|
* @param {Object} ctx 上下文对象,用于传递数据和状态
|
|
28
31
|
* @param {import('./typings/ad.js').IAdOptions} ctx.options 广告执行选项
|
|
29
32
|
* @param {CallbackCollection} ctx.collection 回调集合
|
|
33
|
+
* @returns {Promise<ITaskResultGeneric<T> | undefined>} 广告执行结果的Promise
|
|
30
34
|
*/
|
|
31
|
-
static executeWithManager(adInstance: any, ctx: {
|
|
35
|
+
static executeWithManager<T extends unknown>(adInstance: any, ctx: {
|
|
32
36
|
options: import("./typings/ad.js").IAdOptions;
|
|
33
37
|
collection: CallbackCollection;
|
|
34
|
-
}): Promise<
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
}>;
|
|
38
|
+
}): Promise<ITaskResultGeneric<T> | undefined>;
|
|
37
39
|
/**
|
|
38
40
|
* @param {IConstructArgs} args
|
|
39
41
|
*/
|
|
@@ -100,17 +102,17 @@ declare class RewardAdFather {
|
|
|
100
102
|
recovered?: RecoveredInfo;
|
|
101
103
|
}, next?: Function): Promise<unknown>;
|
|
102
104
|
/**
|
|
105
|
+
* @template {object} T
|
|
103
106
|
* 确保广告按顺序执行
|
|
104
107
|
* @param {Object} [ctx] 上下文对象,用于传递数据和状态
|
|
105
108
|
* @param {import('./typings/ad.js').IAdOptions} [ctx.options] 广告执行选项
|
|
106
109
|
* @param {CallbackCollection} [ctx.collection] 回调集合
|
|
110
|
+
* @returns {Promise<ITaskResultGeneric<T> | undefined>} 广告执行结果的Promise
|
|
107
111
|
*/
|
|
108
|
-
addExecuteManager(ctx?: {
|
|
112
|
+
addExecuteManager<T extends unknown>(ctx?: {
|
|
109
113
|
options?: import("./typings/ad.js").IAdOptions;
|
|
110
114
|
collection?: CallbackCollection;
|
|
111
|
-
}): Promise<
|
|
112
|
-
[key: string]: any;
|
|
113
|
-
}>;
|
|
115
|
+
}): Promise<ITaskResultGeneric<T> | undefined>;
|
|
114
116
|
destroy(): void;
|
|
115
117
|
/**
|
|
116
118
|
* 清理广告实例
|
|
@@ -152,6 +152,40 @@ export type IApiError = {
|
|
|
152
152
|
*/
|
|
153
153
|
message?: string;
|
|
154
154
|
};
|
|
155
|
+
export type ITaskResult = {
|
|
156
|
+
/**
|
|
157
|
+
* 广告任务的唯一标识符
|
|
158
|
+
*/
|
|
159
|
+
id: string;
|
|
160
|
+
/**
|
|
161
|
+
* 广告错误信息
|
|
162
|
+
*/
|
|
163
|
+
apiError?: IApiError;
|
|
164
|
+
/**
|
|
165
|
+
* 广告任务后台恢复前台时预估重试次数的原因
|
|
166
|
+
*/
|
|
167
|
+
recovered?: RecoveredInfo;
|
|
168
|
+
/**
|
|
169
|
+
* 广告场景
|
|
170
|
+
*/
|
|
171
|
+
scene?: string;
|
|
172
|
+
/**
|
|
173
|
+
* 广告类型 1:激励视频 2:插屏
|
|
174
|
+
*/
|
|
175
|
+
adTypeR?: 1 | 2;
|
|
176
|
+
/**
|
|
177
|
+
* 广告结束类型
|
|
178
|
+
*/
|
|
179
|
+
end_type?: "finished" | "halfway";
|
|
180
|
+
/**
|
|
181
|
+
* 是否看完广告
|
|
182
|
+
*/
|
|
183
|
+
isEnded?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* 完整观看广告次数
|
|
186
|
+
*/
|
|
187
|
+
count?: number;
|
|
188
|
+
};
|
|
155
189
|
export type ICallbackArgs = IExeCallbackArgs;
|
|
156
190
|
export type IConnection = {
|
|
157
191
|
/**
|
package/package.json
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@singcl/ad-execute-manager",
|
|
3
|
-
"version": "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.
|
|
88
|
-
"@ad-execute-manager/logger": "^2.0.5",
|
|
89
|
-
"@ad-execute-manager/ad-reward": "^2.0.
|
|
90
|
-
"@ad-execute-manager/ad-interstitial": "^2.0.
|
|
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.0.13",
|
|
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.0.6",
|
|
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
|
+
}
|