@mpgd/platform 0.18.0 → 0.20.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/capability-conformance.js +103 -1
- package/dist/commerce-capabilities.d.ts +9 -0
- package/dist/commerce-capabilities.js +24 -0
- package/dist/commerce-conformance.d.ts +518 -0
- package/dist/commerce-conformance.js +2162 -0
- package/dist/commerce-contract.d.ts +222 -0
- package/dist/commerce-contract.js +1 -0
- package/dist/commerce-vectors.d.ts +277 -0
- package/dist/commerce-vectors.js +3089 -0
- package/dist/commerce.d.ts +303 -0
- package/dist/commerce.js +5623 -0
- package/dist/index.d.ts +53 -0
- package/package.json +18 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AdProvider } from './ads.js';
|
|
2
|
+
import type { CommerceProvider } from './commerce-contract.js';
|
|
2
3
|
export type PlatformTarget = 'browser' | 'microsoft-store' | 'android' | 'ios' | 'ait' | 'reddit' | 'verse8' | 'crazygames' | 'oneplay' | 'telegram' | 'tauri' | 'wechat' | 'tiktok';
|
|
3
4
|
export type StarterLogicalProductId = 'COINS_100' | 'COINS_500' | 'REMOVE_ADS';
|
|
4
5
|
export type LogicalProductId = StarterLogicalProductId | (string & Record<never, never>);
|
|
@@ -208,6 +209,45 @@ export interface LeaderboardAdapter {
|
|
|
208
209
|
export type PlatformProviderAvailability = 'unsupported' | 'configuration-required' | 'action-required' | 'temporarily-unavailable' | 'available';
|
|
209
210
|
/** Existing capabilities and integrations annotated by optional providers. */
|
|
210
211
|
export type PlatformProviderFeature = 'nativeIap' | 'subscriptionIap' | 'rewardedAds' | 'interstitialAds' | 'bannerAds' | 'nativeLeaderboard' | 'identityUpgrade' | 'pushNotifications';
|
|
212
|
+
export type CommerceFinishOwner = 'client' | 'server' | 'host' | 'none';
|
|
213
|
+
export type CommerceEvidenceAuthority = 'client-token' | 'host-callback' | 'adapter-settled' | 'server-push';
|
|
214
|
+
export type CommerceAccountBindingPolicy = 'required' | 'optional' | 'host';
|
|
215
|
+
export interface CommercePurchaseCapabilities {
|
|
216
|
+
readonly consumable: boolean;
|
|
217
|
+
readonly durable: boolean;
|
|
218
|
+
readonly subscription: boolean;
|
|
219
|
+
readonly quantity: boolean;
|
|
220
|
+
}
|
|
221
|
+
export interface CommerceCatalogCapabilities {
|
|
222
|
+
readonly products: boolean;
|
|
223
|
+
readonly offers: boolean;
|
|
224
|
+
readonly localizedPrice: boolean;
|
|
225
|
+
}
|
|
226
|
+
export interface CommerceLifecycleCapabilities {
|
|
227
|
+
readonly availablePurchases: boolean;
|
|
228
|
+
readonly pending: boolean;
|
|
229
|
+
readonly restore: boolean;
|
|
230
|
+
readonly events: boolean;
|
|
231
|
+
/** Who finishes a granted purchase. */
|
|
232
|
+
readonly finish: CommerceFinishOwner;
|
|
233
|
+
}
|
|
234
|
+
export interface CommerceAuthorityCapabilities {
|
|
235
|
+
/** What the backend verifies to grant. */
|
|
236
|
+
readonly evidence: CommerceEvidenceAuthority;
|
|
237
|
+
readonly accountBinding: CommerceAccountBindingPolicy;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Commerce v2 capability declaration (`@mpgd/platform/commerce`). Declared
|
|
241
|
+
* here so the main entry stays free of validator imports; code branches on
|
|
242
|
+
* these declarations, never on a store id or target name.
|
|
243
|
+
*/
|
|
244
|
+
export interface CommerceCapabilities {
|
|
245
|
+
readonly purchase: CommercePurchaseCapabilities;
|
|
246
|
+
readonly catalog: CommerceCatalogCapabilities;
|
|
247
|
+
readonly lifecycle: CommerceLifecycleCapabilities;
|
|
248
|
+
readonly authority: CommerceAuthorityCapabilities;
|
|
249
|
+
readonly availability: PlatformProviderAvailability;
|
|
250
|
+
}
|
|
211
251
|
export interface PlatformCapabilities {
|
|
212
252
|
readonly nativeIap: boolean;
|
|
213
253
|
/** Optional for adapters published before subscription-specific support. */
|
|
@@ -227,6 +267,12 @@ export interface PlatformCapabilities {
|
|
|
227
267
|
readonly localizedContent: boolean;
|
|
228
268
|
/** Explains a false capability without claiming an unavailable SDK works. */
|
|
229
269
|
readonly providerAvailability?: Readonly<Partial<Record<PlatformProviderFeature, PlatformProviderAvailability>>>;
|
|
270
|
+
/**
|
|
271
|
+
* Optional commerce v2 capability block. When present it must be a fresh
|
|
272
|
+
* object on every read with no unknown keys, and `nativeIap` and
|
|
273
|
+
* `subscriptionIap` must equal `deriveLegacyCommerceCapabilities(commerce)`.
|
|
274
|
+
*/
|
|
275
|
+
readonly commerce?: CommerceCapabilities;
|
|
230
276
|
}
|
|
231
277
|
export interface PlayerIdentity {
|
|
232
278
|
readonly playerId: string;
|
|
@@ -436,6 +482,13 @@ export interface PlatformGateway {
|
|
|
436
482
|
getCapabilities(): Promise<PlatformCapabilities>;
|
|
437
483
|
readonly identity: IdentityAdapter;
|
|
438
484
|
readonly commerce: CommerceAdapter;
|
|
485
|
+
/**
|
|
486
|
+
* Optional commerce v2 provider (`@mpgd/platform/commerce`). Transitional:
|
|
487
|
+
* adapters expose it next to the v1 `commerce` adapter until C4 removes v1,
|
|
488
|
+
* and the game-services reconciler (C1) prefers it when present. Absent on
|
|
489
|
+
* gateways whose target has no v2 provider.
|
|
490
|
+
*/
|
|
491
|
+
readonly commerceV2?: CommerceProvider;
|
|
439
492
|
readonly ads: AdAdapter;
|
|
440
493
|
readonly leaderboard: LeaderboardAdapter;
|
|
441
494
|
readonly lifecycle: LifecycleAdapter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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": {
|
|
@@ -44,12 +44,28 @@
|
|
|
44
44
|
"./storage-conformance": {
|
|
45
45
|
"types": "./dist/storage-conformance.d.ts",
|
|
46
46
|
"default": "./dist/storage-conformance.js"
|
|
47
|
+
},
|
|
48
|
+
"./commerce": {
|
|
49
|
+
"types": "./dist/commerce.d.ts",
|
|
50
|
+
"default": "./dist/commerce.js"
|
|
51
|
+
},
|
|
52
|
+
"./commerce-vectors": {
|
|
53
|
+
"types": "./dist/commerce-vectors.d.ts",
|
|
54
|
+
"default": "./dist/commerce-vectors.js"
|
|
55
|
+
},
|
|
56
|
+
"./commerce-conformance": {
|
|
57
|
+
"types": "./dist/commerce-conformance.d.ts",
|
|
58
|
+
"default": "./dist/commerce-conformance.js"
|
|
47
59
|
}
|
|
48
60
|
},
|
|
49
61
|
"files": [
|
|
50
62
|
"dist"
|
|
51
63
|
],
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"typia": "13.0.2"
|
|
66
|
+
},
|
|
52
67
|
"devDependencies": {
|
|
68
|
+
"@ttsc/unplugin": "0.30.4",
|
|
53
69
|
"ttsc": "0.30.4",
|
|
54
70
|
"typescript": "7.0.2",
|
|
55
71
|
"vitest": "^4.0.0"
|
|
@@ -64,6 +80,6 @@
|
|
|
64
80
|
"lint": "ttsc --noEmit",
|
|
65
81
|
"format": "ttsc format",
|
|
66
82
|
"fix": "ttsc fix",
|
|
67
|
-
"test": "vitest run && node test/capability-conformance-dist-import.mjs && node test/storage-conformance-dist-import.mjs && node test/ads-dist-import.mjs"
|
|
83
|
+
"test": "vitest run && node test/capability-conformance-dist-import.mjs && node test/storage-conformance-dist-import.mjs && node test/ads-dist-import.mjs && node test/commerce-dist-import.mjs && node test/commerce-conformance-dist-import.mjs && cd ../.. && node tools/run-ttsx.mjs packages/platform/test/commerce-derived-key-parity.ts"
|
|
68
84
|
}
|
|
69
85
|
}
|