@revenuecat/purchases-capacitor 10.0.2 → 10.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,8 @@ 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
+ * [`parseAsWebPurchaseRedemption(...)`](#parseaswebpurchaseredemption)
58
+ * [`redeemWebPurchase(...)`](#redeemwebpurchase)
57
59
  * [`setMockWebResults(...)`](#setmockwebresults)
58
60
  * [`setSimulatesAskToBuyInSandbox(...)`](#setsimulatesasktobuyinsandbox)
59
61
  * [`addCustomerInfoUpdateListener(...)`](#addcustomerinfoupdatelistener)
@@ -141,6 +143,40 @@ Sets up Purchases with your API key and an app user id.
141
143
  --------------------
142
144
 
143
145
 
146
+ ### parseAsWebPurchaseRedemption(...)
147
+
148
+ ```typescript
149
+ parseAsWebPurchaseRedemption(options: { urlString: string; }) => Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>
150
+ ```
151
+
152
+ Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.
153
+
154
+ | Param | Type | Description |
155
+ | ------------- | ----------------------------------- | --------------------------------------- |
156
+ | **`options`** | <code>{ urlString: string; }</code> | Set the urlString used to open the App. |
157
+
158
+ **Returns:** <code>Promise&lt;{ webPurchaseRedemption: <a href="#webpurchaseredemption">WebPurchaseRedemption</a> | null; }&gt;</code>
159
+
160
+ --------------------
161
+
162
+
163
+ ### redeemWebPurchase(...)
164
+
165
+ ```typescript
166
+ redeemWebPurchase(options: { webPurchaseRedemption: WebPurchaseRedemption; }) => Promise<WebPurchaseRedemptionResult>
167
+ ```
168
+
169
+ Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].
170
+
171
+ | Param | Type | Description |
172
+ | ------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
173
+ | **`options`** | <code>{ webPurchaseRedemption: <a href="#webpurchaseredemption">WebPurchaseRedemption</a>; }</code> | The <a href="#webpurchaseredemption">WebPurchaseRedemption</a> object obtained from {@link parseAsWebPurchaseRedemption}. |
174
+
175
+ **Returns:** <code>Promise&lt;<a href="#webpurchaseredemptionresult">WebPurchaseRedemptionResult</a>&gt;</code>
176
+
177
+ --------------------
178
+
179
+
144
180
  ### setMockWebResults(...)
145
181
 
146
182
  ```typescript
@@ -1220,7 +1256,7 @@ The EntitlementInfo object gives you access to all of the information about the
1220
1256
  | **`identifier`** | <code>string</code> | The entitlement identifier configured in the RevenueCat dashboard |
1221
1257
  | **`isActive`** | <code>boolean</code> | True if the user has access to this entitlement |
1222
1258
  | **`willRenew`** | <code>boolean</code> | True if the underlying subscription is set to renew at the end of the billing period (expirationDate). |
1223
- | **`periodType`** | <code>string</code> | The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL. |
1259
+ | **`periodType`** | <code>string</code> | The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL, PREPAID. |
1224
1260
  | **`latestPurchaseDate`** | <code>string</code> | The latest purchase or renewal date for the entitlement in ISO8601 format. |
1225
1261
  | **`latestPurchaseDateMillis`** | <code>number</code> | The latest purchase or renewal date for the entitlement in milliseconds. |
1226
1262
  | **`originalPurchaseDate`** | <code>string</code> | The first date this entitlement was purchased in ISO8601 format. |
@@ -1250,6 +1286,29 @@ Represents a non-subscription transaction in the Store.
1250
1286
  | **`purchaseDate`** | <code>string</code> | Purchase date of the transaction in ISO 8601 format. |
1251
1287
 
1252
1288
 
1289
+ #### PurchasesError
1290
+
1291
+ Type encapsulating an error in an SDK operation.
1292
+
1293
+ | Prop | Type |
1294
+ | ---------------------------- | --------------------------------------------------------------------- |
1295
+ | **`code`** | <code><a href="#purchases_error_code">PURCHASES_ERROR_CODE</a></code> |
1296
+ | **`message`** | <code>string</code> |
1297
+ | **`readableErrorCode`** | <code>string</code> |
1298
+ | **`userInfo`** | <code><a href="#errorinfo">ErrorInfo</a></code> |
1299
+ | **`underlyingErrorMessage`** | <code>string</code> |
1300
+ | **`userCancelled`** | <code>boolean \| null</code> |
1301
+
1302
+
1303
+ #### ErrorInfo
1304
+
1305
+ Type encapsulating extra info on an error in an SDK operation.
1306
+
1307
+ | Prop | Type |
1308
+ | ----------------------- | ------------------- |
1309
+ | **`readableErrorCode`** | <code>string</code> |
1310
+
1311
+
1253
1312
  #### PurchasesOfferings
1254
1313
 
1255
1314
  Contains all the offerings configured in RevenueCat dashboard.
@@ -1627,6 +1686,20 @@ Configuration option that specifies that your app will complete purchases.
1627
1686
  <code>{ type: <a href="#purchases_are_completed_by_type">PURCHASES_ARE_COMPLETED_BY_TYPE.MY_APP</a>; /** * The version of StoreKit that your app is using to make purchases. This value is ignored * on Android, so if your app is Android-only, you may provide any value. */ storeKitVersion: <a href="#storekit_version">STOREKIT_VERSION</a>; }</code>
1628
1687
 
1629
1688
 
1689
+ #### WebPurchaseRedemption
1690
+
1691
+ An object containing the redemption link to be redeemed.
1692
+
1693
+ <code>{ /** * The redemption link to be redeemed. */ redemptionLink: string; }</code>
1694
+
1695
+
1696
+ #### WebPurchaseRedemptionResult
1697
+
1698
+ The result of a redemption attempt.
1699
+
1700
+ <code>{ result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.SUCCESS</a>; customerInfo: <a href="#customerinfo">CustomerInfo</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.ERROR</a>; error: <a href="#purchaseserror">PurchasesError</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.PURCHASE_BELONGS_TO_OTHER_USER</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.INVALID_TOKEN</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.EXPIRED</a>; obfuscatedEmail: string; }</code>
1701
+
1702
+
1630
1703
  #### CustomerInfoUpdateListener
1631
1704
 
1632
1705
  Listener used on updated customer info
@@ -1686,6 +1759,17 @@ Listener used to receive log messages from the SDK.
1686
1759
  | **`INFORMATIONAL`** | <code>"INFORMATIONAL"</code> | Enable entitlement verification. If verification fails, this will be indicated with [VerificationResult.FAILED] in the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail (i.e. Entitlements will still be granted). This can be useful if you want to handle verification failures to display an error/warning to the user or to track this situation but still grant access. |
1687
1760
 
1688
1761
 
1762
+ #### WebPurchaseRedemptionResultType
1763
+
1764
+ | Members | Value | Description |
1765
+ | ------------------------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------- |
1766
+ | **`SUCCESS`** | <code>"SUCCESS"</code> | The redemption was successful. |
1767
+ | **`ERROR`** | <code>"ERROR"</code> | The redemption failed. |
1768
+ | **`PURCHASE_BELONGS_TO_OTHER_USER`** | <code>"PURCHASE_BELONGS_TO_OTHER_USER"</code> | The purchase associated to the link belongs to another user. |
1769
+ | **`INVALID_TOKEN`** | <code>"INVALID_TOKEN"</code> | The token is invalid. |
1770
+ | **`EXPIRED`** | <code>"EXPIRED"</code> | The token has expired. A new Redemption Link will be sent to the email used during purchase. |
1771
+
1772
+
1689
1773
  #### VERIFICATION_RESULT
1690
1774
 
1691
1775
  | Members | Value | Description |
@@ -1696,6 +1780,47 @@ Listener used to receive log messages from the SDK.
1696
1780
  | **`VERIFIED_ON_DEVICE`** | <code>"VERIFIED_ON_DEVICE"</code> | Verification was performed on device. |
1697
1781
 
1698
1782
 
1783
+ #### PURCHASES_ERROR_CODE
1784
+
1785
+ | Members | Value |
1786
+ | ------------------------------------------------------------------ | ----------------- |
1787
+ | **`UNKNOWN_ERROR`** | <code>"0"</code> |
1788
+ | **`PURCHASE_CANCELLED_ERROR`** | <code>"1"</code> |
1789
+ | **`STORE_PROBLEM_ERROR`** | <code>"2"</code> |
1790
+ | **`PURCHASE_NOT_ALLOWED_ERROR`** | <code>"3"</code> |
1791
+ | **`PURCHASE_INVALID_ERROR`** | <code>"4"</code> |
1792
+ | **`PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR`** | <code>"5"</code> |
1793
+ | **`PRODUCT_ALREADY_PURCHASED_ERROR`** | <code>"6"</code> |
1794
+ | **`RECEIPT_ALREADY_IN_USE_ERROR`** | <code>"7"</code> |
1795
+ | **`INVALID_RECEIPT_ERROR`** | <code>"8"</code> |
1796
+ | **`MISSING_RECEIPT_FILE_ERROR`** | <code>"9"</code> |
1797
+ | **`NETWORK_ERROR`** | <code>"10"</code> |
1798
+ | **`INVALID_CREDENTIALS_ERROR`** | <code>"11"</code> |
1799
+ | **`UNEXPECTED_BACKEND_RESPONSE_ERROR`** | <code>"12"</code> |
1800
+ | **`RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR`** | <code>"13"</code> |
1801
+ | **`INVALID_APP_USER_ID_ERROR`** | <code>"14"</code> |
1802
+ | **`OPERATION_ALREADY_IN_PROGRESS_ERROR`** | <code>"15"</code> |
1803
+ | **`UNKNOWN_BACKEND_ERROR`** | <code>"16"</code> |
1804
+ | **`INVALID_APPLE_SUBSCRIPTION_KEY_ERROR`** | <code>"17"</code> |
1805
+ | **`INELIGIBLE_ERROR`** | <code>"18"</code> |
1806
+ | **`INSUFFICIENT_PERMISSIONS_ERROR`** | <code>"19"</code> |
1807
+ | **`PAYMENT_PENDING_ERROR`** | <code>"20"</code> |
1808
+ | **`INVALID_SUBSCRIBER_ATTRIBUTES_ERROR`** | <code>"21"</code> |
1809
+ | **`LOG_OUT_ANONYMOUS_USER_ERROR`** | <code>"22"</code> |
1810
+ | **`CONFIGURATION_ERROR`** | <code>"23"</code> |
1811
+ | **`UNSUPPORTED_ERROR`** | <code>"24"</code> |
1812
+ | **`EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR`** | <code>"25"</code> |
1813
+ | **`PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR`** | <code>"26"</code> |
1814
+ | **`PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR`** | <code>"28"</code> |
1815
+ | **`CUSTOMER_INFO_ERROR`** | <code>"29"</code> |
1816
+ | **`SYSTEM_INFO_ERROR`** | <code>"30"</code> |
1817
+ | **`BEGIN_REFUND_REQUEST_ERROR`** | <code>"31"</code> |
1818
+ | **`PRODUCT_REQUEST_TIMED_OUT_ERROR`** | <code>"32"</code> |
1819
+ | **`API_ENDPOINT_BLOCKED`** | <code>"33"</code> |
1820
+ | **`INVALID_PROMOTIONAL_OFFER_ERROR`** | <code>"34"</code> |
1821
+ | **`OFFLINE_CONNECTION_ERROR`** | <code>"35"</code> |
1822
+
1823
+
1699
1824
  #### PACKAGE_TYPE
1700
1825
 
1701
1826
  | Members | Value | Description |
@@ -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', '13.17.1'
16
+ s.dependency 'PurchasesHybridCommon', '13.19.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:13.17.1'
59
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.19.0'
60
60
  testImplementation "junit:junit:$junitVersion"
61
61
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
62
62
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -20,6 +20,7 @@ import com.revenuecat.purchases.hybridcommon.OnResultAny
20
20
  import com.revenuecat.purchases.hybridcommon.OnResultList
21
21
  import com.revenuecat.purchases.hybridcommon.configure
22
22
  import com.revenuecat.purchases.hybridcommon.getProductInfo
23
+ import com.revenuecat.purchases.hybridcommon.isWebPurchaseRedemptionURL
23
24
  import com.revenuecat.purchases.hybridcommon.mappers.convertToMap
24
25
  import com.revenuecat.purchases.hybridcommon.mappers.map
25
26
  import com.revenuecat.purchases.hybridcommon.purchaseProduct
@@ -40,6 +41,7 @@ import com.revenuecat.purchases.hybridcommon.logIn as logInCommon
40
41
  import com.revenuecat.purchases.hybridcommon.logOut as logOutCommon
41
42
  import com.revenuecat.purchases.hybridcommon.purchasePackage as purchasePackageCommon
42
43
  import com.revenuecat.purchases.hybridcommon.purchaseSubscriptionOption as purchaseSubscriptionOptionCommon
44
+ import com.revenuecat.purchases.hybridcommon.redeemWebPurchase as redeemWebPurchaseCommon
43
45
  import com.revenuecat.purchases.hybridcommon.restorePurchases as restorePurchasesCommon
44
46
  import com.revenuecat.purchases.hybridcommon.setAd as setAdCommon
45
47
  import com.revenuecat.purchases.hybridcommon.setAdGroup as setAdGroupCommon
@@ -77,7 +79,7 @@ class PurchasesPlugin : Plugin() {
77
79
 
78
80
  companion object {
79
81
  private const val PLATFORM_NAME = "capacitor"
80
- private const val PLUGIN_VERSION = "10.0.2"
82
+ private const val PLUGIN_VERSION = "10.1.0"
81
83
 
82
84
  private const val CUSTOMER_INFO_KEY = "customerInfo"
83
85
  }
@@ -120,6 +122,24 @@ class PurchasesPlugin : Plugin() {
120
122
  call.resolve()
121
123
  }
122
124
 
125
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
126
+ fun parseAsWebPurchaseRedemption(call: PluginCall) {
127
+ val urlString = call.getStringOrReject("urlString") ?: return
128
+ if (isWebPurchaseRedemptionURL(urlString)) {
129
+ call.resolveWithMap(mapOf("webPurchaseRedemption" to mapOf("redemptionLink" to urlString)))
130
+ } else {
131
+ call.resolveWithMap(mapOf("webPurchaseRedemption" to null))
132
+ }
133
+ }
134
+
135
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
136
+ fun redeemWebPurchase(call: PluginCall) {
137
+ if (rejectIfNotConfigured(call)) return
138
+ val webPurchaseRedemption = call.getObjectOrReject("webPurchaseRedemption") ?: return
139
+ val redemptionLink = webPurchaseRedemption.getStringOrReject(call, "redemptionLink") ?: return
140
+ redeemWebPurchaseCommon(redemptionLink, getOnResult(call))
141
+ }
142
+
123
143
  @PluginMethod(returnType = PluginMethod.RETURN_NONE)
124
144
  fun setMockWebResults(call: PluginCall) {
125
145
  Log.e(
package/dist/docs.json CHANGED
@@ -28,6 +28,61 @@
28
28
  ],
29
29
  "slug": "configure"
30
30
  },
31
+ {
32
+ "name": "parseAsWebPurchaseRedemption",
33
+ "signature": "(options: { urlString: string; }) => Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>",
34
+ "parameters": [
35
+ {
36
+ "name": "options",
37
+ "docs": "Set the urlString used to open the App.",
38
+ "type": "{ urlString: string; }"
39
+ }
40
+ ],
41
+ "returns": "Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>",
42
+ "tags": [
43
+ {
44
+ "name": "param",
45
+ "text": "options Set the urlString used to open the App."
46
+ },
47
+ {
48
+ "name": "returns",
49
+ "text": "A promise of a WebPurchaseRedemption\nobject that can be redeemed using {@link redeemWebPurchase} or null if the link is invalid."
50
+ }
51
+ ],
52
+ "docs": "Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.",
53
+ "complexTypes": [
54
+ "WebPurchaseRedemption"
55
+ ],
56
+ "slug": "parseaswebpurchaseredemption"
57
+ },
58
+ {
59
+ "name": "redeemWebPurchase",
60
+ "signature": "(options: { webPurchaseRedemption: WebPurchaseRedemption; }) => Promise<WebPurchaseRedemptionResult>",
61
+ "parameters": [
62
+ {
63
+ "name": "options",
64
+ "docs": "The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}.",
65
+ "type": "{ webPurchaseRedemption: WebPurchaseRedemption; }"
66
+ }
67
+ ],
68
+ "returns": "Promise<WebPurchaseRedemptionResult>",
69
+ "tags": [
70
+ {
71
+ "name": "param",
72
+ "text": "options The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}."
73
+ },
74
+ {
75
+ "name": "returns",
76
+ "text": "The result of the redemption process.\nCan throw if an invalid WebPurchaseRedemption parameter is passed or Purchases is not configured."
77
+ }
78
+ ],
79
+ "docs": "Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].",
80
+ "complexTypes": [
81
+ "WebPurchaseRedemptionResult",
82
+ "WebPurchaseRedemption"
83
+ ],
84
+ "slug": "redeemwebpurchase"
85
+ },
31
86
  {
32
87
  "name": "setMockWebResults",
33
88
  "signature": "(options: { shouldMockWebResults: boolean; }) => Promise<void>",
@@ -1747,7 +1802,7 @@
1747
1802
  {
1748
1803
  "name": "periodType",
1749
1804
  "tags": [],
1750
- "docs": "The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL.",
1805
+ "docs": "The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL, PREPAID.",
1751
1806
  "complexTypes": [],
1752
1807
  "type": "string"
1753
1808
  },
@@ -1901,6 +1956,95 @@
1901
1956
  }
1902
1957
  ]
1903
1958
  },
1959
+ {
1960
+ "name": "PurchasesError",
1961
+ "slug": "purchaseserror",
1962
+ "docs": "Type encapsulating an error in an SDK operation.",
1963
+ "tags": [
1964
+ {
1965
+ "name": "public"
1966
+ }
1967
+ ],
1968
+ "methods": [],
1969
+ "properties": [
1970
+ {
1971
+ "name": "code",
1972
+ "tags": [],
1973
+ "docs": "",
1974
+ "complexTypes": [
1975
+ "PURCHASES_ERROR_CODE"
1976
+ ],
1977
+ "type": "PURCHASES_ERROR_CODE"
1978
+ },
1979
+ {
1980
+ "name": "message",
1981
+ "tags": [],
1982
+ "docs": "",
1983
+ "complexTypes": [],
1984
+ "type": "string"
1985
+ },
1986
+ {
1987
+ "name": "readableErrorCode",
1988
+ "tags": [
1989
+ {
1990
+ "text": "access readableErrorCode through userInfo.readableErrorCode",
1991
+ "name": "deprecated"
1992
+ }
1993
+ ],
1994
+ "docs": "",
1995
+ "complexTypes": [],
1996
+ "type": "string"
1997
+ },
1998
+ {
1999
+ "name": "userInfo",
2000
+ "tags": [],
2001
+ "docs": "",
2002
+ "complexTypes": [
2003
+ "ErrorInfo"
2004
+ ],
2005
+ "type": "ErrorInfo"
2006
+ },
2007
+ {
2008
+ "name": "underlyingErrorMessage",
2009
+ "tags": [],
2010
+ "docs": "",
2011
+ "complexTypes": [],
2012
+ "type": "string"
2013
+ },
2014
+ {
2015
+ "name": "userCancelled",
2016
+ "tags": [
2017
+ {
2018
+ "text": "use code === Purchases.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR instead",
2019
+ "name": "deprecated"
2020
+ }
2021
+ ],
2022
+ "docs": "",
2023
+ "complexTypes": [],
2024
+ "type": "boolean | null"
2025
+ }
2026
+ ]
2027
+ },
2028
+ {
2029
+ "name": "ErrorInfo",
2030
+ "slug": "errorinfo",
2031
+ "docs": "Type encapsulating extra info on an error in an SDK operation.",
2032
+ "tags": [
2033
+ {
2034
+ "name": "public"
2035
+ }
2036
+ ],
2037
+ "methods": [],
2038
+ "properties": [
2039
+ {
2040
+ "name": "readableErrorCode",
2041
+ "tags": [],
2042
+ "docs": "",
2043
+ "complexTypes": [],
2044
+ "type": "string"
2045
+ }
2046
+ ]
2047
+ },
1904
2048
  {
1905
2049
  "name": "PurchasesOfferings",
1906
2050
  "slug": "purchasesofferings",
@@ -3290,6 +3434,42 @@
3290
3434
  }
3291
3435
  ]
3292
3436
  },
3437
+ {
3438
+ "name": "WebPurchaseRedemptionResultType",
3439
+ "slug": "webpurchaseredemptionresulttype",
3440
+ "members": [
3441
+ {
3442
+ "name": "SUCCESS",
3443
+ "value": "\"SUCCESS\"",
3444
+ "tags": [],
3445
+ "docs": "The redemption was successful."
3446
+ },
3447
+ {
3448
+ "name": "ERROR",
3449
+ "value": "\"ERROR\"",
3450
+ "tags": [],
3451
+ "docs": "The redemption failed."
3452
+ },
3453
+ {
3454
+ "name": "PURCHASE_BELONGS_TO_OTHER_USER",
3455
+ "value": "\"PURCHASE_BELONGS_TO_OTHER_USER\"",
3456
+ "tags": [],
3457
+ "docs": "The purchase associated to the link belongs to another user."
3458
+ },
3459
+ {
3460
+ "name": "INVALID_TOKEN",
3461
+ "value": "\"INVALID_TOKEN\"",
3462
+ "tags": [],
3463
+ "docs": "The token is invalid."
3464
+ },
3465
+ {
3466
+ "name": "EXPIRED",
3467
+ "value": "\"EXPIRED\"",
3468
+ "tags": [],
3469
+ "docs": "The token has expired. A new Redemption Link will be sent to the email used during purchase."
3470
+ }
3471
+ ]
3472
+ },
3293
3473
  {
3294
3474
  "name": "VERIFICATION_RESULT",
3295
3475
  "slug": "verification_result",
@@ -3320,6 +3500,222 @@
3320
3500
  }
3321
3501
  ]
3322
3502
  },
3503
+ {
3504
+ "name": "PURCHASES_ERROR_CODE",
3505
+ "slug": "purchases_error_code",
3506
+ "members": [
3507
+ {
3508
+ "name": "UNKNOWN_ERROR",
3509
+ "value": "\"0\"",
3510
+ "tags": [],
3511
+ "docs": ""
3512
+ },
3513
+ {
3514
+ "name": "PURCHASE_CANCELLED_ERROR",
3515
+ "value": "\"1\"",
3516
+ "tags": [],
3517
+ "docs": ""
3518
+ },
3519
+ {
3520
+ "name": "STORE_PROBLEM_ERROR",
3521
+ "value": "\"2\"",
3522
+ "tags": [],
3523
+ "docs": ""
3524
+ },
3525
+ {
3526
+ "name": "PURCHASE_NOT_ALLOWED_ERROR",
3527
+ "value": "\"3\"",
3528
+ "tags": [],
3529
+ "docs": ""
3530
+ },
3531
+ {
3532
+ "name": "PURCHASE_INVALID_ERROR",
3533
+ "value": "\"4\"",
3534
+ "tags": [],
3535
+ "docs": ""
3536
+ },
3537
+ {
3538
+ "name": "PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR",
3539
+ "value": "\"5\"",
3540
+ "tags": [],
3541
+ "docs": ""
3542
+ },
3543
+ {
3544
+ "name": "PRODUCT_ALREADY_PURCHASED_ERROR",
3545
+ "value": "\"6\"",
3546
+ "tags": [],
3547
+ "docs": ""
3548
+ },
3549
+ {
3550
+ "name": "RECEIPT_ALREADY_IN_USE_ERROR",
3551
+ "value": "\"7\"",
3552
+ "tags": [],
3553
+ "docs": ""
3554
+ },
3555
+ {
3556
+ "name": "INVALID_RECEIPT_ERROR",
3557
+ "value": "\"8\"",
3558
+ "tags": [],
3559
+ "docs": ""
3560
+ },
3561
+ {
3562
+ "name": "MISSING_RECEIPT_FILE_ERROR",
3563
+ "value": "\"9\"",
3564
+ "tags": [],
3565
+ "docs": ""
3566
+ },
3567
+ {
3568
+ "name": "NETWORK_ERROR",
3569
+ "value": "\"10\"",
3570
+ "tags": [],
3571
+ "docs": ""
3572
+ },
3573
+ {
3574
+ "name": "INVALID_CREDENTIALS_ERROR",
3575
+ "value": "\"11\"",
3576
+ "tags": [],
3577
+ "docs": ""
3578
+ },
3579
+ {
3580
+ "name": "UNEXPECTED_BACKEND_RESPONSE_ERROR",
3581
+ "value": "\"12\"",
3582
+ "tags": [],
3583
+ "docs": ""
3584
+ },
3585
+ {
3586
+ "name": "RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR",
3587
+ "value": "\"13\"",
3588
+ "tags": [],
3589
+ "docs": ""
3590
+ },
3591
+ {
3592
+ "name": "INVALID_APP_USER_ID_ERROR",
3593
+ "value": "\"14\"",
3594
+ "tags": [],
3595
+ "docs": ""
3596
+ },
3597
+ {
3598
+ "name": "OPERATION_ALREADY_IN_PROGRESS_ERROR",
3599
+ "value": "\"15\"",
3600
+ "tags": [],
3601
+ "docs": ""
3602
+ },
3603
+ {
3604
+ "name": "UNKNOWN_BACKEND_ERROR",
3605
+ "value": "\"16\"",
3606
+ "tags": [],
3607
+ "docs": ""
3608
+ },
3609
+ {
3610
+ "name": "INVALID_APPLE_SUBSCRIPTION_KEY_ERROR",
3611
+ "value": "\"17\"",
3612
+ "tags": [],
3613
+ "docs": ""
3614
+ },
3615
+ {
3616
+ "name": "INELIGIBLE_ERROR",
3617
+ "value": "\"18\"",
3618
+ "tags": [],
3619
+ "docs": ""
3620
+ },
3621
+ {
3622
+ "name": "INSUFFICIENT_PERMISSIONS_ERROR",
3623
+ "value": "\"19\"",
3624
+ "tags": [],
3625
+ "docs": ""
3626
+ },
3627
+ {
3628
+ "name": "PAYMENT_PENDING_ERROR",
3629
+ "value": "\"20\"",
3630
+ "tags": [],
3631
+ "docs": ""
3632
+ },
3633
+ {
3634
+ "name": "INVALID_SUBSCRIBER_ATTRIBUTES_ERROR",
3635
+ "value": "\"21\"",
3636
+ "tags": [],
3637
+ "docs": ""
3638
+ },
3639
+ {
3640
+ "name": "LOG_OUT_ANONYMOUS_USER_ERROR",
3641
+ "value": "\"22\"",
3642
+ "tags": [],
3643
+ "docs": ""
3644
+ },
3645
+ {
3646
+ "name": "CONFIGURATION_ERROR",
3647
+ "value": "\"23\"",
3648
+ "tags": [],
3649
+ "docs": ""
3650
+ },
3651
+ {
3652
+ "name": "UNSUPPORTED_ERROR",
3653
+ "value": "\"24\"",
3654
+ "tags": [],
3655
+ "docs": ""
3656
+ },
3657
+ {
3658
+ "name": "EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR",
3659
+ "value": "\"25\"",
3660
+ "tags": [],
3661
+ "docs": ""
3662
+ },
3663
+ {
3664
+ "name": "PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR",
3665
+ "value": "\"26\"",
3666
+ "tags": [],
3667
+ "docs": ""
3668
+ },
3669
+ {
3670
+ "name": "PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR",
3671
+ "value": "\"28\"",
3672
+ "tags": [],
3673
+ "docs": ""
3674
+ },
3675
+ {
3676
+ "name": "CUSTOMER_INFO_ERROR",
3677
+ "value": "\"29\"",
3678
+ "tags": [],
3679
+ "docs": ""
3680
+ },
3681
+ {
3682
+ "name": "SYSTEM_INFO_ERROR",
3683
+ "value": "\"30\"",
3684
+ "tags": [],
3685
+ "docs": ""
3686
+ },
3687
+ {
3688
+ "name": "BEGIN_REFUND_REQUEST_ERROR",
3689
+ "value": "\"31\"",
3690
+ "tags": [],
3691
+ "docs": ""
3692
+ },
3693
+ {
3694
+ "name": "PRODUCT_REQUEST_TIMED_OUT_ERROR",
3695
+ "value": "\"32\"",
3696
+ "tags": [],
3697
+ "docs": ""
3698
+ },
3699
+ {
3700
+ "name": "API_ENDPOINT_BLOCKED",
3701
+ "value": "\"33\"",
3702
+ "tags": [],
3703
+ "docs": ""
3704
+ },
3705
+ {
3706
+ "name": "INVALID_PROMOTIONAL_OFFER_ERROR",
3707
+ "value": "\"34\"",
3708
+ "tags": [],
3709
+ "docs": ""
3710
+ },
3711
+ {
3712
+ "name": "OFFLINE_CONNECTION_ERROR",
3713
+ "value": "\"35\"",
3714
+ "tags": [],
3715
+ "docs": ""
3716
+ }
3717
+ ]
3718
+ },
3323
3719
  {
3324
3720
  "name": "PACKAGE_TYPE",
3325
3721
  "slug": "package_type",
@@ -3763,6 +4159,56 @@
3763
4159
  }
3764
4160
  ]
3765
4161
  },
4162
+ {
4163
+ "name": "WebPurchaseRedemption",
4164
+ "slug": "webpurchaseredemption",
4165
+ "docs": "An object containing the redemption link to be redeemed.",
4166
+ "types": [
4167
+ {
4168
+ "text": "{\n /**\n * The redemption link to be redeemed.\n */\n redemptionLink: string;\n}",
4169
+ "complexTypes": []
4170
+ }
4171
+ ]
4172
+ },
4173
+ {
4174
+ "name": "WebPurchaseRedemptionResult",
4175
+ "slug": "webpurchaseredemptionresult",
4176
+ "docs": "The result of a redemption attempt.",
4177
+ "types": [
4178
+ {
4179
+ "text": "{\n result: WebPurchaseRedemptionResultType.SUCCESS;\n customerInfo: CustomerInfo;\n}",
4180
+ "complexTypes": [
4181
+ "WebPurchaseRedemptionResultType",
4182
+ "CustomerInfo"
4183
+ ]
4184
+ },
4185
+ {
4186
+ "text": "{\n result: WebPurchaseRedemptionResultType.ERROR;\n error: PurchasesError;\n}",
4187
+ "complexTypes": [
4188
+ "WebPurchaseRedemptionResultType",
4189
+ "PurchasesError"
4190
+ ]
4191
+ },
4192
+ {
4193
+ "text": "{\n result: WebPurchaseRedemptionResultType.PURCHASE_BELONGS_TO_OTHER_USER;\n}",
4194
+ "complexTypes": [
4195
+ "WebPurchaseRedemptionResultType"
4196
+ ]
4197
+ },
4198
+ {
4199
+ "text": "{\n result: WebPurchaseRedemptionResultType.INVALID_TOKEN;\n}",
4200
+ "complexTypes": [
4201
+ "WebPurchaseRedemptionResultType"
4202
+ ]
4203
+ },
4204
+ {
4205
+ "text": "{\n result: WebPurchaseRedemptionResultType.EXPIRED;\n obfuscatedEmail: string;\n}",
4206
+ "complexTypes": [
4207
+ "WebPurchaseRedemptionResultType"
4208
+ ]
4209
+ }
4210
+ ]
4211
+ },
3766
4212
  {
3767
4213
  "name": "CustomerInfoUpdateListener",
3768
4214
  "slug": "customerinfoupdatelistener",
@@ -1,4 +1,4 @@
1
- import type { CustomerInfo, CustomerInfoUpdateListener, GoogleProductChangeInfo, IntroEligibility, LogHandler, LogInResult, MakePurchaseResult, PurchasesConfiguration, PurchasesEntitlementInfo, PurchasesOfferings, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesStoreProductDiscount, SubscriptionOption, BILLING_FEATURE, LOG_LEVEL, PRODUCT_CATEGORY, REFUND_REQUEST_STATUS, IN_APP_MESSAGE_TYPE, PurchasesOffering, PurchasesStoreTransaction, PurchasesWinBackOffer } 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, PurchasesWinBackOffer, REFUND_REQUEST_STATUS, 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,26 @@ 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
+ * Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.
161
+ * @param options Set the urlString used to open the App.
162
+ * @returns {Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null}>} A promise of a WebPurchaseRedemption
163
+ * object that can be redeemed using {@link redeemWebPurchase} or null if the link is invalid.
164
+ */
165
+ parseAsWebPurchaseRedemption(options: {
166
+ urlString: string;
167
+ }): Promise<{
168
+ webPurchaseRedemption: WebPurchaseRedemption | null;
169
+ }>;
170
+ /**
171
+ * Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].
172
+ * @param options The WebPurchaseRedemption object obtained from {@link parseAsWebPurchaseRedemption}.
173
+ * @returns {Promise<WebPurchaseRedemptionResult>} The result of the redemption process.
174
+ * Can throw if an invalid WebPurchaseRedemption parameter is passed or Purchases is not configured.
175
+ */
176
+ redeemWebPurchase(options: {
177
+ webPurchaseRedemption: WebPurchaseRedemption;
178
+ }): Promise<WebPurchaseRedemptionResult>;
159
179
  /**
160
180
  * Sets whether the SDK should return mocked results in the web version.
161
181
  * This won't affect the iOS and Android versions of the implementation.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA0BA,cAAc,+CAA+C,CAAC","sourcesContent":["import type {\n CustomerInfo,\n CustomerInfoUpdateListener,\n GoogleProductChangeInfo,\n IntroEligibility,\n LogHandler,\n LogInResult,\n MakePurchaseResult,\n PurchasesConfiguration,\n PurchasesEntitlementInfo,\n PurchasesOfferings,\n PurchasesPackage,\n PurchasesPromotionalOffer,\n PurchasesStoreProduct,\n PurchasesStoreProductDiscount,\n SubscriptionOption,\n BILLING_FEATURE,\n LOG_LEVEL,\n PRODUCT_CATEGORY,\n REFUND_REQUEST_STATUS,\n IN_APP_MESSAGE_TYPE,\n PurchasesOffering,\n PurchasesStoreTransaction,\n PurchasesWinBackOffer,\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 * 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 * 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":"AA4BA,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 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 * 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,11 +1,19 @@
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 } 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, PurchasesWinBackOffer, ShouldPurchasePromoProductListener, WebPurchaseRedemption, WebPurchaseRedemptionResult } from '@revenuecat/purchases-typescript-internal-esm';
3
3
  import { REFUND_REQUEST_STATUS } from '@revenuecat/purchases-typescript-internal-esm';
4
- import type { GetEligibleWinBackOffersForProductOptions, GetEligibleWinBackOffersForPackageOptions, GetProductOptions, GetPromotionalOfferOptions, PurchaseDiscountedPackageOptions, PurchaseDiscountedProductOptions, PurchasePackageOptions, PurchasePackageWithWinBackOfferOptions, PurchaseProductWithWinBackOfferOptions, PurchasesPlugin, PurchaseStoreProductOptions, PurchaseSubscriptionOptionOptions, SyncAmazonPurchaseOptions, SyncObserverModeAmazonPurchaseOptions } from './definitions';
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 {
6
6
  private shouldMockWebResults;
7
7
  private webNotSupportedErrorMessage;
8
8
  configure(_configuration: PurchasesConfiguration): Promise<void>;
9
+ parseAsWebPurchaseRedemption(_options: {
10
+ urlString: string;
11
+ }): Promise<{
12
+ webPurchaseRedemption: WebPurchaseRedemption | null;
13
+ }>;
14
+ redeemWebPurchase(_options: {
15
+ webPurchaseRedemption: WebPurchaseRedemption;
16
+ }): Promise<WebPurchaseRedemptionResult>;
9
17
  setMockWebResults(options: {
10
18
  shouldMockWebResults: boolean;
11
19
  }): Promise<void>;
package/dist/esm/web.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import { WebPlugin } from '@capacitor/core';
3
- import { REFUND_REQUEST_STATUS, VERIFICATION_RESULT } from '@revenuecat/purchases-typescript-internal-esm';
3
+ import { REFUND_REQUEST_STATUS, VERIFICATION_RESULT, WebPurchaseRedemptionResultType, } from '@revenuecat/purchases-typescript-internal-esm';
4
4
  export class PurchasesWeb extends WebPlugin {
5
5
  constructor() {
6
6
  super(...arguments);
@@ -30,6 +30,14 @@ export class PurchasesWeb extends WebPlugin {
30
30
  configure(_configuration) {
31
31
  return this.mockNonReturningFunctionIfEnabled('configure');
32
32
  }
33
+ parseAsWebPurchaseRedemption(_options) {
34
+ return this.mockReturningFunctionIfEnabled('parseAsWebPurchaseRedemption', { webPurchaseRedemption: null });
35
+ }
36
+ redeemWebPurchase(_options) {
37
+ return this.mockReturningFunctionIfEnabled('redeemWebPurchase', {
38
+ result: WebPurchaseRedemptionResultType.INVALID_TOKEN,
39
+ });
40
+ }
33
41
  setMockWebResults(options) {
34
42
  this.shouldMockWebResults = options.shouldMockWebResults;
35
43
  return Promise.resolve();
@@ -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;AAqB5C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAmB3G,MAAM,OAAO,YAAa,SAAQ,SAAS;IAA3C;;QACU,yBAAoB,GAAG,KAAK,CAAC;QAC7B,gCAA2B,GAAG,mCAAmC,CAAC;QA4R1E,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;SAChC,CAAC;IAyBJ,CAAC;IAvUC,SAAS,CAAC,cAAsC;QAC9C,OAAO,IAAI,CAAC,iCAAiC,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,iBAAiB,CAAC,OAA0C;QAC1D,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,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,YAAY,EAAE,IAAI,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,8BAA8B,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;IAwBO,eAAe,CAAC,iBAAyB;QAC/C,OAAO;YACL,iBAAiB,EAAE,iBAAiB;YACpC,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACtC,qBAAqB,EAAE,EAAE;SAC1B,CAAC;IACJ,CAAC;IAEO,iCAAiC,CAAC,YAAoB;QAC5D,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;SACzD;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,4CAA4C,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAEO,8BAA8B,CAAI,YAAoB,EAAE,WAAc;QAC5E,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,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 PurchasesWinBackOffer,\n ShouldPurchasePromoProductListener,\n} from '@revenuecat/purchases-typescript-internal-esm';\nimport { REFUND_REQUEST_STATUS, VERIFICATION_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n GetEligibleWinBackOffersForProductOptions,\n GetEligibleWinBackOffersForPackageOptions,\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 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 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 };\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":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB5C,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;QAwS1E,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;SAChC,CAAC;IAyBJ,CAAC;IAnVC,SAAS,CAAC,cAAsC;QAC9C,OAAO,IAAI,CAAC,iCAAiC,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,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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 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 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 };\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,8 @@
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(parseAsWebPurchaseRedemption, CAPPluginReturnPromise);
9
+ CAP_PLUGIN_METHOD(redeemWebPurchase, CAPPluginReturnPromise);
8
10
  CAP_PLUGIN_METHOD(setMockWebResults, CAPPluginReturnNone);
9
11
  CAP_PLUGIN_METHOD(setFinishTransactions, CAPPluginReturnNone);
10
12
  CAP_PLUGIN_METHOD(setSimulatesAskToBuyInSandbox, 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 = "10.0.2"
15
+ private let platformVersion = "10.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 parseAsWebPurchaseRedemption(_ call: CAPPluginCall) {
73
+ guard let urlString = call.getOrRejectString("urlString") else { return }
74
+ let result: [String: Any?]
75
+ if CommonFunctionality.isWebPurchaseRedemptionURL(urlString: urlString) {
76
+ result = ["webPurchaseRedemption": ["redemptionLink": urlString]]
77
+ } else {
78
+ result = [
79
+ "webPurchaseRedemption": nil
80
+ ]
81
+ }
82
+ call.resolve(result as PluginCallResultData)
83
+ }
84
+
85
+ @objc func redeemWebPurchase(_ call: CAPPluginCall) {
86
+ guard let webPurchaseRedemption = call.getOrRejectObject("webPurchaseRedemption") else { return }
87
+ guard let redemptionLink = webPurchaseRedemption["redemptionLink"] as? String else {
88
+ call.reject("WebPurchaseRedemption parameter did not have a redemptionLink key")
89
+ return
90
+ }
91
+ CommonFunctionality.redeemWebPurchase(urlString: redemptionLink,
92
+ completion: self.getCompletionBlockHandler(call))
93
+ }
94
+
72
95
  @objc func setMockWebResults(_ call: CAPPluginCall) {
73
96
  NSLog("Cannot enable mock web results in iOS.")
74
97
  call.resolve()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-capacitor",
3
- "version": "10.0.2",
3
+ "version": "10.1.0",
4
4
  "description": "Capacitor in-app purchases and subscriptions made easy. Support for iOS and Android.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -17,7 +17,7 @@
17
17
  "license": "MIT",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/RevenueCat/purchases-capacitor.git"
20
+ "url": "https://github.com/RevenueCat/purchases-capacitor.git"
21
21
  },
22
22
  "bugs": {
23
23
  "url": "https://github.com/RevenueCat/purchases-capacitor/issues"
@@ -72,6 +72,6 @@
72
72
  }
73
73
  },
74
74
  "dependencies": {
75
- "@revenuecat/purchases-typescript-internal-esm": "13.17.1"
75
+ "@revenuecat/purchases-typescript-internal-esm": "13.19.0"
76
76
  }
77
77
  }