@mpgd/bridge 0.4.0 → 0.5.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.
- package/dist/cloudflare-pages.js +27 -1
- package/dist/fixtures.d.ts +1 -0
- package/dist/fixtures.js +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/cloudflare-pages.js
CHANGED
|
@@ -74,13 +74,39 @@ export function createMpgdCloudflarePagesBridgeHandler() {
|
|
|
74
74
|
nativeLeaderboard: false,
|
|
75
75
|
achievements: false,
|
|
76
76
|
cloudSave: false,
|
|
77
|
-
socialShare:
|
|
77
|
+
socialShare: false,
|
|
78
78
|
haptics: false,
|
|
79
79
|
localizedContent: true,
|
|
80
80
|
});
|
|
81
81
|
case 'identity.getPlayer': {
|
|
82
82
|
return ok(input.bridgeRequest, null);
|
|
83
83
|
}
|
|
84
|
+
case 'identity.getSession':
|
|
85
|
+
return ok(input.bridgeRequest, {
|
|
86
|
+
identityLevel: 'guest',
|
|
87
|
+
trustLevel: 'local',
|
|
88
|
+
});
|
|
89
|
+
case 'identity.requestUpgrade':
|
|
90
|
+
return ok(input.bridgeRequest, {
|
|
91
|
+
status: 'unavailable',
|
|
92
|
+
reloadExpected: false,
|
|
93
|
+
});
|
|
94
|
+
case 'presentation.getLaunchIntent':
|
|
95
|
+
return ok(input.bridgeRequest, {
|
|
96
|
+
entry: 'home',
|
|
97
|
+
});
|
|
98
|
+
case 'presentation.requestGameSurface':
|
|
99
|
+
return ok(input.bridgeRequest, 'already-fullscreen');
|
|
100
|
+
case 'share.share':
|
|
101
|
+
return ok(input.bridgeRequest, {
|
|
102
|
+
status: 'unavailable',
|
|
103
|
+
});
|
|
104
|
+
case 'share.readInboundShare':
|
|
105
|
+
return ok(input.bridgeRequest, null);
|
|
106
|
+
case 'notifications.getStatus':
|
|
107
|
+
return ok(input.bridgeRequest, 'unsupported');
|
|
108
|
+
case 'notifications.requestSubscription':
|
|
109
|
+
return ok(input.bridgeRequest, 'unavailable');
|
|
84
110
|
case 'commerce.getProducts':
|
|
85
111
|
case 'commerce.getEntitlements':
|
|
86
112
|
return ok(input.bridgeRequest, []);
|
package/dist/fixtures.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BridgeRequest, BridgeResponse } from './index';
|
|
2
2
|
export declare const validBridgeRequest: BridgeRequest;
|
|
3
|
+
export declare const validNewBridgeRequests: BridgeRequest<unknown>[];
|
|
3
4
|
export declare const validBridgeOkResponse: BridgeResponse<{
|
|
4
5
|
readonly nativeAds: boolean;
|
|
5
6
|
}>;
|
package/dist/fixtures.js
CHANGED
|
@@ -9,6 +9,16 @@ export const validBridgeRequest = {
|
|
|
9
9
|
sentAt: '2026-07-03T00:00:00.000Z',
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
|
+
export const validNewBridgeRequests = [
|
|
13
|
+
createBridgeRequest('identity.getSession'),
|
|
14
|
+
createBridgeRequest('identity.requestUpgrade'),
|
|
15
|
+
createBridgeRequest('presentation.getLaunchIntent'),
|
|
16
|
+
createBridgeRequest('presentation.requestGameSurface'),
|
|
17
|
+
createBridgeRequest('share.share'),
|
|
18
|
+
createBridgeRequest('share.readInboundShare'),
|
|
19
|
+
createBridgeRequest('notifications.getStatus'),
|
|
20
|
+
createBridgeRequest('notifications.requestSubscription'),
|
|
21
|
+
];
|
|
12
22
|
export const validBridgeOkResponse = {
|
|
13
23
|
id: validBridgeRequest.id,
|
|
14
24
|
ok: true,
|
|
@@ -42,3 +52,10 @@ export const invalidBridgeRequests = [
|
|
|
42
52
|
},
|
|
43
53
|
},
|
|
44
54
|
];
|
|
55
|
+
function createBridgeRequest(method) {
|
|
56
|
+
return {
|
|
57
|
+
...validBridgeRequest,
|
|
58
|
+
id: `bridge-request-${method}`,
|
|
59
|
+
method,
|
|
60
|
+
};
|
|
61
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type BridgeMethod = 'runtime.getCapabilities' | 'identity.getPlayer' | 'commerce.getProducts' | 'commerce.purchase' | 'commerce.restore' | 'commerce.getEntitlements' | 'ads.preload' | 'ads.showRewarded' | 'ads.showInterstitial' | 'leaderboard.submitScore' | 'leaderboard.open' | 'storage.load' | 'storage.save';
|
|
1
|
+
export type BridgeMethod = 'runtime.getCapabilities' | 'identity.getPlayer' | 'identity.getSession' | 'identity.requestUpgrade' | 'presentation.getLaunchIntent' | 'presentation.requestGameSurface' | 'share.share' | 'share.readInboundShare' | 'notifications.getStatus' | 'notifications.requestSubscription' | 'commerce.getProducts' | 'commerce.purchase' | 'commerce.restore' | 'commerce.getEntitlements' | 'ads.preload' | 'ads.showRewarded' | 'ads.showInterstitial' | 'leaderboard.submitScore' | 'leaderboard.open' | 'storage.load' | 'storage.save';
|
|
2
2
|
export interface BridgeRequest<TPayload = unknown> {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly method: BridgeMethod;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _a from "typia/lib/internal/_assertGuard";
|
|
2
2
|
import typia from 'typia';
|
|
3
3
|
export const assertBridgeRequest = (() => {
|
|
4
|
-
const _iv0 = new Set(["ads.preload", "ads.showInterstitial", "ads.showRewarded", "commerce.getEntitlements", "commerce.getProducts", "commerce.purchase", "commerce.restore", "identity.getPlayer", "leaderboard.open", "leaderboard.submitScore", "runtime.getCapabilities", "storage.load", "storage.save"]);
|
|
5
|
-
const _av0 = new Set(["ads.preload", "ads.showInterstitial", "ads.showRewarded", "commerce.getEntitlements", "commerce.getProducts", "commerce.purchase", "commerce.restore", "identity.getPlayer", "leaderboard.open", "leaderboard.submitScore", "runtime.getCapabilities", "storage.load", "storage.save"]);
|
|
6
|
-
const _ae0 = "(\"ads.preload\" | \"ads.showInterstitial\" | \"ads.showRewarded\" | \"commerce.getEntitlements\" | \"commerce.getProducts\" | \"commerce.purchase\" | \"commerce.restore\" | \"identity.getPlayer\" | \"leaderboard.open\" | \"leaderboard.submitScore\" | \"runtime.getCapabilities\" | \"storage.load\" | \"storage.save\")";
|
|
4
|
+
const _iv0 = new Set(["ads.preload", "ads.showInterstitial", "ads.showRewarded", "commerce.getEntitlements", "commerce.getProducts", "commerce.purchase", "commerce.restore", "identity.getPlayer", "identity.getSession", "identity.requestUpgrade", "leaderboard.open", "leaderboard.submitScore", "notifications.getStatus", "notifications.requestSubscription", "presentation.getLaunchIntent", "presentation.requestGameSurface", "runtime.getCapabilities", "share.readInboundShare", "share.share", "storage.load", "storage.save"]);
|
|
5
|
+
const _av0 = new Set(["ads.preload", "ads.showInterstitial", "ads.showRewarded", "commerce.getEntitlements", "commerce.getProducts", "commerce.purchase", "commerce.restore", "identity.getPlayer", "identity.getSession", "identity.requestUpgrade", "leaderboard.open", "leaderboard.submitScore", "notifications.getStatus", "notifications.requestSubscription", "presentation.getLaunchIntent", "presentation.requestGameSurface", "runtime.getCapabilities", "share.readInboundShare", "share.share", "storage.load", "storage.save"]);
|
|
6
|
+
const _ae0 = "(\"ads.preload\" | \"ads.showInterstitial\" | \"ads.showRewarded\" | \"commerce.getEntitlements\" | \"commerce.getProducts\" | \"commerce.purchase\" | \"commerce.restore\" | \"identity.getPlayer\" | \"identity.getSession\" | \"identity.requestUpgrade\" | \"leaderboard.open\" | \"leaderboard.submitScore\" | \"notifications.getStatus\" | \"notifications.requestSubscription\" | \"presentation.getLaunchIntent\" | \"presentation.requestGameSurface\" | \"runtime.getCapabilities\" | \"share.readInboundShare\" | \"share.share\" | \"storage.load\" | \"storage.save\")";
|
|
7
7
|
const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || _a._assertGuard(_exceptionable, {
|
|
8
8
|
method: "typia.createAssert",
|
|
9
9
|
path: _path + ".id",
|