@revenuecat/purchases-capacitor 13.1.7 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +1 -1
- package/README.md +8 -7
- package/RevenuecatPurchasesCapacitor.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/revenuecat/purchases/capacitor/PurchasesPlugin.kt +33 -2
- package/dist/docs.json +18 -4
- package/dist/esm/definitions.d.ts +14 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +30 -1
- package/dist/esm/index.js.map +1 -1
- package/ios/Sources/RevenuecatPurchasesCapacitor/PurchasesPlugin.swift +23 -2
- package/package.json +2 -2
package/Package.swift
CHANGED
|
@@ -11,7 +11,7 @@ let package = Package(
|
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
|
|
14
|
-
.package(url: "https://github.com/RevenueCat/purchases-hybrid-common.git", exact: "18.
|
|
14
|
+
.package(url: "https://github.com/RevenueCat/purchases-hybrid-common.git", exact: "18.15.1")
|
|
15
15
|
],
|
|
16
16
|
targets: [
|
|
17
17
|
.target(
|
package/README.md
CHANGED
|
@@ -1285,9 +1285,9 @@ so that RevenueCat can track paywall analytics.
|
|
|
1285
1285
|
Call this method once per paywall display, ideally when the paywall first becomes visible to the user,
|
|
1286
1286
|
not in callbacks that may fire multiple times for the same display.
|
|
1287
1287
|
|
|
1288
|
-
| Param | Type | Description
|
|
1289
|
-
| ------------- | --------------------------------------------------------------------------------------------------- |
|
|
1290
|
-
| **`options`** | <code><a href="#trackcustompaywallimpressionoptions">TrackCustomPaywallImpressionOptions</a></code> | Optional parameters for the impression. Include `paywallId` to identify which paywall was shown. |
|
|
1288
|
+
| Param | Type | Description |
|
|
1289
|
+
| ------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1290
|
+
| **`options`** | <code><a href="#trackcustompaywallimpressionoptions">TrackCustomPaywallImpressionOptions</a></code> | Optional parameters for the impression. Include `paywallId` to identify which paywall was shown, and pass `offering` when available so the SDK can derive placement and targeting context. |
|
|
1291
1291
|
|
|
1292
1292
|
--------------------
|
|
1293
1293
|
|
|
@@ -1826,10 +1826,11 @@ Holds the information about a Win-Back Offer in Apple's App <a href="#store">Sto
|
|
|
1826
1826
|
|
|
1827
1827
|
Options for tracking a custom paywall impression.
|
|
1828
1828
|
|
|
1829
|
-
| Prop | Type
|
|
1830
|
-
| ---------------- |
|
|
1831
|
-
| **`paywallId`** | <code>string \| null</code>
|
|
1832
|
-
| **`
|
|
1829
|
+
| Prop | Type | Description |
|
|
1830
|
+
| ---------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1831
|
+
| **`paywallId`** | <code>string \| null</code> | The identifier of the paywall that was shown. |
|
|
1832
|
+
| **`offering`** | <code><a href="#purchasesoffering">PurchasesOffering</a> \| null</code> | The offering associated with the custom paywall. Pass the offering object so RevenueCat can track placement and targeting context for placement-resolved offerings. |
|
|
1833
|
+
| **`offeringId`** | <code>string \| null</code> | Deprecated. Pass `offering` instead so RevenueCat can track placement and targeting context. An optional identifier for the offering associated with the custom paywall. |
|
|
1833
1834
|
|
|
1834
1835
|
|
|
1835
1836
|
### Type Aliases
|
|
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'PurchasesHybridCommon', '18.
|
|
16
|
+
s.dependency 'PurchasesHybridCommon', '18.15.1'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/android/build.gradle
CHANGED
|
@@ -61,7 +61,7 @@ dependencies {
|
|
|
61
61
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
62
62
|
implementation project(':capacitor-android')
|
|
63
63
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
64
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.
|
|
64
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.15.1'
|
|
65
65
|
testImplementation "junit:junit:$junitVersion"
|
|
66
66
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
67
67
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -27,6 +27,7 @@ import com.revenuecat.purchases.hybridcommon.purchaseProduct
|
|
|
27
27
|
import com.revenuecat.purchases.hybridcommon.showInAppMessagesIfNeeded
|
|
28
28
|
import com.revenuecat.purchases.interfaces.UpdatedCustomerInfoListener
|
|
29
29
|
import com.revenuecat.purchases.models.InAppMessageType
|
|
30
|
+
import org.json.JSONArray
|
|
30
31
|
import org.json.JSONObject
|
|
31
32
|
import com.revenuecat.purchases.hybridcommon.canMakePayments as canMakePaymentsCommon
|
|
32
33
|
import com.revenuecat.purchases.hybridcommon.checkTrialOrIntroductoryPriceEligibility as checkTrialOrIntroductoryPriceEligibilityCommon
|
|
@@ -85,7 +86,7 @@ class PurchasesPlugin : Plugin() {
|
|
|
85
86
|
|
|
86
87
|
companion object {
|
|
87
88
|
private const val PLATFORM_NAME = "capacitor"
|
|
88
|
-
private const val PLUGIN_VERSION = "13.
|
|
89
|
+
private const val PLUGIN_VERSION = "13.2.0"
|
|
89
90
|
|
|
90
91
|
private const val CUSTOMER_INFO_KEY = "customerInfo"
|
|
91
92
|
}
|
|
@@ -713,7 +714,7 @@ class PurchasesPlugin : Plugin() {
|
|
|
713
714
|
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
714
715
|
fun trackCustomPaywallImpression(call: PluginCall) {
|
|
715
716
|
if (rejectIfNotConfigured(call)) return
|
|
716
|
-
trackCustomPaywallImpressionCommon(call.data
|
|
717
|
+
trackCustomPaywallImpressionCommon(mapWithoutNullValues(call.data))
|
|
717
718
|
call.resolve()
|
|
718
719
|
}
|
|
719
720
|
|
|
@@ -724,6 +725,36 @@ class PurchasesPlugin : Plugin() {
|
|
|
724
725
|
private val activity: Activity
|
|
725
726
|
get() = bridge.activity
|
|
726
727
|
|
|
728
|
+
private fun mapWithoutNullValues(jsonObject: JSONObject): Map<String, Any> {
|
|
729
|
+
return jsonObject.keys().asSequence<String>().mapNotNull { key ->
|
|
730
|
+
valueWithoutNullValues(jsonObject.opt(key))?.let { key to it }
|
|
731
|
+
}.toMap()
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
private fun mapWithoutNullValues(map: Map<String, Any?>): Map<String, Any> {
|
|
735
|
+
return map.mapNotNull { (key, value) ->
|
|
736
|
+
valueWithoutNullValues(value)?.let { key to it }
|
|
737
|
+
}.toMap()
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
private fun valueWithoutNullValues(value: Any?): Any? {
|
|
741
|
+
return when (value) {
|
|
742
|
+
null, JSONObject.NULL -> null
|
|
743
|
+
is JSONObject -> mapWithoutNullValues(value)
|
|
744
|
+
is JSONArray -> (0 until value.length()).mapNotNull { index ->
|
|
745
|
+
valueWithoutNullValues(value.opt(index))
|
|
746
|
+
}
|
|
747
|
+
is Map<*, *> -> value.mapNotNull { (key, entryValue) ->
|
|
748
|
+
val filteredValue = valueWithoutNullValues(entryValue)
|
|
749
|
+
if (key is String && filteredValue != null) key to filteredValue else null
|
|
750
|
+
}.toMap()
|
|
751
|
+
is List<*> -> value.mapNotNull { item ->
|
|
752
|
+
valueWithoutNullValues(item)
|
|
753
|
+
}
|
|
754
|
+
else -> value
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
727
758
|
private fun getOnResult(call: PluginCall, wrapperKey: String? = null): OnResult {
|
|
728
759
|
return object : OnResult {
|
|
729
760
|
override fun onReceived(map: Map<String, *>) {
|
package/dist/docs.json
CHANGED
|
@@ -1618,7 +1618,7 @@
|
|
|
1618
1618
|
"parameters": [
|
|
1619
1619
|
{
|
|
1620
1620
|
"name": "options",
|
|
1621
|
-
"docs": "Optional parameters for the impression. Include `paywallId` to identify which paywall was shown.",
|
|
1621
|
+
"docs": "Optional parameters for the impression. Include `paywallId` to identify which paywall was shown,\nand pass `offering` when available so the SDK can derive placement and targeting context.",
|
|
1622
1622
|
"type": "TrackCustomPaywallImpressionOptions | undefined"
|
|
1623
1623
|
}
|
|
1624
1624
|
],
|
|
@@ -1626,7 +1626,7 @@
|
|
|
1626
1626
|
"tags": [
|
|
1627
1627
|
{
|
|
1628
1628
|
"name": "param",
|
|
1629
|
-
"text": "options Optional parameters for the impression. Include `paywallId` to identify which paywall was shown."
|
|
1629
|
+
"text": "options Optional parameters for the impression. Include `paywallId` to identify which paywall was shown,\nand pass `offering` when available so the SDK can derive placement and targeting context."
|
|
1630
1630
|
},
|
|
1631
1631
|
{
|
|
1632
1632
|
"name": "returns",
|
|
@@ -3849,9 +3849,23 @@
|
|
|
3849
3849
|
"type": "string | null | undefined"
|
|
3850
3850
|
},
|
|
3851
3851
|
{
|
|
3852
|
-
"name": "
|
|
3852
|
+
"name": "offering",
|
|
3853
3853
|
"tags": [],
|
|
3854
|
-
"docs": "
|
|
3854
|
+
"docs": "The offering associated with the custom paywall.\n\nPass the offering object so RevenueCat can track placement and targeting\ncontext for placement-resolved offerings.",
|
|
3855
|
+
"complexTypes": [
|
|
3856
|
+
"PurchasesOffering"
|
|
3857
|
+
],
|
|
3858
|
+
"type": "PurchasesOffering | null | undefined"
|
|
3859
|
+
},
|
|
3860
|
+
{
|
|
3861
|
+
"name": "offeringId",
|
|
3862
|
+
"tags": [
|
|
3863
|
+
{
|
|
3864
|
+
"text": "Use `offering` instead.",
|
|
3865
|
+
"name": "deprecated"
|
|
3866
|
+
}
|
|
3867
|
+
],
|
|
3868
|
+
"docs": "Deprecated. Pass `offering` instead so RevenueCat can track placement and\ntargeting context.\n\nAn optional identifier for the offering associated with the custom paywall.",
|
|
3855
3869
|
"complexTypes": [],
|
|
3856
3870
|
"type": "string | null | undefined"
|
|
3857
3871
|
}
|
|
@@ -900,7 +900,8 @@ export interface PurchasesPlugin {
|
|
|
900
900
|
* Call this method once per paywall display, ideally when the paywall first becomes visible to the user,
|
|
901
901
|
* not in callbacks that may fire multiple times for the same display.
|
|
902
902
|
*
|
|
903
|
-
* @param options Optional parameters for the impression. Include `paywallId` to identify which paywall was shown
|
|
903
|
+
* @param options Optional parameters for the impression. Include `paywallId` to identify which paywall was shown,
|
|
904
|
+
* and pass `offering` when available so the SDK can derive placement and targeting context.
|
|
904
905
|
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet.
|
|
905
906
|
*/
|
|
906
907
|
trackCustomPaywallImpression(options?: TrackCustomPaywallImpressionOptions): Promise<void>;
|
|
@@ -912,8 +913,19 @@ export interface TrackCustomPaywallImpressionOptions {
|
|
|
912
913
|
/** The identifier of the paywall that was shown. */
|
|
913
914
|
paywallId?: string | null;
|
|
914
915
|
/**
|
|
916
|
+
* The offering associated with the custom paywall.
|
|
917
|
+
*
|
|
918
|
+
* Pass the offering object so RevenueCat can track placement and targeting
|
|
919
|
+
* context for placement-resolved offerings.
|
|
920
|
+
*/
|
|
921
|
+
offering?: PurchasesOffering | null;
|
|
922
|
+
/**
|
|
923
|
+
* Deprecated. Pass `offering` instead so RevenueCat can track placement and
|
|
924
|
+
* targeting context.
|
|
925
|
+
*
|
|
915
926
|
* An optional identifier for the offering associated with the custom paywall.
|
|
916
|
-
*
|
|
927
|
+
*
|
|
928
|
+
* @deprecated Use `offering` instead.
|
|
917
929
|
*/
|
|
918
930
|
offeringId?: string | null;
|
|
919
931
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA+BA,cAAc,+CAA+C,CAAC","sourcesContent":["import type {\n BILLING_FEATURE,\n CustomerInfo,\n CustomerInfoUpdateListener,\n GoogleProductChangeInfo,\n IN_APP_MESSAGE_TYPE,\n IntroEligibility,\n LOG_LEVEL,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PRODUCT_CATEGORY,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOffering,\n PurchasesOfferings,\n PurchasesPackage,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreProductDiscount,\n PurchasesStoreTransaction,\n PurchasesVirtualCurrencies,\n PurchasesWinBackOffer,\n REFUND_REQUEST_STATUS,\n StoreProductChangeInfo,\n Storefront,\n SubscriptionOption,\n WebPurchaseRedemption,\n WebPurchaseRedemptionResult,\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 * If both googleProductChangeInfo and storeProductChangeInfo are provided,\n * storeProductChangeInfo is used and googleProductChangeInfo is ignored.\n * @deprecated Use storeProductChangeInfo instead.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android only. Optional StoreProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional replacementMode.\n */\n storeProductChangeInfo?: StoreProductChangeInfo | 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 GetEligibleWinBackOffersForProductOptions {\n /**\n * The product you want to fetch eligible win-back offers for\n */\n product: PurchasesStoreProduct;\n}\n\nexport interface GetEligibleWinBackOffersForPackageOptions {\n /**\n * The package you want to fetch eligible win-back offers for\n */\n aPackage: PurchasesPackage;\n}\n\nexport interface PurchaseProductWithWinBackOfferOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForProduct.\n */\n winBackOffer: PurchasesWinBackOffer;\n}\n\nexport interface PurchasePackageWithWinBackOfferOptions {\n /**\n * The package you want to purchase\n */\n aPackage: PurchasesPackage;\n /**\n * Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForPackage.\n */\n winBackOffer: PurchasesWinBackOffer;\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 * If both googleProductChangeInfo and storeProductChangeInfo are provided,\n * storeProductChangeInfo is used and googleProductChangeInfo is ignored.\n * @deprecated Use storeProductChangeInfo instead.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android only. Optional StoreProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional replacementMode.\n */\n storeProductChangeInfo?: StoreProductChangeInfo | 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 * If both googleProductChangeInfo and storeProductChangeInfo are provided,\n * storeProductChangeInfo is used and googleProductChangeInfo is ignored.\n * @deprecated Use storeProductChangeInfo instead.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android only. Optional StoreProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional replacementMode.\n */\n storeProductChangeInfo?: StoreProductChangeInfo | 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 SyncAmazonPurchaseOptions {\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\n/**\n * @deprecated - Use SyncAmazonPurchaseOptions instead\n */\nexport type SyncObserverModeAmazonPurchaseOptions = SyncAmazonPurchaseOptions;\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 * Fetches the virtual currencies for the current subscriber.\n *\n * @returns {Promise<{ virtualCurrencies: PurchasesVirtualCurrencies }>} A promise of a {@link PurchasesVirtualCurrencies} object.\n * The promise will be rejected if configure has not been called yet or if an error occurs while getting the virtual currencies.\n */\n getVirtualCurrencies(): Promise<{ virtualCurrencies: PurchasesVirtualCurrencies }>;\n\n /**\n * Invalidates the cache for virtual currencies.\n *\n * This is useful for cases where a virtual currency's balance might have been updated\n * outside of the app, like if you decreased a user's balance from the user spending a virtual currency,\n * or if you increased the balance from your backend using the server APIs.\n */\n invalidateVirtualCurrenciesCache(): Promise<void>;\n\n /**\n * The currently cached {@link PurchasesVirtualCurrencies} if one is available.\n * This value will remain null until virtual currencies have been fetched at\n * least once with {@link getVirtualCurrencies} or an equivalent function.\n *\n * @returns {Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null }>} The currently cached virtual currencies for the current subscriber.\n * The promise will be rejected if configure has not been called yet or there's an error.\n */\n getCachedVirtualCurrencies(): Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null }>;\n\n /**\n * Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.\n * @param options Set the urlString used to open the App.\n * @returns {Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null}>} A promise of a WebPurchaseRedemption\n * object that can be redeemed using {@link redeemWebPurchase} or null if the link is invalid.\n */\n parseAsWebPurchaseRedemption(options: {\n urlString: string;\n }): Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null }>;\n\n /**\n * Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].\n * @param options The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}.\n * @returns {Promise<WebPurchaseRedemptionResult>} The result of the redemption process.\n * Can throw if an invalid WebPurchaseRedemption parameter is passed or Purchases is not configured.\n */\n redeemWebPurchase(options: { webPurchaseRedemption: WebPurchaseRedemption }): Promise<WebPurchaseRedemptionResult>;\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 * 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: { simulatesAskToBuyInSandbox: boolean }): 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(customerInfoUpdateListener: CustomerInfoUpdateListener): Promise<PurchasesCallbackId>;\n\n /**\n * Removes a given CustomerInfoUpdateListener\n * @param {CustomerInfoUpdateListener} options Include listenerToRemove, which is a CustomerInfoUpdateListener\n * reference of the listener to remove\n * @returns Promise with boolean. True if listener was removed, false otherwise\n */\n removeCustomerInfoUpdateListener(options: {\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 * Retrieves a current offering for a placement identifier, use this to access offerings defined by targeting\n * placements configured in the RevenueCat dashboard.\n * @returns {Promise<PurchasesOffering | null>} Promise of optional offering. The promise will be rejected if configure\n * has not been called yet.\n */\n getCurrentOfferingForPlacement(options: { placementIdentifier: string }): Promise<PurchasesOffering | null>;\n\n /**\n * Syncs subscriber attributes and then fetches the configured offerings for this user. This method is intended to\n * be called when using Targeting Rules with Custom Attributes. Any subscriber attributes should be set before\n * calling this method to ensure the returned offerings are applied with the latest subscriber attributes.\n * @returns {Promise<PurchasesOfferings>} Promise of entitlements structure. The promise will be rejected if configure\n * has not been called yet.\n */\n syncAttributesAndOfferingsIfNeeded(): 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(options: GetProductOptions): 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(options: PurchaseStoreProductOptions): 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(options: PurchaseDiscountedProductOptions): 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(options: PurchaseSubscriptionOptionOptions): 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(options: PurchaseDiscountedPackageOptions): 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 * Use this method only if you already have your own IAP implementation using StoreKit 2 and want to use\n * RevenueCat's backend. If you are using StoreKit 1 for your implementation, you do not need this method.\n *\n * You only need to use this method with *new* purchases. Subscription updates are observed automatically.\n * @param options The productID that was purchased that needs to be synced with RevenueCat's backend.\n */\n recordPurchase(options: { productID: string }): Promise<{ transaction: PurchasesStoreTransaction }>;\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 * Gets the storefront for the current store account.\n * @return {Promise<Storefront>} A promise of a Storefront object.\n * The promise will be rejected if configure has not been called yet or if storefront could\n * not be obtained for account.\n */\n getStorefront(): Promise<Storefront>;\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 * @deprecated - Use syncAmazonPurchase instead\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(options: SyncObserverModeAmazonPurchaseOptions): 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 syncAmazonPurchase(options: SyncAmazonPurchaseOptions): 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(options: GetPromotionalOfferOptions): Promise<PurchasesPromotionalOffer | undefined>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve\n * the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a\n * given `PurchasesStoreProduct`.\n *\n * @returns { Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> } A dictionary containing an array of `PurchasesWinBackOffer`s that\n * the subscriber is eligible for for the given `PurchasesStoreProduct`.\n * The promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n * The promise will also be rejected if configure has not been called yet.\n */\n getEligibleWinBackOffersForProduct(options: GetEligibleWinBackOffersForProductOptions): Promise<{\n eligibleWinBackOffers: PurchasesWinBackOffer[];\n }>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve\n * the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a\n * given `PurchasesStorePackage`.\n *\n * @returns { Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> } An array of `PurchasesWinBackOffer`s that\n * the subscriber is eligible for for the given `PurchasesStorePackage`.\n * The promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n * The promise will also be rejected if configure has not been called yet.\n */\n getEligibleWinBackOffersForPackage(options: GetEligibleWinBackOffersForPackageOptions): Promise<{\n eligibleWinBackOffers: PurchasesWinBackOffer[];\n }>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a product applying a given win-back offer.\n *\n * @returns {Promise<MakePurchaseResult>} A promise of an object containing\n * a customer info object, a transaction, 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 or if called in an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n */\n purchaseProductWithWinBackOffer(\n options: PurchaseProductWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | undefined>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a package applying a given win-back offer.\n *\n * @returns {Promise<MakePurchaseResult>} A promise of an object containing\n * a customer info object, a transaction, 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 or if called in an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n */\n purchasePackageWithWinBackOffer(\n options: PurchasePackageWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | 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: { mixpanelDistinctID: string | null }): 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: { firebaseAppInstanceID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the OneSignal Player ID for the user\n * Required for the RevenueCat OneSignal integration. Deprecated for OneSignal versions above v9.0.\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 OneSignal User ID for the user\n * Required for the RevenueCat OneSignal integration with versions v11.0 and above.\n *\n * @param options OneSignal UserId 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 user ID.\n */\n setOnesignalUserID(options: { onesignalUserID: 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: { airshipChannelID: string | null }): 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?: { features?: BILLING_FEATURE[] }): 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 * Shows in-app messages available from the App Store or Google Play. You need to disable messages from showing\n * automatically using [PurchasesConfiguration.shouldShowInAppMessagesAutomatically].\n *\n * Note: In iOS, this requires version 16+. In older versions the promise will be resolved successfully\n * immediately.\n *\n * @param options An array of message types that the stores can display inside your app. Values must be one of\n * [IN_APP_MESSAGE_TYPE]. By default, is undefined and all message types will be shown.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n showInAppMessages(options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] }): Promise<void>;\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 /**\n * Override the preferred UI locale for RevenueCat UI components at runtime. This affects both API requests\n * and UI rendering. If the locale changes, this will automatically clear the offerings cache and trigger\n * a background refetch to get paywall templates with the correct localizations.\n *\n * @param options The locale string (e.g., \"es-ES\", \"en-US\") or null to use system default.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n overridePreferredUILocale(options: { locale: string | null }): Promise<void>;\n\n /**\n * Tracks an impression of a custom paywall. Use this to record when a user views your custom paywall\n * so that RevenueCat can track paywall analytics.\n *\n * Call this method once per paywall display, ideally when the paywall first becomes visible to the user,\n * not in callbacks that may fire multiple times for the same display.\n *\n * @param options Optional parameters for the impression. Include `paywallId` to identify which paywall was shown.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n trackCustomPaywallImpression(options?: TrackCustomPaywallImpressionOptions): Promise<void>;\n}\n\n/**\n * Options for tracking a custom paywall impression.\n */\nexport interface TrackCustomPaywallImpressionOptions {\n /** The identifier of the paywall that was shown. */\n paywallId?: string | null;\n /**\n * An optional identifier for the offering associated with the custom paywall.\n * If not provided, the SDK will use the current offering identifier from the cache.\n */\n offeringId?: string | null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA+BA,cAAc,+CAA+C,CAAC","sourcesContent":["import type {\n BILLING_FEATURE,\n CustomerInfo,\n CustomerInfoUpdateListener,\n GoogleProductChangeInfo,\n IN_APP_MESSAGE_TYPE,\n IntroEligibility,\n LOG_LEVEL,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PRODUCT_CATEGORY,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOffering,\n PurchasesOfferings,\n PurchasesPackage,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreProductDiscount,\n PurchasesStoreTransaction,\n PurchasesVirtualCurrencies,\n PurchasesWinBackOffer,\n REFUND_REQUEST_STATUS,\n StoreProductChangeInfo,\n Storefront,\n SubscriptionOption,\n WebPurchaseRedemption,\n WebPurchaseRedemptionResult,\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 * If both googleProductChangeInfo and storeProductChangeInfo are provided,\n * storeProductChangeInfo is used and googleProductChangeInfo is ignored.\n * @deprecated Use storeProductChangeInfo instead.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android only. Optional StoreProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional replacementMode.\n */\n storeProductChangeInfo?: StoreProductChangeInfo | 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 GetEligibleWinBackOffersForProductOptions {\n /**\n * The product you want to fetch eligible win-back offers for\n */\n product: PurchasesStoreProduct;\n}\n\nexport interface GetEligibleWinBackOffersForPackageOptions {\n /**\n * The package you want to fetch eligible win-back offers for\n */\n aPackage: PurchasesPackage;\n}\n\nexport interface PurchaseProductWithWinBackOfferOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForProduct.\n */\n winBackOffer: PurchasesWinBackOffer;\n}\n\nexport interface PurchasePackageWithWinBackOfferOptions {\n /**\n * The package you want to purchase\n */\n aPackage: PurchasesPackage;\n /**\n * Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForPackage.\n */\n winBackOffer: PurchasesWinBackOffer;\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 * If both googleProductChangeInfo and storeProductChangeInfo are provided,\n * storeProductChangeInfo is used and googleProductChangeInfo is ignored.\n * @deprecated Use storeProductChangeInfo instead.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android only. Optional StoreProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional replacementMode.\n */\n storeProductChangeInfo?: StoreProductChangeInfo | 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 * If both googleProductChangeInfo and storeProductChangeInfo are provided,\n * storeProductChangeInfo is used and googleProductChangeInfo is ignored.\n * @deprecated Use storeProductChangeInfo instead.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android only. Optional StoreProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional replacementMode.\n */\n storeProductChangeInfo?: StoreProductChangeInfo | 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 SyncAmazonPurchaseOptions {\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\n/**\n * @deprecated - Use SyncAmazonPurchaseOptions instead\n */\nexport type SyncObserverModeAmazonPurchaseOptions = SyncAmazonPurchaseOptions;\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 * Fetches the virtual currencies for the current subscriber.\n *\n * @returns {Promise<{ virtualCurrencies: PurchasesVirtualCurrencies }>} A promise of a {@link PurchasesVirtualCurrencies} object.\n * The promise will be rejected if configure has not been called yet or if an error occurs while getting the virtual currencies.\n */\n getVirtualCurrencies(): Promise<{ virtualCurrencies: PurchasesVirtualCurrencies }>;\n\n /**\n * Invalidates the cache for virtual currencies.\n *\n * This is useful for cases where a virtual currency's balance might have been updated\n * outside of the app, like if you decreased a user's balance from the user spending a virtual currency,\n * or if you increased the balance from your backend using the server APIs.\n */\n invalidateVirtualCurrenciesCache(): Promise<void>;\n\n /**\n * The currently cached {@link PurchasesVirtualCurrencies} if one is available.\n * This value will remain null until virtual currencies have been fetched at\n * least once with {@link getVirtualCurrencies} or an equivalent function.\n *\n * @returns {Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null }>} The currently cached virtual currencies for the current subscriber.\n * The promise will be rejected if configure has not been called yet or there's an error.\n */\n getCachedVirtualCurrencies(): Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null }>;\n\n /**\n * Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.\n * @param options Set the urlString used to open the App.\n * @returns {Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null}>} A promise of a WebPurchaseRedemption\n * object that can be redeemed using {@link redeemWebPurchase} or null if the link is invalid.\n */\n parseAsWebPurchaseRedemption(options: {\n urlString: string;\n }): Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null }>;\n\n /**\n * Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].\n * @param options The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}.\n * @returns {Promise<WebPurchaseRedemptionResult>} The result of the redemption process.\n * Can throw if an invalid WebPurchaseRedemption parameter is passed or Purchases is not configured.\n */\n redeemWebPurchase(options: { webPurchaseRedemption: WebPurchaseRedemption }): Promise<WebPurchaseRedemptionResult>;\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 * 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: { simulatesAskToBuyInSandbox: boolean }): 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(customerInfoUpdateListener: CustomerInfoUpdateListener): Promise<PurchasesCallbackId>;\n\n /**\n * Removes a given CustomerInfoUpdateListener\n * @param {CustomerInfoUpdateListener} options Include listenerToRemove, which is a CustomerInfoUpdateListener\n * reference of the listener to remove\n * @returns Promise with boolean. True if listener was removed, false otherwise\n */\n removeCustomerInfoUpdateListener(options: {\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 * Retrieves a current offering for a placement identifier, use this to access offerings defined by targeting\n * placements configured in the RevenueCat dashboard.\n * @returns {Promise<PurchasesOffering | null>} Promise of optional offering. The promise will be rejected if configure\n * has not been called yet.\n */\n getCurrentOfferingForPlacement(options: { placementIdentifier: string }): Promise<PurchasesOffering | null>;\n\n /**\n * Syncs subscriber attributes and then fetches the configured offerings for this user. This method is intended to\n * be called when using Targeting Rules with Custom Attributes. Any subscriber attributes should be set before\n * calling this method to ensure the returned offerings are applied with the latest subscriber attributes.\n * @returns {Promise<PurchasesOfferings>} Promise of entitlements structure. The promise will be rejected if configure\n * has not been called yet.\n */\n syncAttributesAndOfferingsIfNeeded(): 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(options: GetProductOptions): 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(options: PurchaseStoreProductOptions): 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(options: PurchaseDiscountedProductOptions): 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(options: PurchaseSubscriptionOptionOptions): 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(options: PurchaseDiscountedPackageOptions): 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 * Use this method only if you already have your own IAP implementation using StoreKit 2 and want to use\n * RevenueCat's backend. If you are using StoreKit 1 for your implementation, you do not need this method.\n *\n * You only need to use this method with *new* purchases. Subscription updates are observed automatically.\n * @param options The productID that was purchased that needs to be synced with RevenueCat's backend.\n */\n recordPurchase(options: { productID: string }): Promise<{ transaction: PurchasesStoreTransaction }>;\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 * Gets the storefront for the current store account.\n * @return {Promise<Storefront>} A promise of a Storefront object.\n * The promise will be rejected if configure has not been called yet or if storefront could\n * not be obtained for account.\n */\n getStorefront(): Promise<Storefront>;\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 * @deprecated - Use syncAmazonPurchase instead\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(options: SyncObserverModeAmazonPurchaseOptions): 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 syncAmazonPurchase(options: SyncAmazonPurchaseOptions): 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(options: GetPromotionalOfferOptions): Promise<PurchasesPromotionalOffer | undefined>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve\n * the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a\n * given `PurchasesStoreProduct`.\n *\n * @returns { Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> } A dictionary containing an array of `PurchasesWinBackOffer`s that\n * the subscriber is eligible for for the given `PurchasesStoreProduct`.\n * The promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n * The promise will also be rejected if configure has not been called yet.\n */\n getEligibleWinBackOffersForProduct(options: GetEligibleWinBackOffersForProductOptions): Promise<{\n eligibleWinBackOffers: PurchasesWinBackOffer[];\n }>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve\n * the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a\n * given `PurchasesStorePackage`.\n *\n * @returns { Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> } An array of `PurchasesWinBackOffer`s that\n * the subscriber is eligible for for the given `PurchasesStorePackage`.\n * The promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n * The promise will also be rejected if configure has not been called yet.\n */\n getEligibleWinBackOffersForPackage(options: GetEligibleWinBackOffersForPackageOptions): Promise<{\n eligibleWinBackOffers: PurchasesWinBackOffer[];\n }>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a product applying a given win-back offer.\n *\n * @returns {Promise<MakePurchaseResult>} A promise of an object containing\n * a customer info object, a transaction, 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 or if called in an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n */\n purchaseProductWithWinBackOffer(\n options: PurchaseProductWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | undefined>;\n\n /**\n * iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a package applying a given win-back offer.\n *\n * @returns {Promise<MakePurchaseResult>} A promise of an object containing\n * a customer info object, a transaction, 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 or if called in an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\n */\n purchasePackageWithWinBackOffer(\n options: PurchasePackageWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | 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: { mixpanelDistinctID: string | null }): 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: { firebaseAppInstanceID: string | null }): Promise<void>;\n\n /**\n * Subscriber attribute associated with the OneSignal Player ID for the user\n * Required for the RevenueCat OneSignal integration. Deprecated for OneSignal versions above v9.0.\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 OneSignal User ID for the user\n * Required for the RevenueCat OneSignal integration with versions v11.0 and above.\n *\n * @param options OneSignal UserId 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 user ID.\n */\n setOnesignalUserID(options: { onesignalUserID: 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: { airshipChannelID: string | null }): 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?: { features?: BILLING_FEATURE[] }): 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 * Shows in-app messages available from the App Store or Google Play. You need to disable messages from showing\n * automatically using [PurchasesConfiguration.shouldShowInAppMessagesAutomatically].\n *\n * Note: In iOS, this requires version 16+. In older versions the promise will be resolved successfully\n * immediately.\n *\n * @param options An array of message types that the stores can display inside your app. Values must be one of\n * [IN_APP_MESSAGE_TYPE]. By default, is undefined and all message types will be shown.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n showInAppMessages(options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] }): Promise<void>;\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 /**\n * Override the preferred UI locale for RevenueCat UI components at runtime. This affects both API requests\n * and UI rendering. If the locale changes, this will automatically clear the offerings cache and trigger\n * a background refetch to get paywall templates with the correct localizations.\n *\n * @param options The locale string (e.g., \"es-ES\", \"en-US\") or null to use system default.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n overridePreferredUILocale(options: { locale: string | null }): Promise<void>;\n\n /**\n * Tracks an impression of a custom paywall. Use this to record when a user views your custom paywall\n * so that RevenueCat can track paywall analytics.\n *\n * Call this method once per paywall display, ideally when the paywall first becomes visible to the user,\n * not in callbacks that may fire multiple times for the same display.\n *\n * @param options Optional parameters for the impression. Include `paywallId` to identify which paywall was shown,\n * and pass `offering` when available so the SDK can derive placement and targeting context.\n * @returns {Promise<void>} The promise will be rejected if configure has not been called yet.\n */\n trackCustomPaywallImpression(options?: TrackCustomPaywallImpressionOptions): Promise<void>;\n}\n\n/**\n * Options for tracking a custom paywall impression.\n */\nexport interface TrackCustomPaywallImpressionOptions {\n /** The identifier of the paywall that was shown. */\n paywallId?: string | null;\n /**\n * The offering associated with the custom paywall.\n *\n * Pass the offering object so RevenueCat can track placement and targeting\n * context for placement-resolved offerings.\n */\n offering?: PurchasesOffering | null;\n /**\n * Deprecated. Pass `offering` instead so RevenueCat can track placement and\n * targeting context.\n *\n * An optional identifier for the offering associated with the custom paywall.\n *\n * @deprecated Use `offering` instead.\n */\n offeringId?: string | null;\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { registerPlugin } from '@capacitor/core';
|
|
2
|
-
const
|
|
2
|
+
const nativePlugin = registerPlugin('Purchases', {
|
|
3
3
|
web: () => import('./web').then((m) => new m.PurchasesWeb()),
|
|
4
4
|
});
|
|
5
|
+
function getNativeTrackCustomPaywallImpressionOptions(options) {
|
|
6
|
+
var _a;
|
|
7
|
+
const offering = options === null || options === void 0 ? void 0 : options.offering;
|
|
8
|
+
const nativeOptions = {};
|
|
9
|
+
if ((options === null || options === void 0 ? void 0 : options.paywallId) != null) {
|
|
10
|
+
nativeOptions.paywallId = options.paywallId;
|
|
11
|
+
}
|
|
12
|
+
if (offering != null) {
|
|
13
|
+
nativeOptions.offeringId = offering.identifier;
|
|
14
|
+
const presentedOfferingContext = (_a = offering.availablePackages[0]) === null || _a === void 0 ? void 0 : _a.presentedOfferingContext;
|
|
15
|
+
if (presentedOfferingContext != null) {
|
|
16
|
+
nativeOptions.presentedOfferingContext = presentedOfferingContext;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if ((options === null || options === void 0 ? void 0 : options.offeringId) != null) {
|
|
20
|
+
nativeOptions.offeringId = options.offeringId;
|
|
21
|
+
}
|
|
22
|
+
return nativeOptions;
|
|
23
|
+
}
|
|
24
|
+
const Purchases = new Proxy(nativePlugin, {
|
|
25
|
+
get(target, prop, receiver) {
|
|
26
|
+
if (prop === 'trackCustomPaywallImpression') {
|
|
27
|
+
return (options) => {
|
|
28
|
+
return target.trackCustomPaywallImpression(getNativeTrackCustomPaywallImpressionOptions(options));
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return Reflect.get(target, prop, receiver);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
5
34
|
export * from './definitions';
|
|
6
35
|
export { Purchases };
|
|
7
36
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQjD,MAAM,YAAY,GAAG,cAAc,CAAkB,WAAW,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;CAC7D,CAAC,CAAC;AAEH,SAAS,4CAA4C,CACnD,OAA6C;;IAE7C,MAAM,QAAQ,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC;IACnC,MAAM,aAAa,GAA8C,EAAE,CAAC;IAEpE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,IAAI,EAAE,CAAC;QAC/B,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAC9C,CAAC;IAED,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACrB,aAAa,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QAC/C,MAAM,wBAAwB,GAAG,MAAA,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,0CAAE,wBAAwB,CAAC;QACzF,IAAI,wBAAwB,IAAI,IAAI,EAAE,CAAC;YACrC,aAAa,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;QACpE,CAAC;IACH,CAAC;SAAM,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,KAAI,IAAI,EAAE,CAAC;QACvC,aAAa,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAChD,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,YAAY,EAAE;IACxC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;QACxB,IAAI,IAAI,KAAK,8BAA8B,EAAE,CAAC;YAC5C,OAAO,CAAC,OAA6C,EAAiB,EAAE;gBACtE,OAAO,MAAM,CAAC,4BAA4B,CAAC,4CAA4C,CAAC,OAAO,CAAC,CAAC,CAAC;YACpG,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;CACF,CAAoB,CAAC;AAEtB,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { PurchasesPlugin, TrackCustomPaywallImpressionOptions } from './definitions';\n\ntype NativeTrackCustomPaywallImpressionOptions = Omit<TrackCustomPaywallImpressionOptions, 'offering'> & {\n presentedOfferingContext?: unknown;\n};\n\nconst nativePlugin = registerPlugin<PurchasesPlugin>('Purchases', {\n web: () => import('./web').then((m) => new m.PurchasesWeb()),\n});\n\nfunction getNativeTrackCustomPaywallImpressionOptions(\n options?: TrackCustomPaywallImpressionOptions,\n): NativeTrackCustomPaywallImpressionOptions {\n const offering = options?.offering;\n const nativeOptions: NativeTrackCustomPaywallImpressionOptions = {};\n\n if (options?.paywallId != null) {\n nativeOptions.paywallId = options.paywallId;\n }\n\n if (offering != null) {\n nativeOptions.offeringId = offering.identifier;\n const presentedOfferingContext = offering.availablePackages[0]?.presentedOfferingContext;\n if (presentedOfferingContext != null) {\n nativeOptions.presentedOfferingContext = presentedOfferingContext;\n }\n } else if (options?.offeringId != null) {\n nativeOptions.offeringId = options.offeringId;\n }\n\n return nativeOptions;\n}\n\nconst Purchases = new Proxy(nativePlugin, {\n get(target, prop, receiver) {\n if (prop === 'trackCustomPaywallImpression') {\n return (options?: TrackCustomPaywallImpressionOptions): Promise<void> => {\n return target.trackCustomPaywallImpression(getNativeTrackCustomPaywallImpressionOptions(options));\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n}) as PurchasesPlugin;\n\nexport * from './definitions';\nexport { Purchases };\n"]}
|
|
@@ -90,7 +90,7 @@ public class PurchasesPlugin: CAPPlugin, PurchasesDelegate, CAPBridgedPlugin {
|
|
|
90
90
|
CAPPluginMethod(name: "trackCustomPaywallImpression", returnType: CAPPluginReturnNone),
|
|
91
91
|
]
|
|
92
92
|
private let platformFlavor = "capacitor"
|
|
93
|
-
private let platformVersion = "13.
|
|
93
|
+
private let platformVersion = "13.2.0"
|
|
94
94
|
|
|
95
95
|
private let customerInfoKey = "customerInfo"
|
|
96
96
|
private let transactionKey = "transaction"
|
|
@@ -677,7 +677,8 @@ public class PurchasesPlugin: CAPPlugin, PurchasesDelegate, CAPBridgedPlugin {
|
|
|
677
677
|
|
|
678
678
|
@objc func trackCustomPaywallImpression(_ call: CAPPluginCall) {
|
|
679
679
|
guard self.rejectIfPurchasesNotConfigured(call) else { return }
|
|
680
|
-
|
|
680
|
+
let data = (call.options as? [String: Any] ?? [:]).mappingNSNullToNil()
|
|
681
|
+
CommonFunctionality.trackCustomPaywallImpression(data)
|
|
681
682
|
call.resolve()
|
|
682
683
|
}
|
|
683
684
|
|
|
@@ -687,4 +688,24 @@ public class PurchasesPlugin: CAPPlugin, PurchasesDelegate, CAPBridgedPlugin {
|
|
|
687
688
|
}
|
|
688
689
|
self.lastReceivedCustomerInfo = customerInfo
|
|
689
690
|
}
|
|
691
|
+
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
private extension Dictionary where Key == String, Value == Any {
|
|
695
|
+
func mappingNSNullToNil() -> [String: Any] {
|
|
696
|
+
compactMapValues { valueByMappingNSNullToNil($0) }
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
private func valueByMappingNSNullToNil(_ value: Any) -> Any? {
|
|
701
|
+
switch value {
|
|
702
|
+
case is NSNull:
|
|
703
|
+
return nil
|
|
704
|
+
case let dictionary as [String: Any]:
|
|
705
|
+
return dictionary.mappingNSNullToNil()
|
|
706
|
+
case let array as [Any]:
|
|
707
|
+
return array.compactMap { valueByMappingNSNullToNil($0) }
|
|
708
|
+
default:
|
|
709
|
+
return value
|
|
710
|
+
}
|
|
690
711
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenuecat/purchases-capacitor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "Capacitor in-app purchases and subscriptions made easy. Support for iOS and Android.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -88,6 +88,6 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@revenuecat/purchases-typescript-internal-esm": "18.
|
|
91
|
+
"@revenuecat/purchases-typescript-internal-esm": "18.15.1"
|
|
92
92
|
}
|
|
93
93
|
}
|