@mpgd/platform 0.15.0 → 0.16.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/ads.d.ts CHANGED
@@ -57,6 +57,8 @@ export interface AdProvider {
57
57
  readonly protocol: typeof adProtocol;
58
58
  readonly protocolVersion: typeof adProtocolVersion;
59
59
  readonly rewardSignal: 'immediate' | 'delayed';
60
+ /** Defaults to requested. Some hosts require audio to continue until physical start. */
61
+ readonly presentationAudio?: 'requested' | 'started';
60
62
  getAvailability(input: AdPlacementInput): Promise<AdAvailability>;
61
63
  preload(input: AdPlacementInput): Promise<AdPreparationResult>;
62
64
  show(input: AdShowInput): Promise<AdShowResult>;
package/dist/ads.js CHANGED
@@ -219,6 +219,9 @@ export function toAdAdapter(provider) {
219
219
  if (provider.rewardSignal !== 'immediate' && provider.rewardSignal !== 'delayed') {
220
220
  throw new TypeError('Invalid advertising provider reward signal.');
221
221
  }
222
+ if (provider.presentationAudio !== undefined && provider.presentationAudio !== 'requested' && provider.presentationAudio !== 'started') {
223
+ throw new TypeError('Invalid advertising presentation audio policy.');
224
+ }
222
225
  return {
223
226
  provider,
224
227
  async preload(input) {
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' | 'telegram' | 'tauri' | 'wechat' | 'tiktok';
2
+ export type PlatformTarget = 'browser' | 'microsoft-store' | 'android' | 'ios' | 'ait' | 'reddit' | 'verse8' | 'crazygames' | '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';
@@ -381,6 +381,18 @@ export interface SecureCredentialStore {
381
381
  readonly key: string;
382
382
  }): Promise<void>;
383
383
  }
384
+ /** Platform telemetry only; it never pauses execution or grants a reward. */
385
+ export interface GameActivityAdapter {
386
+ /** The host already accounts for focus changes; avoid duplicate gameplay events. */
387
+ readonly handlesFocusChanges?: boolean;
388
+ setLoading(loading: boolean): void;
389
+ setGameplayActive(active: boolean): void;
390
+ }
391
+ /** Host audio policy takes precedence over an in-game sound toggle. */
392
+ export interface GameSettingsAdapter {
393
+ getAudioMuted(): boolean;
394
+ onAudioMuteChange(callback: (muted: boolean) => void): () => void;
395
+ }
384
396
  export interface PlatformGateway {
385
397
  readonly target: PlatformTarget;
386
398
  getCapabilities(): Promise<PlatformCapabilities>;
@@ -397,5 +409,7 @@ export interface PlatformGateway {
397
409
  readonly sharing?: ShareAdapter;
398
410
  readonly notifications?: NotificationSubscriptionAdapter;
399
411
  readonly promotions?: PromotionRewardAdapter;
412
+ readonly gameActivity?: GameActivityAdapter;
413
+ readonly gameSettings?: GameSettingsAdapter;
400
414
  }
401
415
  export declare function createUnsupportedCapabilities(): PlatformCapabilities;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/platform",
3
- "version": "0.15.0",
3
+ "version": "0.16.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": {