@revenuecat/purchases-capacitor 9.0.9 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -82,6 +82,10 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
82
82
  * [`isAnonymous()`](#isanonymous)
83
83
  * [`checkTrialOrIntroductoryPriceEligibility(...)`](#checktrialorintroductorypriceeligibility)
84
84
  * [`getPromotionalOffer(...)`](#getpromotionaloffer)
85
+ * [`getEligibleWinBackOffersForProduct(...)`](#geteligiblewinbackoffersforproduct)
86
+ * [`getEligibleWinBackOffersForPackage(...)`](#geteligiblewinbackoffersforpackage)
87
+ * [`purchaseProductWithWinBackOffer(...)`](#purchaseproductwithwinbackoffer)
88
+ * [`purchasePackageWithWinBackOffer(...)`](#purchasepackagewithwinbackoffer)
85
89
  * [`invalidateCustomerInfoCache()`](#invalidatecustomerinfocache)
86
90
  * [`presentCodeRedemptionSheet()`](#presentcoderedemptionsheet)
87
91
  * [`setAttributes(...)`](#setattributes)
@@ -575,6 +579,78 @@ iOS only. Use this function to retrieve the <a href="#purchasespromotionaloffer"
575
579
  --------------------
576
580
 
577
581
 
582
+ ### getEligibleWinBackOffersForProduct(...)
583
+
584
+ ```typescript
585
+ getEligibleWinBackOffersForProduct(options: GetEligibleWinBackOffersForProductOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
586
+ ```
587
+
588
+ iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
589
+ the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a
590
+ given <a href="#purchasesstoreproduct">`PurchasesStoreProduct`</a>.
591
+
592
+ | Param | Type |
593
+ | ------------- | --------------------------------------------------------------------------------------------------------------- |
594
+ | **`options`** | <code><a href="#geteligiblewinbackoffersforproductoptions">GetEligibleWinBackOffersForProductOptions</a></code> |
595
+
596
+ **Returns:** <code>Promise&lt;{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }&gt;</code>
597
+
598
+ --------------------
599
+
600
+
601
+ ### getEligibleWinBackOffersForPackage(...)
602
+
603
+ ```typescript
604
+ getEligibleWinBackOffersForPackage(options: GetEligibleWinBackOffersForPackageOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>
605
+ ```
606
+
607
+ iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
608
+ the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a
609
+ given `PurchasesStorePackage`.
610
+
611
+ | Param | Type |
612
+ | ------------- | --------------------------------------------------------------------------------------------------------------- |
613
+ | **`options`** | <code><a href="#geteligiblewinbackoffersforpackageoptions">GetEligibleWinBackOffersForPackageOptions</a></code> |
614
+
615
+ **Returns:** <code>Promise&lt;{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }&gt;</code>
616
+
617
+ --------------------
618
+
619
+
620
+ ### purchaseProductWithWinBackOffer(...)
621
+
622
+ ```typescript
623
+ purchaseProductWithWinBackOffer(options: PurchaseProductWithWinBackOfferOptions) => Promise<MakePurchaseResult | undefined>
624
+ ```
625
+
626
+ iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a product applying a given win-back offer.
627
+
628
+ | Param | Type |
629
+ | ------------- | --------------------------------------------------------------------------------------------------------- |
630
+ | **`options`** | <code><a href="#purchaseproductwithwinbackofferoptions">PurchaseProductWithWinBackOfferOptions</a></code> |
631
+
632
+ **Returns:** <code>Promise&lt;<a href="#makepurchaseresult">MakePurchaseResult</a>&gt;</code>
633
+
634
+ --------------------
635
+
636
+
637
+ ### purchasePackageWithWinBackOffer(...)
638
+
639
+ ```typescript
640
+ purchasePackageWithWinBackOffer(options: PurchasePackageWithWinBackOfferOptions) => Promise<MakePurchaseResult | undefined>
641
+ ```
642
+
643
+ iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a package applying a given win-back offer.
644
+
645
+ | Param | Type |
646
+ | ------------- | --------------------------------------------------------------------------------------------------------- |
647
+ | **`options`** | <code><a href="#purchasepackagewithwinbackofferoptions">PurchasePackageWithWinBackOfferOptions</a></code> |
648
+
649
+ **Returns:** <code>Promise&lt;<a href="#makepurchaseresult">MakePurchaseResult</a>&gt;</code>
650
+
651
+ --------------------
652
+
653
+
578
654
  ### invalidateCustomerInfoCache()
579
655
 
580
656
  ```typescript
@@ -1100,6 +1176,7 @@ Holds parameters to initialize the SDK.
1100
1176
  | **`shouldShowInAppMessagesAutomatically`** | <code>boolean</code> | Whether we should show store in-app messages automatically. Both Google Play and the App Store provide in-app messages for some situations like billing issues. By default, those messages will be shown automatically. This allows to disable that behavior, so you can display those messages at your convenience. For more information, check: https://rev.cat/storekit-message and https://rev.cat/googleplayinappmessaging |
1101
1177
  | **`entitlementVerificationMode`** | <code><a href="#entitlement_verification_mode">ENTITLEMENT_VERIFICATION_MODE</a></code> | Verification strictness levels for [EntitlementInfo]. See https://rev.cat/trusted-entitlements for more info. |
1102
1178
  | **`pendingTransactionsForPrepaidPlansEnabled`** | <code>boolean</code> | Enable this setting if you want to allow pending purchases for prepaid subscriptions (only supported in Google Play). Note that entitlements are not granted until payment is done. Disabled by default. |
1179
+ | **`diagnosticsEnabled`** | <code>boolean</code> | Enabling diagnostics will send some performance and debugging information from the SDK to our servers. Examples of this information include response times, cache hits or error codes. No personal identifiable information will be collected. The default value is false. |
1103
1180
 
1104
1181
 
1105
1182
  #### CustomerInfo
@@ -1478,6 +1555,41 @@ Holds the introductory price status
1478
1555
  | **`discount`** | <code><a href="#purchasesstoreproductdiscount">PurchasesStoreProductDiscount</a></code> | The <a href="#purchasesstoreproductdiscount">`PurchasesStoreProductDiscount`</a> to apply to the product. |
1479
1556
 
1480
1557
 
1558
+ #### PurchasesWinBackOffer
1559
+
1560
+ Holds the information about a Win-Back Offer in Apple's App Store.
1561
+
1562
+
1563
+ #### GetEligibleWinBackOffersForProductOptions
1564
+
1565
+ | Prop | Type | Description |
1566
+ | ------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------- |
1567
+ | **`product`** | <code><a href="#purchasesstoreproduct">PurchasesStoreProduct</a></code> | The product you want to fetch eligible win-back offers for |
1568
+
1569
+
1570
+ #### GetEligibleWinBackOffersForPackageOptions
1571
+
1572
+ | Prop | Type | Description |
1573
+ | -------------- | ------------------------------------------------------------- | ---------------------------------------------------------- |
1574
+ | **`aPackage`** | <code><a href="#purchasespackage">PurchasesPackage</a></code> | The package you want to fetch eligible win-back offers for |
1575
+
1576
+
1577
+ #### PurchaseProductWithWinBackOfferOptions
1578
+
1579
+ | Prop | Type | Description |
1580
+ | ------------------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
1581
+ | **`product`** | <code><a href="#purchasesstoreproduct">PurchasesStoreProduct</a></code> | The product you want to purchase |
1582
+ | **`winBackOffer`** | <code><a href="#purchaseswinbackoffer">PurchasesWinBackOffer</a></code> | Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForProduct. |
1583
+
1584
+
1585
+ #### PurchasePackageWithWinBackOfferOptions
1586
+
1587
+ | Prop | Type | Description |
1588
+ | ------------------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
1589
+ | **`aPackage`** | <code><a href="#purchasespackage">PurchasesPackage</a></code> | The package you want to purchase |
1590
+ | **`winBackOffer`** | <code><a href="#purchaseswinbackoffer">PurchasesWinBackOffer</a></code> | Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForPackage. |
1591
+
1592
+
1481
1593
  ### Type Aliases
1482
1594
 
1483
1595
 
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'PurchasesHybridCommon', '13.13.0'
16
+ s.dependency 'PurchasesHybridCommon', '13.14.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.13.0'
59
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.14.0'
60
60
  testImplementation "junit:junit:$junitVersion"
61
61
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
62
62
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -77,7 +77,7 @@ class PurchasesPlugin : Plugin() {
77
77
 
78
78
  companion object {
79
79
  private const val PLATFORM_NAME = "capacitor"
80
- private const val PLUGIN_VERSION = "9.0.9"
80
+ private const val PLUGIN_VERSION = "9.2.0"
81
81
 
82
82
  private const val CUSTOMER_INFO_KEY = "customerInfo"
83
83
  }
@@ -98,6 +98,7 @@ class PurchasesPlugin : Plugin() {
98
98
  val shouldShowInAppMessages = call.getBoolean("shouldShowInAppMessagesAutomatically")
99
99
  val entitlementVerificationMode = call.getString("entitlementVerificationMode")
100
100
  val pendingTransactionsForPrepaidPlansEnabled = call.getBoolean("pendingTransactionsForPrepaidPlansEnabled")
101
+ val diagnosticsEnabled = call.getBoolean("diagnosticsEnabled")
101
102
 
102
103
  configure(
103
104
  context.applicationContext,
@@ -109,6 +110,7 @@ class PurchasesPlugin : Plugin() {
109
110
  shouldShowInAppMessagesAutomatically = shouldShowInAppMessages,
110
111
  verificationMode = entitlementVerificationMode,
111
112
  pendingTransactionsForPrepaidPlansEnabled = pendingTransactionsForPrepaidPlansEnabled,
113
+ diagnosticsEnabled = diagnosticsEnabled,
112
114
  )
113
115
  Purchases.sharedInstance.updatedCustomerInfoListener = UpdatedCustomerInfoListener { customerInfo ->
114
116
  for (callbackId in customerInfoListeners) {
@@ -365,6 +367,30 @@ class PurchasesPlugin : Plugin() {
365
367
  call.resolve()
366
368
  }
367
369
 
370
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
371
+ fun getEligibleWinBackOffersForProduct(call: PluginCall) {
372
+ logNotSupportedFunctionalityInAndroid("getEligibleWinBackOffersForProduct")
373
+ call.unavailable()
374
+ }
375
+
376
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
377
+ fun getEligibleWinBackOffersForPackage(call: PluginCall) {
378
+ logNotSupportedFunctionalityInAndroid("getEligibleWinBackOffersForPackage")
379
+ call.unavailable()
380
+ }
381
+
382
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
383
+ fun purchaseProductWithWinBackOffer(call: PluginCall) {
384
+ logNotSupportedFunctionalityInAndroid("purchaseProductWithWinBackOffer")
385
+ call.unavailable()
386
+ }
387
+
388
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
389
+ fun purchasePackageWithWinBackOffer(call: PluginCall) {
390
+ logNotSupportedFunctionalityInAndroid("purchasePackageWithWinBackOffer")
391
+ call.unavailable()
392
+ }
393
+
368
394
  @PluginMethod(returnType = PluginMethod.RETURN_NONE)
369
395
  fun invalidateCustomerInfoCache(call: PluginCall) {
370
396
  if (rejectIfNotConfigured(call)) return
package/dist/docs.json CHANGED
@@ -642,6 +642,102 @@
642
642
  ],
643
643
  "slug": "getpromotionaloffer"
644
644
  },
645
+ {
646
+ "name": "getEligibleWinBackOffersForProduct",
647
+ "signature": "(options: GetEligibleWinBackOffersForProductOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>",
648
+ "parameters": [
649
+ {
650
+ "name": "options",
651
+ "docs": "",
652
+ "type": "GetEligibleWinBackOffersForProductOptions"
653
+ }
654
+ ],
655
+ "returns": "Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>",
656
+ "tags": [
657
+ {
658
+ "name": "returns",
659
+ "text": "A dictionary containing an array of `PurchasesWinBackOffer`s that\nthe subscriber is eligible for for the given `PurchasesStoreProduct`.\nThe promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\nThe promise will also be rejected if configure has not been called yet."
660
+ }
661
+ ],
662
+ "docs": "iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve\nthe eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a\ngiven `PurchasesStoreProduct`.",
663
+ "complexTypes": [
664
+ "PurchasesWinBackOffer",
665
+ "GetEligibleWinBackOffersForProductOptions"
666
+ ],
667
+ "slug": "geteligiblewinbackoffersforproduct"
668
+ },
669
+ {
670
+ "name": "getEligibleWinBackOffersForPackage",
671
+ "signature": "(options: GetEligibleWinBackOffersForPackageOptions) => Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>",
672
+ "parameters": [
673
+ {
674
+ "name": "options",
675
+ "docs": "",
676
+ "type": "GetEligibleWinBackOffersForPackageOptions"
677
+ }
678
+ ],
679
+ "returns": "Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[]; }>",
680
+ "tags": [
681
+ {
682
+ "name": "returns",
683
+ "text": "An array of `PurchasesWinBackOffer`s that\nthe subscriber is eligible for for the given `PurchasesStorePackage`.\nThe promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.\nThe promise will also be rejected if configure has not been called yet."
684
+ }
685
+ ],
686
+ "docs": "iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve\nthe eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a\ngiven `PurchasesStorePackage`.",
687
+ "complexTypes": [
688
+ "PurchasesWinBackOffer",
689
+ "GetEligibleWinBackOffersForPackageOptions"
690
+ ],
691
+ "slug": "geteligiblewinbackoffersforpackage"
692
+ },
693
+ {
694
+ "name": "purchaseProductWithWinBackOffer",
695
+ "signature": "(options: PurchaseProductWithWinBackOfferOptions) => Promise<MakePurchaseResult | undefined>",
696
+ "parameters": [
697
+ {
698
+ "name": "options",
699
+ "docs": "",
700
+ "type": "PurchaseProductWithWinBackOfferOptions"
701
+ }
702
+ ],
703
+ "returns": "Promise<MakePurchaseResult | undefined>",
704
+ "tags": [
705
+ {
706
+ "name": "returns",
707
+ "text": "A promise of an object containing\na customer info object, a transaction, and a product identifier. Rejections return an error code, a boolean indicating if the\nuser cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\nhas not been called yet or if called in an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1."
708
+ }
709
+ ],
710
+ "docs": "iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a product applying a given win-back offer.",
711
+ "complexTypes": [
712
+ "MakePurchaseResult",
713
+ "PurchaseProductWithWinBackOfferOptions"
714
+ ],
715
+ "slug": "purchaseproductwithwinbackoffer"
716
+ },
717
+ {
718
+ "name": "purchasePackageWithWinBackOffer",
719
+ "signature": "(options: PurchasePackageWithWinBackOfferOptions) => Promise<MakePurchaseResult | undefined>",
720
+ "parameters": [
721
+ {
722
+ "name": "options",
723
+ "docs": "",
724
+ "type": "PurchasePackageWithWinBackOfferOptions"
725
+ }
726
+ ],
727
+ "returns": "Promise<MakePurchaseResult | undefined>",
728
+ "tags": [
729
+ {
730
+ "name": "returns",
731
+ "text": "A promise of an object containing\na customer info object, a transaction, and a product identifier. Rejections return an error code, a boolean indicating if the\nuser cancelled the purchase, and an object with more information. The promise will be also be rejected if configure\nhas not been called yet or if called in an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1."
732
+ }
733
+ ],
734
+ "docs": "iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a package applying a given win-back offer.",
735
+ "complexTypes": [
736
+ "MakePurchaseResult",
737
+ "PurchasePackageWithWinBackOfferOptions"
738
+ ],
739
+ "slug": "purchasepackagewithwinbackoffer"
740
+ },
645
741
  {
646
742
  "name": "invalidateCustomerInfoCache",
647
743
  "signature": "() => Promise<void>",
@@ -1458,6 +1554,13 @@
1458
1554
  "docs": "Enable this setting if you want to allow pending purchases for prepaid subscriptions (only supported\nin Google Play). Note that entitlements are not granted until payment is done.\nDisabled by default.",
1459
1555
  "complexTypes": [],
1460
1556
  "type": "boolean | undefined"
1557
+ },
1558
+ {
1559
+ "name": "diagnosticsEnabled",
1560
+ "tags": [],
1561
+ "docs": "Enabling diagnostics will send some performance and debugging information from the SDK to our servers.\nExamples of this information include response times, cache hits or error codes.\nNo personal identifiable information will be collected.\nThe default value is false.",
1562
+ "complexTypes": [],
1563
+ "type": "boolean | undefined"
1461
1564
  }
1462
1565
  ]
1463
1566
  },
@@ -3022,6 +3125,108 @@
3022
3125
  "type": "PurchasesStoreProductDiscount"
3023
3126
  }
3024
3127
  ]
3128
+ },
3129
+ {
3130
+ "name": "PurchasesWinBackOffer",
3131
+ "slug": "purchaseswinbackoffer",
3132
+ "docs": "Holds the information about a Win-Back Offer in Apple's App Store.",
3133
+ "tags": [
3134
+ {
3135
+ "name": "public"
3136
+ }
3137
+ ],
3138
+ "methods": [],
3139
+ "properties": []
3140
+ },
3141
+ {
3142
+ "name": "GetEligibleWinBackOffersForProductOptions",
3143
+ "slug": "geteligiblewinbackoffersforproductoptions",
3144
+ "docs": "",
3145
+ "tags": [],
3146
+ "methods": [],
3147
+ "properties": [
3148
+ {
3149
+ "name": "product",
3150
+ "tags": [],
3151
+ "docs": "The product you want to fetch eligible win-back offers for",
3152
+ "complexTypes": [
3153
+ "PurchasesStoreProduct"
3154
+ ],
3155
+ "type": "PurchasesStoreProduct"
3156
+ }
3157
+ ]
3158
+ },
3159
+ {
3160
+ "name": "GetEligibleWinBackOffersForPackageOptions",
3161
+ "slug": "geteligiblewinbackoffersforpackageoptions",
3162
+ "docs": "",
3163
+ "tags": [],
3164
+ "methods": [],
3165
+ "properties": [
3166
+ {
3167
+ "name": "aPackage",
3168
+ "tags": [],
3169
+ "docs": "The package you want to fetch eligible win-back offers for",
3170
+ "complexTypes": [
3171
+ "PurchasesPackage"
3172
+ ],
3173
+ "type": "PurchasesPackage"
3174
+ }
3175
+ ]
3176
+ },
3177
+ {
3178
+ "name": "PurchaseProductWithWinBackOfferOptions",
3179
+ "slug": "purchaseproductwithwinbackofferoptions",
3180
+ "docs": "",
3181
+ "tags": [],
3182
+ "methods": [],
3183
+ "properties": [
3184
+ {
3185
+ "name": "product",
3186
+ "tags": [],
3187
+ "docs": "The product you want to purchase",
3188
+ "complexTypes": [
3189
+ "PurchasesStoreProduct"
3190
+ ],
3191
+ "type": "PurchasesStoreProduct"
3192
+ },
3193
+ {
3194
+ "name": "winBackOffer",
3195
+ "tags": [],
3196
+ "docs": "Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForProduct.",
3197
+ "complexTypes": [
3198
+ "PurchasesWinBackOffer"
3199
+ ],
3200
+ "type": "PurchasesWinBackOffer"
3201
+ }
3202
+ ]
3203
+ },
3204
+ {
3205
+ "name": "PurchasePackageWithWinBackOfferOptions",
3206
+ "slug": "purchasepackagewithwinbackofferoptions",
3207
+ "docs": "",
3208
+ "tags": [],
3209
+ "methods": [],
3210
+ "properties": [
3211
+ {
3212
+ "name": "aPackage",
3213
+ "tags": [],
3214
+ "docs": "The package you want to purchase",
3215
+ "complexTypes": [
3216
+ "PurchasesPackage"
3217
+ ],
3218
+ "type": "PurchasesPackage"
3219
+ },
3220
+ {
3221
+ "name": "winBackOffer",
3222
+ "tags": [],
3223
+ "docs": "Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForPackage.",
3224
+ "complexTypes": [
3225
+ "PurchasesWinBackOffer"
3226
+ ],
3227
+ "type": "PurchasesWinBackOffer"
3228
+ }
3229
+ ]
3025
3230
  }
3026
3231
  ],
3027
3232
  "enums": [
@@ -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 } from '@revenuecat/purchases-typescript-internal-esm';
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';
2
2
  export * from '@revenuecat/purchases-typescript-internal-esm';
3
3
  export declare type PurchasesCallbackId = string;
4
4
  export interface GetProductOptions {
@@ -38,6 +38,38 @@ export interface PurchaseDiscountedProductOptions {
38
38
  */
39
39
  discount: PurchasesPromotionalOffer;
40
40
  }
41
+ export interface GetEligibleWinBackOffersForProductOptions {
42
+ /**
43
+ * The product you want to fetch eligible win-back offers for
44
+ */
45
+ product: PurchasesStoreProduct;
46
+ }
47
+ export interface GetEligibleWinBackOffersForPackageOptions {
48
+ /**
49
+ * The package you want to fetch eligible win-back offers for
50
+ */
51
+ aPackage: PurchasesPackage;
52
+ }
53
+ export interface PurchaseProductWithWinBackOfferOptions {
54
+ /**
55
+ * The product you want to purchase
56
+ */
57
+ product: PurchasesStoreProduct;
58
+ /**
59
+ * Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForProduct.
60
+ */
61
+ winBackOffer: PurchasesWinBackOffer;
62
+ }
63
+ export interface PurchasePackageWithWinBackOfferOptions {
64
+ /**
65
+ * The package you want to purchase
66
+ */
67
+ aPackage: PurchasesPackage;
68
+ /**
69
+ * Win-back offer to apply to this purchase. Retrieve this using getEligibleWinBackOffersForPackage.
70
+ */
71
+ winBackOffer: PurchasesWinBackOffer;
72
+ }
41
73
  export interface PurchasePackageOptions {
42
74
  /**
43
75
  * The Package you wish to purchase. You can get the Packages by calling getOfferings
@@ -378,6 +410,50 @@ export interface PurchasesPlugin {
378
410
  * called yet or if there's an error getting the payment discount.
379
411
  */
380
412
  getPromotionalOffer(options: GetPromotionalOfferOptions): Promise<PurchasesPromotionalOffer | undefined>;
413
+ /**
414
+ * iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
415
+ * the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a
416
+ * given `PurchasesStoreProduct`.
417
+ *
418
+ * @returns { Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> } A dictionary containing an array of `PurchasesWinBackOffer`s that
419
+ * the subscriber is eligible for for the given `PurchasesStoreProduct`.
420
+ * The promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.
421
+ * The promise will also be rejected if configure has not been called yet.
422
+ */
423
+ getEligibleWinBackOffersForProduct(options: GetEligibleWinBackOffersForProductOptions): Promise<{
424
+ eligibleWinBackOffers: PurchasesWinBackOffer[];
425
+ }>;
426
+ /**
427
+ * iOS only, requires iOS 18.0 or greater with StoreKit 2. Use this function to retrieve
428
+ * the eligible `PurchasesWinBackOffer`s that a subscriber is eligible for for a
429
+ * given `PurchasesStorePackage`.
430
+ *
431
+ * @returns { Promise<{ eligibleWinBackOffers: PurchasesWinBackOffer[] }> } An array of `PurchasesWinBackOffer`s that
432
+ * the subscriber is eligible for for the given `PurchasesStorePackage`.
433
+ * The promise will be rejected if called on an unsupported platform (Android or iOS < 18), or if called on iOS 18+ with StoreKit 1.
434
+ * The promise will also be rejected if configure has not been called yet.
435
+ */
436
+ getEligibleWinBackOffersForPackage(options: GetEligibleWinBackOffersForPackageOptions): Promise<{
437
+ eligibleWinBackOffers: PurchasesWinBackOffer[];
438
+ }>;
439
+ /**
440
+ * iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a product applying a given win-back offer.
441
+ *
442
+ * @returns {Promise<MakePurchaseResult>} A promise of an object containing
443
+ * a customer info object, a transaction, and a product identifier. Rejections return an error code, a boolean indicating if the
444
+ * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
445
+ * 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.
446
+ */
447
+ purchaseProductWithWinBackOffer(options: PurchaseProductWithWinBackOfferOptions): Promise<MakePurchaseResult | undefined>;
448
+ /**
449
+ * iOS only, requires iOS 18.0 or greater with StoreKit 2. Purchase a package applying a given win-back offer.
450
+ *
451
+ * @returns {Promise<MakePurchaseResult>} A promise of an object containing
452
+ * a customer info object, a transaction, and a product identifier. Rejections return an error code, a boolean indicating if the
453
+ * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
454
+ * 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.
455
+ */
456
+ purchasePackageWithWinBackOffer(options: PurchasePackageWithWinBackOfferOptions): Promise<MakePurchaseResult | undefined>;
381
457
  /**
382
458
  * Invalidates the cache for customer information.
383
459
  *