@playcraft/adsdk 1.0.18-beta.4 → 1.0.19
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 -21
- package/defines.d.ts +130 -130
- package/dist/esm/index.js +13 -4
- package/dist/iife/index.js +13 -4
- package/dist/index.js +13 -4
- package/package.json +56 -56
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-present Smoud
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Smoud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/defines.d.ts
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
declare const mraid: {
|
|
2
|
-
getVersion: () => string; // MRAID 规范必需:返回 MRAID 版本(如 "3.0")
|
|
3
|
-
isReady: () => boolean;
|
|
4
|
-
isViewable: () => boolean;
|
|
5
|
-
getState: () => string;
|
|
6
|
-
addEventListener: (
|
|
7
|
-
event: 'viewableChange' | 'sizeChange' | 'ready' | 'audioVolumeChange' | 'stateChange' | 'error' | 'orientationChange' | 'resize',
|
|
8
|
-
callback: (...args: any[]) => void
|
|
9
|
-
) => void;
|
|
10
|
-
removeEventListener: (
|
|
11
|
-
event: 'viewableChange' | 'sizeChange' | 'ready' | 'audioVolumeChange' | 'stateChange' | 'error' | 'orientationChange' | 'resize',
|
|
12
|
-
callback: (...args: any[]) => void
|
|
13
|
-
) => void;
|
|
14
|
-
getMaxSize: () => { width: number; height: number };
|
|
15
|
-
openStoreUrl: () => void;
|
|
16
|
-
open: (url: string) => void;
|
|
17
|
-
close: () => void; // Unity Ads 必需:关闭广告
|
|
18
|
-
getAudioVolume: () => number;
|
|
19
|
-
fireTrackingEvent?: (event: string) => void; // Unity Ads 可选:跟踪事件
|
|
20
|
-
preloadStore?: () => void;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
declare const dapi: {
|
|
24
|
-
addEventListener: (
|
|
25
|
-
event: 'viewableChange' | 'adResized' | 'ready' | 'audioVolumeChange' | 'error',
|
|
26
|
-
callback: (...args: any[]) => void
|
|
27
|
-
) => void;
|
|
28
|
-
removeEventListener: (
|
|
29
|
-
event: 'viewableChange' | 'adResized' | 'ready' | 'audioVolumeChange' | 'error',
|
|
30
|
-
callback: (...args: any[]) => void
|
|
31
|
-
) => void;
|
|
32
|
-
getScreenSize: () => { width: number; height: number };
|
|
33
|
-
openStoreUrl: () => void;
|
|
34
|
-
getAudioVolume: () => number;
|
|
35
|
-
isViewable: () => boolean;
|
|
36
|
-
isReady: () => boolean;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
declare const NUC: {
|
|
40
|
-
trigger: {
|
|
41
|
-
convert: (destinationUrl: string) => void;
|
|
42
|
-
tryAgain: Function;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
declare const ScPlayableAd: { onCTAClick: () => void };
|
|
47
|
-
|
|
48
|
-
// Adikteev 占位符变量
|
|
49
|
-
declare const AK_CLICK_DESTINATION_URL: string;
|
|
50
|
-
declare const AK_CLICK_PIXEL_URL: string;
|
|
51
|
-
declare const FbPlayableAd: { onCTAClick: () => void };
|
|
52
|
-
declare const smxTracking: { redirect: () => void };
|
|
53
|
-
declare const ExitApi: { exit: () => void };
|
|
54
|
-
|
|
55
|
-
declare const AD_NETWORK:
|
|
56
|
-
| 'preview'
|
|
57
|
-
| 'applovin'
|
|
58
|
-
| 'unity'
|
|
59
|
-
| 'google'
|
|
60
|
-
| 'ironsource'
|
|
61
|
-
| 'facebook'
|
|
62
|
-
| 'moloco'
|
|
63
|
-
| 'mintegral'
|
|
64
|
-
| 'vungle'
|
|
65
|
-
| 'adcolony'
|
|
66
|
-
| 'tapjoy'
|
|
67
|
-
| 'snapchat'
|
|
68
|
-
| 'tiktok'
|
|
69
|
-
| 'appreciate'
|
|
70
|
-
| 'chartboost'
|
|
71
|
-
| 'pangle'
|
|
72
|
-
| 'mytarget'
|
|
73
|
-
| 'liftoff'
|
|
74
|
-
| 'smadex'
|
|
75
|
-
| 'adikteev'
|
|
76
|
-
| 'bigabid'
|
|
77
|
-
| 'inmobi'
|
|
78
|
-
| 'bigoads';
|
|
79
|
-
|
|
80
|
-
declare const AD_PROTOCOL: 'mraid' | 'dapi' | 'nucleo' | 'none';
|
|
81
|
-
declare const GOOGLE_PLAY_URL: string;
|
|
82
|
-
declare const APP_STORE_URL: string;
|
|
83
|
-
declare const BUILD_HASH: string;
|
|
84
|
-
|
|
85
|
-
interface Window {
|
|
86
|
-
PlayableSDK: any;
|
|
87
|
-
ADS_MRAID_CONFIG: {
|
|
88
|
-
landUrl: string;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// AppLovin Playable Analytics
|
|
92
|
-
// 文档: https://support.axon.ai/en/growth/promoting-your-apps/creatives/playable-analytics-integration
|
|
93
|
-
ALPlayableAnalytics?: {
|
|
94
|
-
trackEvent: (event: string) => void;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// BigoAds SDK
|
|
98
|
-
// 文档: https://www.bigoads.com/help/detail?id=143&moduleId=7¤tLan=CN
|
|
99
|
-
BGY_MRAID: {
|
|
100
|
-
open: () => void; // 打开应用商店/推广地址
|
|
101
|
-
gameReady: () => void; // 素材准备完毕时调用
|
|
102
|
-
gameEnd: () => void; // 游戏结束时调用
|
|
103
|
-
isViewable: () => boolean;
|
|
104
|
-
addEventListener: (event: string, callback: (...args: any[]) => void) => void;
|
|
105
|
-
removeEventListener: (event: string, callback: (...args: any[]) => void) => void;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// Mintegral functions
|
|
109
|
-
gameReady: Function;
|
|
110
|
-
gameEnd: Function;
|
|
111
|
-
gameRetry: Function;
|
|
112
|
-
install: Function;
|
|
113
|
-
mintGameStart: Function;
|
|
114
|
-
mintGameClose: Function;
|
|
115
|
-
|
|
116
|
-
// Tapjoy functions
|
|
117
|
-
TJ_API: {
|
|
118
|
-
objectiveComplete: Function;
|
|
119
|
-
playableFinished: Function;
|
|
120
|
-
gameplayFinished: Function;
|
|
121
|
-
setPlayableBuild: Function;
|
|
122
|
-
setPlayableAPI: Function;
|
|
123
|
-
click: Function;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
BIGABID_BIDTIMEMACROS?: Record<string, string>
|
|
127
|
-
INMOBI_DSPMACROS?: Record<string, string>
|
|
128
|
-
|
|
129
|
-
openAppStore: Function;
|
|
130
|
-
}
|
|
1
|
+
declare const mraid: {
|
|
2
|
+
getVersion: () => string; // MRAID 规范必需:返回 MRAID 版本(如 "3.0")
|
|
3
|
+
isReady: () => boolean;
|
|
4
|
+
isViewable: () => boolean;
|
|
5
|
+
getState: () => string;
|
|
6
|
+
addEventListener: (
|
|
7
|
+
event: 'viewableChange' | 'sizeChange' | 'ready' | 'audioVolumeChange' | 'stateChange' | 'error' | 'orientationChange' | 'resize',
|
|
8
|
+
callback: (...args: any[]) => void
|
|
9
|
+
) => void;
|
|
10
|
+
removeEventListener: (
|
|
11
|
+
event: 'viewableChange' | 'sizeChange' | 'ready' | 'audioVolumeChange' | 'stateChange' | 'error' | 'orientationChange' | 'resize',
|
|
12
|
+
callback: (...args: any[]) => void
|
|
13
|
+
) => void;
|
|
14
|
+
getMaxSize: () => { width: number; height: number };
|
|
15
|
+
openStoreUrl: () => void;
|
|
16
|
+
open: (url: string) => void;
|
|
17
|
+
close: () => void; // Unity Ads 必需:关闭广告
|
|
18
|
+
getAudioVolume: () => number;
|
|
19
|
+
fireTrackingEvent?: (event: string) => void; // Unity Ads 可选:跟踪事件
|
|
20
|
+
preloadStore?: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
declare const dapi: {
|
|
24
|
+
addEventListener: (
|
|
25
|
+
event: 'viewableChange' | 'adResized' | 'ready' | 'audioVolumeChange' | 'error',
|
|
26
|
+
callback: (...args: any[]) => void
|
|
27
|
+
) => void;
|
|
28
|
+
removeEventListener: (
|
|
29
|
+
event: 'viewableChange' | 'adResized' | 'ready' | 'audioVolumeChange' | 'error',
|
|
30
|
+
callback: (...args: any[]) => void
|
|
31
|
+
) => void;
|
|
32
|
+
getScreenSize: () => { width: number; height: number };
|
|
33
|
+
openStoreUrl: () => void;
|
|
34
|
+
getAudioVolume: () => number;
|
|
35
|
+
isViewable: () => boolean;
|
|
36
|
+
isReady: () => boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
declare const NUC: {
|
|
40
|
+
trigger: {
|
|
41
|
+
convert: (destinationUrl: string) => void;
|
|
42
|
+
tryAgain: Function;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare const ScPlayableAd: { onCTAClick: () => void };
|
|
47
|
+
|
|
48
|
+
// Adikteev 占位符变量
|
|
49
|
+
declare const AK_CLICK_DESTINATION_URL: string;
|
|
50
|
+
declare const AK_CLICK_PIXEL_URL: string;
|
|
51
|
+
declare const FbPlayableAd: { onCTAClick: () => void };
|
|
52
|
+
declare const smxTracking: { redirect: () => void };
|
|
53
|
+
declare const ExitApi: { exit: () => void };
|
|
54
|
+
|
|
55
|
+
declare const AD_NETWORK:
|
|
56
|
+
| 'preview'
|
|
57
|
+
| 'applovin'
|
|
58
|
+
| 'unity'
|
|
59
|
+
| 'google'
|
|
60
|
+
| 'ironsource'
|
|
61
|
+
| 'facebook'
|
|
62
|
+
| 'moloco'
|
|
63
|
+
| 'mintegral'
|
|
64
|
+
| 'vungle'
|
|
65
|
+
| 'adcolony'
|
|
66
|
+
| 'tapjoy'
|
|
67
|
+
| 'snapchat'
|
|
68
|
+
| 'tiktok'
|
|
69
|
+
| 'appreciate'
|
|
70
|
+
| 'chartboost'
|
|
71
|
+
| 'pangle'
|
|
72
|
+
| 'mytarget'
|
|
73
|
+
| 'liftoff'
|
|
74
|
+
| 'smadex'
|
|
75
|
+
| 'adikteev'
|
|
76
|
+
| 'bigabid'
|
|
77
|
+
| 'inmobi'
|
|
78
|
+
| 'bigoads';
|
|
79
|
+
|
|
80
|
+
declare const AD_PROTOCOL: 'mraid' | 'dapi' | 'nucleo' | 'none';
|
|
81
|
+
declare const GOOGLE_PLAY_URL: string;
|
|
82
|
+
declare const APP_STORE_URL: string;
|
|
83
|
+
declare const BUILD_HASH: string;
|
|
84
|
+
|
|
85
|
+
interface Window {
|
|
86
|
+
PlayableSDK: any;
|
|
87
|
+
ADS_MRAID_CONFIG: {
|
|
88
|
+
landUrl: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// AppLovin Playable Analytics
|
|
92
|
+
// 文档: https://support.axon.ai/en/growth/promoting-your-apps/creatives/playable-analytics-integration
|
|
93
|
+
ALPlayableAnalytics?: {
|
|
94
|
+
trackEvent: (event: string) => void;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// BigoAds SDK
|
|
98
|
+
// 文档: https://www.bigoads.com/help/detail?id=143&moduleId=7¤tLan=CN
|
|
99
|
+
BGY_MRAID: {
|
|
100
|
+
open: () => void; // 打开应用商店/推广地址
|
|
101
|
+
gameReady: () => void; // 素材准备完毕时调用
|
|
102
|
+
gameEnd: () => void; // 游戏结束时调用
|
|
103
|
+
isViewable: () => boolean;
|
|
104
|
+
addEventListener: (event: string, callback: (...args: any[]) => void) => void;
|
|
105
|
+
removeEventListener: (event: string, callback: (...args: any[]) => void) => void;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Mintegral functions
|
|
109
|
+
gameReady: Function;
|
|
110
|
+
gameEnd: Function;
|
|
111
|
+
gameRetry: Function;
|
|
112
|
+
install: Function;
|
|
113
|
+
mintGameStart: Function;
|
|
114
|
+
mintGameClose: Function;
|
|
115
|
+
|
|
116
|
+
// Tapjoy functions
|
|
117
|
+
TJ_API: {
|
|
118
|
+
objectiveComplete: Function;
|
|
119
|
+
playableFinished: Function;
|
|
120
|
+
gameplayFinished: Function;
|
|
121
|
+
setPlayableBuild: Function;
|
|
122
|
+
setPlayableAPI: Function;
|
|
123
|
+
click: Function;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
BIGABID_BIDTIMEMACROS?: Record<string, string>
|
|
127
|
+
INMOBI_DSPMACROS?: Record<string, string>
|
|
128
|
+
|
|
129
|
+
openAppStore: Function;
|
|
130
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -614,9 +614,9 @@ function lookupI18nRuntime(runtime, key, langCode) {
|
|
|
614
614
|
const fallbackChain = (_a = LANG_FALLBACK_MAP[langCode]) != null ? _a : [langCode, "en"];
|
|
615
615
|
for (const code of fallbackChain) {
|
|
616
616
|
const val = map[code];
|
|
617
|
-
if (
|
|
617
|
+
if (typeof val === "string") return val;
|
|
618
618
|
}
|
|
619
|
-
return Object.values(map).find((v) => typeof v === "string"
|
|
619
|
+
return Object.values(map).find((v) => typeof v === "string");
|
|
620
620
|
}
|
|
621
621
|
function mergeI18nRuntimes(runtimes) {
|
|
622
622
|
const merged = {};
|
|
@@ -645,7 +645,7 @@ function resolveI18nRefs(config, i18nRecord, langCode) {
|
|
|
645
645
|
if (resolved !== void 0) {
|
|
646
646
|
config[key] = resolved;
|
|
647
647
|
} else {
|
|
648
|
-
console.warn(`[i18n] Missing translation for key "${i18nKey}" (lang: ${langCode}), using key name as fallback
|
|
648
|
+
console.warn(`[i18n] Missing translation for key "${i18nKey}" (lang: ${langCode}), using key name as fallback.`);
|
|
649
649
|
config[key] = i18nKey;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
@@ -1051,6 +1051,15 @@ function initSDK() {
|
|
|
1051
1051
|
destinationUrl = /android/i.test(navigator.userAgent) ? GOOGLE_PLAY_URL : APP_STORE_URL;
|
|
1052
1052
|
console.log("[SDK DEBUG] destinationUrl set to:", destinationUrl, "length:", destinationUrl.length);
|
|
1053
1053
|
ensureProtocol();
|
|
1054
|
+
document.addEventListener("visibilitychange", function lockScreenAudioHandler() {
|
|
1055
|
+
if (document.visibilityState === "hidden") {
|
|
1056
|
+
changeVolume(0);
|
|
1057
|
+
} else if (document.visibilityState === "visible") {
|
|
1058
|
+
if (!sdk.isPaused) {
|
|
1059
|
+
changeVolume(actualVolume);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1054
1063
|
if ("mraid" === AD_PROTOCOL && typeof mraid === "undefined") {
|
|
1055
1064
|
console.warn("[SDK] MRAID protocol detected but mraid.js not loaded, creating fallback mock (MRAID 2.0)");
|
|
1056
1065
|
window.mraid = {
|
|
@@ -1576,7 +1585,7 @@ var _sdk = class _sdk {
|
|
|
1576
1585
|
}
|
|
1577
1586
|
};
|
|
1578
1587
|
/** Current version of the SDK */
|
|
1579
|
-
_sdk.version = "1.0.
|
|
1588
|
+
_sdk.version = "1.0.19";
|
|
1580
1589
|
/** Current maximum width of the playable ad container in pixels */
|
|
1581
1590
|
_sdk.maxWidth = Math.floor(window.innerWidth);
|
|
1582
1591
|
/** Current maximum height of the playable ad container in pixels */
|
package/dist/iife/index.js
CHANGED
|
@@ -852,9 +852,9 @@
|
|
|
852
852
|
const fallbackChain = (_a = LANG_FALLBACK_MAP[langCode]) != null ? _a : [langCode, "en"];
|
|
853
853
|
for (const code of fallbackChain) {
|
|
854
854
|
const val = map[code];
|
|
855
|
-
if (
|
|
855
|
+
if (typeof val === "string") return val;
|
|
856
856
|
}
|
|
857
|
-
return Object.values(map).find((v) => typeof v === "string"
|
|
857
|
+
return Object.values(map).find((v) => typeof v === "string");
|
|
858
858
|
}
|
|
859
859
|
function mergeI18nRuntimes(runtimes) {
|
|
860
860
|
const merged = {};
|
|
@@ -883,7 +883,7 @@
|
|
|
883
883
|
if (resolved !== void 0) {
|
|
884
884
|
config[key] = resolved;
|
|
885
885
|
} else {
|
|
886
|
-
console.warn(`[i18n] Missing translation for key "${i18nKey}" (lang: ${langCode}), using key name as fallback
|
|
886
|
+
console.warn(`[i18n] Missing translation for key "${i18nKey}" (lang: ${langCode}), using key name as fallback.`);
|
|
887
887
|
config[key] = i18nKey;
|
|
888
888
|
}
|
|
889
889
|
}
|
|
@@ -1289,6 +1289,15 @@
|
|
|
1289
1289
|
destinationUrl = /android/i.test(navigator.userAgent) ? GOOGLE_PLAY_URL : APP_STORE_URL;
|
|
1290
1290
|
console.log("[SDK DEBUG] destinationUrl set to:", destinationUrl, "length:", destinationUrl.length);
|
|
1291
1291
|
ensureProtocol();
|
|
1292
|
+
document.addEventListener("visibilitychange", function lockScreenAudioHandler() {
|
|
1293
|
+
if (document.visibilityState === "hidden") {
|
|
1294
|
+
changeVolume(0);
|
|
1295
|
+
} else if (document.visibilityState === "visible") {
|
|
1296
|
+
if (!sdk.isPaused) {
|
|
1297
|
+
changeVolume(actualVolume);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1292
1301
|
if ("mraid" === AD_PROTOCOL && typeof mraid === "undefined") {
|
|
1293
1302
|
console.warn("[SDK] MRAID protocol detected but mraid.js not loaded, creating fallback mock (MRAID 2.0)");
|
|
1294
1303
|
window.mraid = {
|
|
@@ -1814,7 +1823,7 @@
|
|
|
1814
1823
|
}
|
|
1815
1824
|
};
|
|
1816
1825
|
/** Current version of the SDK */
|
|
1817
|
-
_sdk.version = "1.0.
|
|
1826
|
+
_sdk.version = "1.0.19";
|
|
1818
1827
|
/** Current maximum width of the playable ad container in pixels */
|
|
1819
1828
|
_sdk.maxWidth = Math.floor(window.innerWidth);
|
|
1820
1829
|
/** Current maximum height of the playable ad container in pixels */
|
package/dist/index.js
CHANGED
|
@@ -644,9 +644,9 @@ function lookupI18nRuntime(runtime, key, langCode) {
|
|
|
644
644
|
const fallbackChain = (_a = LANG_FALLBACK_MAP[langCode]) != null ? _a : [langCode, "en"];
|
|
645
645
|
for (const code of fallbackChain) {
|
|
646
646
|
const val = map[code];
|
|
647
|
-
if (
|
|
647
|
+
if (typeof val === "string") return val;
|
|
648
648
|
}
|
|
649
|
-
return Object.values(map).find((v) => typeof v === "string"
|
|
649
|
+
return Object.values(map).find((v) => typeof v === "string");
|
|
650
650
|
}
|
|
651
651
|
function mergeI18nRuntimes(runtimes) {
|
|
652
652
|
const merged = {};
|
|
@@ -675,7 +675,7 @@ function resolveI18nRefs(config, i18nRecord, langCode) {
|
|
|
675
675
|
if (resolved !== void 0) {
|
|
676
676
|
config[key] = resolved;
|
|
677
677
|
} else {
|
|
678
|
-
console.warn(`[i18n] Missing translation for key "${i18nKey}" (lang: ${langCode}), using key name as fallback
|
|
678
|
+
console.warn(`[i18n] Missing translation for key "${i18nKey}" (lang: ${langCode}), using key name as fallback.`);
|
|
679
679
|
config[key] = i18nKey;
|
|
680
680
|
}
|
|
681
681
|
}
|
|
@@ -1081,6 +1081,15 @@ function initSDK() {
|
|
|
1081
1081
|
destinationUrl = /android/i.test(navigator.userAgent) ? GOOGLE_PLAY_URL : APP_STORE_URL;
|
|
1082
1082
|
console.log("[SDK DEBUG] destinationUrl set to:", destinationUrl, "length:", destinationUrl.length);
|
|
1083
1083
|
ensureProtocol();
|
|
1084
|
+
document.addEventListener("visibilitychange", function lockScreenAudioHandler() {
|
|
1085
|
+
if (document.visibilityState === "hidden") {
|
|
1086
|
+
changeVolume(0);
|
|
1087
|
+
} else if (document.visibilityState === "visible") {
|
|
1088
|
+
if (!sdk.isPaused) {
|
|
1089
|
+
changeVolume(actualVolume);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1084
1093
|
if ("mraid" === AD_PROTOCOL && typeof mraid === "undefined") {
|
|
1085
1094
|
console.warn("[SDK] MRAID protocol detected but mraid.js not loaded, creating fallback mock (MRAID 2.0)");
|
|
1086
1095
|
window.mraid = {
|
|
@@ -1606,7 +1615,7 @@ var _sdk = class _sdk {
|
|
|
1606
1615
|
}
|
|
1607
1616
|
};
|
|
1608
1617
|
/** Current version of the SDK */
|
|
1609
|
-
_sdk.version = "1.0.
|
|
1618
|
+
_sdk.version = "1.0.19";
|
|
1610
1619
|
/** Current maximum width of the playable ad container in pixels */
|
|
1611
1620
|
_sdk.maxWidth = Math.floor(window.innerWidth);
|
|
1612
1621
|
/** Current maximum height of the playable ad container in pixels */
|
package/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@playcraft/adsdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "统一的 Playable SDK,支持 MRAID、Google、Facebook、Vungle、BigoAds 等多广告渠道",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/esm/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"LICENSE",
|
|
14
|
-
"defines.d.ts"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "npx tsup",
|
|
18
|
-
"test": "jest",
|
|
19
|
-
"deploy": "npm run build && node scripts/publish.js",
|
|
20
|
-
"deploy:beta": "npm run build && node scripts/publish.js --tag beta"
|
|
21
|
-
},
|
|
22
|
-
"author": "Tencent ADS Team",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/jest": "^29.5.14",
|
|
26
|
-
"jest": "^29.7.0",
|
|
27
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
28
|
-
"ts-jest": "^29.2.5",
|
|
29
|
-
"tsup": "^8.4.0",
|
|
30
|
-
"typescript": "^5.7.2"
|
|
31
|
-
},
|
|
32
|
-
"keywords": [
|
|
33
|
-
"playable",
|
|
34
|
-
"sdk",
|
|
35
|
-
"playable-sdk",
|
|
36
|
-
"PlayableSDK",
|
|
37
|
-
"playable-ads",
|
|
38
|
-
"html5",
|
|
39
|
-
"tencent",
|
|
40
|
-
"bigoads",
|
|
41
|
-
"mraid",
|
|
42
|
-
"google-ads",
|
|
43
|
-
"facebook-playable",
|
|
44
|
-
"unity-ads",
|
|
45
|
-
"vungle",
|
|
46
|
-
"ironsource",
|
|
47
|
-
"javascript-sdk",
|
|
48
|
-
"typescript-sdk"
|
|
49
|
-
],
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"registry": "https://mirrors.tencent.com/npm/"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@playcraft/ads-tracking": "*"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@playcraft/adsdk",
|
|
3
|
+
"version": "1.0.19",
|
|
4
|
+
"description": "统一的 Playable SDK,支持 MRAID、Google、Facebook、Vungle、BigoAds 等多广告渠道",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"defines.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "npx tsup",
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"deploy": "npm run build && node scripts/publish.js",
|
|
20
|
+
"deploy:beta": "npm run build && node scripts/publish.js --tag beta"
|
|
21
|
+
},
|
|
22
|
+
"author": "Tencent ADS Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/jest": "^29.5.14",
|
|
26
|
+
"jest": "^29.7.0",
|
|
27
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
28
|
+
"ts-jest": "^29.2.5",
|
|
29
|
+
"tsup": "^8.4.0",
|
|
30
|
+
"typescript": "^5.7.2"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"playable",
|
|
34
|
+
"sdk",
|
|
35
|
+
"playable-sdk",
|
|
36
|
+
"PlayableSDK",
|
|
37
|
+
"playable-ads",
|
|
38
|
+
"html5",
|
|
39
|
+
"tencent",
|
|
40
|
+
"bigoads",
|
|
41
|
+
"mraid",
|
|
42
|
+
"google-ads",
|
|
43
|
+
"facebook-playable",
|
|
44
|
+
"unity-ads",
|
|
45
|
+
"vungle",
|
|
46
|
+
"ironsource",
|
|
47
|
+
"javascript-sdk",
|
|
48
|
+
"typescript-sdk"
|
|
49
|
+
],
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"registry": "https://mirrors.tencent.com/npm/"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@playcraft/ads-tracking": "*"
|
|
55
|
+
}
|
|
56
|
+
}
|