@maoyugames/phaser-framework 1.0.11 → 1.0.12
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/dist/{BasePlatform-BCOkvvDW.d.ts → BasePlatform-CwVOo3_q.d.ts} +3 -1
- package/dist/{chunk-H5CUVYCN.js → chunk-PDESBWLX.js} +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/platform/capacitor.d.ts +2 -2
- package/dist/platform/capacitor.js +1 -1
- package/dist/platform/facebook.d.ts +2 -2
- package/dist/platform/facebook.js +1 -1
- package/dist/platform/tiktok.d.ts +4 -2
- package/dist/platform/tiktok.js +151 -16
- package/dist/platform/web.d.ts +2 -2
- package/dist/platform/web.js +1 -1
- package/dist/platform/wechat.d.ts +1 -1
- package/dist/{types-DtcRFbM0.d.ts → types-WJYVtDfo.d.ts} +29 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as IPlatform,
|
|
1
|
+
import { d as IPlatform, r as PlatformName, S as SafeArea, v as SystemInfo, L as LaunchOptions, k as IPlatformNet, o as IPlatformStorage, i as IPlatformLifecycle, g as IPlatformAuth, e as IPlatformAds, l as IPlatformPayment, h as IPlatformDevice, f as IPlatformAnalytics, m as IPlatformShortcut, j as IPlatformMission, P as PlatformInfo } from './types-WJYVtDfo.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 平台抽象基类:封装"有 DOM/BOM 的环境"通用实现,供
|
|
@@ -35,6 +35,8 @@ declare abstract class BasePlatform implements IPlatform {
|
|
|
35
35
|
readonly payment?: IPlatformPayment;
|
|
36
36
|
readonly device?: IPlatformDevice;
|
|
37
37
|
readonly analytics?: IPlatformAnalytics;
|
|
38
|
+
readonly shortcut?: IPlatformShortcut;
|
|
39
|
+
readonly mission?: IPlatformMission;
|
|
38
40
|
get info(): PlatformInfo;
|
|
39
41
|
abstract init(): Promise<void>;
|
|
40
42
|
getLaunchOptions(): LaunchOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as HttpRequestOptions, U as Unsubscribe, H as Handler,
|
|
2
|
-
export { a as HttpMethod, c as HttpResponse, I as IDisposable, e as IPlatformAds, f as IPlatformAnalytics, g as IPlatformAuth, h as IPlatformDevice, j as
|
|
1
|
+
import { b as HttpRequestOptions, U as Unsubscribe, H as Handler, p as LogLevel, A as AdResult, t as PurchaseResult, q as LoginResult, d as IPlatform, i as IPlatformLifecycle, S as SafeArea } from './types-WJYVtDfo.js';
|
|
2
|
+
export { a as HttpMethod, c as HttpResponse, I as IDisposable, e as IPlatformAds, f as IPlatformAnalytics, g as IPlatformAuth, h as IPlatformDevice, j as IPlatformMission, k as IPlatformNet, l as IPlatformPayment, m as IPlatformShortcut, n as IPlatformSocket, o as IPlatformStorage, L as LaunchOptions, P as PlatformInfo, r as PlatformName, s as PlatformUnsupportedError, R as Result, u as SocketOptions, v as SystemInfo, V as Vec2, w as err, x as ok } from './types-WJYVtDfo.js';
|
|
3
3
|
import Phaser from 'phaser';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as BasePlatform } from '../BasePlatform-
|
|
1
|
+
import { r as PlatformName, h as IPlatformDevice, i as IPlatformLifecycle } from '../types-WJYVtDfo.js';
|
|
2
|
+
import { B as BasePlatform } from '../BasePlatform-CwVOo3_q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Capacitor(原生 WebView 容器)平台适配器。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as BasePlatform } from '../BasePlatform-
|
|
1
|
+
import { r as PlatformName, o as IPlatformStorage, g as IPlatformAuth, e as IPlatformAds, l as IPlatformPayment, h as IPlatformDevice, i as IPlatformLifecycle } from '../types-WJYVtDfo.js';
|
|
2
|
+
import { B as BasePlatform } from '../BasePlatform-CwVOo3_q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Facebook Instant Games 平台适配器。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as BasePlatform } from '../BasePlatform-
|
|
1
|
+
import { r as PlatformName, g as IPlatformAuth, e as IPlatformAds, l as IPlatformPayment, h as IPlatformDevice, f as IPlatformAnalytics, m as IPlatformShortcut, j as IPlatformMission, i as IPlatformLifecycle } from '../types-WJYVtDfo.js';
|
|
2
|
+
import { B as BasePlatform } from '../BasePlatform-CwVOo3_q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* TikTok Mini Games(Minis)平台适配器。
|
|
@@ -23,6 +23,8 @@ declare class TikTokPlatform extends BasePlatform {
|
|
|
23
23
|
readonly payment: IPlatformPayment;
|
|
24
24
|
readonly device: IPlatformDevice;
|
|
25
25
|
readonly analytics: IPlatformAnalytics;
|
|
26
|
+
readonly shortcut: IPlatformShortcut;
|
|
27
|
+
readonly mission: IPlatformMission;
|
|
26
28
|
readonly lifecycle: IPlatformLifecycle;
|
|
27
29
|
init(): Promise<void>;
|
|
28
30
|
}
|
package/dist/platform/tiktok.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasePlatform } from '../chunk-
|
|
1
|
+
import { BasePlatform } from '../chunk-PDESBWLX.js';
|
|
2
2
|
import { PlatformUnsupportedError } from '../chunk-II3JM4R3.js';
|
|
3
3
|
import { __publicField } from '../chunk-PKBMQBKP.js';
|
|
4
4
|
|
|
@@ -33,27 +33,160 @@ var TikTokAuth = class {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
var TikTokAds = class {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
// TikTok H5 SDK 只有 createRewardedVideoAd(没有 preload/show/Interstitial 单独 API,
|
|
37
|
+
// 实测 2026-05-28 反编译 connect.tiktok-minis.com/game/sdk.js 36 个 game.* 方法确认)。
|
|
38
|
+
// 之前 framework 调 preloadRewardedVideo / showRewardedVideo / showInterstitialAd 全部
|
|
39
|
+
// throw TypeError,被 try-catch 吞掉返 'failed',审核因此判"未集成有效营收功能"。
|
|
40
|
+
//
|
|
41
|
+
// 修复:统一走 createRewardedVideoAd(优先同步签名拿 ad 实例,失败试异步 callback 签名),
|
|
42
|
+
// ad.onClose 等结果后 ad.show 触发展示;preloadRewarded 退化为 noop(SDK 自身管预加载)。
|
|
43
|
+
async preloadRewarded(_adUnitId) {
|
|
39
44
|
}
|
|
40
|
-
|
|
45
|
+
showRewarded(adUnitId) {
|
|
41
46
|
requireTT("ads.showRewarded");
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const onResult = (isEnded) => resolve(isEnded ? "completed" : "skipped");
|
|
49
|
+
const onError = (msg) => {
|
|
50
|
+
console.warn("[ads.showRewarded] error:", msg);
|
|
51
|
+
resolve("failed");
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
const adSync = TTMinis.game.createRewardedVideoAd({ adUnitId });
|
|
55
|
+
if (adSync && typeof adSync.show === "function") {
|
|
56
|
+
this.wireAd(adSync, onResult, onError);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.warn("[ads] sync createRewardedVideoAd failed, try async:", e?.message);
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
TTMinis.game.createRewardedVideoAd((res) => {
|
|
64
|
+
if (res?.is_success && res.rewardedVideoAd) {
|
|
65
|
+
this.wireAd(res.rewardedVideoAd, onResult, onError);
|
|
66
|
+
} else {
|
|
67
|
+
onError(JSON.stringify(res?.error ?? "create failed"));
|
|
68
|
+
}
|
|
69
|
+
}, { adUnitId });
|
|
70
|
+
} catch (e) {
|
|
71
|
+
onError(e?.message ?? "createRewardedVideoAd both signatures failed");
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
wireAd(ad, onResult, onError) {
|
|
76
|
+
let settled = false;
|
|
42
77
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
78
|
+
ad.onClose((res) => {
|
|
79
|
+
if (settled) return;
|
|
80
|
+
settled = true;
|
|
81
|
+
onResult(!!res?.isEnded);
|
|
82
|
+
});
|
|
83
|
+
} catch (e) {
|
|
84
|
+
onError(`onClose unsupported: ${e?.message}`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (typeof ad.onError === "function") {
|
|
88
|
+
try {
|
|
89
|
+
ad.onError((res) => {
|
|
90
|
+
if (settled) return;
|
|
91
|
+
settled = true;
|
|
92
|
+
onError(res?.error?.error_msg ?? "ad error");
|
|
93
|
+
});
|
|
94
|
+
} catch {
|
|
95
|
+
}
|
|
47
96
|
}
|
|
97
|
+
void ad.show().catch((e) => {
|
|
98
|
+
if (settled) return;
|
|
99
|
+
settled = true;
|
|
100
|
+
onError(e?.message ?? "show rejected");
|
|
101
|
+
});
|
|
48
102
|
}
|
|
49
|
-
async showInterstitial(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
103
|
+
async showInterstitial(_adUnitId) {
|
|
104
|
+
return "failed";
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
var TikTokShortcut = class {
|
|
108
|
+
// SDK callback-style API;每个都用 typeof 检测 + 静默降级,避免老 SDK 没此方法 throw 阻断业务。
|
|
109
|
+
check() {
|
|
110
|
+
if (!hasTT() || typeof TTMinis.game.checkShortcut !== "function") return Promise.resolve(false);
|
|
111
|
+
return new Promise((resolve) => {
|
|
112
|
+
try {
|
|
113
|
+
TTMinis.game.checkShortcut({
|
|
114
|
+
success: (res) => resolve(!!res?.exist),
|
|
115
|
+
fail: () => resolve(false)
|
|
116
|
+
});
|
|
117
|
+
} catch {
|
|
118
|
+
resolve(false);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
add() {
|
|
123
|
+
if (!hasTT() || typeof TTMinis.game.addShortcut !== "function") return Promise.resolve(false);
|
|
124
|
+
return new Promise((resolve) => {
|
|
125
|
+
try {
|
|
126
|
+
TTMinis.game.addShortcut({
|
|
127
|
+
success: () => resolve(true),
|
|
128
|
+
fail: () => resolve(false)
|
|
129
|
+
});
|
|
130
|
+
} catch {
|
|
131
|
+
resolve(false);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
getMissionReward() {
|
|
136
|
+
if (!hasTT() || typeof TTMinis.game.getShortcutMissionReward !== "function") {
|
|
137
|
+
return Promise.resolve({ canReceive: false });
|
|
56
138
|
}
|
|
139
|
+
return new Promise((resolve) => {
|
|
140
|
+
try {
|
|
141
|
+
TTMinis.game.getShortcutMissionReward({
|
|
142
|
+
success: (res) => resolve({ canReceive: !!res?.canReceiveReward }),
|
|
143
|
+
fail: () => resolve({ canReceive: false })
|
|
144
|
+
});
|
|
145
|
+
} catch {
|
|
146
|
+
resolve({ canReceive: false });
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var TikTokMission = class {
|
|
152
|
+
startEntrance() {
|
|
153
|
+
if (!hasTT() || typeof TTMinis.game.startEntranceMission !== "function") return Promise.resolve({ ok: false });
|
|
154
|
+
return new Promise((resolve) => {
|
|
155
|
+
try {
|
|
156
|
+
TTMinis.game.startEntranceMission({
|
|
157
|
+
success: () => resolve({ ok: true }),
|
|
158
|
+
fail: () => resolve({ ok: false })
|
|
159
|
+
});
|
|
160
|
+
} catch {
|
|
161
|
+
resolve({ ok: false });
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
getEntranceReward() {
|
|
166
|
+
if (!hasTT() || typeof TTMinis.game.getEntranceMissionReward !== "function") return Promise.resolve({ canReceive: false });
|
|
167
|
+
return new Promise((resolve) => {
|
|
168
|
+
try {
|
|
169
|
+
TTMinis.game.getEntranceMissionReward({
|
|
170
|
+
success: (res) => resolve({ canReceive: !!res?.canReceiveReward }),
|
|
171
|
+
fail: () => resolve({ canReceive: false })
|
|
172
|
+
});
|
|
173
|
+
} catch {
|
|
174
|
+
resolve({ canReceive: false });
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
getFyfReward() {
|
|
179
|
+
if (!hasTT() || typeof TTMinis.game.getFyfMissionReward !== "function") return Promise.resolve({ canReceive: false });
|
|
180
|
+
return new Promise((resolve) => {
|
|
181
|
+
try {
|
|
182
|
+
TTMinis.game.getFyfMissionReward({
|
|
183
|
+
success: (res) => resolve({ canReceive: !!res?.canReceiveReward }),
|
|
184
|
+
fail: () => resolve({ canReceive: false })
|
|
185
|
+
});
|
|
186
|
+
} catch {
|
|
187
|
+
resolve({ canReceive: false });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
57
190
|
}
|
|
58
191
|
};
|
|
59
192
|
var TikTokPayment = class {
|
|
@@ -151,6 +284,8 @@ var TikTokPlatform = class extends BasePlatform {
|
|
|
151
284
|
__publicField(this, "payment", new TikTokPayment());
|
|
152
285
|
__publicField(this, "device", new TikTokDevice());
|
|
153
286
|
__publicField(this, "analytics", new TikTokAnalytics());
|
|
287
|
+
__publicField(this, "shortcut", new TikTokShortcut());
|
|
288
|
+
__publicField(this, "mission", new TikTokMission());
|
|
154
289
|
// 用 TTMinis 桥接的生命周期,缺失时由其内部退回 noop;DOM 退路在 init 中按需补
|
|
155
290
|
__publicField(this, "lifecycle", new TikTokLifecycle());
|
|
156
291
|
}
|
package/dist/platform/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as BasePlatform } from '../BasePlatform-
|
|
1
|
+
import { r as PlatformName, h as IPlatformDevice } from '../types-WJYVtDfo.js';
|
|
2
|
+
import { B as BasePlatform } from '../BasePlatform-CwVOo3_q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Web(普通浏览器 / H5)平台适配器。
|
package/dist/platform/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as IPlatform,
|
|
1
|
+
import { d as IPlatform, k as IPlatformNet, o as IPlatformStorage, i as IPlatformLifecycle, g as IPlatformAuth, e as IPlatformAds, l as IPlatformPayment, h as IPlatformDevice, P as PlatformInfo, L as LaunchOptions } from '../types-WJYVtDfo.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 微信小游戏平台适配器。
|
|
@@ -207,6 +207,32 @@ interface IPlatformDevice {
|
|
|
207
207
|
query?: string;
|
|
208
208
|
}): Promise<void>;
|
|
209
209
|
}
|
|
210
|
+
/** 桌面快捷方式(TikTok minigame 审核硬性要求;不支持的平台为 undefined) */
|
|
211
|
+
interface IPlatformShortcut {
|
|
212
|
+
/** 是否已添加到桌面(平台不支持时 resolve false) */
|
|
213
|
+
check(): Promise<boolean>;
|
|
214
|
+
/** 触发平台原生"添加到桌面"系统提示,resolve 表示添加成功 */
|
|
215
|
+
add(): Promise<boolean>;
|
|
216
|
+
/** 查询"添加桌面快捷方式"任务奖励状态(可领取且未领取返 true) */
|
|
217
|
+
getMissionReward?(): Promise<{
|
|
218
|
+
canReceive: boolean;
|
|
219
|
+
}>;
|
|
220
|
+
}
|
|
221
|
+
/** 任务系统(TikTok minigame 审核硬性要求 - 侧边栏入口任务) */
|
|
222
|
+
interface IPlatformMission {
|
|
223
|
+
/** 触发侧边栏入口任务(SDK 把用户带到 TikTok profile sidebar 完成教育流程) */
|
|
224
|
+
startEntrance(): Promise<{
|
|
225
|
+
ok: boolean;
|
|
226
|
+
}>;
|
|
227
|
+
/** 查询入口任务奖励状态 */
|
|
228
|
+
getEntranceReward(): Promise<{
|
|
229
|
+
canReceive: boolean;
|
|
230
|
+
}>;
|
|
231
|
+
/** 查询"For You Feed 入口"任务奖励状态(若启用) */
|
|
232
|
+
getFyfReward?(): Promise<{
|
|
233
|
+
canReceive: boolean;
|
|
234
|
+
}>;
|
|
235
|
+
}
|
|
210
236
|
/** 平台原生埋点(可选;通常业务用 AnalyticsManager 统一上报) */
|
|
211
237
|
interface IPlatformAnalytics {
|
|
212
238
|
reportEvent(name: string, params?: Record<string, unknown>): void;
|
|
@@ -234,6 +260,8 @@ interface IPlatform {
|
|
|
234
260
|
readonly payment?: IPlatformPayment;
|
|
235
261
|
readonly device?: IPlatformDevice;
|
|
236
262
|
readonly analytics?: IPlatformAnalytics;
|
|
263
|
+
readonly shortcut?: IPlatformShortcut;
|
|
264
|
+
readonly mission?: IPlatformMission;
|
|
237
265
|
}
|
|
238
266
|
|
|
239
|
-
export { type AdResult as A, type Handler as H, type IDisposable as I, type LaunchOptions as L, type PlatformInfo as P, type Result as R, type SafeArea as S, type Unsubscribe as U, type Vec2 as V, type HttpMethod as a, type HttpRequestOptions as b, type HttpResponse as c, type IPlatform as d, type IPlatformAds as e, type IPlatformAnalytics as f, type IPlatformAuth as g, type IPlatformDevice as h, type IPlatformLifecycle as i, type
|
|
267
|
+
export { type AdResult as A, type Handler as H, type IDisposable as I, type LaunchOptions as L, type PlatformInfo as P, type Result as R, type SafeArea as S, type Unsubscribe as U, type Vec2 as V, type HttpMethod as a, type HttpRequestOptions as b, type HttpResponse as c, type IPlatform as d, type IPlatformAds as e, type IPlatformAnalytics as f, type IPlatformAuth as g, type IPlatformDevice as h, type IPlatformLifecycle as i, type IPlatformMission as j, type IPlatformNet as k, type IPlatformPayment as l, type IPlatformShortcut as m, type IPlatformSocket as n, type IPlatformStorage as o, LogLevel as p, type LoginResult as q, type PlatformName as r, PlatformUnsupportedError as s, type PurchaseResult as t, type SocketOptions as u, type SystemInfo as v, err as w, ok as x };
|