@mpgd/adapter-ait 0.8.0 → 0.10.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/ad-config.d.ts +2 -1
- package/dist/ad-config.js +4 -1
- package/dist/host.d.ts +87 -9
- package/dist/host.js +1173 -14
- package/dist/index.js +8 -0
- package/dist/local-mock.d.ts +71 -0
- package/dist/local-mock.js +59 -0
- package/package.json +9 -5
package/dist/index.js
CHANGED
|
@@ -58,6 +58,8 @@ export function createAitPlatformGateway(input) {
|
|
|
58
58
|
preload: (payload) => request('ads.preload', payload),
|
|
59
59
|
showRewarded: (payload) => request('ads.showRewarded', payload),
|
|
60
60
|
showInterstitial: (payload) => request('ads.showInterstitial', payload),
|
|
61
|
+
mountBanner: (payload) => request('ads.mountBanner', payload),
|
|
62
|
+
unmountBanner: (payload) => request('ads.unmountBanner', payload),
|
|
61
63
|
},
|
|
62
64
|
leaderboard: {
|
|
63
65
|
submitScore: (payload) => request('leaderboard.submitScore', payload),
|
|
@@ -95,9 +97,11 @@ export function createAitSandboxBridge(options = {}) {
|
|
|
95
97
|
return ok(input, {
|
|
96
98
|
nativeIap: true,
|
|
97
99
|
nativeAds: true,
|
|
100
|
+
bannerAds: false,
|
|
98
101
|
rewardedAds: true,
|
|
99
102
|
interstitialAds: true,
|
|
100
103
|
nativeLeaderboard: true,
|
|
104
|
+
remoteLeaderboard: false,
|
|
101
105
|
achievements: false,
|
|
102
106
|
cloudSave: false,
|
|
103
107
|
socialShare: true,
|
|
@@ -177,6 +181,10 @@ export function createAitSandboxBridge(options = {}) {
|
|
|
177
181
|
return ok(input, {
|
|
178
182
|
status: 'shown',
|
|
179
183
|
});
|
|
184
|
+
case 'ads.mountBanner':
|
|
185
|
+
return ok(input, { status: 'unavailable' });
|
|
186
|
+
case 'ads.unmountBanner':
|
|
187
|
+
return ok(input, {});
|
|
180
188
|
case 'leaderboard.submitScore':
|
|
181
189
|
return ok(input, {
|
|
182
190
|
submitted: true,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-only SDK 3 development substitute.
|
|
3
|
+
*
|
|
4
|
+
* Vite aliases the native Apps in Toss module to this file only for explicit
|
|
5
|
+
* local wrapper development. It intentionally exposes no ads, promotions, or
|
|
6
|
+
* commerce: those paths must be verified in the Toss app sandbox/console.
|
|
7
|
+
*/
|
|
8
|
+
declare function unsupported(): boolean;
|
|
9
|
+
export declare const Storage: {
|
|
10
|
+
getItem(key: string): Promise<string | null>;
|
|
11
|
+
setItem(key: string, value: string): Promise<void>;
|
|
12
|
+
removeItem(key: string): Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare function getUserKeyForGame(): Promise<{
|
|
15
|
+
readonly type: 'HASH';
|
|
16
|
+
readonly hash: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function getTossShareLink(): Promise<string>;
|
|
19
|
+
export declare function share(): Promise<void>;
|
|
20
|
+
export declare function isMinVersionSupported(): boolean;
|
|
21
|
+
export declare const grantPromotionRewardForGame: (() => Promise<'ERROR'>) & {
|
|
22
|
+
isSupported: typeof unsupported;
|
|
23
|
+
};
|
|
24
|
+
export declare const requestNotificationAgreement: ((_callbacks: unknown) => (() => void)) & {
|
|
25
|
+
isSupported: typeof unsupported;
|
|
26
|
+
};
|
|
27
|
+
export declare const loadFullScreenAd: ((_callbacks: unknown) => (() => void)) & {
|
|
28
|
+
isSupported: typeof unsupported;
|
|
29
|
+
};
|
|
30
|
+
export declare const showFullScreenAd: ((_callbacks: unknown) => (() => void)) & {
|
|
31
|
+
isSupported: typeof unsupported;
|
|
32
|
+
};
|
|
33
|
+
export declare const TossAds: {
|
|
34
|
+
initialize: ((_options: unknown) => void) & {
|
|
35
|
+
isSupported: typeof unsupported;
|
|
36
|
+
};
|
|
37
|
+
attachBanner: ((_adGroupId: string, _target: string | HTMLElement, _options?: unknown) => {
|
|
38
|
+
destroy(): void;
|
|
39
|
+
}) & {
|
|
40
|
+
isSupported: typeof unsupported;
|
|
41
|
+
};
|
|
42
|
+
destroy: ((_slotId: string) => void) & {
|
|
43
|
+
isSupported: typeof unsupported;
|
|
44
|
+
};
|
|
45
|
+
destroyAll: (() => void) & {
|
|
46
|
+
isSupported: typeof unsupported;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function openGameCenterLeaderboard(): Promise<void>;
|
|
50
|
+
export declare function submitGameCenterLeaderBoardScore(): Promise<{
|
|
51
|
+
readonly statusCode: 'ERROR';
|
|
52
|
+
}>;
|
|
53
|
+
export declare const IAP: {
|
|
54
|
+
createOneTimePurchaseOrder: ((_callbacks: unknown) => (() => void)) & {
|
|
55
|
+
isSupported: typeof unsupported;
|
|
56
|
+
};
|
|
57
|
+
getProductItemList: (() => Promise<{
|
|
58
|
+
readonly products: readonly unknown[];
|
|
59
|
+
}>) & {
|
|
60
|
+
isSupported: typeof unsupported;
|
|
61
|
+
};
|
|
62
|
+
getPendingOrders: (() => Promise<{
|
|
63
|
+
readonly orders: readonly unknown[];
|
|
64
|
+
}>) & {
|
|
65
|
+
isSupported: typeof unsupported;
|
|
66
|
+
};
|
|
67
|
+
completeProductGrant: (() => Promise<boolean>) & {
|
|
68
|
+
isSupported: typeof unsupported;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-only SDK 3 development substitute.
|
|
3
|
+
*
|
|
4
|
+
* Vite aliases the native Apps in Toss module to this file only for explicit
|
|
5
|
+
* local wrapper development. It intentionally exposes no ads, promotions, or
|
|
6
|
+
* commerce: those paths must be verified in the Toss app sandbox/console.
|
|
7
|
+
*/
|
|
8
|
+
const localStorageValues = new Map();
|
|
9
|
+
function unsupported() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function noOpSubscription() {
|
|
13
|
+
return () => { };
|
|
14
|
+
}
|
|
15
|
+
export const Storage = {
|
|
16
|
+
async getItem(key) {
|
|
17
|
+
return localStorageValues.get(key) ?? null;
|
|
18
|
+
},
|
|
19
|
+
async setItem(key, value) {
|
|
20
|
+
localStorageValues.set(key, value);
|
|
21
|
+
},
|
|
22
|
+
async removeItem(key) {
|
|
23
|
+
localStorageValues.delete(key);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export async function getUserKeyForGame() {
|
|
27
|
+
return { type: 'HASH', hash: 'ait-local-player' };
|
|
28
|
+
}
|
|
29
|
+
export async function getTossShareLink() {
|
|
30
|
+
return globalThis.location?.href ?? 'https://localhost/';
|
|
31
|
+
}
|
|
32
|
+
export async function share() { }
|
|
33
|
+
export function isMinVersionSupported() {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
export const grantPromotionRewardForGame = Object.assign(async () => 'ERROR', {
|
|
37
|
+
isSupported: unsupported,
|
|
38
|
+
});
|
|
39
|
+
export const requestNotificationAgreement = Object.assign((_callbacks) => noOpSubscription(), { isSupported: unsupported });
|
|
40
|
+
export const loadFullScreenAd = Object.assign((_callbacks) => noOpSubscription(), { isSupported: unsupported });
|
|
41
|
+
export const showFullScreenAd = Object.assign((_callbacks) => noOpSubscription(), { isSupported: unsupported });
|
|
42
|
+
export const TossAds = {
|
|
43
|
+
initialize: Object.assign((_options) => { }, { isSupported: unsupported }),
|
|
44
|
+
attachBanner: Object.assign((_adGroupId, _target, _options) => ({
|
|
45
|
+
destroy() { },
|
|
46
|
+
}), { isSupported: unsupported }),
|
|
47
|
+
destroy: Object.assign((_slotId) => { }, { isSupported: unsupported }),
|
|
48
|
+
destroyAll: Object.assign(() => { }, { isSupported: unsupported }),
|
|
49
|
+
};
|
|
50
|
+
export async function openGameCenterLeaderboard() { }
|
|
51
|
+
export async function submitGameCenterLeaderBoardScore() {
|
|
52
|
+
return { statusCode: 'ERROR' };
|
|
53
|
+
}
|
|
54
|
+
export const IAP = {
|
|
55
|
+
createOneTimePurchaseOrder: Object.assign((_callbacks) => noOpSubscription(), { isSupported: unsupported }),
|
|
56
|
+
getProductItemList: Object.assign(async () => ({ products: [] }), { isSupported: unsupported }),
|
|
57
|
+
getPendingOrders: Object.assign(async () => ({ orders: [] }), { isSupported: unsupported }),
|
|
58
|
+
completeProductGrant: Object.assign(async () => false, { isSupported: unsupported }),
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/adapter-ait",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Apps in Toss WebView platform adapter for mpgd games.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,17 +41,21 @@
|
|
|
41
41
|
"types": "./dist/ad-config.d.ts",
|
|
42
42
|
"default": "./dist/ad-config.js"
|
|
43
43
|
},
|
|
44
|
+
"./local-mock": {
|
|
45
|
+
"types": "./dist/local-mock.d.ts",
|
|
46
|
+
"default": "./dist/local-mock.js"
|
|
47
|
+
},
|
|
44
48
|
"./package.json": "./package.json"
|
|
45
49
|
},
|
|
46
50
|
"files": [
|
|
47
51
|
"dist"
|
|
48
52
|
],
|
|
49
53
|
"dependencies": {
|
|
50
|
-
"@mpgd/
|
|
51
|
-
"@mpgd/
|
|
54
|
+
"@mpgd/bridge": "0.9.0",
|
|
55
|
+
"@mpgd/platform": "0.10.0"
|
|
52
56
|
},
|
|
53
57
|
"peerDependencies": {
|
|
54
|
-
"@apps-in-toss/web-framework": ">=3.0.0
|
|
58
|
+
"@apps-in-toss/web-framework": ">=3.0.0 <4"
|
|
55
59
|
},
|
|
56
60
|
"peerDependenciesMeta": {
|
|
57
61
|
"@apps-in-toss/web-framework": {
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
}
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
62
|
-
"@apps-in-toss/web-framework": "3.
|
|
66
|
+
"@apps-in-toss/web-framework": "3.1.1",
|
|
63
67
|
"ttsc": "0.18.4",
|
|
64
68
|
"typescript": "7.0.2",
|
|
65
69
|
"vitest": "^4.0.0"
|