@mpgd/adapter-capacitor 0.16.3 → 0.18.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/README.md +88 -5
- package/dist/commerce-bridge.d.ts +32 -1
- package/dist/commerce-bridge.js +96 -4
- package/dist/index.d.ts +11 -2
- package/dist/index.js +141 -8
- package/dist/providers.d.ts +10 -2
- package/dist/purchase-presentation.d.ts +55 -0
- package/dist/purchase-presentation.js +170 -0
- package/dist/store-commerce-provider.d.ts +67 -4
- package/dist/store-commerce-provider.js +301 -37
- package/dist/store-sdk.d.ts +41 -1
- package/package.json +8 -8
package/dist/store-sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlatformProviderAvailability } from '@mpgd/platform';
|
|
1
|
+
import type { PlatformProviderAvailability, PlatformPurchasePresentationReason } from '@mpgd/platform';
|
|
2
2
|
import { CommerceError, type CommerceErrorCode, type CommerceFinishOwner, type CommercePurchaseCapabilities, type FetchProductsType, type PurchaseKind, type StoreId, type StoreOffer, type StorePrice, type StorePurchaseAccountBinding, type StorePurchaseState } from '@mpgd/platform/commerce';
|
|
3
3
|
/**
|
|
4
4
|
* In-process surface a store plugin exposes to `createStoreCommerceProvider`.
|
|
@@ -26,6 +26,39 @@ export interface StoreSdk {
|
|
|
26
26
|
addListener<TEvent extends StoreSdkEventName>(eventName: TEvent, listener: (event: StoreSdkEventOf<TEvent>) => void): () => void;
|
|
27
27
|
/** Current readiness; omitted means the SDK is in-process and ready. */
|
|
28
28
|
getAvailability?(): Promise<PlatformProviderAvailability>;
|
|
29
|
+
/**
|
|
30
|
+
* Native facts about the store's purchase sheet. Present only when the SDK
|
|
31
|
+
* (and the native code under it) reports them for every `requestPurchase`
|
|
32
|
+
* that carries a `presentationId`; `createStoreCommerceProvider` then
|
|
33
|
+
* offers `CommerceProvider.presentation`. An SDK without it keeps the
|
|
34
|
+
* provider without presentation, as before.
|
|
35
|
+
*/
|
|
36
|
+
readonly purchasePresentation?: StoreSdkPurchasePresentation;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The purchase sheet facts of one SDK. For a `requestPurchase` call with a
|
|
40
|
+
* `presentationId` the SDK reports, by that id: `open` once the store sheet
|
|
41
|
+
* is up, then exactly one `closed` when it is gone (which may come after the
|
|
42
|
+
* call settled), or `not-started` when no sheet opened. A fact the call
|
|
43
|
+
* settles without (the sheet never opened) means `not-started`, so an SDK
|
|
44
|
+
* reports `open` before it settles whenever a sheet opened, and `unknown`
|
|
45
|
+
* before it settles when it cannot tell yet (a terminal fact then follows). A transaction
|
|
46
|
+
* update, a pending purchase, or a result is not a `closed` fact.
|
|
47
|
+
*/
|
|
48
|
+
export interface StoreSdkPurchasePresentation {
|
|
49
|
+
subscribe(listener: (event: StoreSdkPurchasePresentationEvent) => void): () => void;
|
|
50
|
+
}
|
|
51
|
+
export interface StoreSdkPurchasePresentationEvent {
|
|
52
|
+
readonly presentationId: string;
|
|
53
|
+
/**
|
|
54
|
+
* `unknown`: the call is answering while the native flow still runs and
|
|
55
|
+
* nothing was observed yet; the sheet may still open, and a terminal fact
|
|
56
|
+
* (`closed` or `not-started`) follows. The provider keeps the call waiting
|
|
57
|
+
* for it instead of reading the answer as a sheet that never opened.
|
|
58
|
+
*/
|
|
59
|
+
readonly state: 'open' | 'closed' | 'not-started' | 'unknown';
|
|
60
|
+
/** On a `closed` fact no native observation proved, why; see `PlatformPurchasePresentationReason`. */
|
|
61
|
+
readonly reason?: PlatformPurchasePresentationReason;
|
|
29
62
|
}
|
|
30
63
|
export interface StoreSdkCapabilities {
|
|
31
64
|
readonly purchase: CommercePurchaseCapabilities;
|
|
@@ -55,6 +88,11 @@ export interface StoreSdkRequestPurchaseInput {
|
|
|
55
88
|
readonly offerId?: string;
|
|
56
89
|
readonly quantity?: number;
|
|
57
90
|
readonly accountBinding?: StorePurchaseAccountBinding;
|
|
91
|
+
/**
|
|
92
|
+
* Correlates this call's `purchasePresentation` facts. Sent only to an SDK
|
|
93
|
+
* that declares `purchasePresentation`; unique per call.
|
|
94
|
+
*/
|
|
95
|
+
readonly presentationId?: string;
|
|
58
96
|
}
|
|
59
97
|
export type StoreSdkRequestPurchaseResult = {
|
|
60
98
|
readonly outcome: 'launched';
|
|
@@ -91,6 +129,8 @@ export interface StoreSdkPurchase {
|
|
|
91
129
|
export interface StoreSdkFinishTransactionInput {
|
|
92
130
|
readonly transactionId: string;
|
|
93
131
|
readonly isConsumable: boolean;
|
|
132
|
+
/** `FinishTransactionInput.retry`: an earlier finish of this purchase was asked for. */
|
|
133
|
+
readonly retry?: boolean;
|
|
94
134
|
/** The ledger entry that authorized the finish; a plugin may record it. */
|
|
95
135
|
readonly ledgerEntryId: string;
|
|
96
136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/adapter-capacitor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Capacitor platform adapter for mpgd Android and iOS shells.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@capacitor/app": "8.1.1",
|
|
54
|
-
"@mpgd/capacitor-game-services": "0.9.
|
|
55
|
-
"@mpgd/
|
|
56
|
-
"@mpgd/
|
|
57
|
-
"@mpgd/
|
|
58
|
-
"@mpgd/
|
|
54
|
+
"@mpgd/capacitor-game-services": "0.9.5",
|
|
55
|
+
"@mpgd/game-services": "0.32.0",
|
|
56
|
+
"@mpgd/target-config": "0.24.5",
|
|
57
|
+
"@mpgd/platform": "0.34.0",
|
|
58
|
+
"@mpgd/bridge": "0.18.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@capacitor-community/admob": "^8.1.0",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"@capacitor/core": "8.5.2",
|
|
90
90
|
"@capacitor/local-notifications": "8.3.1",
|
|
91
91
|
"@capawesome/capacitor-app-review": "8.1.0",
|
|
92
|
-
"ttsc": "0.
|
|
92
|
+
"ttsc": "0.34.2",
|
|
93
93
|
"typescript": "7.0.2",
|
|
94
94
|
"vitest": "^4.0.0",
|
|
95
|
-
"@mpgd/game-runtime": "0.
|
|
95
|
+
"@mpgd/game-runtime": "0.9.0"
|
|
96
96
|
},
|
|
97
97
|
"main": "./dist/index.js",
|
|
98
98
|
"types": "./dist/index.d.ts",
|