@mpgd/platform 0.7.0 → 0.9.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.
@@ -1,5 +1,5 @@
1
1
  import type { PlatformCapabilities, PlatformGateway, PlatformTarget } from './index.js';
2
- export declare const platformCapabilityKeys: readonly ["nativeIap", "nativeAds", "rewardedAds", "interstitialAds", "nativeLeaderboard", "achievements", "cloudSave", "socialShare", "haptics", "localizedContent"];
2
+ export declare const platformCapabilityKeys: readonly ["nativeIap", "nativeAds", "rewardedAds", "interstitialAds", "nativeLeaderboard", "remoteLeaderboard", "achievements", "cloudSave", "socialShare", "haptics", "localizedContent"];
3
3
  export interface PlatformGatewayCapabilityConformanceTransition {
4
4
  readonly update: () => Promise<void> | void;
5
5
  readonly expectedCapabilities: PlatformCapabilities;
@@ -4,6 +4,7 @@ export const platformCapabilityKeys = Object.freeze([
4
4
  'rewardedAds',
5
5
  'interstitialAds',
6
6
  'nativeLeaderboard',
7
+ 'remoteLeaderboard',
7
8
  'achievements',
8
9
  'cloudSave',
9
10
  'socialShare',
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type PlatformTarget = 'browser' | 'android' | 'ios' | 'ait' | 'reddit' | 'verse8' | 'telegram' | 'tauri';
1
+ export type PlatformTarget = 'browser' | 'microsoft-store' | 'android' | 'ios' | 'ait' | 'reddit' | 'verse8' | 'telegram' | 'tauri';
2
2
  export type StarterLogicalProductId = 'COINS_100' | 'COINS_500' | 'REMOVE_ADS';
3
3
  export type LogicalProductId = StarterLogicalProductId | (string & Record<never, never>);
4
4
  export type StarterLogicalAdPlacementId = 'CONTINUE_AFTER_FAIL' | 'STAGE_END_INTERSTITIAL';
@@ -29,6 +29,11 @@ export interface PurchaseResult {
29
29
  readonly transactionId?: string;
30
30
  readonly entitlementIds: readonly string[];
31
31
  readonly evidence?: PlatformEvidenceEnvelope;
32
+ /** Present only when the adapter already completed the authoritative server grant. */
33
+ readonly authoritativeGrant?: Readonly<{
34
+ readonly ledgerEntryId: string;
35
+ readonly alreadyProcessed?: boolean;
36
+ }>;
32
37
  }
33
38
  export interface PurchaseRestoreResult {
34
39
  readonly restoredEntitlements: readonly Entitlement[];
@@ -64,6 +69,31 @@ export interface AdAdapter {
64
69
  readonly placementId: LogicalAdPlacementId;
65
70
  }): Promise<InterstitialAdResult>;
66
71
  }
72
+ export type PromotionRewardAvailability = 'available' | 'configuration-required' | 'unsupported';
73
+ export type PromotionRewardResult = {
74
+ readonly status: 'granted';
75
+ /** Opaque provider receipt used by the game backend to finalize the authorized claim. */
76
+ readonly receiptKey: string;
77
+ } | {
78
+ readonly status: 'pending' | 'unavailable' | 'failed';
79
+ };
80
+ /**
81
+ * Optional platform-funded promotion surface.
82
+ *
83
+ * Games address logical campaign ids only. Platform promotion codes and reward
84
+ * amounts belong to the target host configuration, while claim authorization
85
+ * and receipt finalization remain server responsibilities.
86
+ */
87
+ export interface PromotionRewardAdapter {
88
+ getAvailability(input: {
89
+ readonly campaignId: string;
90
+ }): Promise<PromotionRewardAvailability>;
91
+ grantReward(input: {
92
+ readonly campaignId: string;
93
+ /** Server-issued, single-use claim id. */
94
+ readonly idempotencyKey: string;
95
+ }): Promise<PromotionRewardResult>;
96
+ }
67
97
  export interface LeaderboardScoreInput {
68
98
  readonly leaderboardId: string;
69
99
  readonly score: number;
@@ -86,6 +116,8 @@ export interface PlatformCapabilities {
86
116
  readonly rewardedAds: boolean;
87
117
  readonly interstitialAds: boolean;
88
118
  readonly nativeLeaderboard: boolean;
119
+ /** A game-owned server leaderboard is available without a native platform surface. */
120
+ readonly remoteLeaderboard: boolean;
89
121
  readonly achievements: boolean;
90
122
  readonly cloudSave: boolean;
91
123
  readonly socialShare: boolean;
@@ -200,5 +232,6 @@ export interface PlatformGateway {
200
232
  readonly presentation?: PresentationAdapter;
201
233
  readonly sharing?: ShareAdapter;
202
234
  readonly notifications?: NotificationSubscriptionAdapter;
235
+ readonly promotions?: PromotionRewardAdapter;
203
236
  }
204
237
  export declare function createUnsupportedCapabilities(): PlatformCapabilities;
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ export function createUnsupportedCapabilities() {
14
14
  rewardedAds: false,
15
15
  interstitialAds: false,
16
16
  nativeLeaderboard: false,
17
+ remoteLeaderboard: false,
17
18
  achievements: false,
18
19
  cloudSave: false,
19
20
  socialShare: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/platform",
3
- "version": "0.7.0",
3
+ "version": "0.9.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": {