@mpgd/platform 0.4.0 → 0.5.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/index.d.ts +15 -1
- package/dist/index.js +9 -0
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -133,9 +133,23 @@ export interface ShareIntent {
|
|
|
133
133
|
readonly payload?: SharePayload;
|
|
134
134
|
readonly previewImageUrl?: string;
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Evidence available after a platform reports a successful share operation.
|
|
138
|
+
* `presented` means the platform share surface opened, not that the user
|
|
139
|
+
* finished sharing. `completed` means the adapter observed completion.
|
|
140
|
+
*/
|
|
141
|
+
export type ShareCompletion = 'presented' | 'completed';
|
|
136
142
|
export interface ShareResult {
|
|
137
143
|
readonly status: 'shared' | 'cancelled' | 'unavailable';
|
|
138
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Optional for backward compatibility. A legacy `shared` result without this
|
|
146
|
+
* field normalizes to `completed`; new adapters should set it explicitly when
|
|
147
|
+
* they can only prove that a share surface was presented.
|
|
148
|
+
*/
|
|
149
|
+
readonly completion?: ShareCompletion;
|
|
150
|
+
}
|
|
151
|
+
export declare function resolveShareCompletion(result: ShareResult): ShareCompletion | undefined;
|
|
152
|
+
export declare function isShareCompleted(result: ShareResult): boolean;
|
|
139
153
|
export interface InboundShare {
|
|
140
154
|
readonly puzzleId?: string;
|
|
141
155
|
readonly challengeToken?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export function resolveShareCompletion(result) {
|
|
2
|
+
if (result.status !== 'shared') {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
return result.completion ?? 'completed';
|
|
6
|
+
}
|
|
7
|
+
export function isShareCompleted(result) {
|
|
8
|
+
return resolveShareCompletion(result) === 'completed';
|
|
9
|
+
}
|
|
1
10
|
export function createUnsupportedCapabilities() {
|
|
2
11
|
return {
|
|
3
12
|
nativeIap: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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": {
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"ttsc": "0.16.9",
|
|
38
|
-
"typescript": "7.0.1-rc"
|
|
38
|
+
"typescript": "7.0.1-rc",
|
|
39
|
+
"vitest": "^4.0.0"
|
|
39
40
|
},
|
|
40
41
|
"main": "./dist/index.js",
|
|
41
42
|
"types": "./dist/index.d.ts",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"check": "ttsc --noEmit",
|
|
47
48
|
"lint": "ttsc --noEmit",
|
|
48
49
|
"format": "ttsc format",
|
|
49
|
-
"fix": "ttsc fix"
|
|
50
|
+
"fix": "ttsc fix",
|
|
51
|
+
"test": "vitest run"
|
|
50
52
|
}
|
|
51
53
|
}
|