@capgo/native-purchases 7.1.33 → 7.3.1
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 +21 -0
- package/android/src/main/java/ee/forgr/nativepurchases/NativePurchasesPlugin.java +152 -0
- package/dist/docs.json +40 -0
- package/dist/esm/definitions.d.ts +15 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +6 -1
- package/dist/esm/web.js +4 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +4 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/NativePurchasesPlugin.swift +69 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -726,6 +726,7 @@ This approach balances immediate user gratification with proper server-side vali
|
|
|
726
726
|
* [`getProduct(...)`](#getproduct)
|
|
727
727
|
* [`isBillingSupported()`](#isbillingsupported)
|
|
728
728
|
* [`getPluginVersion()`](#getpluginversion)
|
|
729
|
+
* [`getPurchases(...)`](#getpurchases)
|
|
729
730
|
* [Interfaces](#interfaces)
|
|
730
731
|
* [Enums](#enums)
|
|
731
732
|
|
|
@@ -822,6 +823,26 @@ Get the native Capacitor plugin version
|
|
|
822
823
|
--------------------
|
|
823
824
|
|
|
824
825
|
|
|
826
|
+
### getPurchases(...)
|
|
827
|
+
|
|
828
|
+
```typescript
|
|
829
|
+
getPurchases(options?: { productType?: PURCHASE_TYPE | undefined; } | undefined) => Promise<{ purchases: Transaction[]; }>
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
Gets all the user's purchases (both in-app purchases and subscriptions).
|
|
833
|
+
This method queries the platform's purchase history for the current user.
|
|
834
|
+
|
|
835
|
+
| Param | Type | Description |
|
|
836
|
+
| ------------- | -------------------------------------------------------------------------- | --------------------------------------------- |
|
|
837
|
+
| **`options`** | <code>{ productType?: <a href="#purchase_type">PURCHASE_TYPE</a>; }</code> | - Optional parameters for filtering purchases |
|
|
838
|
+
|
|
839
|
+
**Returns:** <code>Promise<{ purchases: Transaction[]; }></code>
|
|
840
|
+
|
|
841
|
+
**Since:** 7.2.0
|
|
842
|
+
|
|
843
|
+
--------------------
|
|
844
|
+
|
|
845
|
+
|
|
825
846
|
### Interfaces
|
|
826
847
|
|
|
827
848
|
|
|
@@ -859,4 +859,156 @@ public class NativePurchasesPlugin extends Plugin {
|
|
|
859
859
|
call
|
|
860
860
|
);
|
|
861
861
|
}
|
|
862
|
+
|
|
863
|
+
@PluginMethod
|
|
864
|
+
public void getPurchases(PluginCall call) {
|
|
865
|
+
Log.d(TAG, "getPurchases() called");
|
|
866
|
+
String productType = call.getString("productType");
|
|
867
|
+
Log.d(TAG, "Product type filter: " + productType);
|
|
868
|
+
|
|
869
|
+
this.initBillingClient(null);
|
|
870
|
+
|
|
871
|
+
JSONArray allPurchases = new JSONArray();
|
|
872
|
+
|
|
873
|
+
try {
|
|
874
|
+
// Query in-app purchases if no filter or if filter is "inapp"
|
|
875
|
+
if (productType == null || productType.equals("inapp")) {
|
|
876
|
+
Log.d(TAG, "Querying in-app purchases");
|
|
877
|
+
QueryPurchasesParams queryInAppParams =
|
|
878
|
+
QueryPurchasesParams.newBuilder()
|
|
879
|
+
.setProductType(BillingClient.ProductType.INAPP)
|
|
880
|
+
.build();
|
|
881
|
+
|
|
882
|
+
billingClient.queryPurchasesAsync(
|
|
883
|
+
queryInAppParams,
|
|
884
|
+
(billingResult, purchases) -> {
|
|
885
|
+
Log.d(
|
|
886
|
+
TAG,
|
|
887
|
+
"In-app purchases query result: " +
|
|
888
|
+
billingResult.getResponseCode()
|
|
889
|
+
);
|
|
890
|
+
if (
|
|
891
|
+
billingResult.getResponseCode() ==
|
|
892
|
+
BillingClient.BillingResponseCode.OK &&
|
|
893
|
+
purchases != null
|
|
894
|
+
) {
|
|
895
|
+
for (Purchase purchase : purchases) {
|
|
896
|
+
Log.d(
|
|
897
|
+
TAG,
|
|
898
|
+
"Processing in-app purchase: " + purchase.getOrderId()
|
|
899
|
+
);
|
|
900
|
+
JSObject purchaseData = new JSObject();
|
|
901
|
+
purchaseData.put("transactionId", purchase.getPurchaseToken());
|
|
902
|
+
allPurchases.put(purchaseData);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// Query subscriptions if no filter or if filter is "subs"
|
|
907
|
+
if (productType == null || productType.equals("subs")) {
|
|
908
|
+
Log.d(TAG, "Querying subscription purchases");
|
|
909
|
+
QueryPurchasesParams querySubsParams =
|
|
910
|
+
QueryPurchasesParams.newBuilder()
|
|
911
|
+
.setProductType(BillingClient.ProductType.SUBS)
|
|
912
|
+
.build();
|
|
913
|
+
|
|
914
|
+
billingClient.queryPurchasesAsync(
|
|
915
|
+
querySubsParams,
|
|
916
|
+
(subsResult, subsPurchases) -> {
|
|
917
|
+
Log.d(
|
|
918
|
+
TAG,
|
|
919
|
+
"Subscription purchases query result: " +
|
|
920
|
+
subsResult.getResponseCode()
|
|
921
|
+
);
|
|
922
|
+
if (
|
|
923
|
+
subsResult.getResponseCode() ==
|
|
924
|
+
BillingClient.BillingResponseCode.OK &&
|
|
925
|
+
subsPurchases != null
|
|
926
|
+
) {
|
|
927
|
+
for (Purchase purchase : subsPurchases) {
|
|
928
|
+
Log.d(
|
|
929
|
+
TAG,
|
|
930
|
+
"Processing subscription purchase: " +
|
|
931
|
+
purchase.getOrderId()
|
|
932
|
+
);
|
|
933
|
+
JSObject purchaseData = new JSObject();
|
|
934
|
+
purchaseData.put(
|
|
935
|
+
"transactionId",
|
|
936
|
+
purchase.getPurchaseToken()
|
|
937
|
+
);
|
|
938
|
+
allPurchases.put(purchaseData);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// Return final result
|
|
943
|
+
JSObject result = new JSObject();
|
|
944
|
+
result.put("purchases", allPurchases);
|
|
945
|
+
Log.d(
|
|
946
|
+
TAG,
|
|
947
|
+
"Returning " + allPurchases.length() + " purchases"
|
|
948
|
+
);
|
|
949
|
+
closeBillingClient();
|
|
950
|
+
call.resolve(result);
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
} else {
|
|
954
|
+
// Only querying in-app, return result now
|
|
955
|
+
JSObject result = new JSObject();
|
|
956
|
+
result.put("purchases", allPurchases);
|
|
957
|
+
Log.d(
|
|
958
|
+
TAG,
|
|
959
|
+
"Returning " + allPurchases.length() + " in-app purchases"
|
|
960
|
+
);
|
|
961
|
+
closeBillingClient();
|
|
962
|
+
call.resolve(result);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
);
|
|
966
|
+
} else if (productType.equals("subs")) {
|
|
967
|
+
// Only query subscriptions
|
|
968
|
+
Log.d(TAG, "Querying only subscription purchases");
|
|
969
|
+
QueryPurchasesParams querySubsParams = QueryPurchasesParams.newBuilder()
|
|
970
|
+
.setProductType(BillingClient.ProductType.SUBS)
|
|
971
|
+
.build();
|
|
972
|
+
|
|
973
|
+
billingClient.queryPurchasesAsync(
|
|
974
|
+
querySubsParams,
|
|
975
|
+
(billingResult, purchases) -> {
|
|
976
|
+
Log.d(
|
|
977
|
+
TAG,
|
|
978
|
+
"Subscription purchases query result: " +
|
|
979
|
+
billingResult.getResponseCode()
|
|
980
|
+
);
|
|
981
|
+
if (
|
|
982
|
+
billingResult.getResponseCode() ==
|
|
983
|
+
BillingClient.BillingResponseCode.OK &&
|
|
984
|
+
purchases != null
|
|
985
|
+
) {
|
|
986
|
+
for (Purchase purchase : purchases) {
|
|
987
|
+
Log.d(
|
|
988
|
+
TAG,
|
|
989
|
+
"Processing subscription purchase: " + purchase.getOrderId()
|
|
990
|
+
);
|
|
991
|
+
JSObject purchaseData = new JSObject();
|
|
992
|
+
purchaseData.put("transactionId", purchase.getPurchaseToken());
|
|
993
|
+
allPurchases.put(purchaseData);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
JSObject result = new JSObject();
|
|
998
|
+
result.put("purchases", allPurchases);
|
|
999
|
+
Log.d(
|
|
1000
|
+
TAG,
|
|
1001
|
+
"Returning " + allPurchases.length() + " subscription purchases"
|
|
1002
|
+
);
|
|
1003
|
+
closeBillingClient();
|
|
1004
|
+
call.resolve(result);
|
|
1005
|
+
}
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
} catch (Exception e) {
|
|
1009
|
+
Log.d(TAG, "Exception during getPurchases: " + e.getMessage());
|
|
1010
|
+
closeBillingClient();
|
|
1011
|
+
call.reject(e.getMessage());
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
862
1014
|
}
|
package/dist/docs.json
CHANGED
|
@@ -159,6 +159,46 @@
|
|
|
159
159
|
"docs": "Get the native Capacitor plugin version",
|
|
160
160
|
"complexTypes": [],
|
|
161
161
|
"slug": "getpluginversion"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "getPurchases",
|
|
165
|
+
"signature": "(options?: { productType?: PURCHASE_TYPE | undefined; } | undefined) => Promise<{ purchases: Transaction[]; }>",
|
|
166
|
+
"parameters": [
|
|
167
|
+
{
|
|
168
|
+
"name": "options",
|
|
169
|
+
"docs": "- Optional parameters for filtering purchases",
|
|
170
|
+
"type": "{ productType?: PURCHASE_TYPE | undefined; } | undefined"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"returns": "Promise<{ purchases: Transaction[]; }>",
|
|
174
|
+
"tags": [
|
|
175
|
+
{
|
|
176
|
+
"name": "param",
|
|
177
|
+
"text": "options - Optional parameters for filtering purchases"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "param",
|
|
181
|
+
"text": "options.productType - Only Android, filter by product type (inapp or subs). If not specified, returns both types."
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "returns",
|
|
185
|
+
"text": "Promise that resolves with array of user's purchases"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "throws",
|
|
189
|
+
"text": "An error if the purchase query fails"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "since",
|
|
193
|
+
"text": "7.2.0"
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"docs": "Gets all the user's purchases (both in-app purchases and subscriptions).\nThis method queries the platform's purchase history for the current user.",
|
|
197
|
+
"complexTypes": [
|
|
198
|
+
"Transaction",
|
|
199
|
+
"PURCHASE_TYPE"
|
|
200
|
+
],
|
|
201
|
+
"slug": "getpurchases"
|
|
162
202
|
}
|
|
163
203
|
],
|
|
164
204
|
"properties": []
|
|
@@ -294,4 +294,19 @@ export interface NativePurchasesPlugin {
|
|
|
294
294
|
getPluginVersion(): Promise<{
|
|
295
295
|
version: string;
|
|
296
296
|
}>;
|
|
297
|
+
/**
|
|
298
|
+
* Gets all the user's purchases (both in-app purchases and subscriptions).
|
|
299
|
+
* This method queries the platform's purchase history for the current user.
|
|
300
|
+
*
|
|
301
|
+
* @param options - Optional parameters for filtering purchases
|
|
302
|
+
* @param options.productType - Only Android, filter by product type (inapp or subs). If not specified, returns both types.
|
|
303
|
+
* @returns {Promise<{ purchases: Transaction[] }>} Promise that resolves with array of user's purchases
|
|
304
|
+
* @throws An error if the purchase query fails
|
|
305
|
+
* @since 7.2.0
|
|
306
|
+
*/
|
|
307
|
+
getPurchases(options?: {
|
|
308
|
+
productType?: PURCHASE_TYPE;
|
|
309
|
+
}): Promise<{
|
|
310
|
+
purchases: Transaction[];
|
|
311
|
+
}>;
|
|
297
312
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,qFAAoB,CAAA;IACpB,iEAAU,CAAA;IACV,uEAAa,CAAA;IACb,iEAAU,CAAA;IACV,iEAAU,CAAA;IACV,qEAAY,CAAA;AACd,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAA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AwB,KAAxB,wBAAwB,QAanC","sourcesContent":["export enum ATTRIBUTION_NETWORK {\n APPLE_SEARCH_ADS = 0,\n ADJUST = 1,\n APPSFLYER = 2,\n BRANCH = 3,\n TENJIN = 4,\n FACEBOOK = 5,\n}\n\nexport enum PURCHASE_TYPE {\n /**\n * A type of SKU for in-app products.\n */\n INAPP = \"inapp\",\n\n /**\n * A type of SKU for subscriptions.\n */\n SUBS = \"subs\",\n}\n\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport enum BILLING_FEATURE {\n /**\n * Purchase/query for subscriptions.\n */\n SUBSCRIPTIONS,\n\n /**\n * Subscriptions update/replace.\n */\n SUBSCRIPTIONS_UPDATE,\n\n /**\n * Purchase/query for in-app items on VR.\n */\n IN_APP_ITEMS_ON_VR,\n\n /**\n * Purchase/query for subscriptions on VR.\n */\n SUBSCRIPTIONS_ON_VR,\n\n /**\n * Launch a price change confirmation flow.\n */\n PRICE_CHANGE_CONFIRMATION,\n}\nexport enum PRORATION_MODE {\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n IMMEDIATE_WITHOUT_PRORATION = 3,\n\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n DEFERRED = 4,\n}\n\nexport enum PACKAGE_TYPE {\n /**\n * A package that was defined with a custom identifier.\n */\n UNKNOWN = \"UNKNOWN\",\n\n /**\n * A package that was defined with a custom identifier.\n */\n CUSTOM = \"CUSTOM\",\n\n /**\n * A package configured with the predefined lifetime identifier.\n */\n LIFETIME = \"LIFETIME\",\n\n /**\n * A package configured with the predefined annual identifier.\n */\n ANNUAL = \"ANNUAL\",\n\n /**\n * A package configured with the predefined six month identifier.\n */\n SIX_MONTH = \"SIX_MONTH\",\n\n /**\n * A package configured with the predefined three month identifier.\n */\n THREE_MONTH = \"THREE_MONTH\",\n\n /**\n * A package configured with the predefined two month identifier.\n */\n TWO_MONTH = \"TWO_MONTH\",\n\n /**\n * A package configured with the predefined monthly identifier.\n */\n MONTHLY = \"MONTHLY\",\n\n /**\n * A package configured with the predefined weekly identifier.\n */\n WEEKLY = \"WEEKLY\",\n}\n\nexport enum INTRO_ELIGIBILITY_STATUS {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_INELIGIBLE,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE,\n}\n\nexport interface Transaction {\n /**\n * RevenueCat Id associated to the transaction.\n */\n readonly transactionId: string;\n /**\n * Receipt data for validation (iOS only - base64 encoded receipt)\n */\n readonly receipt?: string;\n /**\n * Product Id associated with the transaction.\n */\n // readonly productIdentifier: string;\n /**\n * Purchase date of the transaction in ISO 8601 format.\n */\n // readonly purchaseDate: string;\n}\n\nexport interface SubscriptionPeriod {\n /**\n * The Subscription Period number of unit.\n */\n readonly numberOfUnits: number;\n /**\n * The Subscription Period unit.\n */\n readonly unit: number;\n}\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n */\n readonly type: number;\n /**\n * The Product discount price.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * The Product discount currency symbol.\n */\n readonly currencySymbol: string;\n /**\n * The Product discount currency code.\n */\n readonly currencyCode: string;\n /**\n * The Product discount paymentMode.\n */\n readonly paymentMode: number;\n /**\n * The Product discount number Of Periods.\n */\n readonly numberOfPeriods: number;\n /**\n * The Product discount subscription period.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n}\nexport interface Product {\n /**\n * Product Id.\n */\n readonly identifier: string;\n /**\n * Description of the product.\n */\n readonly description: string;\n /**\n * Title of the product.\n */\n readonly title: string;\n /**\n * Price of the product in the local currency.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * Currency code for price and original price.\n */\n readonly currencyCode: string;\n /**\n * Currency symbol for price and original price.\n */\n readonly currencySymbol: string;\n /**\n * Boolean indicating if the product is sharable with family\n */\n readonly isFamilyShareable: boolean;\n /**\n * Group identifier for the product.\n */\n readonly subscriptionGroupIdentifier: string;\n /**\n * The Product subcription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * The Product discounts list.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Restores a user's previous and links their appUserIDs to any user's also using those .\n */\n restorePurchases(): Promise<void>;\n\n /**\n * Started purchase process for the given product.\n *\n * @param options - The product to purchase\n * @param options.productIdentifier - The product identifier of the product you want to purchase.\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @param options.planIdentifier - Only Android, the identifier of the plan you want to purchase, require for for subs.\n * @param options.quantity - Only iOS, the number of items you wish to purchase. Will use 1 by default.\n * @param options.appAccountToken - Only iOS, UUID for the user's account. Used to link purchases to the user account for App Store Server Notifications.\n */\n purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n appAccountToken?: string;\n }): Promise<Transaction>;\n\n /**\n * Gets the product info associated with a list of product identifiers.\n *\n * @param options - The product identifiers you wish to retrieve information for\n * @param options.productIdentifiers - Array of product identifiers\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProducts(options: {\n productIdentifiers: string[];\n productType?: PURCHASE_TYPE;\n }): Promise<{ products: Product[] }>;\n\n /**\n * Gets the product info for a single product identifier.\n *\n * @param options - The product identifier you wish to retrieve information for\n * @param options.productIdentifier - The product identifier\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProduct(options: {\n productIdentifier: string;\n productType?: PURCHASE_TYPE;\n }): Promise<{ product: Product }>;\n\n /**\n * Check if billing is supported for the current device.\n *\n *\n */\n isBillingSupported(): Promise<{ isBillingSupported: boolean }>;\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,qFAAoB,CAAA;IACpB,iEAAU,CAAA;IACV,uEAAa,CAAA;IACb,iEAAU,CAAA;IACV,iEAAU,CAAA;IACV,qEAAY,CAAA;AACd,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAAN,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB;;OAEG;IACH,gCAAe,CAAA;IAEf;;OAEG;IACH,8BAAa,CAAA;AACf,CAAC,EAVW,aAAa,KAAb,aAAa,QAUxB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB;;OAEG;IACH,uEAAa,CAAA;IAEb;;OAEG;IACH,qFAAoB,CAAA;IAEpB;;OAEG;IACH,iFAAkB,CAAA;IAElB;;OAEG;IACH,mFAAmB,CAAA;IAEnB;;OAEG;IACH,+FAAyB,CAAA;AAC3B,CAAC,EAzBW,eAAe,KAAf,eAAe,QAyB1B;AACD,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,qIAAiD,CAAA;IAEjD;;;OAGG;IACH,qGAAiC,CAAA;IAEjC;;;;OAIG;IACH,iHAAuC,CAAA;IAEvC;;;OAGG;IACH,iGAA+B,CAAA;IAE/B;;;OAGG;IACH,2DAAY,CAAA;AACd,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,MAAM,CAAN,IAAY,YA6CX;AA7CD,WAAY,YAAY;IACtB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,qCAAqB,CAAA;IAErB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,2CAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EA7CW,YAAY,KAAZ,YAAY,QA6CvB;AAED,MAAM,CAAN,IAAY,wBAaX;AAbD,WAAY,wBAAwB;IAClC;;OAEG;IACH,+HAAoC,CAAA;IACpC;;OAEG;IACH,qIAAmC,CAAA;IACnC;;OAEG;IACH,iIAAiC,CAAA;AACnC,CAAC,EAbW,wBAAwB,KAAxB,wBAAwB,QAanC","sourcesContent":["export enum ATTRIBUTION_NETWORK {\n APPLE_SEARCH_ADS = 0,\n ADJUST = 1,\n APPSFLYER = 2,\n BRANCH = 3,\n TENJIN = 4,\n FACEBOOK = 5,\n}\n\nexport enum PURCHASE_TYPE {\n /**\n * A type of SKU for in-app products.\n */\n INAPP = \"inapp\",\n\n /**\n * A type of SKU for subscriptions.\n */\n SUBS = \"subs\",\n}\n\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport enum BILLING_FEATURE {\n /**\n * Purchase/query for subscriptions.\n */\n SUBSCRIPTIONS,\n\n /**\n * Subscriptions update/replace.\n */\n SUBSCRIPTIONS_UPDATE,\n\n /**\n * Purchase/query for in-app items on VR.\n */\n IN_APP_ITEMS_ON_VR,\n\n /**\n * Purchase/query for subscriptions on VR.\n */\n SUBSCRIPTIONS_ON_VR,\n\n /**\n * Launch a price change confirmation flow.\n */\n PRICE_CHANGE_CONFIRMATION,\n}\nexport enum PRORATION_MODE {\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n IMMEDIATE_WITHOUT_PRORATION = 3,\n\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n DEFERRED = 4,\n}\n\nexport enum PACKAGE_TYPE {\n /**\n * A package that was defined with a custom identifier.\n */\n UNKNOWN = \"UNKNOWN\",\n\n /**\n * A package that was defined with a custom identifier.\n */\n CUSTOM = \"CUSTOM\",\n\n /**\n * A package configured with the predefined lifetime identifier.\n */\n LIFETIME = \"LIFETIME\",\n\n /**\n * A package configured with the predefined annual identifier.\n */\n ANNUAL = \"ANNUAL\",\n\n /**\n * A package configured with the predefined six month identifier.\n */\n SIX_MONTH = \"SIX_MONTH\",\n\n /**\n * A package configured with the predefined three month identifier.\n */\n THREE_MONTH = \"THREE_MONTH\",\n\n /**\n * A package configured with the predefined two month identifier.\n */\n TWO_MONTH = \"TWO_MONTH\",\n\n /**\n * A package configured with the predefined monthly identifier.\n */\n MONTHLY = \"MONTHLY\",\n\n /**\n * A package configured with the predefined weekly identifier.\n */\n WEEKLY = \"WEEKLY\",\n}\n\nexport enum INTRO_ELIGIBILITY_STATUS {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_INELIGIBLE,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE,\n}\n\nexport interface Transaction {\n /**\n * RevenueCat Id associated to the transaction.\n */\n readonly transactionId: string;\n /**\n * Receipt data for validation (iOS only - base64 encoded receipt)\n */\n readonly receipt?: string;\n /**\n * Product Id associated with the transaction.\n */\n // readonly productIdentifier: string;\n /**\n * Purchase date of the transaction in ISO 8601 format.\n */\n // readonly purchaseDate: string;\n}\n\nexport interface SubscriptionPeriod {\n /**\n * The Subscription Period number of unit.\n */\n readonly numberOfUnits: number;\n /**\n * The Subscription Period unit.\n */\n readonly unit: number;\n}\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n */\n readonly type: number;\n /**\n * The Product discount price.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * The Product discount currency symbol.\n */\n readonly currencySymbol: string;\n /**\n * The Product discount currency code.\n */\n readonly currencyCode: string;\n /**\n * The Product discount paymentMode.\n */\n readonly paymentMode: number;\n /**\n * The Product discount number Of Periods.\n */\n readonly numberOfPeriods: number;\n /**\n * The Product discount subscription period.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n}\nexport interface Product {\n /**\n * Product Id.\n */\n readonly identifier: string;\n /**\n * Description of the product.\n */\n readonly description: string;\n /**\n * Title of the product.\n */\n readonly title: string;\n /**\n * Price of the product in the local currency.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * Currency code for price and original price.\n */\n readonly currencyCode: string;\n /**\n * Currency symbol for price and original price.\n */\n readonly currencySymbol: string;\n /**\n * Boolean indicating if the product is sharable with family\n */\n readonly isFamilyShareable: boolean;\n /**\n * Group identifier for the product.\n */\n readonly subscriptionGroupIdentifier: string;\n /**\n * The Product subcription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * The Product discounts list.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Restores a user's previous and links their appUserIDs to any user's also using those .\n */\n restorePurchases(): Promise<void>;\n\n /**\n * Started purchase process for the given product.\n *\n * @param options - The product to purchase\n * @param options.productIdentifier - The product identifier of the product you want to purchase.\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @param options.planIdentifier - Only Android, the identifier of the plan you want to purchase, require for for subs.\n * @param options.quantity - Only iOS, the number of items you wish to purchase. Will use 1 by default.\n * @param options.appAccountToken - Only iOS, UUID for the user's account. Used to link purchases to the user account for App Store Server Notifications.\n */\n purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n appAccountToken?: string;\n }): Promise<Transaction>;\n\n /**\n * Gets the product info associated with a list of product identifiers.\n *\n * @param options - The product identifiers you wish to retrieve information for\n * @param options.productIdentifiers - Array of product identifiers\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProducts(options: {\n productIdentifiers: string[];\n productType?: PURCHASE_TYPE;\n }): Promise<{ products: Product[] }>;\n\n /**\n * Gets the product info for a single product identifier.\n *\n * @param options - The product identifier you wish to retrieve information for\n * @param options.productIdentifier - The product identifier\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProduct(options: {\n productIdentifier: string;\n productType?: PURCHASE_TYPE;\n }): Promise<{ product: Product }>;\n\n /**\n * Check if billing is supported for the current device.\n *\n *\n */\n isBillingSupported(): Promise<{ isBillingSupported: boolean }>;\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n /**\n * Gets all the user's purchases (both in-app purchases and subscriptions).\n * This method queries the platform's purchase history for the current user.\n *\n * @param options - Optional parameters for filtering purchases\n * @param options.productType - Only Android, filter by product type (inapp or subs). If not specified, returns both types.\n * @returns {Promise<{ purchases: Transaction[] }>} Promise that resolves with array of user's purchases\n * @throws An error if the purchase query fails\n * @since 7.2.0\n */\n getPurchases(options?: {\n productType?: PURCHASE_TYPE;\n }): Promise<{ purchases: Transaction[] }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebPlugin } from "@capacitor/core";
|
|
2
|
-
import type { NativePurchasesPlugin, Product } from "./definitions";
|
|
2
|
+
import type { NativePurchasesPlugin, Product, PURCHASE_TYPE, Transaction } from "./definitions";
|
|
3
3
|
export declare class NativePurchasesWeb extends WebPlugin implements NativePurchasesPlugin {
|
|
4
4
|
restorePurchases(): Promise<void>;
|
|
5
5
|
getProducts(options: {
|
|
@@ -25,4 +25,9 @@ export declare class NativePurchasesWeb extends WebPlugin implements NativePurch
|
|
|
25
25
|
getPluginVersion(): Promise<{
|
|
26
26
|
version: string;
|
|
27
27
|
}>;
|
|
28
|
+
getPurchases(options?: {
|
|
29
|
+
productType?: PURCHASE_TYPE;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
purchases: Transaction[];
|
|
32
|
+
}>;
|
|
28
33
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -23,5 +23,9 @@ export class NativePurchasesWeb extends WebPlugin {
|
|
|
23
23
|
console.warn("Cannot get plugin version in web");
|
|
24
24
|
return { version: "default" };
|
|
25
25
|
}
|
|
26
|
+
async getPurchases(options) {
|
|
27
|
+
console.error("getPurchases only mocked in web " + options);
|
|
28
|
+
return { purchases: [] };
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
31
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,kBACX,SAAQ,SAAS;IAGjB,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAEjB;QACC,OAAO,CAAC,KAAK,CAAC,iCAAiC,GAAG,OAAO,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAEhB;QACC,OAAO,CAAC,KAAK,CAAC,gCAAgC,GAAG,OAAO,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,EAAS,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAIrB;QACC,OAAO,CAAC,KAAK,CAAC,oCAAoC,GAAG,OAAO,CAAC,CAAC;QAC9D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACvD,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACjD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC;IACD,KAAK,CAAC,YAAY,CAAC,OAElB;QACC,OAAO,CAAC,KAAK,CAAC,kCAAkC,GAAG,OAAO,CAAC,CAAC;QAC5D,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n NativePurchasesPlugin,\n Product,\n PURCHASE_TYPE,\n Transaction,\n} from \"./definitions\";\n\nexport class NativePurchasesWeb\n extends WebPlugin\n implements NativePurchasesPlugin\n{\n async restorePurchases(): Promise<void> {\n console.error(\"restorePurchases only mocked in web\");\n }\n\n async getProducts(options: {\n productIdentifiers: string[];\n }): Promise<{ products: Product[] }> {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n\n async getProduct(options: {\n productIdentifier: string;\n }): Promise<{ product: Product }> {\n console.error(\"getProduct only mocked in web \" + options);\n return { product: {} as any };\n }\n\n async purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier: string;\n quantity: number;\n }): Promise<{ transactionId: string }> {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { transactionId: \"transactionId\" };\n }\n\n async isBillingSupported(): Promise<{ isBillingSupported: boolean }> {\n console.error(\"isBillingSupported only mocked in web\");\n return { isBillingSupported: false };\n }\n async getPluginVersion(): Promise<{ version: string }> {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async getPurchases(options?: {\n productType?: PURCHASE_TYPE;\n }): Promise<{ purchases: Transaction[] }> {\n console.error(\"getPurchases only mocked in web \" + options);\n return { purchases: [] };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -158,6 +158,10 @@ class NativePurchasesWeb extends core.WebPlugin {
|
|
|
158
158
|
console.warn("Cannot get plugin version in web");
|
|
159
159
|
return { version: "default" };
|
|
160
160
|
}
|
|
161
|
+
async getPurchases(options) {
|
|
162
|
+
console.error("getPurchases only mocked in web " + options);
|
|
163
|
+
return { purchases: [] };
|
|
164
|
+
}
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst NativePurchases = registerPlugin(\"NativePurchases\", {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n});\nexport * from \"./definitions\";\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"restorePurchases only mocked in web\");\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error(\"getProduct only mocked in web \" + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { transactionId: \"transactionId\" };\n }\n async isBillingSupported() {\n console.error(\"isBillingSupported only mocked in web\");\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,mBAAmB,EAAE;AAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;AACzF,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AAQ,OAAO,CAAC,KAAK,CAAC,oCAAoC,GAAG,OAAO,CAAC;AACrE,QAAQ,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE;AACjD;AACA,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC;AAC9D,QAAQ,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE;AAC5C;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;AACxD,QAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AACrC;AACA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst NativePurchases = registerPlugin(\"NativePurchases\", {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n});\nexport * from \"./definitions\";\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"restorePurchases only mocked in web\");\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error(\"getProduct only mocked in web \" + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { transactionId: \"transactionId\" };\n }\n async isBillingSupported() {\n console.error(\"isBillingSupported only mocked in web\");\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async getPurchases(options) {\n console.error(\"getPurchases only mocked in web \" + options);\n return { purchases: [] };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_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;AAC/B;AACA,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,OAAO,CAAC,KAAK,CAAC,gCAAgC,GAAG,OAAO,CAAC;AACjE,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;AAC9B;AACA,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;AACnC,QAAQ,OAAO,CAAC,KAAK,CAAC,oCAAoC,GAAG,OAAO,CAAC;AACrE,QAAQ,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE;AACjD;AACA,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC;AAC9D,QAAQ,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE;AAC5C;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;AACxD,QAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AACrC;AACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;AAChC,QAAQ,OAAO,CAAC,KAAK,CAAC,kCAAkC,GAAG,OAAO,CAAC;AACnE,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;AAChC;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -157,6 +157,10 @@ var capacitorNativePurchases = (function (exports, core) {
|
|
|
157
157
|
console.warn("Cannot get plugin version in web");
|
|
158
158
|
return { version: "default" };
|
|
159
159
|
}
|
|
160
|
+
async getPurchases(options) {
|
|
161
|
+
console.error("getPurchases only mocked in web " + options);
|
|
162
|
+
return { purchases: [] };
|
|
163
|
+
}
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst NativePurchases = registerPlugin(\"NativePurchases\", {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n});\nexport * from \"./definitions\";\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"restorePurchases only mocked in web\");\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error(\"getProduct only mocked in web \" + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { transactionId: \"transactionId\" };\n }\n async isBillingSupported() {\n console.error(\"isBillingSupported only mocked in web\");\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,mBAAmB,EAAE;IAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;IACzF,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;IACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;IAC3E,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;IACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;IACrE,IAAI,m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AAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;IACrC;IACA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst NativePurchases = registerPlugin(\"NativePurchases\", {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n});\nexport * from \"./definitions\";\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"restorePurchases only mocked in web\");\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error(\"getProduct only mocked in web \" + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { transactionId: \"transactionId\" };\n }\n async isBillingSupported() {\n console.error(\"isBillingSupported only mocked in web\");\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async getPurchases(options) {\n console.error(\"getPurchases only mocked in web \" + options);\n return { purchases: [] };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,mBAAmB,EAAE;IAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;IACzF,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;IACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,C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,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC;IAC9D,QAAQ,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE;IAC5C;IACA,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;IACxD,QAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;IACrC;IACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;IAChC,QAAQ,OAAO,CAAC,KAAK,CAAC,kCAAkC,GAAG,OAAO,CAAC;IACnE,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;IAChC;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -16,7 +16,8 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
16
16
|
CAPPluginMethod(name: "restorePurchases", returnType: CAPPluginReturnPromise),
|
|
17
17
|
CAPPluginMethod(name: "getProducts", returnType: CAPPluginReturnPromise),
|
|
18
18
|
CAPPluginMethod(name: "getProduct", returnType: CAPPluginReturnPromise),
|
|
19
|
-
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
|
|
19
|
+
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise),
|
|
20
|
+
CAPPluginMethod(name: "getPurchases", returnType: CAPPluginReturnPromise)
|
|
20
21
|
]
|
|
21
22
|
|
|
22
23
|
private let PLUGIN_VERSION = "0.0.25"
|
|
@@ -188,4 +189,71 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
@objc func getPurchases(_ call: CAPPluginCall) {
|
|
193
|
+
if #available(iOS 15.0, *) {
|
|
194
|
+
print("getPurchases")
|
|
195
|
+
DispatchQueue.global().async {
|
|
196
|
+
Task {
|
|
197
|
+
do {
|
|
198
|
+
var allPurchases: [[String: Any]] = []
|
|
199
|
+
|
|
200
|
+
// Get all current entitlements (active subscriptions)
|
|
201
|
+
for await result in Transaction.currentEntitlements {
|
|
202
|
+
if case .verified(let transaction) = result {
|
|
203
|
+
var purchaseData: [String: Any] = ["transactionId": String(transaction.id)]
|
|
204
|
+
|
|
205
|
+
// Get receipt data
|
|
206
|
+
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
|
|
207
|
+
FileManager.default.fileExists(atPath: appStoreReceiptURL.path),
|
|
208
|
+
let receiptData = try? Data(contentsOf: appStoreReceiptURL) {
|
|
209
|
+
let receiptBase64 = receiptData.base64EncodedString()
|
|
210
|
+
purchaseData["receipt"] = receiptBase64
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
allPurchases.append(purchaseData)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Also get all transactions (including non-consumables and expired subscriptions)
|
|
218
|
+
for await result in Transaction.all {
|
|
219
|
+
if case .verified(let transaction) = result {
|
|
220
|
+
let transactionIdString = String(transaction.id)
|
|
221
|
+
|
|
222
|
+
// Check if we already have this transaction
|
|
223
|
+
let alreadyExists = allPurchases.contains { purchase in
|
|
224
|
+
if let existingId = purchase["transactionId"] as? String {
|
|
225
|
+
return existingId == transactionIdString
|
|
226
|
+
}
|
|
227
|
+
return false
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if !alreadyExists {
|
|
231
|
+
var purchaseData: [String: Any] = ["transactionId": transactionIdString]
|
|
232
|
+
|
|
233
|
+
// Get receipt data
|
|
234
|
+
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
|
|
235
|
+
FileManager.default.fileExists(atPath: appStoreReceiptURL.path),
|
|
236
|
+
let receiptData = try? Data(contentsOf: appStoreReceiptURL) {
|
|
237
|
+
let receiptBase64 = receiptData.base64EncodedString()
|
|
238
|
+
purchaseData["receipt"] = receiptBase64
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
allPurchases.append(purchaseData)
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
call.resolve(["purchases": allPurchases])
|
|
247
|
+
} catch {
|
|
248
|
+
print("getPurchases error: \(error)")
|
|
249
|
+
call.reject(error.localizedDescription)
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
print("Not implemented under iOS 15")
|
|
255
|
+
call.reject("Not implemented under iOS 15")
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
191
259
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/native-purchases",
|
|
3
|
-
"version": "7.1
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "In-app Subscriptions Made Easy",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@ionic/eslint-config": "^0.4.0",
|
|
53
53
|
"@ionic/prettier-config": "^4.0.0",
|
|
54
54
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
55
|
-
"@types/node": "^
|
|
55
|
+
"@types/node": "^24.0.0",
|
|
56
56
|
"eslint": "^8.57.0",
|
|
57
57
|
"eslint-plugin-import": "^2.31.0",
|
|
58
58
|
"husky": "^9.1.7",
|