@revenuecat/purchases-capacitor 11.0.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -54,6 +54,9 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
54
54
  <docgen-index>
55
55
 
56
56
  * [`configure(...)`](#configure)
57
+ * [`getVirtualCurrencies()`](#getvirtualcurrencies)
58
+ * [`invalidateVirtualCurrenciesCache()`](#invalidatevirtualcurrenciescache)
59
+ * [`getCachedVirtualCurrencies()`](#getcachedvirtualcurrencies)
57
60
  * [`parseAsWebPurchaseRedemption(...)`](#parseaswebpurchaseredemption)
58
61
  * [`redeemWebPurchase(...)`](#redeemwebpurchase)
59
62
  * [`setMockWebResults(...)`](#setmockwebresults)
@@ -144,6 +147,49 @@ Sets up Purchases with your API key and an app user id.
144
147
  --------------------
145
148
 
146
149
 
150
+ ### getVirtualCurrencies()
151
+
152
+ ```typescript
153
+ getVirtualCurrencies() => Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>
154
+ ```
155
+
156
+ Fetches the virtual currencies for the current subscriber.
157
+
158
+ **Returns:** <code>Promise&lt;{ virtualCurrencies: <a href="#purchasesvirtualcurrencies">PurchasesVirtualCurrencies</a>; }&gt;</code>
159
+
160
+ --------------------
161
+
162
+
163
+ ### invalidateVirtualCurrenciesCache()
164
+
165
+ ```typescript
166
+ invalidateVirtualCurrenciesCache() => Promise<void>
167
+ ```
168
+
169
+ Invalidates the cache for virtual currencies.
170
+
171
+ This is useful for cases where a virtual currency's balance might have been updated
172
+ outside of the app, like if you decreased a user's balance from the user spending a virtual currency,
173
+ or if you increased the balance from your backend using the server APIs.
174
+
175
+ --------------------
176
+
177
+
178
+ ### getCachedVirtualCurrencies()
179
+
180
+ ```typescript
181
+ getCachedVirtualCurrencies() => Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>
182
+ ```
183
+
184
+ The currently cached {@link <a href="#purchasesvirtualcurrencies">PurchasesVirtualCurrencies</a>} if one is available.
185
+ This value will remain null until virtual currencies have been fetched at
186
+ least once with {@link getVirtualCurrencies} or an equivalent function.
187
+
188
+ **Returns:** <code>Promise&lt;{ cachedVirtualCurrencies: <a href="#purchasesvirtualcurrencies">PurchasesVirtualCurrencies</a> | null; }&gt;</code>
189
+
190
+ --------------------
191
+
192
+
147
193
  ### parseAsWebPurchaseRedemption(...)
148
194
 
149
195
  ```typescript
@@ -1229,6 +1275,28 @@ Holds parameters to initialize the SDK.
1229
1275
  | **`diagnosticsEnabled`** | <code>boolean</code> | Enabling diagnostics will send some performance and debugging information from the SDK to RevenueCat's servers. Examples of this information include response times, cache hits or error codes. No personal identifiable information will be collected. The default value is false. |
1230
1276
 
1231
1277
 
1278
+ #### PurchasesVirtualCurrencies
1279
+
1280
+ The VirtualCurrencies object contains all the virtual currencies associated to the user.
1281
+
1282
+ | Prop | Type | Description |
1283
+ | --------- | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
1284
+ | **`all`** | <code>{ [key: string]: <a href="#purchasesvirtualcurrency">PurchasesVirtualCurrency</a>; }</code> | Map of all VirtualCurrency (<a href="#purchasesvirtualcurrency">`PurchasesVirtualCurrency`</a>) objects keyed by virtual currency code. |
1285
+
1286
+
1287
+ #### PurchasesVirtualCurrency
1288
+
1289
+ The VirtualCurrency object represents information about a virtual currency in the app.
1290
+ Use this object to access information about a virtual currency, such as its current balance.
1291
+
1292
+ | Prop | Type | Description |
1293
+ | ----------------------- | --------------------------- | ----------------------------------------------------------------------- |
1294
+ | **`balance`** | <code>number</code> | The virtual currency's balance. |
1295
+ | **`name`** | <code>string</code> | The virtual currency's name. |
1296
+ | **`code`** | <code>string</code> | The virtual currency's code. |
1297
+ | **`serverDescription`** | <code>string \| null</code> | The virtual currency's description defined in the RevenueCat dashboard. |
1298
+
1299
+
1232
1300
  #### CustomerInfo
1233
1301
 
1234
1302
  Type containing all information regarding the customer
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'PurchasesHybridCommon', '15.0.0'
16
+ s.dependency 'PurchasesHybridCommon', '16.1.0'
17
17
  s.swift_version = '5.1'
18
18
  end
@@ -56,7 +56,7 @@ dependencies {
56
56
  implementation fileTree(dir: 'libs', include: ['*.jar'])
57
57
  implementation project(':capacitor-android')
58
58
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
59
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:15.0.0'
59
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:16.1.0'
60
60
  testImplementation "junit:junit:$junitVersion"
61
61
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
62
62
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -32,11 +32,14 @@ import com.revenuecat.purchases.hybridcommon.canMakePayments as canMakePaymentsC
32
32
  import com.revenuecat.purchases.hybridcommon.checkTrialOrIntroductoryPriceEligibility as checkTrialOrIntroductoryPriceEligibilityCommon
33
33
  import com.revenuecat.purchases.hybridcommon.collectDeviceIdentifiers as collectDeviceIdentifiersCommon
34
34
  import com.revenuecat.purchases.hybridcommon.getAppUserID as getAppUserIDCommon
35
+ import com.revenuecat.purchases.hybridcommon.getCachedVirtualCurrencies as getCachedVirtualCurrenciesCommon
35
36
  import com.revenuecat.purchases.hybridcommon.getCurrentOfferingForPlacement as getCurrentOfferingForPlacementCommon
36
37
  import com.revenuecat.purchases.hybridcommon.getCustomerInfo as getCustomerInfoCommon
37
38
  import com.revenuecat.purchases.hybridcommon.getOfferings as getOfferingsCommon
38
39
  import com.revenuecat.purchases.hybridcommon.getStorefront as getStorefrontCommon
40
+ import com.revenuecat.purchases.hybridcommon.getVirtualCurrencies as getVirtualCurrenciesCommon
39
41
  import com.revenuecat.purchases.hybridcommon.invalidateCustomerInfoCache as invalidateCustomerInfoCacheCommon
42
+ import com.revenuecat.purchases.hybridcommon.invalidateVirtualCurrenciesCache as invalidateVirtualCurrenciesCacheCommon
40
43
  import com.revenuecat.purchases.hybridcommon.isAnonymous as isAnonymousCommon
41
44
  import com.revenuecat.purchases.hybridcommon.logIn as logInCommon
42
45
  import com.revenuecat.purchases.hybridcommon.logOut as logOutCommon
@@ -80,7 +83,7 @@ class PurchasesPlugin : Plugin() {
80
83
 
81
84
  companion object {
82
85
  private const val PLATFORM_NAME = "capacitor"
83
- private const val PLUGIN_VERSION = "11.0.0"
86
+ private const val PLUGIN_VERSION = "11.1.0"
84
87
 
85
88
  private const val CUSTOMER_INFO_KEY = "customerInfo"
86
89
  }
@@ -125,6 +128,25 @@ class PurchasesPlugin : Plugin() {
125
128
  call.resolve()
126
129
  }
127
130
 
131
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
132
+ fun getVirtualCurrencies(call: PluginCall) {
133
+ if (rejectIfNotConfigured(call)) return
134
+ getVirtualCurrenciesCommon(getOnResult(call, "virtualCurrencies"))
135
+ }
136
+
137
+ @PluginMethod(returnType = PluginMethod.RETURN_NONE)
138
+ fun invalidateVirtualCurrenciesCache(call: PluginCall) {
139
+ if (rejectIfNotConfigured(call)) return
140
+ invalidateVirtualCurrenciesCacheCommon()
141
+ call.resolve()
142
+ }
143
+
144
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
145
+ fun getCachedVirtualCurrencies(call: PluginCall) {
146
+ if (rejectIfNotConfigured(call)) return
147
+ call.resolveWithMap(mapOf("cachedVirtualCurrencies" to getCachedVirtualCurrenciesCommon()))
148
+ }
149
+
128
150
  @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
129
151
  fun parseAsWebPurchaseRedemption(call: PluginCall) {
130
152
  val urlString = call.getStringOrReject("urlString") ?: return
package/dist/docs.json CHANGED
@@ -28,6 +28,50 @@
28
28
  ],
29
29
  "slug": "configure"
30
30
  },
31
+ {
32
+ "name": "getVirtualCurrencies",
33
+ "signature": "() => Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>",
34
+ "parameters": [],
35
+ "returns": "Promise<{ virtualCurrencies: PurchasesVirtualCurrencies; }>",
36
+ "tags": [
37
+ {
38
+ "name": "returns",
39
+ "text": "A promise of a {@link PurchasesVirtualCurrencies} object.\nThe promise will be rejected if configure has not been called yet or if an error occurs while getting the virtual currencies."
40
+ }
41
+ ],
42
+ "docs": "Fetches the virtual currencies for the current subscriber.",
43
+ "complexTypes": [
44
+ "PurchasesVirtualCurrencies"
45
+ ],
46
+ "slug": "getvirtualcurrencies"
47
+ },
48
+ {
49
+ "name": "invalidateVirtualCurrenciesCache",
50
+ "signature": "() => Promise<void>",
51
+ "parameters": [],
52
+ "returns": "Promise<void>",
53
+ "tags": [],
54
+ "docs": "Invalidates the cache for virtual currencies.\n\nThis is useful for cases where a virtual currency's balance might have been updated\noutside of the app, like if you decreased a user's balance from the user spending a virtual currency,\nor if you increased the balance from your backend using the server APIs.",
55
+ "complexTypes": [],
56
+ "slug": "invalidatevirtualcurrenciescache"
57
+ },
58
+ {
59
+ "name": "getCachedVirtualCurrencies",
60
+ "signature": "() => Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>",
61
+ "parameters": [],
62
+ "returns": "Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null; }>",
63
+ "tags": [
64
+ {
65
+ "name": "returns",
66
+ "text": "The currently cached virtual currencies for the current subscriber.\nThe promise will be rejected if configure has not been called yet or there's an error."
67
+ }
68
+ ],
69
+ "docs": "The currently cached {@link PurchasesVirtualCurrencies} if one is available.\nThis value will remain null until virtual currencies have been fetched at\nleast once with {@link getVirtualCurrencies} or an equivalent function.",
70
+ "complexTypes": [
71
+ "PurchasesVirtualCurrencies"
72
+ ],
73
+ "slug": "getcachedvirtualcurrencies"
74
+ },
31
75
  {
32
76
  "name": "parseAsWebPurchaseRedemption",
33
77
  "signature": "(options: { urlString: string; }) => Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>",
@@ -1636,6 +1680,69 @@
1636
1680
  }
1637
1681
  ]
1638
1682
  },
1683
+ {
1684
+ "name": "PurchasesVirtualCurrencies",
1685
+ "slug": "purchasesvirtualcurrencies",
1686
+ "docs": "The VirtualCurrencies object contains all the virtual currencies associated to the user.",
1687
+ "tags": [
1688
+ {
1689
+ "name": "public"
1690
+ }
1691
+ ],
1692
+ "methods": [],
1693
+ "properties": [
1694
+ {
1695
+ "name": "all",
1696
+ "tags": [],
1697
+ "docs": "Map of all VirtualCurrency (`PurchasesVirtualCurrency`) objects keyed by virtual currency code.",
1698
+ "complexTypes": [
1699
+ "PurchasesVirtualCurrency"
1700
+ ],
1701
+ "type": "{ [key: string]: PurchasesVirtualCurrency; }"
1702
+ }
1703
+ ]
1704
+ },
1705
+ {
1706
+ "name": "PurchasesVirtualCurrency",
1707
+ "slug": "purchasesvirtualcurrency",
1708
+ "docs": "The VirtualCurrency object represents information about a virtual currency in the app.\nUse this object to access information about a virtual currency, such as its current balance.",
1709
+ "tags": [
1710
+ {
1711
+ "name": "public"
1712
+ }
1713
+ ],
1714
+ "methods": [],
1715
+ "properties": [
1716
+ {
1717
+ "name": "balance",
1718
+ "tags": [],
1719
+ "docs": "The virtual currency's balance.",
1720
+ "complexTypes": [],
1721
+ "type": "number"
1722
+ },
1723
+ {
1724
+ "name": "name",
1725
+ "tags": [],
1726
+ "docs": "The virtual currency's name.",
1727
+ "complexTypes": [],
1728
+ "type": "string"
1729
+ },
1730
+ {
1731
+ "name": "code",
1732
+ "tags": [],
1733
+ "docs": "The virtual currency's code.",
1734
+ "complexTypes": [],
1735
+ "type": "string"
1736
+ },
1737
+ {
1738
+ "name": "serverDescription",
1739
+ "tags": [],
1740
+ "docs": "The virtual currency's description defined in the RevenueCat dashboard.",
1741
+ "complexTypes": [],
1742
+ "type": "string | null"
1743
+ }
1744
+ ]
1745
+ },
1639
1746
  {
1640
1747
  "name": "CustomerInfo",
1641
1748
  "slug": "customerinfo",
@@ -1,4 +1,4 @@
1
- import type { BILLING_FEATURE, CustomerInfo, CustomerInfoUpdateListener, GoogleProductChangeInfo, IN_APP_MESSAGE_TYPE, IntroEligibility, LOG_LEVEL, LogHandler, LogInResult, MakePurchaseResult, PRODUCT_CATEGORY, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOffering, PurchasesOfferings, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreProductDiscount, PurchasesStoreTransaction, PurchasesWinBackOffer, REFUND_REQUEST_STATUS, Storefront, SubscriptionOption, WebPurchaseRedemption, WebPurchaseRedemptionResult } from '@revenuecat/purchases-typescript-internal-esm';
1
+ import type { BILLING_FEATURE, CustomerInfo, CustomerInfoUpdateListener, GoogleProductChangeInfo, IN_APP_MESSAGE_TYPE, IntroEligibility, LOG_LEVEL, LogHandler, LogInResult, MakePurchaseResult, PRODUCT_CATEGORY, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOffering, PurchasesOfferings, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreProductDiscount, PurchasesStoreTransaction, PurchasesVirtualCurrencies, PurchasesWinBackOffer, REFUND_REQUEST_STATUS, Storefront, SubscriptionOption, WebPurchaseRedemption, WebPurchaseRedemptionResult } from '@revenuecat/purchases-typescript-internal-esm';
2
2
  export * from '@revenuecat/purchases-typescript-internal-esm';
3
3
  export declare type PurchasesCallbackId = string;
4
4
  export interface GetProductOptions {
@@ -156,6 +156,34 @@ export interface PurchasesPlugin {
156
156
  * @param {PurchasesConfiguration} configuration RevenueCat configuration object including the API key and other optional parameters. See {@link PurchasesConfiguration}
157
157
  */
158
158
  configure(configuration: PurchasesConfiguration): Promise<void>;
159
+ /**
160
+ * Fetches the virtual currencies for the current subscriber.
161
+ *
162
+ * @returns {Promise<{ virtualCurrencies: PurchasesVirtualCurrencies }>} A promise of a {@link PurchasesVirtualCurrencies} object.
163
+ * The promise will be rejected if configure has not been called yet or if an error occurs while getting the virtual currencies.
164
+ */
165
+ getVirtualCurrencies(): Promise<{
166
+ virtualCurrencies: PurchasesVirtualCurrencies;
167
+ }>;
168
+ /**
169
+ * Invalidates the cache for virtual currencies.
170
+ *
171
+ * This is useful for cases where a virtual currency's balance might have been updated
172
+ * outside of the app, like if you decreased a user's balance from the user spending a virtual currency,
173
+ * or if you increased the balance from your backend using the server APIs.
174
+ */
175
+ invalidateVirtualCurrenciesCache(): Promise<void>;
176
+ /**
177
+ * The currently cached {@link PurchasesVirtualCurrencies} if one is available.
178
+ * This value will remain null until virtual currencies have been fetched at
179
+ * least once with {@link getVirtualCurrencies} or an equivalent function.
180
+ *
181
+ * @returns {Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null }>} The currently cached virtual currencies for the current subscriber.
182
+ * The promise will be rejected if configure has not been called yet or there's an error.
183
+ */
184
+ getCachedVirtualCurrencies(): Promise<{
185
+ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null;
186
+ }>;
159
187
  /**
160
188
  * Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.
161
189
  * @param options Set the urlString used to open the App.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA6BA,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 PurchasesWinBackOffer,\n REFUND_REQUEST_STATUS,\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 */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedProductOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface 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 */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseSubscriptionOptionOptions {\n /**\n * The SubscriptionOption you wish to purchase. You can get the SubscriptionOption from StoreProducts by calling getOfferings\n */\n subscriptionOption: SubscriptionOption;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedPackageOptions {\n /**\n * The Package you wish to purchase. You can get the Packages by calling getOfferings\n */\n aPackage: PurchasesPackage;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface 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 * 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"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA8BA,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 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 */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedProductOptions {\n /**\n * The product you want to purchase\n */\n product: PurchasesStoreProduct;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface 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 */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseSubscriptionOptionOptions {\n /**\n * The SubscriptionOption you wish to purchase. You can get the SubscriptionOption from StoreProducts by calling getOfferings\n */\n subscriptionOption: SubscriptionOption;\n /**\n * Android only. Optional GoogleProductChangeInfo you\n * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.\n */\n googleProductChangeInfo?: GoogleProductChangeInfo | null;\n /**\n * Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.\n * For compliance with EU regulations. User will see \"This price has been customized for you\" in the purchase dialog when true.\n * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.\n */\n googleIsPersonalizedPrice?: boolean | null;\n}\n\nexport interface PurchaseDiscountedPackageOptions {\n /**\n * The Package you wish to purchase. You can get the Packages by calling getOfferings\n */\n aPackage: PurchasesPackage;\n /**\n * Discount to apply to this package. Retrieve this discount using getPromotionalOffer.\n */\n discount: PurchasesPromotionalOffer;\n}\n\nexport interface 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"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { BILLING_FEATURE, CustomerInfo, CustomerInfoUpdateListener, IN_APP_MESSAGE_TYPE, IntroEligibility, LOG_LEVEL, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOffering, PurchasesOfferings, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreTransaction, PurchasesWinBackOffer, ShouldPurchasePromoProductListener, Storefront, WebPurchaseRedemption, WebPurchaseRedemptionResult } from '@revenuecat/purchases-typescript-internal-esm';
2
+ import type { BILLING_FEATURE, CustomerInfo, CustomerInfoUpdateListener, IN_APP_MESSAGE_TYPE, IntroEligibility, LOG_LEVEL, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOffering, PurchasesOfferings, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreTransaction, PurchasesVirtualCurrencies, PurchasesWinBackOffer, ShouldPurchasePromoProductListener, Storefront, WebPurchaseRedemption, WebPurchaseRedemptionResult } from '@revenuecat/purchases-typescript-internal-esm';
3
3
  import { REFUND_REQUEST_STATUS } from '@revenuecat/purchases-typescript-internal-esm';
4
4
  import type { GetEligibleWinBackOffersForPackageOptions, GetEligibleWinBackOffersForProductOptions, GetProductOptions, GetPromotionalOfferOptions, PurchaseDiscountedPackageOptions, PurchaseDiscountedProductOptions, PurchasePackageOptions, PurchasePackageWithWinBackOfferOptions, PurchaseProductWithWinBackOfferOptions, PurchasesPlugin, PurchaseStoreProductOptions, PurchaseSubscriptionOptionOptions, SyncAmazonPurchaseOptions, SyncObserverModeAmazonPurchaseOptions } from './definitions';
5
5
  export declare class PurchasesWeb extends WebPlugin implements PurchasesPlugin {
@@ -182,7 +182,15 @@ export declare class PurchasesWeb extends WebPlugin implements PurchasesPlugin {
182
182
  isConfigured(): Promise<{
183
183
  isConfigured: boolean;
184
184
  }>;
185
+ getVirtualCurrencies(): Promise<{
186
+ virtualCurrencies: PurchasesVirtualCurrencies;
187
+ }>;
188
+ invalidateVirtualCurrenciesCache(): Promise<void>;
189
+ getCachedVirtualCurrencies(): Promise<{
190
+ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null;
191
+ }>;
185
192
  private mockEmptyCustomerInfo;
193
+ private mockEmptyVirtualCurrencies;
186
194
  private mockTransaction;
187
195
  private mockNonReturningFunctionIfEnabled;
188
196
  private mockReturningFunctionIfEnabled;
package/dist/esm/web.js CHANGED
@@ -27,6 +27,9 @@ export class PurchasesWeb extends WebPlugin {
27
27
  nonSubscriptionTransactions: [],
28
28
  subscriptionsByProductIdentifier: {},
29
29
  };
30
+ this.mockEmptyVirtualCurrencies = {
31
+ all: {},
32
+ };
30
33
  }
31
34
  configure(_configuration) {
32
35
  return this.mockNonReturningFunctionIfEnabled('configure');
@@ -300,6 +303,19 @@ export class PurchasesWeb extends WebPlugin {
300
303
  const mockResult = { isConfigured: true };
301
304
  return this.mockReturningFunctionIfEnabled('isConfigured', mockResult);
302
305
  }
306
+ getVirtualCurrencies() {
307
+ return this.mockReturningFunctionIfEnabled('getVirtualCurrencies', {
308
+ virtualCurrencies: this.mockEmptyVirtualCurrencies,
309
+ });
310
+ }
311
+ invalidateVirtualCurrenciesCache() {
312
+ return this.mockNonReturningFunctionIfEnabled('invalidateVirtualCurrenciesCache');
313
+ }
314
+ getCachedVirtualCurrencies() {
315
+ return this.mockReturningFunctionIfEnabled('getCachedVirtualCurrencies', {
316
+ cachedVirtualCurrencies: this.mockEmptyVirtualCurrencies,
317
+ });
318
+ }
303
319
  mockTransaction(productIdentifier) {
304
320
  return {
305
321
  productIdentifier: productIdentifier,
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAwB5C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,+CAA+C,CAAC;AAmBvD,MAAM,OAAO,YAAa,SAAQ,SAAS;IAA3C;;QACU,yBAAoB,GAAG,KAAK,CAAC;QAC7B,gCAA2B,GAAG,mCAAmC,CAAC;QA6S1E,eAAe;QAEP,0BAAqB,GAAiB;YAC5C,YAAY,EAAE;gBACZ,GAAG,EAAE,EAAE;gBACP,MAAM,EAAE,EAAE;gBACV,YAAY,EAAE,mBAAmB,CAAC,aAAa;aAChD;YACD,mBAAmB,EAAE,EAAE;YACvB,8BAA8B,EAAE,EAAE;YAClC,oBAAoB,EAAE,IAAI;YAC1B,SAAS,EAAE,0BAA0B;YACrC,iBAAiB,EAAE,kBAAkB;YACrC,WAAW,EAAE,0BAA0B;YACvC,kBAAkB,EAAE,EAAE;YACtB,gBAAgB,EAAE,EAAE;YACpB,0BAA0B,EAAE,IAAI;YAChC,oBAAoB,EAAE,IAAI;YAC1B,aAAa,EAAE,IAAI;YACnB,2BAA2B,EAAE,EAAE;YAC/B,gCAAgC,EAAE,EAAE;SACrC,CAAC;IAyBJ,CAAC;IAzVC,SAAS,CAAC,cAAsC;QAC9C,OAAO,IAAI,CAAC,iCAAiC,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,4BAA4B,CAAC,QAA+B;QAG1D,OAAO,IAAI,CAAC,8BAA8B,CAAC,8BAA8B,EAAE,EAAE,qBAAqB,EAA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sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { WebPlugin } from '@capacitor/core';\nimport type {\n BILLING_FEATURE,\n CustomerInfo,\n CustomerInfoUpdateListener,\n IN_APP_MESSAGE_TYPE,\n IntroEligibility,\n LOG_LEVEL,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOffering,\n PurchasesOfferings,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreTransaction,\n PurchasesWinBackOffer,\n ShouldPurchasePromoProductListener,\n Storefront,\n WebPurchaseRedemption,\n WebPurchaseRedemptionResult,\n} from '@revenuecat/purchases-typescript-internal-esm';\nimport {\n REFUND_REQUEST_STATUS,\n VERIFICATION_RESULT,\n WebPurchaseRedemptionResultType,\n} from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n GetEligibleWinBackOffersForPackageOptions,\n GetEligibleWinBackOffersForProductOptions,\n GetProductOptions,\n GetPromotionalOfferOptions,\n PurchaseDiscountedPackageOptions,\n PurchaseDiscountedProductOptions,\n PurchasePackageOptions,\n PurchasePackageWithWinBackOfferOptions,\n PurchaseProductWithWinBackOfferOptions,\n PurchasesPlugin,\n PurchaseStoreProductOptions,\n PurchaseSubscriptionOptionOptions,\n SyncAmazonPurchaseOptions,\n SyncObserverModeAmazonPurchaseOptions,\n} from './definitions';\n\nexport class PurchasesWeb extends WebPlugin implements PurchasesPlugin {\n private shouldMockWebResults = false;\n private webNotSupportedErrorMessage = 'Web not supported in this plugin.';\n\n configure(_configuration: PurchasesConfiguration): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('configure');\n }\n\n parseAsWebPurchaseRedemption(_options: { urlString: string }): Promise<{\n webPurchaseRedemption: WebPurchaseRedemption | null;\n }> {\n return this.mockReturningFunctionIfEnabled('parseAsWebPurchaseRedemption', { webPurchaseRedemption: null });\n }\n\n redeemWebPurchase(_options: { webPurchaseRedemption: WebPurchaseRedemption }): Promise<WebPurchaseRedemptionResult> {\n return this.mockReturningFunctionIfEnabled('redeemWebPurchase', {\n result: WebPurchaseRedemptionResultType.INVALID_TOKEN,\n });\n }\n\n setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void> {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n\n setSimulatesAskToBuyInSandbox(_simulatesAskToBuyInSandbox: { simulatesAskToBuyInSandbox: boolean }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setSimulatesAskToBuyInSandbox');\n }\n addCustomerInfoUpdateListener(_customerInfoUpdateListener: CustomerInfoUpdateListener): Promise<string> {\n return this.mockReturningFunctionIfEnabled('addCustomerInfoUpdateListener', 'mock-callback-id');\n }\n removeCustomerInfoUpdateListener(_options: { listenerToRemove: string }): Promise<{ wasRemoved: boolean }> {\n return this.mockReturningFunctionIfEnabled('removeCustomerInfoUpdateListener', { wasRemoved: false });\n }\n addShouldPurchasePromoProductListener(\n _shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener,\n ): Promise<string> {\n return this.mockReturningFunctionIfEnabled('addShouldPurchasePromoProductListener', 'mock-callback-id');\n }\n removeShouldPurchasePromoProductListener(_listenerToRemove: string): Promise<{ wasRemoved: boolean }> {\n return this.mockReturningFunctionIfEnabled('removeShouldPurchasePromoProductListener', { wasRemoved: false });\n }\n getOfferings(): Promise<PurchasesOfferings> {\n const mockOfferings: PurchasesOfferings = {\n all: {},\n current: null,\n };\n return this.mockReturningFunctionIfEnabled('getOfferings', mockOfferings);\n }\n getCurrentOfferingForPlacement(_options: { placementIdentifier: string }): Promise<PurchasesOffering | null> {\n const mockOffering: PurchasesOffering | null = null;\n return this.mockReturningFunctionIfEnabled('getCurrentOfferingForPlacement', mockOffering);\n }\n syncAttributesAndOfferingsIfNeeded(): Promise<PurchasesOfferings> {\n const mockOfferings: PurchasesOfferings = {\n all: {},\n current: null,\n };\n return this.mockReturningFunctionIfEnabled('syncAttributesAndOfferingsIfNeeded', mockOfferings);\n }\n getProducts(_options: GetProductOptions): Promise<{ products: PurchasesStoreProduct[] }> {\n const mockProducts = { products: [] };\n return this.mockReturningFunctionIfEnabled('getProducts', mockProducts);\n }\n purchaseStoreProduct(_options: PurchaseStoreProductOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchaseStoreProduct', mockPurchaseResult);\n }\n purchaseDiscountedProduct(_options: PurchaseDiscountedProductOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchaseDiscountedProduct', mockPurchaseResult);\n }\n purchasePackage(_options: PurchasePackageOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.aPackage.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.aPackage.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchasePackage', mockPurchaseResult);\n }\n purchaseSubscriptionOption(_options: PurchaseSubscriptionOptionOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.subscriptionOption.productId,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.subscriptionOption.productId),\n };\n return this.mockReturningFunctionIfEnabled('purchaseSubscriptionOption', mockPurchaseResult);\n }\n purchaseDiscountedPackage(_options: PurchaseDiscountedPackageOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.aPackage.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.aPackage.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchaseDiscountedPackage', mockPurchaseResult);\n }\n restorePurchases(): Promise<{ customerInfo: CustomerInfo }> {\n const mockResponse = { customerInfo: this.mockEmptyCustomerInfo };\n return this.mockReturningFunctionIfEnabled('restorePurchases', mockResponse);\n }\n recordPurchase(options: { productID: string }): Promise<{ transaction: PurchasesStoreTransaction }> {\n const mockResponse = {\n transaction: this.mockTransaction(options.productID),\n };\n return this.mockReturningFunctionIfEnabled('recordPurchase', mockResponse);\n }\n getAppUserID(): Promise<{ appUserID: string }> {\n return this.mockReturningFunctionIfEnabled('getAppUserID', {\n appUserID: 'test-web-user-id',\n });\n }\n getStorefront(): Promise<Storefront> {\n return this.mockReturningFunctionIfEnabled('getStorefront', {\n countryCode: 'USA',\n });\n }\n logIn(_appUserID: { appUserID: string }): Promise<LogInResult> {\n const mockLogInResult: LogInResult = {\n customerInfo: this.mockEmptyCustomerInfo,\n created: false,\n };\n return this.mockReturningFunctionIfEnabled('logIn', mockLogInResult);\n }\n logOut(): Promise<{ customerInfo: CustomerInfo }> {\n const mockResponse = { customerInfo: this.mockEmptyCustomerInfo };\n return this.mockReturningFunctionIfEnabled('logOut', mockResponse);\n }\n setLogLevel(_level: { level: LOG_LEVEL }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setLogLevel');\n }\n setLogHandler(_logHandler: LogHandler): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setLogHandler');\n }\n getCustomerInfo(): Promise<{ customerInfo: CustomerInfo }> {\n const mockResponse = { customerInfo: this.mockEmptyCustomerInfo };\n return this.mockReturningFunctionIfEnabled('getCustomerInfo', mockResponse);\n }\n syncPurchases(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('syncPurchases');\n }\n syncObserverModeAmazonPurchase(_options: SyncObserverModeAmazonPurchaseOptions): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('syncObserverModeAmazonPurchase');\n }\n syncAmazonPurchase(_options: SyncAmazonPurchaseOptions): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('syncAmazonPurchase');\n }\n enableAdServicesAttributionTokenCollection(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('enableAdServicesAttributionTokenCollection');\n }\n isAnonymous(): Promise<{ isAnonymous: boolean }> {\n const mockResponse = { isAnonymous: false };\n return this.mockReturningFunctionIfEnabled('isAnonymous', mockResponse);\n }\n checkTrialOrIntroductoryPriceEligibility(_productIdentifiers: {\n productIdentifiers: string[];\n }): Promise<{ [productId: string]: IntroEligibility }> {\n return this.mockReturningFunctionIfEnabled('checkTrialOrIntroductoryPriceEligibility', {});\n }\n getPromotionalOffer(_options: GetPromotionalOfferOptions): Promise<PurchasesPromotionalOffer | undefined> {\n return this.mockReturningFunctionIfEnabled('getPromotionalOffer', undefined);\n }\n getEligibleWinBackOffersForProduct(\n _options: GetEligibleWinBackOffersForProductOptions,\n ): Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> {\n return this.mockReturningFunctionIfEnabled('getEligibleWinBackOffersForProduct', { eligibleWinBackOffers: [] });\n }\n getEligibleWinBackOffersForPackage(\n _options: GetEligibleWinBackOffersForPackageOptions,\n ): Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> {\n return this.mockReturningFunctionIfEnabled('getEligibleWinBackOffersForPackage', { eligibleWinBackOffers: [] });\n }\n purchaseProductWithWinBackOffer(\n _options: PurchaseProductWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | undefined> {\n return this.mockReturningFunctionIfEnabled('purchaseProductWithWinBackOffer', undefined);\n }\n purchasePackageWithWinBackOffer(\n _options: PurchasePackageWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | undefined> {\n return this.mockReturningFunctionIfEnabled('purchasePackageWithWinBackOffer', undefined);\n }\n invalidateCustomerInfoCache(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('invalidateCustomerInfoCache');\n }\n presentCodeRedemptionSheet(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('presentCodeRedemptionSheet');\n }\n setAttributes(_attributes: { [key: string]: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAttributes');\n }\n setEmail(_email: { email: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setEmail');\n }\n setPhoneNumber(_phoneNumber: { phoneNumber: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setPhoneNumber');\n }\n setDisplayName(_displayName: { displayName: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setDisplayName');\n }\n setPushToken(_pushToken: { pushToken: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setPushToken');\n }\n setProxyURL(_url: { url: string }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setProxyURL');\n }\n collectDeviceIdentifiers(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('collectDeviceIdentifiers');\n }\n setAdjustID(_adjustID: { adjustID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAdjustID');\n }\n setAppsflyerID(_appsflyerID: { appsflyerID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAppsflyerID');\n }\n setFBAnonymousID(_fbAnonymousID: { fbAnonymousID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setFBAnonymousID');\n }\n setMparticleID(_mparticleID: { mparticleID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setMparticleID');\n }\n setCleverTapID(_cleverTapID: { cleverTapID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setCleverTapID');\n }\n setMixpanelDistinctID(_mixpanelDistinctID: { mixpanelDistinctID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setMixpanelDistinctID');\n }\n setFirebaseAppInstanceID(_firebaseAppInstanceID: { firebaseAppInstanceID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setFirebaseAppInstanceID');\n }\n setOnesignalID(_onesignalID: { onesignalID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setOnesignalID');\n }\n setOnesignalUserID(_onesignalUserID: { onesignalUserID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setOnesignalUserID');\n }\n setAirshipChannelID(_airshipChannelID: { airshipChannelID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAirshipChannelID');\n }\n setMediaSource(_mediaSource: { mediaSource: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setMediaSource');\n }\n setCampaign(_campaign: { campaign: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setCampaign');\n }\n setAdGroup(_adGroup: { adGroup: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAdGroup');\n }\n setAd(_ad: { ad: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAd');\n }\n setKeyword(_keyword: { keyword: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setKeyword');\n }\n setCreative(_creative: { creative: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setCreative');\n }\n canMakePayments(_features?: { features?: BILLING_FEATURE[] }): Promise<{ canMakePayments: boolean }> {\n return this.mockReturningFunctionIfEnabled('canMakePayments', {\n canMakePayments: true,\n });\n }\n beginRefundRequestForActiveEntitlement(): Promise<{\n refundRequestStatus: REFUND_REQUEST_STATUS;\n }> {\n const mockResult = {\n refundRequestStatus: REFUND_REQUEST_STATUS.USER_CANCELLED,\n };\n return this.mockReturningFunctionIfEnabled('beginRefundRequestForActiveEntitlement', mockResult);\n }\n beginRefundRequestForEntitlement(_entitlementInfo: {\n entitlementInfo: PurchasesEntitlementInfo;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }> {\n const mockResult = {\n refundRequestStatus: REFUND_REQUEST_STATUS.USER_CANCELLED,\n };\n return this.mockReturningFunctionIfEnabled('beginRefundRequestForEntitlement', mockResult);\n }\n beginRefundRequestForProduct(_storeProduct: {\n storeProduct: PurchasesStoreProduct;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }> {\n const mockResult = {\n refundRequestStatus: REFUND_REQUEST_STATUS.USER_CANCELLED,\n };\n return this.mockReturningFunctionIfEnabled('beginRefundRequestForProduct', mockResult);\n }\n\n showInAppMessages(_options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('showInAppMessages');\n }\n\n isConfigured(): Promise<{ isConfigured: boolean }> {\n const mockResult = { isConfigured: true };\n return this.mockReturningFunctionIfEnabled('isConfigured', mockResult);\n }\n\n // Mock helpers\n\n private mockEmptyCustomerInfo: CustomerInfo = {\n entitlements: {\n all: {},\n active: {},\n verification: VERIFICATION_RESULT.NOT_REQUESTED,\n },\n activeSubscriptions: [],\n allPurchasedProductIdentifiers: [],\n latestExpirationDate: null,\n firstSeen: '2023-08-31T15:11:21.445Z',\n originalAppUserId: 'mock-web-user-id',\n requestDate: '2023-08-31T15:11:21.445Z',\n allExpirationDates: {},\n allPurchaseDates: {},\n originalApplicationVersion: null,\n originalPurchaseDate: null,\n managementURL: null,\n nonSubscriptionTransactions: [],\n subscriptionsByProductIdentifier: {},\n };\n\n private mockTransaction(productIdentifier: string): PurchasesStoreTransaction {\n return {\n productIdentifier: productIdentifier,\n purchaseDate: new Date().toISOString(),\n transactionIdentifier: '',\n };\n }\n\n private mockNonReturningFunctionIfEnabled(functionName: string): Promise<void> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n\n private mockReturningFunctionIfEnabled<T>(functionName: string, returnValue: T): Promise<T> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`);\n return Promise.resolve(returnValue);\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mapp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AI,CAAC,2BAA2B,CAAC,CAAC;SACzD;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,6DAA6D,CAAC,CAAC;QAC1F,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { WebPlugin } from '@capacitor/core';\nimport type {\n BILLING_FEATURE,\n CustomerInfo,\n CustomerInfoUpdateListener,\n IN_APP_MESSAGE_TYPE,\n IntroEligibility,\n LOG_LEVEL,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOffering,\n PurchasesOfferings,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreTransaction,\n PurchasesVirtualCurrencies,\n PurchasesWinBackOffer,\n ShouldPurchasePromoProductListener,\n Storefront,\n WebPurchaseRedemption,\n WebPurchaseRedemptionResult,\n} from '@revenuecat/purchases-typescript-internal-esm';\nimport {\n REFUND_REQUEST_STATUS,\n VERIFICATION_RESULT,\n WebPurchaseRedemptionResultType,\n} from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n GetEligibleWinBackOffersForPackageOptions,\n GetEligibleWinBackOffersForProductOptions,\n GetProductOptions,\n GetPromotionalOfferOptions,\n PurchaseDiscountedPackageOptions,\n PurchaseDiscountedProductOptions,\n PurchasePackageOptions,\n PurchasePackageWithWinBackOfferOptions,\n PurchaseProductWithWinBackOfferOptions,\n PurchasesPlugin,\n PurchaseStoreProductOptions,\n PurchaseSubscriptionOptionOptions,\n SyncAmazonPurchaseOptions,\n SyncObserverModeAmazonPurchaseOptions,\n} from './definitions';\n\nexport class PurchasesWeb extends WebPlugin implements PurchasesPlugin {\n private shouldMockWebResults = false;\n private webNotSupportedErrorMessage = 'Web not supported in this plugin.';\n\n configure(_configuration: PurchasesConfiguration): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('configure');\n }\n\n parseAsWebPurchaseRedemption(_options: { urlString: string }): Promise<{\n webPurchaseRedemption: WebPurchaseRedemption | null;\n }> {\n return this.mockReturningFunctionIfEnabled('parseAsWebPurchaseRedemption', { webPurchaseRedemption: null });\n }\n\n redeemWebPurchase(_options: { webPurchaseRedemption: WebPurchaseRedemption }): Promise<WebPurchaseRedemptionResult> {\n return this.mockReturningFunctionIfEnabled('redeemWebPurchase', {\n result: WebPurchaseRedemptionResultType.INVALID_TOKEN,\n });\n }\n\n setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void> {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n\n setSimulatesAskToBuyInSandbox(_simulatesAskToBuyInSandbox: { simulatesAskToBuyInSandbox: boolean }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setSimulatesAskToBuyInSandbox');\n }\n addCustomerInfoUpdateListener(_customerInfoUpdateListener: CustomerInfoUpdateListener): Promise<string> {\n return this.mockReturningFunctionIfEnabled('addCustomerInfoUpdateListener', 'mock-callback-id');\n }\n removeCustomerInfoUpdateListener(_options: { listenerToRemove: string }): Promise<{ wasRemoved: boolean }> {\n return this.mockReturningFunctionIfEnabled('removeCustomerInfoUpdateListener', { wasRemoved: false });\n }\n addShouldPurchasePromoProductListener(\n _shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener,\n ): Promise<string> {\n return this.mockReturningFunctionIfEnabled('addShouldPurchasePromoProductListener', 'mock-callback-id');\n }\n removeShouldPurchasePromoProductListener(_listenerToRemove: string): Promise<{ wasRemoved: boolean }> {\n return this.mockReturningFunctionIfEnabled('removeShouldPurchasePromoProductListener', { wasRemoved: false });\n }\n getOfferings(): Promise<PurchasesOfferings> {\n const mockOfferings: PurchasesOfferings = {\n all: {},\n current: null,\n };\n return this.mockReturningFunctionIfEnabled('getOfferings', mockOfferings);\n }\n getCurrentOfferingForPlacement(_options: { placementIdentifier: string }): Promise<PurchasesOffering | null> {\n const mockOffering: PurchasesOffering | null = null;\n return this.mockReturningFunctionIfEnabled('getCurrentOfferingForPlacement', mockOffering);\n }\n syncAttributesAndOfferingsIfNeeded(): Promise<PurchasesOfferings> {\n const mockOfferings: PurchasesOfferings = {\n all: {},\n current: null,\n };\n return this.mockReturningFunctionIfEnabled('syncAttributesAndOfferingsIfNeeded', mockOfferings);\n }\n getProducts(_options: GetProductOptions): Promise<{ products: PurchasesStoreProduct[] }> {\n const mockProducts = { products: [] };\n return this.mockReturningFunctionIfEnabled('getProducts', mockProducts);\n }\n purchaseStoreProduct(_options: PurchaseStoreProductOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchaseStoreProduct', mockPurchaseResult);\n }\n purchaseDiscountedProduct(_options: PurchaseDiscountedProductOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchaseDiscountedProduct', mockPurchaseResult);\n }\n purchasePackage(_options: PurchasePackageOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.aPackage.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.aPackage.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchasePackage', mockPurchaseResult);\n }\n purchaseSubscriptionOption(_options: PurchaseSubscriptionOptionOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.subscriptionOption.productId,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.subscriptionOption.productId),\n };\n return this.mockReturningFunctionIfEnabled('purchaseSubscriptionOption', mockPurchaseResult);\n }\n purchaseDiscountedPackage(_options: PurchaseDiscountedPackageOptions): Promise<MakePurchaseResult> {\n const mockPurchaseResult: MakePurchaseResult = {\n productIdentifier: _options.aPackage.product.identifier,\n customerInfo: this.mockEmptyCustomerInfo,\n transaction: this.mockTransaction(_options.aPackage.product.identifier),\n };\n return this.mockReturningFunctionIfEnabled('purchaseDiscountedPackage', mockPurchaseResult);\n }\n restorePurchases(): Promise<{ customerInfo: CustomerInfo }> {\n const mockResponse = { customerInfo: this.mockEmptyCustomerInfo };\n return this.mockReturningFunctionIfEnabled('restorePurchases', mockResponse);\n }\n recordPurchase(options: { productID: string }): Promise<{ transaction: PurchasesStoreTransaction }> {\n const mockResponse = {\n transaction: this.mockTransaction(options.productID),\n };\n return this.mockReturningFunctionIfEnabled('recordPurchase', mockResponse);\n }\n getAppUserID(): Promise<{ appUserID: string }> {\n return this.mockReturningFunctionIfEnabled('getAppUserID', {\n appUserID: 'test-web-user-id',\n });\n }\n getStorefront(): Promise<Storefront> {\n return this.mockReturningFunctionIfEnabled('getStorefront', {\n countryCode: 'USA',\n });\n }\n logIn(_appUserID: { appUserID: string }): Promise<LogInResult> {\n const mockLogInResult: LogInResult = {\n customerInfo: this.mockEmptyCustomerInfo,\n created: false,\n };\n return this.mockReturningFunctionIfEnabled('logIn', mockLogInResult);\n }\n logOut(): Promise<{ customerInfo: CustomerInfo }> {\n const mockResponse = { customerInfo: this.mockEmptyCustomerInfo };\n return this.mockReturningFunctionIfEnabled('logOut', mockResponse);\n }\n setLogLevel(_level: { level: LOG_LEVEL }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setLogLevel');\n }\n setLogHandler(_logHandler: LogHandler): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setLogHandler');\n }\n getCustomerInfo(): Promise<{ customerInfo: CustomerInfo }> {\n const mockResponse = { customerInfo: this.mockEmptyCustomerInfo };\n return this.mockReturningFunctionIfEnabled('getCustomerInfo', mockResponse);\n }\n syncPurchases(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('syncPurchases');\n }\n syncObserverModeAmazonPurchase(_options: SyncObserverModeAmazonPurchaseOptions): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('syncObserverModeAmazonPurchase');\n }\n syncAmazonPurchase(_options: SyncAmazonPurchaseOptions): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('syncAmazonPurchase');\n }\n enableAdServicesAttributionTokenCollection(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('enableAdServicesAttributionTokenCollection');\n }\n isAnonymous(): Promise<{ isAnonymous: boolean }> {\n const mockResponse = { isAnonymous: false };\n return this.mockReturningFunctionIfEnabled('isAnonymous', mockResponse);\n }\n checkTrialOrIntroductoryPriceEligibility(_productIdentifiers: {\n productIdentifiers: string[];\n }): Promise<{ [productId: string]: IntroEligibility }> {\n return this.mockReturningFunctionIfEnabled('checkTrialOrIntroductoryPriceEligibility', {});\n }\n getPromotionalOffer(_options: GetPromotionalOfferOptions): Promise<PurchasesPromotionalOffer | undefined> {\n return this.mockReturningFunctionIfEnabled('getPromotionalOffer', undefined);\n }\n getEligibleWinBackOffersForProduct(\n _options: GetEligibleWinBackOffersForProductOptions,\n ): Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> {\n return this.mockReturningFunctionIfEnabled('getEligibleWinBackOffersForProduct', { eligibleWinBackOffers: [] });\n }\n getEligibleWinBackOffersForPackage(\n _options: GetEligibleWinBackOffersForPackageOptions,\n ): Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> {\n return this.mockReturningFunctionIfEnabled('getEligibleWinBackOffersForPackage', { eligibleWinBackOffers: [] });\n }\n purchaseProductWithWinBackOffer(\n _options: PurchaseProductWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | undefined> {\n return this.mockReturningFunctionIfEnabled('purchaseProductWithWinBackOffer', undefined);\n }\n purchasePackageWithWinBackOffer(\n _options: PurchasePackageWithWinBackOfferOptions,\n ): Promise<MakePurchaseResult | undefined> {\n return this.mockReturningFunctionIfEnabled('purchasePackageWithWinBackOffer', undefined);\n }\n invalidateCustomerInfoCache(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('invalidateCustomerInfoCache');\n }\n presentCodeRedemptionSheet(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('presentCodeRedemptionSheet');\n }\n setAttributes(_attributes: { [key: string]: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAttributes');\n }\n setEmail(_email: { email: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setEmail');\n }\n setPhoneNumber(_phoneNumber: { phoneNumber: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setPhoneNumber');\n }\n setDisplayName(_displayName: { displayName: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setDisplayName');\n }\n setPushToken(_pushToken: { pushToken: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setPushToken');\n }\n setProxyURL(_url: { url: string }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setProxyURL');\n }\n collectDeviceIdentifiers(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('collectDeviceIdentifiers');\n }\n setAdjustID(_adjustID: { adjustID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAdjustID');\n }\n setAppsflyerID(_appsflyerID: { appsflyerID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAppsflyerID');\n }\n setFBAnonymousID(_fbAnonymousID: { fbAnonymousID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setFBAnonymousID');\n }\n setMparticleID(_mparticleID: { mparticleID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setMparticleID');\n }\n setCleverTapID(_cleverTapID: { cleverTapID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setCleverTapID');\n }\n setMixpanelDistinctID(_mixpanelDistinctID: { mixpanelDistinctID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setMixpanelDistinctID');\n }\n setFirebaseAppInstanceID(_firebaseAppInstanceID: { firebaseAppInstanceID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setFirebaseAppInstanceID');\n }\n setOnesignalID(_onesignalID: { onesignalID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setOnesignalID');\n }\n setOnesignalUserID(_onesignalUserID: { onesignalUserID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setOnesignalUserID');\n }\n setAirshipChannelID(_airshipChannelID: { airshipChannelID: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAirshipChannelID');\n }\n setMediaSource(_mediaSource: { mediaSource: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setMediaSource');\n }\n setCampaign(_campaign: { campaign: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setCampaign');\n }\n setAdGroup(_adGroup: { adGroup: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAdGroup');\n }\n setAd(_ad: { ad: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setAd');\n }\n setKeyword(_keyword: { keyword: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setKeyword');\n }\n setCreative(_creative: { creative: string | null }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('setCreative');\n }\n canMakePayments(_features?: { features?: BILLING_FEATURE[] }): Promise<{ canMakePayments: boolean }> {\n return this.mockReturningFunctionIfEnabled('canMakePayments', {\n canMakePayments: true,\n });\n }\n beginRefundRequestForActiveEntitlement(): Promise<{\n refundRequestStatus: REFUND_REQUEST_STATUS;\n }> {\n const mockResult = {\n refundRequestStatus: REFUND_REQUEST_STATUS.USER_CANCELLED,\n };\n return this.mockReturningFunctionIfEnabled('beginRefundRequestForActiveEntitlement', mockResult);\n }\n beginRefundRequestForEntitlement(_entitlementInfo: {\n entitlementInfo: PurchasesEntitlementInfo;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }> {\n const mockResult = {\n refundRequestStatus: REFUND_REQUEST_STATUS.USER_CANCELLED,\n };\n return this.mockReturningFunctionIfEnabled('beginRefundRequestForEntitlement', mockResult);\n }\n beginRefundRequestForProduct(_storeProduct: {\n storeProduct: PurchasesStoreProduct;\n }): Promise<{ refundRequestStatus: REFUND_REQUEST_STATUS }> {\n const mockResult = {\n refundRequestStatus: REFUND_REQUEST_STATUS.USER_CANCELLED,\n };\n return this.mockReturningFunctionIfEnabled('beginRefundRequestForProduct', mockResult);\n }\n\n showInAppMessages(_options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('showInAppMessages');\n }\n\n isConfigured(): Promise<{ isConfigured: boolean }> {\n const mockResult = { isConfigured: true };\n return this.mockReturningFunctionIfEnabled('isConfigured', mockResult);\n }\n\n getVirtualCurrencies(): Promise<{ virtualCurrencies: PurchasesVirtualCurrencies }> {\n return this.mockReturningFunctionIfEnabled('getVirtualCurrencies', {\n virtualCurrencies: this.mockEmptyVirtualCurrencies,\n });\n }\n\n invalidateVirtualCurrenciesCache(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('invalidateVirtualCurrenciesCache');\n }\n\n getCachedVirtualCurrencies(): Promise<{ cachedVirtualCurrencies: PurchasesVirtualCurrencies | null }> {\n return this.mockReturningFunctionIfEnabled('getCachedVirtualCurrencies', {\n cachedVirtualCurrencies: this.mockEmptyVirtualCurrencies,\n });\n }\n\n // Mock helpers\n\n private mockEmptyCustomerInfo: CustomerInfo = {\n entitlements: {\n all: {},\n active: {},\n verification: VERIFICATION_RESULT.NOT_REQUESTED,\n },\n activeSubscriptions: [],\n allPurchasedProductIdentifiers: [],\n latestExpirationDate: null,\n firstSeen: '2023-08-31T15:11:21.445Z',\n originalAppUserId: 'mock-web-user-id',\n requestDate: '2023-08-31T15:11:21.445Z',\n allExpirationDates: {},\n allPurchaseDates: {},\n originalApplicationVersion: null,\n originalPurchaseDate: null,\n managementURL: null,\n nonSubscriptionTransactions: [],\n subscriptionsByProductIdentifier: {},\n };\n\n private mockEmptyVirtualCurrencies: PurchasesVirtualCurrencies = {\n all: {},\n };\n\n private mockTransaction(productIdentifier: string): PurchasesStoreTransaction {\n return {\n productIdentifier: productIdentifier,\n purchaseDate: new Date().toISOString(),\n transactionIdentifier: '',\n };\n }\n\n private mockNonReturningFunctionIfEnabled(functionName: string): Promise<void> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n\n private mockReturningFunctionIfEnabled<T>(functionName: string, returnValue: T): Promise<T> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`);\n return Promise.resolve(returnValue);\n }\n}\n"]}
@@ -5,6 +5,9 @@
5
5
  // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
6
  CAP_PLUGIN(PurchasesPlugin, "Purchases",
7
7
  CAP_PLUGIN_METHOD(configure, CAPPluginReturnNone);
8
+ CAP_PLUGIN_METHOD(getVirtualCurrencies, CAPPluginReturnPromise);
9
+ CAP_PLUGIN_METHOD(invalidateVirtualCurrenciesCache, CAPPluginReturnNone);
10
+ CAP_PLUGIN_METHOD(getCachedVirtualCurrencies, CAPPluginReturnPromise);
8
11
  CAP_PLUGIN_METHOD(parseAsWebPurchaseRedemption, CAPPluginReturnPromise);
9
12
  CAP_PLUGIN_METHOD(redeemWebPurchase, CAPPluginReturnPromise);
10
13
  CAP_PLUGIN_METHOD(setMockWebResults, CAPPluginReturnNone);
@@ -12,7 +12,7 @@ import RevenueCat
12
12
  @objc(PurchasesPlugin)
13
13
  public class PurchasesPlugin: CAPPlugin, PurchasesDelegate {
14
14
  private let platformFlavor = "capacitor"
15
- private let platformVersion = "11.0.0"
15
+ private let platformVersion = "11.1.0"
16
16
 
17
17
  private let customerInfoKey = "customerInfo"
18
18
  private let transactionKey = "transaction"
@@ -69,6 +69,29 @@ public class PurchasesPlugin: CAPPlugin, PurchasesDelegate {
69
69
  call.resolve()
70
70
  }
71
71
 
72
+ @objc func getVirtualCurrencies(_ call: CAPPluginCall) {
73
+ guard self.rejectIfPurchasesNotConfigured(call) else { return }
74
+ CommonFunctionality.getVirtualCurrencies(
75
+ completion: self.getCompletionBlockHandler(
76
+ call,
77
+ wrapperKey: "virtualCurrencies"
78
+ )
79
+ )
80
+ }
81
+
82
+ @objc func invalidateVirtualCurrenciesCache(_ call: CAPPluginCall) {
83
+ guard self.rejectIfPurchasesNotConfigured(call) else { return }
84
+ CommonFunctionality.invalidateVirtualCurrenciesCache()
85
+ call.resolve()
86
+ }
87
+
88
+ @objc func getCachedVirtualCurrencies(_ call: CAPPluginCall) {
89
+ guard self.rejectIfPurchasesNotConfigured(call) else { return }
90
+ call.resolve([
91
+ "cachedVirtualCurrencies": CommonFunctionality.getCachedVirtualCurrencies()
92
+ ])
93
+ }
94
+
72
95
  @objc func parseAsWebPurchaseRedemption(_ call: CAPPluginCall) {
73
96
  guard let urlString = call.getOrRejectString("urlString") else { return }
74
97
  let result: [String: Any?]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-capacitor",
3
- "version": "11.0.0",
3
+ "version": "11.1.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",
@@ -73,6 +73,6 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@revenuecat/purchases-typescript-internal-esm": "15.0.0"
76
+ "@revenuecat/purchases-typescript-internal-esm": "16.1.0"
77
77
  }
78
78
  }