@revenuecat/purchases-capacitor 6.0.0-beta.1 → 6.0.0-beta.2
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 +18 -0
- package/RevenueCatPurchasesCapacitor.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/revenuecat/purchases/capacitor/PurchasesPlugin.kt +10 -1
- package/dist/docs.json +21 -0
- package/dist/esm/definitions.d.ts +11 -2
- package/dist/esm/definitions.js +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +9 -1
- package/dist/esm/web.js +139 -56
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +141 -59
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +142 -60
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/PurchasesPlugin.m +1 -0
- package/ios/Plugin/PurchasesPlugin.swift +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -54,6 +54,7 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
|
|
|
54
54
|
<docgen-index>
|
|
55
55
|
|
|
56
56
|
* [`configure(...)`](#configure)
|
|
57
|
+
* [`setMockWebResults(...)`](#setmockwebresults)
|
|
57
58
|
* [`setFinishTransactions(...)`](#setfinishtransactions)
|
|
58
59
|
* [`setSimulatesAskToBuyInSandbox(...)`](#setsimulatesasktobuyinsandbox)
|
|
59
60
|
* [`addCustomerInfoUpdateListener(...)`](#addcustomerinfoupdatelistener)
|
|
@@ -131,6 +132,23 @@ Sets up Purchases with your API key and an app user id.
|
|
|
131
132
|
--------------------
|
|
132
133
|
|
|
133
134
|
|
|
135
|
+
### setMockWebResults(...)
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
setMockWebResults(options: { shouldMockWebResults: boolean; }) => Promise<void>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Sets whether the SDK should return mocked results in the web version.
|
|
142
|
+
This won't affect the iOS and Android versions of the implementation.
|
|
143
|
+
Default is false
|
|
144
|
+
|
|
145
|
+
| Param | Type | Description |
|
|
146
|
+
| ------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
147
|
+
| **`options`** | <code>{ shouldMockWebResults: boolean; }</code> | Set shouldMockWebResults to true if you want the plugin methods to return mocked values |
|
|
148
|
+
|
|
149
|
+
--------------------
|
|
150
|
+
|
|
151
|
+
|
|
134
152
|
### setFinishTransactions(...)
|
|
135
153
|
|
|
136
154
|
```typescript
|
|
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'PurchasesHybridCommon', '6.1.
|
|
16
|
+
s.dependency 'PurchasesHybridCommon', '6.1.2'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/android/build.gradle
CHANGED
|
@@ -53,7 +53,7 @@ dependencies {
|
|
|
53
53
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
54
54
|
implementation project(':capacitor-android')
|
|
55
55
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
56
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:6.1.
|
|
56
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:6.1.2'
|
|
57
57
|
testImplementation "junit:junit:$junitVersion"
|
|
58
58
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
59
59
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -70,7 +70,7 @@ class PurchasesPlugin : Plugin() {
|
|
|
70
70
|
|
|
71
71
|
companion object {
|
|
72
72
|
private const val PLATFORM_NAME = "capacitor"
|
|
73
|
-
private const val PLUGIN_VERSION = "6.0.0-beta.
|
|
73
|
+
private const val PLUGIN_VERSION = "6.0.0-beta.2"
|
|
74
74
|
|
|
75
75
|
private const val CUSTOMER_INFO_KEY = "customerInfo"
|
|
76
76
|
}
|
|
@@ -99,6 +99,15 @@ class PurchasesPlugin : Plugin() {
|
|
|
99
99
|
call.resolve()
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
103
|
+
fun setMockWebResults(call: PluginCall) {
|
|
104
|
+
Log.e(
|
|
105
|
+
"PurchasesCapacitor",
|
|
106
|
+
"Cannot enable mock web results in Android."
|
|
107
|
+
)
|
|
108
|
+
call.resolve()
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
103
112
|
fun setFinishTransactions(call: PluginCall) {
|
|
104
113
|
if (rejectIfNotConfigured(call)) return
|
package/dist/docs.json
CHANGED
|
@@ -28,6 +28,27 @@
|
|
|
28
28
|
],
|
|
29
29
|
"slug": "configure"
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
"name": "setMockWebResults",
|
|
33
|
+
"signature": "(options: { shouldMockWebResults: boolean; }) => Promise<void>",
|
|
34
|
+
"parameters": [
|
|
35
|
+
{
|
|
36
|
+
"name": "options",
|
|
37
|
+
"docs": "Set shouldMockWebResults to true if you want the plugin methods to return mocked values",
|
|
38
|
+
"type": "{ shouldMockWebResults: boolean; }"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"returns": "Promise<void>",
|
|
42
|
+
"tags": [
|
|
43
|
+
{
|
|
44
|
+
"name": "param",
|
|
45
|
+
"text": "options Set shouldMockWebResults to true if you want the plugin methods to return mocked values"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"docs": "Sets whether the SDK should return mocked results in the web version.\nThis won't affect the iOS and Android versions of the implementation.\nDefault is false",
|
|
49
|
+
"complexTypes": [],
|
|
50
|
+
"slug": "setmockwebresults"
|
|
51
|
+
},
|
|
31
52
|
{
|
|
32
53
|
"name": "setFinishTransactions",
|
|
33
54
|
"signature": "(options: { finishTransactions: boolean; }) => Promise<void>",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CustomerInfo, CustomerInfoUpdateListener, GoogleProductChangeInfo, IntroEligibility, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOfferings, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreProductDiscount, SubscriptionOption, BILLING_FEATURE, LOG_LEVEL, PRODUCT_CATEGORY, REFUND_REQUEST_STATUS } from '@revenuecat/purchases-typescript-internal';
|
|
2
|
-
export * from '@revenuecat/purchases-typescript-internal';
|
|
1
|
+
import type { CustomerInfo, CustomerInfoUpdateListener, GoogleProductChangeInfo, IntroEligibility, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOfferings, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreProductDiscount, SubscriptionOption, BILLING_FEATURE, LOG_LEVEL, PRODUCT_CATEGORY, REFUND_REQUEST_STATUS } from '@revenuecat/purchases-typescript-internal-esm';
|
|
2
|
+
export * from '@revenuecat/purchases-typescript-internal-esm';
|
|
3
3
|
export declare type PurchasesCallbackId = string;
|
|
4
4
|
export interface GetProductOptions {
|
|
5
5
|
/**
|
|
@@ -120,6 +120,15 @@ export interface PurchasesPlugin {
|
|
|
120
120
|
* @param {PurchasesConfiguration} configuration RevenueCat configuration object including the API key and other optional parameters. See {@link PurchasesConfiguration}
|
|
121
121
|
*/
|
|
122
122
|
configure(configuration: PurchasesConfiguration): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Sets whether the SDK should return mocked results in the web version.
|
|
125
|
+
* This won't affect the iOS and Android versions of the implementation.
|
|
126
|
+
* Default is false
|
|
127
|
+
* @param options Set shouldMockWebResults to true if you want the plugin methods to return mocked values
|
|
128
|
+
*/
|
|
129
|
+
setMockWebResults(options: {
|
|
130
|
+
shouldMockWebResults: boolean;
|
|
131
|
+
}): Promise<void>;
|
|
123
132
|
/**
|
|
124
133
|
* @param options Set finishTransactions to false if you aren't using Purchases SDK to
|
|
125
134
|
* make the purchase
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '@revenuecat/purchases-typescript-internal';
|
|
1
|
+
export * from '@revenuecat/purchases-typescript-internal-esm';
|
|
2
2
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsBA,cAAc,2CAA2C,CAAC","sourcesContent":["import type {\n CustomerInfo,\n CustomerInfoUpdateListener,\n GoogleProductChangeInfo,\n IntroEligibility,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOfferings,\n PurchasesPackage,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreProductDiscount,\n SubscriptionOption,\n BILLING_FEATURE,\n LOG_LEVEL,\n PRODUCT_CATEGORY,\n REFUND_REQUEST_STATUS,\n} from '@revenuecat/purchases-typescript-internal';\n\nexport * from '@revenuecat/purchases-typescript-internal';\n\nexport type PurchasesCallbackId = string;\n\nexport interface GetProductOptions {\n /**\n * Array of product identifiers to obtain\n */\n productIdentifiers: string[];\n /**\n * Optional type of products to fetch, can be SUBSCRIPTION or NON_SUBSCRIPTION. SUBSCRIPTION by default. Ignored in iOS.\n */\n type?: PRODUCT_CATEGORY;\n}\n\nexport interface PurchaseStoreProductOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedProductOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface PurchasePackageOptions {\n /**\n * The Package you wish to purchase. You can get the Packages by calling getOfferings\n */\n aPackage: PurchasesPackage;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseSubscriptionOptionOptions {\n /**\n * The SubscriptionOption you wish to purchase. You can get the SubscriptionOption from StoreProducts by calling getOfferings\n */\n subscriptionOption: SubscriptionOption;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedPackageOptions {\n /**\n * The Package you wish to purchase. You can get the Packages by calling getOfferings\n */\n aPackage: PurchasesPackage;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface SyncObserverModeAmazonPurchaseOptions {\n /**\n * Product ID associated to the purchase.\n */\n productID: string;\n /**\n * ReceiptId that represents the Amazon purchase.\n */\n receiptID: string;\n /**\n * Amazon's userID. This parameter will be ignored when syncing a Google purchase.\n */\n amazonUserID: string;\n /**\n * Product's currency code in ISO 4217 format.\n */\n isoCurrencyCode?: string | null;\n /**\n * Product's price.\n */\n price?: number | null;\n}\n\nexport interface GetPromotionalOfferOptions {\n /**\n * The `PurchasesStoreProduct` the user intends to purchase.\n */\n product: PurchasesStoreProduct;\n /**\n * The `PurchasesStoreProductDiscount` to apply to the product.\n */\n discount: PurchasesStoreProductDiscount;\n}\n\nexport interface PurchasesPlugin {\n /**\n * Sets up Purchases with your API key and an app user id.\n * @param {PurchasesConfiguration} configuration RevenueCat configuration object including the API key and other optional parameters. See {@link PurchasesConfiguration}\n */\n configure(configuration: PurchasesConfiguration): Promise<void>;\n\n /**\n * @param options Set finishTransactions to false if you aren't using Purchases SDK to\n * make the purchase\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n setFinishTransactions(options: {\n finishTransactions: boolean;\n }): Promise<void>;\n\n /**\n * iOS only.\n * @param options Set this property to true *only* when testing the ask-to-buy / SCA\n * purchases flow. More information: http://errors.rev.cat/ask-to-buy\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n setSimulatesAskToBuyInSandbox(options: {\n simulatesAskToBuyInSandbox: boolean;\n }): Promise<void>;\n\n /**\n * Sets a function to be called on updated customer info\n * @param {CustomerInfoUpdateListener} customerInfoUpdateListener CustomerInfo update listener\n */\n addCustomerInfoUpdateListener(\n customerInfoUpdateListener: CustomerInfoUpdateListener,\n ): Promise<PurchasesCallbackId>;\n\n /**\n * Removes a given CustomerInfoUpdateListener\n * @param {CustomerInfoUpdateListener} listenerToRemove CustomerInfoUpdateListener reference of the listener to remove\n * @returns Promise with boolean. True if listener was removed, false otherwise\n */\n removeCustomerInfoUpdateListener(\n listenerToRemove: PurchasesCallbackId,\n ): Promise<{ wasRemoved: boolean }>;\n\n // TODO: Support addShouldPurchasePromoProductListener functionality\n // /**\n // * Sets a function to be called on purchases initiated on the Apple App Store. This is only used in iOS.\n // * @param {ShouldPurchasePromoProductListener} shouldPurchasePromoProductListener Called when a user initiates a\n // * promotional in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run\n // * the deferredPurchase function. If the app is not in a state to make a purchase: cache the deferredPurchase, then\n // * call the deferredPurchase when the app is ready to make the promotional purchase.\n // * If the purchase should never be made, you don't need to ever call the deferredPurchase and the app will not\n // * proceed with promotional purchases.\n // */\n // addShouldPurchasePromoProductListener(\n // shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener,\n // ): Promise<PurchasesCallbackId>;\n //\n // /**\n // * Removes a given ShouldPurchasePromoProductListener\n // * @param {ShouldPurchasePromoProductListener} listenerToRemove ShouldPurchasePromoProductListener reference of\n // * the listener to remove\n // * @returns Promise with boolean. True if listener was removed, false otherwise\n // */\n // removeShouldPurchasePromoProductListener(\n // listenerToRemove: PurchasesCallbackId,\n // ): Promise<{ wasRemoved: boolean }>;\n\n /**\n * Gets the map of entitlements -> offerings -> products\n * @returns {Promise<PurchasesOfferings>} Promise of entitlements structure. The promise will be rejected if configure\n * has not been called yet.\n */\n getOfferings(): Promise<PurchasesOfferings>;\n\n /**\n * Fetch the product info\n * @returns {Promise<PurchasesStoreProduct[]>} A promise containing an array of products. The promise will be rejected\n * if the products are not properly configured in RevenueCat or if there is another error retrieving them.\n * Rejections return an error code, and a userInfo object with more information. The promise will also be rejected\n * if configure has not been called yet.\n */\n getProducts(\n options: GetProductOptions,\n ): Promise<{ products: PurchasesStoreProduct[] }>;\n\n /**\n * Make a purchase\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code,\n * a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will\n * also be rejected if configure has not been called yet.\n */\n purchaseStoreProduct(\n options: PurchaseStoreProductOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * iOS only. Purchase a product applying a given discount.\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code,\n * a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be\n * rejected if configure has not been called yet.\n */\n purchaseDiscountedProduct(\n options: PurchaseDiscountedProductOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * Make a purchase\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the\n * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\n * has not been called yet.\n */\n purchasePackage(options: PurchasePackageOptions): Promise<MakePurchaseResult>;\n\n /**\n * Google only. Make a purchase of a subscriptionOption\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the\n * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\n * has not been called yet.\n */\n purchaseSubscriptionOption(\n options: PurchaseSubscriptionOptionOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * iOS only. Purchase a package applying a given discount.\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the\n * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\n * has not been called yet.\n */\n purchaseDiscountedPackage(\n options: PurchaseDiscountedPackageOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.\n * @returns {Promise<{ customerInfo: CustomerInfo }>} A promise of a customer info object. Rejections return an error code, and an\n * userInfo object with more information. The promise will be also be rejected if configure has not been called yet.\n */\n restorePurchases(): Promise<{ customerInfo: CustomerInfo }>;\n\n /**\n * Get the appUserID\n * @returns {Promise<string>} The app user id in a promise\n */\n getAppUserID(): Promise<{ appUserID: string }>;\n\n /**\n * This function will log in the current user with an appUserID. Typically, this would be used after a log in\n * to identify a user without calling configure.\n * @param options The appUserID that should be linked to the current user\n * @returns {Promise<LogInResult>} A promise of an object that contains the customerInfo after logging in, as well\n * as a boolean indicating whether the user has just been created for the first time in the RevenueCat backend. The\n * promise will be rejected if configure has not been called yet or if there's an issue logging in.\n */\n logIn(options: { appUserID: string }): Promise<LogInResult>;\n\n /**\n * Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.\n * @returns {Promise<{ customerInfo: CustomerInfo }>} A promise of a customer info object. Rejections return an error code,\n * and a userInfo object with more information. The promise will be rejected if configure has not been called yet or if\n * there's an issue logging out.\n */\n logOut(): Promise<{ customerInfo: CustomerInfo }>;\n\n /**\n * Used to set the log level. Useful for debugging issues with the lovely team @RevenueCat.\n * The default is {LOG_LEVEL.INFO} in release builds and {LOG_LEVEL.DEBUG} in debug builds.\n * @param options Log level to use to display logs.\n */\n setLogLevel(options: { level: LOG_LEVEL }): Promise<void>;\n\n /**\n * Set a custom log handler for redirecting logs to your own logging system.\n * By default, this sends info, warning, and error messages.\n * If you wish to receive Debug level messages, see [setLogLevel].\n * @param {LogHandler} logHandler It will get called for each log event.\n * Use this function to redirect the log to your own logging system\n */\n setLogHandler(logHandler: LogHandler): Promise<void>;\n\n /**\n * Gets current customer info\n * @returns {Promise<{ customerInfo: CustomerInfo }>} A promise of a customer info object. Rejections return an error code, and an\n * userInfo object with more information. The promise will be rejected if configure has not been called yet or if\n * there's an issue getting the customer information.\n */\n getCustomerInfo(): Promise<{ customerInfo: CustomerInfo }>;\n\n /**\n * This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation\n * for subscriptions anytime a sync is needed, like after a successful purchase.\n *\n * @warning This function should only be called if you're not calling purchaseProduct/purchaseStoreProduct/purchasePackage/purchaseSubscriptionOption.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * syncing purchases.\n */\n syncPurchases(): Promise<void>;\n\n /**\n * This method will send a purchase to the RevenueCat backend. This function should only be called if you are\n * in Amazon observer mode or performing a client side migration of your current users to RevenueCat.\n *\n * The receipt IDs are cached if successfully posted, so they are not posted more than once.\n *\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * syncing purchases.\n */\n syncObserverModeAmazonPurchase(\n options: SyncObserverModeAmazonPurchaseOptions,\n ): Promise<void>;\n\n /**\n * Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default. Supported in iOS 14.3+ only\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n enableAdServicesAttributionTokenCollection(): Promise<void>;\n\n /**\n * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.\n * The promise will be rejected if configure has not been called yet.\n */\n isAnonymous(): Promise<{ isAnonymous: boolean }>;\n\n /**\n * iOS only. Computes whether a user is eligible for the introductory pricing period of a given product.\n * You should use this method to determine whether you show the user the normal product price or the\n * introductory price. This also applies to trials (trials are considered a type of introductory pricing).\n *\n * @note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't\n * definitively compute the eligibility, most likely because of missing group information, it will return\n * `INTRO_ELIGIBILITY_STATUS_UNKNOWN`. The best course of action on unknown status is to display the non-intro\n * pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of\n * iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN.\n *\n * @param options Array of product identifiers for which you want to compute eligibility\n * @returns { Promise<[productId: string]: IntroEligibility> } A map of IntroEligility per productId. The promise\n * will be rejected if configure has not been called yet or if there's in an error checking eligibility.\n */\n checkTrialOrIntroductoryPriceEligibility(options: {\n productIdentifiers: string[];\n }): Promise<{ [productId: string]: IntroEligibility }>;\n\n /**\n * iOS only. Use this function to retrieve the `PurchasesPromotionalOffer` for a given `PurchasesPackage`.\n *\n * @returns { Promise<PurchasesPromotionalOffer | undefined> } Returns when the `PurchasesPaymentDiscount` is returned.\n * Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been\n * called yet or if there's an error getting the payment discount.\n */\n getPromotionalOffer(\n options: GetPromotionalOfferOptions,\n ): Promise<PurchasesPromotionalOffer | undefined>;\n\n /**\n * Invalidates the cache for customer information.\n *\n * Most apps will not need to use this method; invalidating the cache can leave your app in an invalid state.\n * Refer to https://docs.revenuecat.com/docs/customer-info#section-get-user-information for more information on\n * using the cache properly.\n *\n * This is useful for cases where customer information might have been updated outside the app, like if a\n * promotional subscription is granted through the RevenueCat dashboard.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error\n * invalidating the customer info cache.\n */\n invalidateCustomerInfoCache(): Promise<void>;\n\n /** iOS 14.0+ only. Presents a code redemption sheet, useful for redeeming offer codes\n * Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how\n * to configure and use offer codes\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error\n * presenting the code redemption sheet.\n */\n presentCodeRedemptionSheet(): Promise<void>;\n\n /**\n * Subscriber attributes are useful for storing additional, structured information on a user.\n * Since attributes are writable using a public key they should not be used for\n * managing secure or sensitive information such as subscription status, coins, etc.\n *\n * Key names starting with \"$\" are reserved names used by RevenueCat. For a full list of key\n * restrictions refer to our guide: https://docs.revenuecat.com/docs/subscriber-attributes\n *\n * @param attributes Map of attributes by key. Set the value as an empty string to delete an attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error\n * setting the subscriber attributes.\n */\n setAttributes(attributes: { [key: string]: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the email address for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the email.\n */\n setEmail(options: { email: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the phone number for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the phone number.\n */\n setPhoneNumber(options: { phoneNumber: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the display name for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the display name.\n */\n setDisplayName(options: { displayName: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the push token for the user\n *\n * @param options null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the push token.\n */\n setPushToken(options: { pushToken: string | null }): Promise<void>;\n\n /**\n * Set this property to your proxy URL before configuring Purchases *only* if you've received a proxy key value\n * from your RevenueCat contact.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the proxy url.\n */\n setProxyURL(options: { url: string }): Promise<void>;\n\n /**\n * Automatically collect subscriber attributes associated with the device identifiers.\n * $idfa, $idfv, $ip on iOS\n * $gpsAdId, $androidId, $ip on Android\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting collecting the device identifiers.\n */\n collectDeviceIdentifiers(): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Adjust ID for the user\n * Required for the RevenueCat Adjust integration\n *\n * @param options Adjust ID to use in Adjust integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting Adjust ID.\n */\n setAdjustID(options: { adjustID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the AppsFlyer ID for the user\n * Required for the RevenueCat AppsFlyer integration\n * @param options Appsflyer ID to use in Appsflyer integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Appsflyer ID.\n */\n setAppsflyerID(options: { appsflyerID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Facebook SDK Anonymous ID for the user\n * Recommended for the RevenueCat Facebook integration\n *\n * @param options Facebook Anonymous ID to use in Mparticle integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Facebook Anonymous ID.\n */\n setFBAnonymousID(options: { fbAnonymousID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the mParticle ID for the user\n * Recommended for the RevenueCat mParticle integration\n *\n * @param options Mparticle ID to use in Mparticle integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Mparticle ID.\n */\n setMparticleID(options: { mparticleID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the CleverTap ID for the user\n * Required for the RevenueCat CleverTap integration\n *\n * @param options CleverTap user ID to use in CleverTap integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the CleverTap ID.\n */\n setCleverTapID(options: { cleverTapID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Mixpanel Distinct ID for the user\n * Required for the RevenueCat Mixpanel integration\n *\n * @param options Mixpanel Distinct ID to use in Mixpanel integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Mixpanel Distinct ID.\n */\n setMixpanelDistinctID(options: {\n mixpanelDistinctID: string | null;\n }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Firebase App Instance ID for the user\n * Required for the RevenueCat Firebase integration\n *\n * @param options Firebase App Instance ID to use in Firebase integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Firebase App Instance ID.\n */\n setFirebaseAppInstanceID(options: {\n firebaseAppInstanceID: string | null;\n }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the OneSignal Player ID for the user\n * Required for the RevenueCat OneSignal integration\n *\n * @param options OneSignal Player ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the OneSignal ID.\n */\n setOnesignalID(options: { onesignalID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Airship Channel ID for the user\n * Required for the RevenueCat Airship integration\n *\n * @param options Airship Channel ID to use in Airship integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Airship Channel ID.\n */\n setAirshipChannelID(options: {\n airshipChannelID: string | null;\n }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install media source for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the media source.\n */\n setMediaSource(options: { mediaSource: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install campaign for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the campaign.\n */\n setCampaign(options: { campaign: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install ad group for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting ad group.\n */\n setAdGroup(options: { adGroup: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install ad for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the ad subscriber attribute.\n */\n setAd(options: { ad: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install keyword for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the keyword.\n */\n setKeyword(options: { keyword: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install ad creative for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the creative subscriber attribute.\n */\n setCreative(options: { creative: string | null }): Promise<void>;\n\n /**\n * Check if billing is supported for the current user (meaning IN-APP purchases are supported)\n * and optionally, whether a list of specified feature types are supported.\n *\n * Note: Billing features are only relevant to Google Play Android users.\n * For other stores and platforms, billing features won't be checked.\n *\n * @param options An array of feature types to check for support. Feature types must be one of\n * [BILLING_FEATURE]. By default, is an empty list and no specific feature support will be checked.\n * @returns promise with boolean response. True if billing is supported, false otherwise.\n */\n canMakePayments(options?: {\n features?: BILLING_FEATURE[];\n }): Promise<{ canMakePayments: boolean }>;\n\n /**\n * iOS 15+ only. Presents a refund request sheet in the current window scene for\n * the latest transaction associated with the active entitlement.\n *\n * If the request was unsuccessful, no active entitlements could be found for\n * the user, or multiple active entitlements were found for the user,\n * the promise will return an error.\n * If called in an unsupported platform (Android or iOS < 15), an `UnsupportedPlatformException` will be thrown.\n *\n * Important: This method should only be used if your user can only have a single active entitlement at a given time.\n * If a user could have more than one entitlement at a time, use `beginRefundRequestForEntitlement` instead.\n *\n * @returns Returns refundRequestStatus: The status of the\n * refund request. Keep in mind the status could be REFUND_REQUEST_STATUS.USER_CANCELLED\n */\n beginRefundRequestForActiveEntitlement(): Promise<{\n refundRequestStatus: REFUND_REQUEST_STATUS;\n }>;\n\n /**\n * iOS 15+ only. Presents a refund request sheet in the current window scene for\n * the latest transaction associated with the `entitlement`.\n *\n * If the request was unsuccessful, the promise will return an error.\n * If called in an unsupported platform (Android or iOS < 15), an `UnsupportedPlatformException` will be thrown.\n *\n * @param options The entitlement to begin a refund request for.\n * @returns Returns refundRequestStatus: The status of the\n * refund request. Keep in mind the status could be REFUND_REQUEST_STATUS.USER_CANCELLED\n */\n beginRefundRequestForEntitlement(options: {\n entitlementInfo: PurchasesEntitlementInfo;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }>;\n\n /**\n * iOS 15+ only. Presents a refund request sheet in the current window scene for\n * the latest transaction associated with the `product`.\n *\n * If the request was unsuccessful, the promise will return an error.\n * If called in an unsupported platform (Android or iOS < 15), an `UnsupportedPlatformException` will be thrown.\n *\n * @param options The StoreProduct to begin a refund request for.\n * @returns {Promise<REFUND_REQUEST_STATUS>} Returns a REFUND_REQUEST_STATUS: The status of the\n * refund request. Keep in mind the status could be REFUND_REQUEST_STATUS.USER_CANCELLED\n */\n beginRefundRequestForProduct(options: {\n storeProduct: PurchasesStoreProduct;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }>;\n\n /**\n * Check if configure has finished and Purchases has been configured.\n *\n * @returns promise with boolean response\n */\n isConfigured(): Promise<{ isConfigured: boolean }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsBA,cAAc,+CAA+C,CAAC","sourcesContent":["import type {\n CustomerInfo,\n CustomerInfoUpdateListener,\n GoogleProductChangeInfo,\n IntroEligibility,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOfferings,\n PurchasesPackage,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreProductDiscount,\n SubscriptionOption,\n BILLING_FEATURE,\n LOG_LEVEL,\n PRODUCT_CATEGORY,\n REFUND_REQUEST_STATUS,\n} from '@revenuecat/purchases-typescript-internal-esm';\n\nexport * from '@revenuecat/purchases-typescript-internal-esm';\n\nexport type PurchasesCallbackId = string;\n\nexport interface GetProductOptions {\n /**\n * Array of product identifiers to obtain\n */\n productIdentifiers: string[];\n /**\n * Optional type of products to fetch, can be SUBSCRIPTION or NON_SUBSCRIPTION. SUBSCRIPTION by default. Ignored in iOS.\n */\n type?: PRODUCT_CATEGORY;\n}\n\nexport interface PurchaseStoreProductOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedProductOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface PurchasePackageOptions {\n /**\n * The Package you wish to purchase. You can get the Packages by calling getOfferings\n */\n aPackage: PurchasesPackage;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseSubscriptionOptionOptions {\n /**\n * The SubscriptionOption you wish to purchase. You can get the SubscriptionOption from StoreProducts by calling getOfferings\n */\n subscriptionOption: SubscriptionOption;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedPackageOptions {\n /**\n * The Package you wish to purchase. You can get the Packages by calling getOfferings\n */\n aPackage: PurchasesPackage;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface SyncObserverModeAmazonPurchaseOptions {\n /**\n * Product ID associated to the purchase.\n */\n productID: string;\n /**\n * ReceiptId that represents the Amazon purchase.\n */\n receiptID: string;\n /**\n * Amazon's userID. This parameter will be ignored when syncing a Google purchase.\n */\n amazonUserID: string;\n /**\n * Product's currency code in ISO 4217 format.\n */\n isoCurrencyCode?: string | null;\n /**\n * Product's price.\n */\n price?: number | null;\n}\n\nexport interface GetPromotionalOfferOptions {\n /**\n * The `PurchasesStoreProduct` the user intends to purchase.\n */\n product: PurchasesStoreProduct;\n /**\n * The `PurchasesStoreProductDiscount` to apply to the product.\n */\n discount: PurchasesStoreProductDiscount;\n}\n\nexport interface PurchasesPlugin {\n /**\n * Sets up Purchases with your API key and an app user id.\n * @param {PurchasesConfiguration} configuration RevenueCat configuration object including the API key and other optional parameters. See {@link PurchasesConfiguration}\n */\n configure(configuration: PurchasesConfiguration): Promise<void>;\n\n /**\n * Sets whether the SDK should return mocked results in the web version.\n * This won't affect the iOS and Android versions of the implementation.\n * Default is false\n * @param options Set shouldMockWebResults to true if you want the plugin methods to return mocked values\n */\n setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void>;\n\n /**\n * @param options Set finishTransactions to false if you aren't using Purchases SDK to\n * make the purchase\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n setFinishTransactions(options: {\n finishTransactions: boolean;\n }): Promise<void>;\n\n /**\n * iOS only.\n * @param options Set this property to true *only* when testing the ask-to-buy / SCA\n * purchases flow. More information: http://errors.rev.cat/ask-to-buy\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n setSimulatesAskToBuyInSandbox(options: {\n simulatesAskToBuyInSandbox: boolean;\n }): Promise<void>;\n\n /**\n * Sets a function to be called on updated customer info\n * @param {CustomerInfoUpdateListener} customerInfoUpdateListener CustomerInfo update listener\n */\n addCustomerInfoUpdateListener(\n customerInfoUpdateListener: CustomerInfoUpdateListener,\n ): Promise<PurchasesCallbackId>;\n\n /**\n * Removes a given CustomerInfoUpdateListener\n * @param {CustomerInfoUpdateListener} listenerToRemove CustomerInfoUpdateListener reference of the listener to remove\n * @returns Promise with boolean. True if listener was removed, false otherwise\n */\n removeCustomerInfoUpdateListener(\n listenerToRemove: PurchasesCallbackId,\n ): Promise<{ wasRemoved: boolean }>;\n\n // TODO: Support addShouldPurchasePromoProductListener functionality\n // /**\n // * Sets a function to be called on purchases initiated on the Apple App Store. This is only used in iOS.\n // * @param {ShouldPurchasePromoProductListener} shouldPurchasePromoProductListener Called when a user initiates a\n // * promotional in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run\n // * the deferredPurchase function. If the app is not in a state to make a purchase: cache the deferredPurchase, then\n // * call the deferredPurchase when the app is ready to make the promotional purchase.\n // * If the purchase should never be made, you don't need to ever call the deferredPurchase and the app will not\n // * proceed with promotional purchases.\n // */\n // addShouldPurchasePromoProductListener(\n // shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener,\n // ): Promise<PurchasesCallbackId>;\n //\n // /**\n // * Removes a given ShouldPurchasePromoProductListener\n // * @param {ShouldPurchasePromoProductListener} listenerToRemove ShouldPurchasePromoProductListener reference of\n // * the listener to remove\n // * @returns Promise with boolean. True if listener was removed, false otherwise\n // */\n // removeShouldPurchasePromoProductListener(\n // listenerToRemove: PurchasesCallbackId,\n // ): Promise<{ wasRemoved: boolean }>;\n\n /**\n * Gets the map of entitlements -> offerings -> products\n * @returns {Promise<PurchasesOfferings>} Promise of entitlements structure. The promise will be rejected if configure\n * has not been called yet.\n */\n getOfferings(): Promise<PurchasesOfferings>;\n\n /**\n * Fetch the product info\n * @returns {Promise<PurchasesStoreProduct[]>} A promise containing an array of products. The promise will be rejected\n * if the products are not properly configured in RevenueCat or if there is another error retrieving them.\n * Rejections return an error code, and a userInfo object with more information. The promise will also be rejected\n * if configure has not been called yet.\n */\n getProducts(\n options: GetProductOptions,\n ): Promise<{ products: PurchasesStoreProduct[] }>;\n\n /**\n * Make a purchase\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code,\n * a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will\n * also be rejected if configure has not been called yet.\n */\n purchaseStoreProduct(\n options: PurchaseStoreProductOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * iOS only. Purchase a product applying a given discount.\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code,\n * a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be\n * rejected if configure has not been called yet.\n */\n purchaseDiscountedProduct(\n options: PurchaseDiscountedProductOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * Make a purchase\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the\n * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\n * has not been called yet.\n */\n purchasePackage(options: PurchasePackageOptions): Promise<MakePurchaseResult>;\n\n /**\n * Google only. Make a purchase of a subscriptionOption\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the\n * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\n * has not been called yet.\n */\n purchaseSubscriptionOption(\n options: PurchaseSubscriptionOptionOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * iOS only. Purchase a package applying a given discount.\n *\n * @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing\n * a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the\n * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\n * has not been called yet.\n */\n purchaseDiscountedPackage(\n options: PurchaseDiscountedPackageOptions,\n ): Promise<MakePurchaseResult>;\n\n /**\n * Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.\n * @returns {Promise<{ customerInfo: CustomerInfo }>} A promise of a customer info object. Rejections return an error code, and an\n * userInfo object with more information. The promise will be also be rejected if configure has not been called yet.\n */\n restorePurchases(): Promise<{ customerInfo: CustomerInfo }>;\n\n /**\n * Get the appUserID\n * @returns {Promise<string>} The app user id in a promise\n */\n getAppUserID(): Promise<{ appUserID: string }>;\n\n /**\n * This function will log in the current user with an appUserID. Typically, this would be used after a log in\n * to identify a user without calling configure.\n * @param options The appUserID that should be linked to the current user\n * @returns {Promise<LogInResult>} A promise of an object that contains the customerInfo after logging in, as well\n * as a boolean indicating whether the user has just been created for the first time in the RevenueCat backend. The\n * promise will be rejected if configure has not been called yet or if there's an issue logging in.\n */\n logIn(options: { appUserID: string }): Promise<LogInResult>;\n\n /**\n * Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.\n * @returns {Promise<{ customerInfo: CustomerInfo }>} A promise of a customer info object. Rejections return an error code,\n * and a userInfo object with more information. The promise will be rejected if configure has not been called yet or if\n * there's an issue logging out.\n */\n logOut(): Promise<{ customerInfo: CustomerInfo }>;\n\n /**\n * Used to set the log level. Useful for debugging issues with the lovely team @RevenueCat.\n * The default is {LOG_LEVEL.INFO} in release builds and {LOG_LEVEL.DEBUG} in debug builds.\n * @param options Log level to use to display logs.\n */\n setLogLevel(options: { level: LOG_LEVEL }): Promise<void>;\n\n /**\n * Set a custom log handler for redirecting logs to your own logging system.\n * By default, this sends info, warning, and error messages.\n * If you wish to receive Debug level messages, see [setLogLevel].\n * @param {LogHandler} logHandler It will get called for each log event.\n * Use this function to redirect the log to your own logging system\n */\n setLogHandler(logHandler: LogHandler): Promise<void>;\n\n /**\n * Gets current customer info\n * @returns {Promise<{ customerInfo: CustomerInfo }>} A promise of a customer info object. Rejections return an error code, and an\n * userInfo object with more information. The promise will be rejected if configure has not been called yet or if\n * there's an issue getting the customer information.\n */\n getCustomerInfo(): Promise<{ customerInfo: CustomerInfo }>;\n\n /**\n * This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation\n * for subscriptions anytime a sync is needed, like after a successful purchase.\n *\n * @warning This function should only be called if you're not calling purchaseProduct/purchaseStoreProduct/purchasePackage/purchaseSubscriptionOption.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * syncing purchases.\n */\n syncPurchases(): Promise<void>;\n\n /**\n * This method will send a purchase to the RevenueCat backend. This function should only be called if you are\n * in Amazon observer mode or performing a client side migration of your current users to RevenueCat.\n *\n * The receipt IDs are cached if successfully posted, so they are not posted more than once.\n *\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * syncing purchases.\n */\n syncObserverModeAmazonPurchase(\n options: SyncObserverModeAmazonPurchaseOptions,\n ): Promise<void>;\n\n /**\n * Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default. Supported in iOS 14.3+ only\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n enableAdServicesAttributionTokenCollection(): Promise<void>;\n\n /**\n * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.\n * The promise will be rejected if configure has not been called yet.\n */\n isAnonymous(): Promise<{ isAnonymous: boolean }>;\n\n /**\n * iOS only. Computes whether a user is eligible for the introductory pricing period of a given product.\n * You should use this method to determine whether you show the user the normal product price or the\n * introductory price. This also applies to trials (trials are considered a type of introductory pricing).\n *\n * @note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't\n * definitively compute the eligibility, most likely because of missing group information, it will return\n * `INTRO_ELIGIBILITY_STATUS_UNKNOWN`. The best course of action on unknown status is to display the non-intro\n * pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of\n * iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN.\n *\n * @param options Array of product identifiers for which you want to compute eligibility\n * @returns { Promise<[productId: string]: IntroEligibility> } A map of IntroEligility per productId. The promise\n * will be rejected if configure has not been called yet or if there's in an error checking eligibility.\n */\n checkTrialOrIntroductoryPriceEligibility(options: {\n productIdentifiers: string[];\n }): Promise<{ [productId: string]: IntroEligibility }>;\n\n /**\n * iOS only. Use this function to retrieve the `PurchasesPromotionalOffer` for a given `PurchasesPackage`.\n *\n * @returns { Promise<PurchasesPromotionalOffer | undefined> } Returns when the `PurchasesPaymentDiscount` is returned.\n * Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been\n * called yet or if there's an error getting the payment discount.\n */\n getPromotionalOffer(\n options: GetPromotionalOfferOptions,\n ): Promise<PurchasesPromotionalOffer | undefined>;\n\n /**\n * Invalidates the cache for customer information.\n *\n * Most apps will not need to use this method; invalidating the cache can leave your app in an invalid state.\n * Refer to https://docs.revenuecat.com/docs/customer-info#section-get-user-information for more information on\n * using the cache properly.\n *\n * This is useful for cases where customer information might have been updated outside the app, like if a\n * promotional subscription is granted through the RevenueCat dashboard.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error\n * invalidating the customer info cache.\n */\n invalidateCustomerInfoCache(): Promise<void>;\n\n /** iOS 14.0+ only. Presents a code redemption sheet, useful for redeeming offer codes\n * Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how\n * to configure and use offer codes\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error\n * presenting the code redemption sheet.\n */\n presentCodeRedemptionSheet(): Promise<void>;\n\n /**\n * Subscriber attributes are useful for storing additional, structured information on a user.\n * Since attributes are writable using a public key they should not be used for\n * managing secure or sensitive information such as subscription status, coins, etc.\n *\n * Key names starting with \"$\" are reserved names used by RevenueCat. For a full list of key\n * restrictions refer to our guide: https://docs.revenuecat.com/docs/subscriber-attributes\n *\n * @param attributes Map of attributes by key. Set the value as an empty string to delete an attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error\n * setting the subscriber attributes.\n */\n setAttributes(attributes: { [key: string]: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the email address for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the email.\n */\n setEmail(options: { email: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the phone number for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the phone number.\n */\n setPhoneNumber(options: { phoneNumber: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the display name for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the display name.\n */\n setDisplayName(options: { displayName: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the push token for the user\n *\n * @param options null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the push token.\n */\n setPushToken(options: { pushToken: string | null }): Promise<void>;\n\n /**\n * Set this property to your proxy URL before configuring Purchases *only* if you've received a proxy key value\n * from your RevenueCat contact.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the proxy url.\n */\n setProxyURL(options: { url: string }): Promise<void>;\n\n /**\n * Automatically collect subscriber attributes associated with the device identifiers.\n * $idfa, $idfv, $ip on iOS\n * $gpsAdId, $androidId, $ip on Android\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting collecting the device identifiers.\n */\n collectDeviceIdentifiers(): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Adjust ID for the user\n * Required for the RevenueCat Adjust integration\n *\n * @param options Adjust ID to use in Adjust integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting Adjust ID.\n */\n setAdjustID(options: { adjustID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the AppsFlyer ID for the user\n * Required for the RevenueCat AppsFlyer integration\n * @param options Appsflyer ID to use in Appsflyer integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Appsflyer ID.\n */\n setAppsflyerID(options: { appsflyerID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Facebook SDK Anonymous ID for the user\n * Recommended for the RevenueCat Facebook integration\n *\n * @param options Facebook Anonymous ID to use in Mparticle integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Facebook Anonymous ID.\n */\n setFBAnonymousID(options: { fbAnonymousID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the mParticle ID for the user\n * Recommended for the RevenueCat mParticle integration\n *\n * @param options Mparticle ID to use in Mparticle integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Mparticle ID.\n */\n setMparticleID(options: { mparticleID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the CleverTap ID for the user\n * Required for the RevenueCat CleverTap integration\n *\n * @param options CleverTap user ID to use in CleverTap integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the CleverTap ID.\n */\n setCleverTapID(options: { cleverTapID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Mixpanel Distinct ID for the user\n * Required for the RevenueCat Mixpanel integration\n *\n * @param options Mixpanel Distinct ID to use in Mixpanel integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Mixpanel Distinct ID.\n */\n setMixpanelDistinctID(options: {\n mixpanelDistinctID: string | null;\n }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Firebase App Instance ID for the user\n * Required for the RevenueCat Firebase integration\n *\n * @param options Firebase App Instance ID to use in Firebase integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Firebase App Instance ID.\n */\n setFirebaseAppInstanceID(options: {\n firebaseAppInstanceID: string | null;\n }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the OneSignal Player ID for the user\n * Required for the RevenueCat OneSignal integration\n *\n * @param options OneSignal Player ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the OneSignal ID.\n */\n setOnesignalID(options: { onesignalID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the Airship Channel ID for the user\n * Required for the RevenueCat Airship integration\n *\n * @param options Airship Channel ID to use in Airship integration. Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the Airship Channel ID.\n */\n setAirshipChannelID(options: {\n airshipChannelID: string | null;\n }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install media source for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the media source.\n */\n setMediaSource(options: { mediaSource: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install campaign for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the campaign.\n */\n setCampaign(options: { campaign: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install ad group for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting ad group.\n */\n setAdGroup(options: { adGroup: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install ad for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the ad subscriber attribute.\n */\n setAd(options: { ad: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install keyword for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the keyword.\n */\n setKeyword(options: { keyword: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the install ad creative for the user\n *\n * @param options Empty String or null will delete the subscriber attribute.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error\n * setting the creative subscriber attribute.\n */\n setCreative(options: { creative: string | null }): Promise<void>;\n\n /**\n * Check if billing is supported for the current user (meaning IN-APP purchases are supported)\n * and optionally, whether a list of specified feature types are supported.\n *\n * Note: Billing features are only relevant to Google Play Android users.\n * For other stores and platforms, billing features won't be checked.\n *\n * @param options An array of feature types to check for support. Feature types must be one of\n * [BILLING_FEATURE]. By default, is an empty list and no specific feature support will be checked.\n * @returns promise with boolean response. True if billing is supported, false otherwise.\n */\n canMakePayments(options?: {\n features?: BILLING_FEATURE[];\n }): Promise<{ canMakePayments: boolean }>;\n\n /**\n * iOS 15+ only. Presents a refund request sheet in the current window scene for\n * the latest transaction associated with the active entitlement.\n *\n * If the request was unsuccessful, no active entitlements could be found for\n * the user, or multiple active entitlements were found for the user,\n * the promise will return an error.\n * If called in an unsupported platform (Android or iOS < 15), an `UnsupportedPlatformException` will be thrown.\n *\n * Important: This method should only be used if your user can only have a single active entitlement at a given time.\n * If a user could have more than one entitlement at a time, use `beginRefundRequestForEntitlement` instead.\n *\n * @returns Returns refundRequestStatus: The status of the\n * refund request. Keep in mind the status could be REFUND_REQUEST_STATUS.USER_CANCELLED\n */\n beginRefundRequestForActiveEntitlement(): Promise<{\n refundRequestStatus: REFUND_REQUEST_STATUS;\n }>;\n\n /**\n * iOS 15+ only. Presents a refund request sheet in the current window scene for\n * the latest transaction associated with the `entitlement`.\n *\n * If the request was unsuccessful, the promise will return an error.\n * If called in an unsupported platform (Android or iOS < 15), an `UnsupportedPlatformException` will be thrown.\n *\n * @param options The entitlement to begin a refund request for.\n * @returns Returns refundRequestStatus: The status of the\n * refund request. Keep in mind the status could be REFUND_REQUEST_STATUS.USER_CANCELLED\n */\n beginRefundRequestForEntitlement(options: {\n entitlementInfo: PurchasesEntitlementInfo;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }>;\n\n /**\n * iOS 15+ only. Presents a refund request sheet in the current window scene for\n * the latest transaction associated with the `product`.\n *\n * If the request was unsuccessful, the promise will return an error.\n * If called in an unsupported platform (Android or iOS < 15), an `UnsupportedPlatformException` will be thrown.\n *\n * @param options The StoreProduct to begin a refund request for.\n * @returns {Promise<REFUND_REQUEST_STATUS>} Returns a REFUND_REQUEST_STATUS: The status of the\n * refund request. Keep in mind the status could be REFUND_REQUEST_STATUS.USER_CANCELLED\n */\n beginRefundRequestForProduct(options: {\n storeProduct: PurchasesStoreProduct;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }>;\n\n /**\n * Check if configure has finished and Purchases has been configured.\n *\n * @returns promise with boolean response\n */\n isConfigured(): Promise<{ isConfigured: boolean }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { BILLING_FEATURE, CustomerInfo, CustomerInfoUpdateListener, IntroEligibility, LOG_LEVEL, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOfferings, PurchasesPromotionalOffer, PurchasesStoreProduct,
|
|
2
|
+
import type { BILLING_FEATURE, CustomerInfo, CustomerInfoUpdateListener, IntroEligibility, LOG_LEVEL, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOfferings, PurchasesPromotionalOffer, PurchasesStoreProduct, ShouldPurchasePromoProductListener } from '@revenuecat/purchases-typescript-internal-esm';
|
|
3
|
+
import { REFUND_REQUEST_STATUS } from '@revenuecat/purchases-typescript-internal-esm';
|
|
3
4
|
import type { GetProductOptions, GetPromotionalOfferOptions, PurchaseDiscountedPackageOptions, PurchaseDiscountedProductOptions, PurchasePackageOptions, PurchasesPlugin, PurchaseStoreProductOptions, PurchaseSubscriptionOptionOptions, SyncObserverModeAmazonPurchaseOptions } from './definitions';
|
|
4
5
|
export declare class PurchasesWeb extends WebPlugin implements PurchasesPlugin {
|
|
6
|
+
private shouldMockWebResults;
|
|
5
7
|
private webNotSupportedErrorMessage;
|
|
6
8
|
configure(_configuration: PurchasesConfiguration): Promise<void>;
|
|
9
|
+
setMockWebResults(options: {
|
|
10
|
+
shouldMockWebResults: boolean;
|
|
11
|
+
}): Promise<void>;
|
|
7
12
|
setFinishTransactions(_finishTransactions: {
|
|
8
13
|
finishTransactions: boolean;
|
|
9
14
|
}): Promise<void>;
|
|
@@ -145,4 +150,7 @@ export declare class PurchasesWeb extends WebPlugin implements PurchasesPlugin {
|
|
|
145
150
|
isConfigured(): Promise<{
|
|
146
151
|
isConfigured: boolean;
|
|
147
152
|
}>;
|
|
153
|
+
private mockEmptyCustomerInfo;
|
|
154
|
+
private mockNonReturningFunctionIfEnabled;
|
|
155
|
+
private mockReturningFunctionIfEnabled;
|
|
148
156
|
}
|