@mpgd/platform 0.16.0 → 0.17.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 (2) hide show
  1. package/dist/index.d.ts +24 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AdProvider } from './ads.js';
2
- export type PlatformTarget = 'browser' | 'microsoft-store' | 'android' | 'ios' | 'ait' | 'reddit' | 'verse8' | 'crazygames' | 'telegram' | 'tauri' | 'wechat' | 'tiktok';
2
+ export type PlatformTarget = 'browser' | 'microsoft-store' | 'android' | 'ios' | 'ait' | 'reddit' | 'verse8' | 'crazygames' | 'oneplay' | 'telegram' | 'tauri' | 'wechat' | 'tiktok';
3
3
  export type StarterLogicalProductId = 'COINS_100' | 'COINS_500' | 'REMOVE_ADS';
4
4
  export type LogicalProductId = StarterLogicalProductId | (string & Record<never, never>);
5
5
  export type StarterLogicalAdPlacementId = 'CONTINUE_AFTER_FAIL' | 'STAGE_END_INTERSTITIAL';
@@ -102,7 +102,16 @@ export interface InterstitialAdResult {
102
102
  export interface BannerAdMountResult {
103
103
  readonly status: 'mounted' | 'unavailable' | 'failed';
104
104
  }
105
+ export interface PlatformPurchasePresentationEvent {
106
+ readonly idempotencyKey: string;
107
+ readonly sequence: number;
108
+ readonly state: 'open' | 'closed' | 'not-started' | 'unknown';
109
+ }
105
110
  export interface CommerceAdapter {
111
+ /** Trusted native presentation facts, independent of the purchase grant result. */
112
+ readonly presentation?: {
113
+ subscribe(listener: (event: PlatformPurchasePresentationEvent) => void): () => void;
114
+ };
106
115
  getProducts(): Promise<readonly ProductInfo[]>;
107
116
  purchase(input: {
108
117
  readonly productId: LogicalProductId;
@@ -333,6 +342,8 @@ export interface ViewportAdapter {
333
342
  export interface LifecycleAdapter {
334
343
  onPause(callback: () => void): () => void;
335
344
  onResume(callback: () => void): () => void;
345
+ /** Synchronous checkpoint only. The host may destroy the document immediately afterward. */
346
+ onExit?(callback: () => void): () => void;
336
347
  /**
337
348
  * Android handlers run last-registered-first until one returns true. If none
338
349
  * consumes the event, Capacitor navigates WebView history when possible or
@@ -367,6 +378,16 @@ export interface StorageAdapter {
367
378
  readonly key: string;
368
379
  readonly value: unknown;
369
380
  }): Promise<void>;
381
+ /** Optional synchronous checkpoint for hosts whose exit event cannot await promises. */
382
+ saveSync?(input: {
383
+ readonly key: string;
384
+ readonly value: unknown;
385
+ }): void;
386
+ }
387
+ /** Host loading UI. Completion is an acknowledgement, not progress reaching 100%. */
388
+ export interface GameLoadingAdapter {
389
+ setProgress(progress: number): void;
390
+ complete(): Promise<void>;
370
391
  }
371
392
  /** Device-protected opaque credentials; never backed by ordinary game storage. */
372
393
  export interface SecureCredentialStore {
@@ -392,9 +413,11 @@ export interface GameActivityAdapter {
392
413
  export interface GameSettingsAdapter {
393
414
  getAudioMuted(): boolean;
394
415
  onAudioMuteChange(callback: (muted: boolean) => void): () => void;
416
+ getLocale?(): string;
395
417
  }
396
418
  export interface PlatformGateway {
397
419
  readonly target: PlatformTarget;
420
+ readonly gameLoading?: GameLoadingAdapter;
398
421
  getCapabilities(): Promise<PlatformCapabilities>;
399
422
  readonly identity: IdentityAdapter;
400
423
  readonly commerce: CommerceAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/platform",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Shared platform gateway, monetization, ads, leaderboard, identity, lifecycle, and storage contracts for mpgd games.",
5
5
  "license": "MIT",
6
6
  "repository": {