@playcraft/adsdk 1.0.17 → 1.0.18-beta.1

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 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&currentLan=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&currentLan=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
@@ -461,6 +461,38 @@ function extractDefaultsFromSchema(schema) {
461
461
  }
462
462
  return void 0;
463
463
  }
464
+ function getLanguageCode() {
465
+ try {
466
+ return (navigator.language || "en").split("-")[0].toLowerCase();
467
+ } catch (e) {
468
+ return "en";
469
+ }
470
+ }
471
+ function lookupI18nRuntime(runtime, key, langCode) {
472
+ var _a, _b;
473
+ const map = runtime[key];
474
+ if (!map || typeof map !== "object") return void 0;
475
+ return (_b = (_a = map[langCode]) != null ? _a : map["en"]) != null ? _b : Object.values(map)[0];
476
+ }
477
+ function resolveI18nRefs(config, i18nRecord, langCode) {
478
+ var _a;
479
+ if (!config || typeof config !== "object" || Array.isArray(config)) return;
480
+ const runtime = (_a = i18nRecord.runtime) != null ? _a : {};
481
+ for (const key of Object.keys(config)) {
482
+ const value = config[key];
483
+ if (typeof value === "string") {
484
+ if (value.startsWith("i18n.runtime.")) {
485
+ const i18nKey = value.slice("i18n.runtime.".length);
486
+ const resolved = lookupI18nRuntime(runtime, i18nKey, langCode);
487
+ if (resolved !== void 0) {
488
+ config[key] = resolved;
489
+ }
490
+ }
491
+ } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
492
+ resolveI18nRefs(value, i18nRecord, langCode);
493
+ }
494
+ }
495
+ }
464
496
  function resolveImagePaths(config, assetRecordByPath) {
465
497
  if (!assetRecordByPath || !config || typeof config !== "object") return;
466
498
  for (const key of Object.keys(config)) {
@@ -488,7 +520,7 @@ function deepMerge(target, source) {
488
520
  return target;
489
521
  }
490
522
  function setConfig(configList, config) {
491
- const { assetRecordByPath } = config;
523
+ const { assetRecordByPath, i18nRecord } = config;
492
524
  const resolvedConfigs = configList.map((item) => {
493
525
  var _a;
494
526
  if (!item) return {};
@@ -499,6 +531,10 @@ function setConfig(configList, config) {
499
531
  for (const data of rest) {
500
532
  deepMerge(mergedConfig, data);
501
533
  }
534
+ if (i18nRecord) {
535
+ const langCode = getLanguageCode();
536
+ resolveI18nRefs(mergedConfig, i18nRecord, langCode);
537
+ }
502
538
  resolveImagePaths(mergedConfig, assetRecordByPath);
503
539
  _cachedConfig = mergedConfig;
504
540
  }
@@ -1364,7 +1400,7 @@ var _sdk = class _sdk {
1364
1400
  }
1365
1401
  };
1366
1402
  /** Current version of the SDK */
1367
- _sdk.version = "1.0.17";
1403
+ _sdk.version = "1.0.18-beta.1";
1368
1404
  /** Current maximum width of the playable ad container in pixels */
1369
1405
  _sdk.maxWidth = Math.floor(window.innerWidth);
1370
1406
  /** Current maximum height of the playable ad container in pixels */
@@ -699,6 +699,38 @@
699
699
  }
700
700
  return void 0;
701
701
  }
702
+ function getLanguageCode() {
703
+ try {
704
+ return (navigator.language || "en").split("-")[0].toLowerCase();
705
+ } catch (e) {
706
+ return "en";
707
+ }
708
+ }
709
+ function lookupI18nRuntime(runtime, key, langCode) {
710
+ var _a, _b;
711
+ const map = runtime[key];
712
+ if (!map || typeof map !== "object") return void 0;
713
+ return (_b = (_a = map[langCode]) != null ? _a : map["en"]) != null ? _b : Object.values(map)[0];
714
+ }
715
+ function resolveI18nRefs(config, i18nRecord, langCode) {
716
+ var _a;
717
+ if (!config || typeof config !== "object" || Array.isArray(config)) return;
718
+ const runtime = (_a = i18nRecord.runtime) != null ? _a : {};
719
+ for (const key of Object.keys(config)) {
720
+ const value = config[key];
721
+ if (typeof value === "string") {
722
+ if (value.startsWith("i18n.runtime.")) {
723
+ const i18nKey = value.slice("i18n.runtime.".length);
724
+ const resolved = lookupI18nRuntime(runtime, i18nKey, langCode);
725
+ if (resolved !== void 0) {
726
+ config[key] = resolved;
727
+ }
728
+ }
729
+ } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
730
+ resolveI18nRefs(value, i18nRecord, langCode);
731
+ }
732
+ }
733
+ }
702
734
  function resolveImagePaths(config, assetRecordByPath) {
703
735
  if (!assetRecordByPath || !config || typeof config !== "object") return;
704
736
  for (const key of Object.keys(config)) {
@@ -726,7 +758,7 @@
726
758
  return target;
727
759
  }
728
760
  function setConfig(configList, config) {
729
- const { assetRecordByPath } = config;
761
+ const { assetRecordByPath, i18nRecord } = config;
730
762
  const resolvedConfigs = configList.map((item) => {
731
763
  var _a;
732
764
  if (!item) return {};
@@ -737,6 +769,10 @@
737
769
  for (const data of rest) {
738
770
  deepMerge(mergedConfig, data);
739
771
  }
772
+ if (i18nRecord) {
773
+ const langCode = getLanguageCode();
774
+ resolveI18nRefs(mergedConfig, i18nRecord, langCode);
775
+ }
740
776
  resolveImagePaths(mergedConfig, assetRecordByPath);
741
777
  _cachedConfig = mergedConfig;
742
778
  }
@@ -1602,7 +1638,7 @@
1602
1638
  }
1603
1639
  };
1604
1640
  /** Current version of the SDK */
1605
- _sdk.version = "1.0.17";
1641
+ _sdk.version = "1.0.18-beta.1";
1606
1642
  /** Current maximum width of the playable ad container in pixels */
1607
1643
  _sdk.maxWidth = Math.floor(window.innerWidth);
1608
1644
  /** Current maximum height of the playable ad container in pixels */
package/dist/index.d.mts CHANGED
@@ -1,3 +1,13 @@
1
+ /**
2
+ * i18n 数据结构(仅 runtime,SDK 只处理游戏内运行时多语言):
3
+ * runtime: { [key]: { [langCode]: "文案" } }
4
+ *
5
+ * xplatform(配置平台 UI 标题)由外部配置平台自行解析,不传入 SDK。
6
+ */
7
+ type I18nRecord = {
8
+ runtime?: Record<string, Record<string, string>>;
9
+ };
10
+
1
11
  type EventName = 'playcraftInit' | 'playcraftReady' | 'playcraftStart' | 'playcraftInteractive' | 'playcraftInteraction' | 'playcraftChallengeStart' | 'playcraftChallengeProgress' | 'playcraftChallengeSuccess' | 'playcraftChallengeFailed' | 'playcraftResize' | 'playcraftPause' | 'playcraftResume' | 'playcraftVolume' | 'playcraftRetry' | 'playcraftFinish' | 'playcraftInstall';
2
12
 
3
13
  /**
@@ -269,7 +279,10 @@ declare class sdk {
269
279
  * { assetRecordByPath: imageAssets }
270
280
  * );
271
281
  */
272
- static setConfig(configList: any[], config: any): void;
282
+ static setConfig(configList: any[], config: {
283
+ assetRecordByPath: Record<string, string>;
284
+ i18nRecord?: I18nRecord;
285
+ }): void;
273
286
  /**
274
287
  * 获取合并后的主题配置。
275
288
  * 返回 schema 默认值与用户主题数据深度合并后的结果。
@@ -323,4 +336,4 @@ declare function hideWechatGuide(): void;
323
336
  */
324
337
  declare function removeWechatGuide(): void;
325
338
 
326
- export { type CursorOptions, sdk as default, disableCustomCursor, enableCustomCursor, hideWechatGuide, removeWechatGuide, sdk, showWechatGuide };
339
+ export { type CursorOptions, type I18nRecord, sdk as default, disableCustomCursor, enableCustomCursor, hideWechatGuide, removeWechatGuide, sdk, showWechatGuide };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,13 @@
1
+ /**
2
+ * i18n 数据结构(仅 runtime,SDK 只处理游戏内运行时多语言):
3
+ * runtime: { [key]: { [langCode]: "文案" } }
4
+ *
5
+ * xplatform(配置平台 UI 标题)由外部配置平台自行解析,不传入 SDK。
6
+ */
7
+ type I18nRecord = {
8
+ runtime?: Record<string, Record<string, string>>;
9
+ };
10
+
1
11
  type EventName = 'playcraftInit' | 'playcraftReady' | 'playcraftStart' | 'playcraftInteractive' | 'playcraftInteraction' | 'playcraftChallengeStart' | 'playcraftChallengeProgress' | 'playcraftChallengeSuccess' | 'playcraftChallengeFailed' | 'playcraftResize' | 'playcraftPause' | 'playcraftResume' | 'playcraftVolume' | 'playcraftRetry' | 'playcraftFinish' | 'playcraftInstall';
2
12
 
3
13
  /**
@@ -269,7 +279,10 @@ declare class sdk {
269
279
  * { assetRecordByPath: imageAssets }
270
280
  * );
271
281
  */
272
- static setConfig(configList: any[], config: any): void;
282
+ static setConfig(configList: any[], config: {
283
+ assetRecordByPath: Record<string, string>;
284
+ i18nRecord?: I18nRecord;
285
+ }): void;
273
286
  /**
274
287
  * 获取合并后的主题配置。
275
288
  * 返回 schema 默认值与用户主题数据深度合并后的结果。
@@ -323,4 +336,4 @@ declare function hideWechatGuide(): void;
323
336
  */
324
337
  declare function removeWechatGuide(): void;
325
338
 
326
- export { type CursorOptions, sdk as default, disableCustomCursor, enableCustomCursor, hideWechatGuide, removeWechatGuide, sdk, showWechatGuide };
339
+ export { type CursorOptions, type I18nRecord, sdk as default, disableCustomCursor, enableCustomCursor, hideWechatGuide, removeWechatGuide, sdk, showWechatGuide };
package/dist/index.js CHANGED
@@ -493,6 +493,38 @@ function extractDefaultsFromSchema(schema) {
493
493
  }
494
494
  return void 0;
495
495
  }
496
+ function getLanguageCode() {
497
+ try {
498
+ return (navigator.language || "en").split("-")[0].toLowerCase();
499
+ } catch (e) {
500
+ return "en";
501
+ }
502
+ }
503
+ function lookupI18nRuntime(runtime, key, langCode) {
504
+ var _a, _b;
505
+ const map = runtime[key];
506
+ if (!map || typeof map !== "object") return void 0;
507
+ return (_b = (_a = map[langCode]) != null ? _a : map["en"]) != null ? _b : Object.values(map)[0];
508
+ }
509
+ function resolveI18nRefs(config, i18nRecord, langCode) {
510
+ var _a;
511
+ if (!config || typeof config !== "object" || Array.isArray(config)) return;
512
+ const runtime = (_a = i18nRecord.runtime) != null ? _a : {};
513
+ for (const key of Object.keys(config)) {
514
+ const value = config[key];
515
+ if (typeof value === "string") {
516
+ if (value.startsWith("i18n.runtime.")) {
517
+ const i18nKey = value.slice("i18n.runtime.".length);
518
+ const resolved = lookupI18nRuntime(runtime, i18nKey, langCode);
519
+ if (resolved !== void 0) {
520
+ config[key] = resolved;
521
+ }
522
+ }
523
+ } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
524
+ resolveI18nRefs(value, i18nRecord, langCode);
525
+ }
526
+ }
527
+ }
496
528
  function resolveImagePaths(config, assetRecordByPath) {
497
529
  if (!assetRecordByPath || !config || typeof config !== "object") return;
498
530
  for (const key of Object.keys(config)) {
@@ -520,7 +552,7 @@ function deepMerge(target, source) {
520
552
  return target;
521
553
  }
522
554
  function setConfig(configList, config) {
523
- const { assetRecordByPath } = config;
555
+ const { assetRecordByPath, i18nRecord } = config;
524
556
  const resolvedConfigs = configList.map((item) => {
525
557
  var _a;
526
558
  if (!item) return {};
@@ -531,6 +563,10 @@ function setConfig(configList, config) {
531
563
  for (const data of rest) {
532
564
  deepMerge(mergedConfig, data);
533
565
  }
566
+ if (i18nRecord) {
567
+ const langCode = getLanguageCode();
568
+ resolveI18nRefs(mergedConfig, i18nRecord, langCode);
569
+ }
534
570
  resolveImagePaths(mergedConfig, assetRecordByPath);
535
571
  _cachedConfig = mergedConfig;
536
572
  }
@@ -1396,7 +1432,7 @@ var _sdk = class _sdk {
1396
1432
  }
1397
1433
  };
1398
1434
  /** Current version of the SDK */
1399
- _sdk.version = "1.0.17";
1435
+ _sdk.version = "1.0.18-beta.1";
1400
1436
  /** Current maximum width of the playable ad container in pixels */
1401
1437
  _sdk.maxWidth = Math.floor(window.innerWidth);
1402
1438
  /** 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.17",
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.18-beta.1",
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
+ }