@mpgd/cli 0.52.0 → 0.53.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/capacitor-shell-starter.d.ts +22 -0
- package/dist/capacitor-shell-starter.js +387 -18
- package/dist/index.js +35 -4
- package/dist/native-build-info.json +2 -2
- package/dist/native-build-target.js +363 -2
- package/dist/notifications-starter.d.ts +69 -0
- package/dist/notifications-starter.js +513 -0
- package/package.json +17 -17
- package/templates/notifications-overlay/common/docs/NOTIFICATIONS.md +75 -0
- package/templates/notifications-overlay/common/notifications/deployment.json +8 -0
- package/templates/notifications-overlay/common/notifications/topics.json +222 -0
- package/templates/notifications-overlay/common/src/platform/capacitorNotifications.ts +59 -0
- package/templates/notifications-overlay/common/src/platform/notificationOpens.ts +60 -0
- package/templates/notifications-overlay/common/src/platform/notificationSettings.ts +761 -0
- package/templates/notifications-overlay/common/src/platform/notifications.ts +131 -0
- package/templates/notifications-overlay/common/tools/validate-notifications.ts +75 -0
- package/templates/notifications-overlay/lite/src/lite/notificationSettingsPanel.ts +200 -0
- package/templates/notifications-overlay/phaser/src/scenes/NotificationSettingsScene.ts +282 -0
- package/templates/phaser-game/apps/target-ait/src/main.ts +15 -0
- package/templates/phaser-game/apps/target-ait/src/runtime-config.types.ts +5 -0
- package/templates/phaser-game/apps/target-ait/vite.config.ts +22 -1
- package/templates/phaser-game/docs/MPGD_KIT_WORKFLOWS.md +14 -0
|
@@ -12,6 +12,7 @@ installAitHostBridge({
|
|
|
12
12
|
adGroupIds: runtimeConfig.adGroupIds,
|
|
13
13
|
adPlacementTypes: runtimeConfig.adPlacementTypes,
|
|
14
14
|
...iapBridgeOptions(),
|
|
15
|
+
...notificationBridgeOptions(),
|
|
15
16
|
...identityBridgeOptions(),
|
|
16
17
|
});
|
|
17
18
|
|
|
@@ -38,6 +39,20 @@ function iapBridgeOptions(): Pick<
|
|
|
38
39
|
return runtimeConfig.iapProducts.length === 0 ? {} : { iapProducts: runtimeConfig.iapProducts };
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Notifications v2 topics come from the notification topic catalog's
|
|
44
|
+
* `targets.ait` mappings at build time. Without one the host bridge offers no
|
|
45
|
+
* notifications event channel, so the game exposes no `notificationsV2`; with
|
|
46
|
+
* them the bridge asks for each topic's agreement through
|
|
47
|
+
* `Notification.requestAgreement` and routes notification landings. Agreements
|
|
48
|
+
* are recorded by the game backend, never trusted from the wrapper.
|
|
49
|
+
*/
|
|
50
|
+
function notificationBridgeOptions(): Pick<InstallAitHostBridgeOptions, 'notificationTopics'> {
|
|
51
|
+
return Object.keys(runtimeConfig.notificationTopics).length === 0
|
|
52
|
+
? {}
|
|
53
|
+
: { notificationTopics: runtimeConfig.notificationTopics };
|
|
54
|
+
}
|
|
55
|
+
|
|
41
56
|
function identityBridgeOptions(): Pick<InstallAitHostBridgeOptions, 'dependencies'> {
|
|
42
57
|
return import.meta.env.VITE_MPGD_AIT_MOCK_IDENTITY === '1'
|
|
43
58
|
? {
|
|
@@ -8,6 +8,11 @@ declare module 'virtual:mpgd-ait-runtime-config' {
|
|
|
8
8
|
>>;
|
|
9
9
|
/** Catalog products sold on Apps in Toss (`platformProductIds.ait`), read at build time. */
|
|
10
10
|
readonly iapProducts: readonly import('@mpgd/adapter-ait').AitIapProductConfig[];
|
|
11
|
+
/** Notifications v2 topics mapped for Apps in Toss (`targets.ait`), read at build time. */
|
|
12
|
+
readonly notificationTopics: Readonly<Record<
|
|
13
|
+
string,
|
|
14
|
+
import('@mpgd/adapter-ait/notification-config').AitNotificationTopicMapping
|
|
15
|
+
>>;
|
|
11
16
|
}>;
|
|
12
17
|
|
|
13
18
|
export default runtimeConfig;
|
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
2
4
|
|
|
3
5
|
import type { AitIapProductConfig } from '@mpgd/adapter-ait';
|
|
4
6
|
import { extractAitAdBridgeConfig, type AitAdBridgeConfig } from '@mpgd/adapter-ait/ad-config';
|
|
5
7
|
import { extractAitIapProductConfig } from '@mpgd/adapter-ait/iap-config';
|
|
8
|
+
import {
|
|
9
|
+
readAitNotificationTopicsFile,
|
|
10
|
+
type AitNotificationTopicMapping,
|
|
11
|
+
} from '@mpgd/adapter-ait/notification-config';
|
|
6
12
|
import ttsc from '@ttsc/unplugin/vite';
|
|
7
13
|
import { defineConfig, type Plugin } from 'vite';
|
|
8
14
|
|
|
9
15
|
const aitAppName = process.env.MPGD_AIT_APP_NAME?.trim() || '__GAME_NAME__';
|
|
10
16
|
const aitAdConfig = readAitAdConfig(process.env.MPGD_AD_PLACEMENTS_FILE);
|
|
11
17
|
const aitIapProducts = readAitIapProducts(process.env.MPGD_PRODUCT_CATALOG_FILE);
|
|
18
|
+
// Notifications v2 topics come from the notification topic catalog
|
|
19
|
+
// (`targets.ait`), so the wrapper and the backend share one source:
|
|
20
|
+
// MPGD_NOTIFICATION_TOPICS_FILE (a relative path names a file of the game),
|
|
21
|
+
// else notifications/topics.json when it exists. Without a catalog, or with
|
|
22
|
+
// no topic mapped for Apps in Toss, the host bridge exposes no notifications.
|
|
23
|
+
const aitNotificationTopics = readAitNotificationTopicsFile(
|
|
24
|
+
{
|
|
25
|
+
configured: process.env.MPGD_NOTIFICATION_TOPICS_FILE,
|
|
26
|
+
rootDir: fileURLToPath(new URL('../..', import.meta.url)),
|
|
27
|
+
defaultFile: 'notifications/topics.json',
|
|
28
|
+
},
|
|
29
|
+
{ existsSync, readFileSync, resolve },
|
|
30
|
+
);
|
|
12
31
|
|
|
13
32
|
export default defineConfig(({ command, isPreview }) => {
|
|
14
33
|
const enableLocalAitMock = command === 'serve'
|
|
@@ -33,6 +52,7 @@ export default defineConfig(({ command, isPreview }) => {
|
|
|
33
52
|
adGroupIds: aitAdConfig.adGroupIds,
|
|
34
53
|
adPlacementTypes: aitAdConfig.adPlacementTypes,
|
|
35
54
|
iapProducts: aitIapProducts,
|
|
55
|
+
notificationTopics: aitNotificationTopics,
|
|
36
56
|
}),
|
|
37
57
|
...(command === 'build'
|
|
38
58
|
? [ttsc({ project: 'tsconfig.json', plugins: false })]
|
|
@@ -51,6 +71,7 @@ function createAitRuntimeConfigPlugin(input: Readonly<{
|
|
|
51
71
|
readonly adGroupIds: Readonly<Record<string, string>>;
|
|
52
72
|
readonly adPlacementTypes: AitAdBridgeConfig['adPlacementTypes'];
|
|
53
73
|
readonly iapProducts: readonly AitIapProductConfig[];
|
|
74
|
+
readonly notificationTopics: Readonly<Record<string, AitNotificationTopicMapping>>;
|
|
54
75
|
}>): Plugin {
|
|
55
76
|
const publicId = 'virtual:mpgd-ait-runtime-config';
|
|
56
77
|
const resolvedId = `\0${publicId}`;
|
|
@@ -165,3 +165,17 @@ game-owned production credentials, deployment, signing, or store evidence.
|
|
|
165
165
|
Use `@mpgd/adapter-browser/oneplay` through `PlatformGateway`. Build and smoke the `oneplay` target with the configured kit path. The adapter initializes the H5 SDK before gameplay; `completeLoading()` awaits host acknowledgement. Exit checkpoints must be synchronous through `storage.saveSync`. Use game-owned issued placement IDs and server verification before enabling ads or purchases. Check final HTTPS hosting headers for both ONE store domain families. See the [ONE play guide](https://github.com/imjlk/mpgd-kit/blob/main/docs/ONEPLAY.md) and [official SDK guide](https://onestore-dev.gitbook.io/dev/tools/web-sdk).
|
|
166
166
|
|
|
167
167
|
Wire `rewardRequests` and `commerceServer` in `src/platform/buildGateways/oneplay.ts`. Server-only `@mpgd/game-services/oneplay-reward`, `oneplay-purchase-client`, `oneplay-purchase` and `oneplay-pns` provide signed SSV, authenticated checkout intents, API V7 verification, post-ledger consume/acknowledge and signed notification recovery. The game owns durable stores, routes, an encrypted client journal and atomic cancellation fencing. A completed PNS requires completed finalization. Missing ports keep capabilities unavailable; subscriptions are unsupported. See `commerce.checkout.verified-intent` in the game manifest and the ONE play acceptance notes before enabling policies.
|
|
168
|
+
|
|
169
|
+
## ONEplay official SDK skill
|
|
170
|
+
|
|
171
|
+
From this game's repository root, install or explicitly refresh the official instructions:
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
npx skills add ONE-store/onestore_web_sdk_skills --agent codex --yes
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Review the resulting `.agents/skills/onestore-web-sdk` and `skills-lock.json` diff before committing.
|
|
178
|
+
Use the skill's doctor and pre-release checklist alongside Kit's `docs/ONEPLAY.md`.
|
|
179
|
+
Keep SDK imports in composition, game-services credentials on the server, and rewards behind
|
|
180
|
+
purchase verification / signed SSV. The official standalone HTML template is reference material,
|
|
181
|
+
not a replacement for the generated gateway. Do not refresh skills inside production builds.
|