@mpgd/cli 0.46.1 → 0.48.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.
Files changed (62) hide show
  1. package/dist/capacitor-shell-starter.d.ts +57 -1
  2. package/dist/capacitor-shell-starter.js +311 -34
  3. package/dist/command-launcher.d.ts +13 -0
  4. package/dist/command-launcher.js +24 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +149 -12
  7. package/dist/microsoft-store-submission.js +11 -6
  8. package/dist/native-build-info.json +2 -2
  9. package/dist/native-build-target.js +2413 -345
  10. package/dist/windows-host/Core/BridgeCommand.cs +17 -0
  11. package/dist/windows-host/Core/Mpgd.MicrosoftStore.Host.csproj +9 -0
  12. package/dist/windows-host/Core/NativeBridgeContracts.cs +33 -0
  13. package/dist/windows-host/Core/NativeBridgeHost.cs +162 -0
  14. package/dist/windows-host/Core/NativeBridgeOrigin.cs +19 -0
  15. package/dist/windows-host/Core/NativeBridgeProtocol.cs +335 -0
  16. package/dist/windows-host/Core/NativeBridgeRequestGate.cs +76 -0
  17. package/dist/windows-host/Core/NativeBridgeResult.cs +65 -0
  18. package/dist/windows-host/README.md +118 -0
  19. package/dist/windows-host/WinUI/DispatcherQueueBridgeDispatcher.cs +39 -0
  20. package/dist/windows-host/WinUI/WebView2DocumentTransport.cs +46 -0
  21. package/dist/windows-host/WinUI/WebView2NativeBridge.cs +185 -0
  22. package/dist/windows-host/WinUI/WindowStoreContext.cs +20 -0
  23. package/dist/windows-native-tools.d.ts +4 -0
  24. package/dist/windows-native-tools.js +21 -0
  25. package/native-tools/windows-msix/WindowsMsixAcceptance.psm1 +333 -0
  26. package/package.json +24 -14
  27. package/templates/lite-overlay/.agents/skills/use-mpgd-kit/SKILL.md +22 -0
  28. package/templates/lite-overlay/AGENTS.md +27 -0
  29. package/templates/lite-overlay/README.md +37 -0
  30. package/templates/lite-overlay/agent/acceptance.md +27 -0
  31. package/templates/lite-overlay/agent/brief.md +17 -0
  32. package/templates/lite-overlay/apps/target-devvit/README.md +134 -0
  33. package/templates/lite-overlay/docs/MPGD_KIT_WORKFLOWS.md +37 -0
  34. package/templates/lite-overlay/src/lite/tapGame.ts +77 -0
  35. package/templates/lite-overlay/src/platform/devvitEntrypoint.ts +116 -0
  36. package/templates/lite-overlay/src/platform/devvitInlineMode.css +146 -0
  37. package/templates/lite-overlay/src/runtime/createGame.ts +57 -0
  38. package/templates/phaser-game/README.md +5 -3
  39. package/templates/phaser-game/apps/target-ait/package.json +2 -2
  40. package/templates/phaser-game/apps/target-ait/src/main.ts +17 -0
  41. package/templates/phaser-game/apps/target-ait/src/runtime-config.types.ts +2 -0
  42. package/templates/phaser-game/apps/target-ait/vite.config.ts +27 -0
  43. package/templates/phaser-game/apps/target-devvit/package.json +2 -1
  44. package/templates/phaser-game/apps/target-devvit/src/server/bridge.ts +137 -18
  45. package/templates/phaser-game/apps/target-devvit/src/server/index.ts +35 -1
  46. package/templates/phaser-game/package.json +3 -1
  47. package/templates/phaser-game/pnpm-workspace.yaml +2 -0
  48. package/templates/phaser-game/src/env.d.ts +2 -0
  49. package/templates/phaser-game/src/main.ts +8 -1
  50. package/templates/phaser-game/src/platform/buildGateways/ait.ts +9 -0
  51. package/templates/phaser-game/src/platform/buildGateways/aitSandbox.ts +13 -1
  52. package/templates/phaser-game/src/platform/buildGateways/capacitorAndroid.ts +51 -2
  53. package/templates/phaser-game/src/platform/buildGateways/capacitorIos.ts +51 -2
  54. package/templates/phaser-game/src/platform/buildGateways/microsoftStore.ts +59 -26
  55. package/templates/phaser-game/src/platform/buildGateways/reddit.ts +36 -1
  56. package/templates/phaser-game/src/platform/buildGateways/verse8.ts +39 -2
  57. package/templates/phaser-game/src/platform/commerceAccountBinding.ts +79 -0
  58. package/templates/phaser-game/src/platform/commerceProducts.ts +69 -0
  59. package/templates/phaser-game/src/platform/gameServices.ts +22 -2
  60. package/templates/phaser-game/src/platform/monetizationJournal.ts +286 -0
  61. package/templates/phaser-game/src/platform/verse8Agent8Client.ts +22 -0
  62. package/templates/phaser-game/vite.shared.ts +40 -1
@@ -17,6 +17,8 @@ interface RuntimePlatformTargetMetadata {
17
17
  readonly crazyGamesLaunch?: 'basic' | 'full';
18
18
  readonly authoritativeGameServices?: boolean;
19
19
  readonly integrations?: Record<string, unknown>;
20
+ /** An Apps in Toss target's `metadata.appName`, for the sandbox bridge only. */
21
+ readonly aitAppName?: string;
20
22
  }
21
23
 
22
24
  // Sandbox gateways self-complete purchases and rewards without any backend
@@ -100,7 +102,10 @@ export function createGameViteSharedConfig<SharedPluginOption = PluginOption>(
100
102
  __APP_TARGET__: JSON.stringify(appTarget),
101
103
  __MPGD_CONFIG_TARGET__: JSON.stringify(configTarget),
102
104
  __MPGD_PLATFORM_TARGET__:
103
- platformTarget === undefined ? 'undefined' : JSON.stringify(platformTarget),
105
+ platformTarget === undefined
106
+ ? 'undefined'
107
+ : JSON.stringify(toEffectivePlatformTargetMetadata(platformTarget)),
108
+ __MPGD_AIT_APP_NAME__: JSON.stringify(resolveAitAppName(platformTarget)),
104
109
  __MPGD_TARGET_CONFIG_MATRIX__:
105
110
  runtimeTargetConfigMatrix === undefined
106
111
  ? 'undefined'
@@ -264,6 +269,8 @@ function readRuntimePlatformTarget(
264
269
  throw new Error(`Platform target ${configTarget} authoritativeGameServices must be a boolean.`);
265
270
  }
266
271
 
272
+ const aitAppName = readAitAppName(target);
273
+
267
274
  return {
268
275
  kind: target.kind,
269
276
  adapter: target.adapter,
@@ -272,9 +279,41 @@ function readRuntimePlatformTarget(
272
279
  : { authoritativeGameServices: target.authoritativeGameServices }),
273
280
  ...(target.crazyGamesLaunch === undefined ? {} : { crazyGamesLaunch: target.crazyGamesLaunch as 'basic' | 'full' }),
274
281
  ...(target.integrations === undefined ? {} : { integrations: target.integrations }),
282
+ ...(aitAppName === undefined ? {} : { aitAppName }),
283
+ };
284
+ }
285
+
286
+ function toEffectivePlatformTargetMetadata(
287
+ input: RuntimePlatformTargetMetadata,
288
+ ): Omit<RuntimePlatformTargetMetadata, 'aitAppName'> {
289
+ return {
290
+ kind: input.kind,
291
+ adapter: input.adapter,
292
+ ...(input.authoritativeGameServices === undefined
293
+ ? {}
294
+ : { authoritativeGameServices: input.authoritativeGameServices }),
295
+ ...(input.crazyGamesLaunch === undefined ? {} : { crazyGamesLaunch: input.crazyGamesLaunch }),
296
+ ...(input.integrations === undefined ? {} : { integrations: input.integrations }),
275
297
  };
276
298
  }
277
299
 
300
+ /**
301
+ * The app name `intoss://` share links must carry in the Apps in Toss sandbox
302
+ * bridge, the one the wrapper's host bridge uses: `MPGD_AIT_APP_NAME`, else
303
+ * the target's `metadata.appName`, else the game name.
304
+ */
305
+ function resolveAitAppName(platformTarget: RuntimePlatformTargetMetadata | undefined): string {
306
+ return process.env.MPGD_AIT_APP_NAME?.trim() || platformTarget?.aitAppName || '__GAME_NAME__';
307
+ }
308
+
309
+ function readAitAppName(target: Record<string, unknown>): string | undefined {
310
+ const appName = target.kind === 'apps-in-toss' && isRecord(target.metadata)
311
+ ? target.metadata.appName
312
+ : undefined;
313
+
314
+ return typeof appName === 'string' && appName.trim().length > 0 ? appName.trim() : undefined;
315
+ }
316
+
278
317
  function isRecord(input: unknown): input is Record<string, unknown> {
279
318
  return typeof input === 'object' && input !== null && !Array.isArray(input);
280
319
  }