react-native-purchases 10.10.1 → 10.11.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.
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '19.2.0'
28
+ spec.dependency "PurchasesHybridCommon", '19.5.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -35,7 +35,7 @@ android {
35
35
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
36
36
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
37
37
  versionCode 1
38
- versionName '10.10.1'
38
+ versionName '10.11.0'
39
39
  }
40
40
 
41
41
  buildTypes {
@@ -127,6 +127,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
127
127
  dependencies {
128
128
  //noinspection GradleDynamicVersion
129
129
  api 'com.facebook.react:react-native:+'
130
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:19.2.0'
130
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:19.5.0'
131
131
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
132
132
  }
@@ -51,7 +51,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
51
51
  private static final String TRACKED_EVENT = "Purchases-TrackedEvent";
52
52
  private static final String DEBUG_EVENT = "Purchases-DebugEvent";
53
53
  public static final String PLATFORM_NAME = "react-native";
54
- public static final String PLUGIN_VERSION = "10.10.1";
54
+ public static final String PLUGIN_VERSION = "10.11.0";
55
55
 
56
56
  private final ReactApplicationContext reactContext;
57
57
 
@@ -96,7 +96,9 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
96
96
  boolean pendingTransactionsForPrepaidPlansEnabled,
97
97
  boolean diagnosticsEnabled,
98
98
  boolean automaticDeviceIdentifierCollectionEnabled,
99
- @Nullable String preferredUILocaleOverride) {
99
+ @Nullable String preferredUILocaleOverride,
100
+ boolean useExternalPurchaseCustomLinks,
101
+ boolean enableExternalPurchasesInSimulator) {
100
102
  PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
101
103
  Store store = Store.PLAY_STORE;
102
104
  if ("GALAXY".equals(storeString)) {
@@ -4,7 +4,7 @@ import type { RewardedAdTrackingMetadata } from '../purchases';
4
4
  * Browser implementation of the native module. This will be used in the browser and Expo Go.
5
5
  */
6
6
  export declare const browserNativeModuleRNPurchases: {
7
- setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _store: string | null, _galaxyBillingMode: string | null, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null) => void;
7
+ setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _store: string | null, _galaxyBillingMode: string | null, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null, _useExternalPurchaseCustomLinks: boolean, _enableExternalPurchasesInSimulator: boolean) => void;
8
8
  setAllowSharingStoreAccount: (_allowSharing: boolean) => Promise<void>;
9
9
  setSimulatesAskToBuyInSandbox: (_simulatesAskToBuyInSandbox: boolean) => Promise<void>;
10
10
  getOfferings: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
@@ -43,12 +43,12 @@ var typeGuards_1 = require("./typeGuards");
43
43
  var environment_1 = require("../utils/environment");
44
44
  var utils_1 = require("./utils");
45
45
  var purchaseSimulatedPackageHelper_1 = require("./simulatedstore/purchaseSimulatedPackageHelper");
46
- var packageVersion = '10.10.1';
46
+ var packageVersion = '10.11.0';
47
47
  /**
48
48
  * Browser implementation of the native module. This will be used in the browser and Expo Go.
49
49
  */
50
50
  exports.browserNativeModuleRNPurchases = {
51
- setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _store, _galaxyBillingMode, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride) {
51
+ setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _store, _galaxyBillingMode, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride, _useExternalPurchaseCustomLinks, _enableExternalPurchasesInSimulator) {
52
52
  try {
53
53
  // Make sure that when running in Expo Go or Rork sandbox a web-compatible API key is used, because the underlying purchases-js error message isn't super clear when a non-compatible API key type is used in this case
54
54
  var webPlatformCompatibleApiKeyPrefixList = ['test_', 'rcb_'];
@@ -0,0 +1 @@
1
+ export declare function normalizingRejections<T extends object>(module: T): T;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizingRejections = void 0;
4
+ var purchases_typescript_internal_1 = require("@revenuecat/purchases-typescript-internal");
5
+ // The returned promise is chained, never copied: enumerating a TurboModule
6
+ // promise's own properties throws inside Hermes.
7
+ function normalizingRejections(module) {
8
+ return new Proxy(module, {
9
+ get: function (target, property, receiver) {
10
+ var value = Reflect.get(target, property, receiver);
11
+ if (typeof value !== "function") {
12
+ return value;
13
+ }
14
+ // An apply trap keeps what the bridge puts on the method it generated, such as its
15
+ // name and React Native's own call-type marker.
16
+ return new Proxy(value, {
17
+ apply: function (method, thisArg, args) {
18
+ var result = Reflect.apply(method, thisArg, args);
19
+ return result instanceof Promise
20
+ ? result.catch(function (error) {
21
+ throw (0, purchases_typescript_internal_1.normalizePurchasesError)(error);
22
+ })
23
+ : result;
24
+ },
25
+ });
26
+ },
27
+ });
28
+ }
29
+ exports.normalizingRejections = normalizingRejections;
@@ -284,6 +284,8 @@ export default class Purchases {
284
284
  * @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
285
285
  * @param {boolean} [automaticDeviceIdentifierCollectionEnabled=true] An optional boolean. Set this to true to allow the collection of identifiers when setting the identifier for an attribution network.
286
286
  * @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
287
+ * @param {boolean} [useExternalPurchaseCustomLinks=false] Experimental. An optional boolean. iOS-only. Set this to true to make web purchase buttons that open in the external browser go through Apple's external purchase custom link flow.
288
+ * @param {boolean} [enableExternalPurchasesInSimulator=true] Experimental. An optional boolean. iOS-only. Set this to false to make the simulator behave as a device does for a customer who is not eligible for external purchases.
287
289
  *
288
290
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
289
291
  */
package/dist/purchases.js CHANGED
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.PurchasesAdTracker = exports.AdRevenuePrecision = exports.AdFormat = exports.AdMediatorName = exports.WebPurchaseRedemptionResultType = exports.STOREKIT_VERSION = exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASES_ARE_COMPLETED_BY_TYPE = exports.PURCHASE_TYPE = void 0;
40
40
  var react_native_1 = require("react-native");
41
41
  var purchases_typescript_internal_1 = require("@revenuecat/purchases-typescript-internal");
42
+ var normalizingRejections_1 = require("./normalizingRejections");
42
43
  var environment_1 = require("./utils/environment");
43
44
  var nativeModule_1 = require("./browser/nativeModule");
44
45
  // This export is kept to keep backwards compatibility to any possible users using this file directly
@@ -62,14 +63,15 @@ var NATIVE_MODULE_ERROR = "[RevenueCat] Native module (RNPurchases) not found. T
62
63
  "- Check that you have rebuilt the app after installing the package\n";
63
64
  // Get the native module or use the browser implementation
64
65
  var usingBrowserMode = (0, environment_1.shouldUseBrowserMode)();
65
- var RNPurchases = usingBrowserMode ? nativeModule_1.browserNativeModuleRNPurchases : react_native_1.NativeModules.RNPurchases;
66
+ var nativeModule = usingBrowserMode ? nativeModule_1.browserNativeModuleRNPurchases : react_native_1.NativeModules.RNPurchases;
67
+ var RNPurchases = nativeModule ? (0, normalizingRejections_1.normalizingRejections)(nativeModule) : nativeModule;
66
68
  // Only create event emitter if native module is available to avoid crash on import
67
69
  //
68
70
  // React Native 0.79+ requires native modules to implement addListener() and removeListeners()
69
71
  // methods for NativeEventEmitter to work. Both iOS and Android native modules now have these.
70
72
  // See: https://github.com/RevenueCat/react-native-purchases/issues/1298
71
73
  // See: https://reactnative.dev/blog/2025/04/08/react-native-0.79 (Breaking Changes section)
72
- var eventEmitter = !usingBrowserMode && RNPurchases ? new react_native_1.NativeEventEmitter(RNPurchases) : null;
74
+ var eventEmitter = !usingBrowserMode && nativeModule ? new react_native_1.NativeEventEmitter(nativeModule) : null;
73
75
  // Helper function to check if native module is available - provides better error message than "Cannot read property X of null"
74
76
  function throwIfNativeModuleNotAvailable() {
75
77
  if (!RNPurchases) {
@@ -165,12 +167,14 @@ var Purchases = /** @class */ (function () {
165
167
  * @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
166
168
  * @param {boolean} [automaticDeviceIdentifierCollectionEnabled=true] An optional boolean. Set this to true to allow the collection of identifiers when setting the identifier for an attribution network.
167
169
  * @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
170
+ * @param {boolean} [useExternalPurchaseCustomLinks=false] Experimental. An optional boolean. iOS-only. Set this to true to make web purchase buttons that open in the external browser go through Apple's external purchase custom link flow.
171
+ * @param {boolean} [enableExternalPurchasesInSimulator=true] Experimental. An optional boolean. iOS-only. Set this to false to make the simulator behave as a device does for a customer who is not eligible for external purchases.
168
172
  *
169
173
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
170
174
  */
171
175
  Purchases.configure = function (configuration) {
172
- var apiKey = configuration.apiKey, _a = configuration.appUserID, appUserID = _a === void 0 ? null : _a, _b = configuration.purchasesAreCompletedBy, purchasesAreCompletedBy = _b === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _b, userDefaultsSuiteName = configuration.userDefaultsSuiteName, _c = configuration.storeKitVersion, storeKitVersion = _c === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _c, _d = configuration.useAmazon, useAmazon = _d === void 0 ? false : _d, _e = configuration.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _e === void 0 ? true : _e, _f = configuration.entitlementVerificationMode, entitlementVerificationMode = _f === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _f, _g = configuration.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _g === void 0 ? false : _g, _h = configuration.diagnosticsEnabled, diagnosticsEnabled = _h === void 0 ? false : _h, _j = configuration.automaticDeviceIdentifierCollectionEnabled, automaticDeviceIdentifierCollectionEnabled = _j === void 0 ? true : _j, preferredUILocaleOverride = configuration.preferredUILocaleOverride;
173
- var _k = configuration, store = _k.store, galaxyBillingMode = _k.galaxyBillingMode;
176
+ var apiKey = configuration.apiKey, _a = configuration.appUserID, appUserID = _a === void 0 ? null : _a, _b = configuration.purchasesAreCompletedBy, purchasesAreCompletedBy = _b === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _b, userDefaultsSuiteName = configuration.userDefaultsSuiteName, _c = configuration.storeKitVersion, storeKitVersion = _c === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _c, _d = configuration.useAmazon, useAmazon = _d === void 0 ? false : _d, _e = configuration.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _e === void 0 ? true : _e, _f = configuration.entitlementVerificationMode, entitlementVerificationMode = _f === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _f, _g = configuration.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _g === void 0 ? false : _g, _h = configuration.diagnosticsEnabled, diagnosticsEnabled = _h === void 0 ? false : _h, _j = configuration.automaticDeviceIdentifierCollectionEnabled, automaticDeviceIdentifierCollectionEnabled = _j === void 0 ? true : _j, preferredUILocaleOverride = configuration.preferredUILocaleOverride, _k = configuration.useExternalPurchaseCustomLinks, useExternalPurchaseCustomLinks = _k === void 0 ? false : _k, _l = configuration.enableExternalPurchasesInSimulator, enableExternalPurchasesInSimulator = _l === void 0 ? true : _l;
177
+ var _m = configuration, store = _m.store, galaxyBillingMode = _m.galaxyBillingMode;
174
178
  throwIfNativeModuleNotAvailable();
175
179
  if (!customLogHandler) {
176
180
  this.setLogHandler(function (logLevel, message) {
@@ -223,7 +227,7 @@ var Purchases = /** @class */ (function () {
223
227
  console.warn("Warning: You should provide the specific StoreKit version you're using in your implementation when configuring PURCHASES_ARE_COMPLETED_BY_TYPE.MY_APP, and not rely on the DEFAULT.");
224
228
  }
225
229
  }
226
- RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, store, galaxyBillingMode, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride);
230
+ RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, store, galaxyBillingMode, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride, useExternalPurchaseCustomLinks, enableExternalPurchasesInSimulator);
227
231
  };
228
232
  /**
229
233
  * @deprecated, configure behavior through the RevenueCat dashboard (app.revenuecat.com) instead.
@@ -431,11 +435,7 @@ var Purchases = /** @class */ (function () {
431
435
  case 0: return [4 /*yield*/, throwIfNotConfigured()];
432
436
  case 1:
433
437
  _a.sent();
434
- return [2 /*return*/, RNPurchases.purchaseProduct(productIdentifier, upgradeInfo, type, null, null, null).catch(function (error) {
435
- error.userCancelled =
436
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
437
- throw error;
438
- })];
438
+ return [2 /*return*/, RNPurchases.purchaseProduct(productIdentifier, upgradeInfo, type, null, null, null)];
439
439
  }
440
440
  });
441
441
  });
@@ -463,11 +463,7 @@ var Purchases = /** @class */ (function () {
463
463
  _a.sent();
464
464
  return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier, productChangeInfo, product.productCategory, null, googleIsPersonalizedPrice == null
465
465
  ? null
466
- : { isPersonalizedPrice: googleIsPersonalizedPrice }, product.presentedOfferingContext).catch(function (error) {
467
- error.userCancelled =
468
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
469
- throw error;
470
- })];
466
+ : { isPersonalizedPrice: googleIsPersonalizedPrice }, product.presentedOfferingContext)];
471
467
  }
472
468
  });
473
469
  });
@@ -495,11 +491,7 @@ var Purchases = /** @class */ (function () {
495
491
  if (typeof discount === "undefined" || discount == null) {
496
492
  throw new Error("A discount is required");
497
493
  }
498
- return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier, null, null, discount.timestamp.toString(), null, product.presentedOfferingContext).catch(function (error) {
499
- error.userCancelled =
500
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
501
- throw error;
502
- })];
494
+ return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier, null, null, discount.timestamp.toString(), null, product.presentedOfferingContext)];
503
495
  }
504
496
  });
505
497
  });
@@ -528,11 +520,7 @@ var Purchases = /** @class */ (function () {
528
520
  _a.sent();
529
521
  return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext, productChangeInfo || upgradeInfo, null, googleIsPersonalizedPrice == null
530
522
  ? null
531
- : { isPersonalizedPrice: googleIsPersonalizedPrice }).catch(function (error) {
532
- error.userCancelled =
533
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
534
- throw error;
535
- })];
523
+ : { isPersonalizedPrice: googleIsPersonalizedPrice })];
536
524
  }
537
525
  });
538
526
  });
@@ -563,11 +551,7 @@ var Purchases = /** @class */ (function () {
563
551
  _a.sent();
564
552
  return [2 /*return*/, RNPurchases.purchaseSubscriptionOption(subscriptionOption.productId, subscriptionOption.id, productChangeInfo, null, googleIsPersonalizedPrice == null
565
553
  ? null
566
- : { isPersonalizedPrice: googleIsPersonalizedPrice }, subscriptionOption.presentedOfferingContext).catch(function (error) {
567
- error.userCancelled =
568
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
569
- throw error;
570
- })];
554
+ : { isPersonalizedPrice: googleIsPersonalizedPrice }, subscriptionOption.presentedOfferingContext)];
571
555
  }
572
556
  });
573
557
  });
@@ -592,11 +576,7 @@ var Purchases = /** @class */ (function () {
592
576
  if (typeof discount === "undefined" || discount == null) {
593
577
  throw new Error("A discount is required");
594
578
  }
595
- return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext, null, discount.timestamp.toString(), null).catch(function (error) {
596
- error.userCancelled =
597
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
598
- throw error;
599
- })];
579
+ return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext, null, discount.timestamp.toString(), null)];
600
580
  }
601
581
  });
602
582
  });
@@ -1131,11 +1111,7 @@ var Purchases = /** @class */ (function () {
1131
1111
  if (react_native_2.Platform.OS === "android") {
1132
1112
  throw new purchases_typescript_internal_1.UnsupportedPlatformError();
1133
1113
  }
1134
- return [2 /*return*/, RNPurchases.purchaseProductWithWinBackOffer(product.identifier, winBackOffer.identifier).catch(function (error) {
1135
- error.userCancelled =
1136
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
1137
- throw error;
1138
- })];
1114
+ return [2 /*return*/, RNPurchases.purchaseProductWithWinBackOffer(product.identifier, winBackOffer.identifier)];
1139
1115
  }
1140
1116
  });
1141
1117
  });
@@ -1165,11 +1141,7 @@ var Purchases = /** @class */ (function () {
1165
1141
  if (react_native_2.Platform.OS === "android") {
1166
1142
  throw new purchases_typescript_internal_1.UnsupportedPlatformError();
1167
1143
  }
1168
- return [2 /*return*/, RNPurchases.purchasePackageWithWinBackOffer(aPackage.identifier, aPackage.presentedOfferingContext, winBackOffer.identifier).catch(function (error) {
1169
- error.userCancelled =
1170
- error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
1171
- throw error;
1172
- })];
1144
+ return [2 /*return*/, RNPurchases.purchasePackageWithWinBackOffer(aPackage.identifier, aPackage.presentedOfferingContext, winBackOffer.identifier)];
1173
1145
  }
1174
1146
  });
1175
1147
  });
package/ios/RNPurchases.m CHANGED
@@ -89,7 +89,9 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
89
89
  pendingTransactionsForPrepaidPlansEnabled:(BOOL)pendingTransactionsForPrepaidPlansEnabled
90
90
  diagnosticsEnabled:(BOOL)diagnosticsEnabled
91
91
  automaticDeviceIdentifierCollectionEnabled:(BOOL)automaticDeviceIdentifierCollectionEnabled
92
- preferredUILocaleOverride:(nullable NSString *)preferredUILocaleOverride) {
92
+ preferredUILocaleOverride:(nullable NSString *)preferredUILocaleOverride
93
+ useExternalPurchaseCustomLinks:(BOOL)useExternalPurchaseCustomLinks
94
+ enableExternalPurchasesInSimulator:(BOOL)enableExternalPurchasesInSimulator) {
93
95
  RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey.mappingNSNullToNil
94
96
  appUserID:appUserID.mappingNSNullToNil
95
97
  purchasesAreCompletedBy:purchasesAreCompletedBy.mappingNSNullToNil
@@ -102,7 +104,9 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
102
104
  verificationMode:entitlementVerificationMode.mappingNSNullToNil
103
105
  diagnosticsEnabled:diagnosticsEnabled
104
106
  automaticDeviceIdentifierCollectionEnabled:automaticDeviceIdentifierCollectionEnabled
105
- preferredLocale:preferredUILocaleOverride.mappingNSNullToNil];
107
+ preferredLocale:preferredUILocaleOverride.mappingNSNullToNil
108
+ useExternalPurchaseCustomLinks:useExternalPurchaseCustomLinks
109
+ enableExternalPurchasesInSimulator:enableExternalPurchasesInSimulator];
106
110
  purchases.delegate = self;
107
111
  }
108
112
 
@@ -324,18 +328,13 @@ RCT_EXPORT_METHOD(eligibleWinBackOffersForProductIdentifier:(nonnull NSString *)
324
328
  [RCCommonFunctionality eligibleWinBackOffersForProductIdentifier:productID
325
329
  completionBlock:^(NSArray<NSDictionary *> * _Nullable offers, RCErrorContainer * _Nullable errorContainer) {
326
330
  if (errorContainer) {
327
- reject(
328
- [NSString stringWithFormat:@"%ld", (long)errorContainer.code],
329
- errorContainer.message,
330
- errorContainer.error
331
- );
331
+ [self rejectPromiseWithBlock:reject error:errorContainer];
332
332
  } else {
333
333
  resolve(offers ?: @[]);
334
334
  }
335
335
  }];
336
336
  } else {
337
- NSError *error = [self createUnsupportedErrorWithDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
338
- reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
337
+ [self rejectPromiseWithBlock:reject unsupportedErrorDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
339
338
  }
340
339
  }
341
340
 
@@ -348,8 +347,7 @@ RCT_EXPORT_METHOD(purchaseProductWithWinBackOffer:(nonnull NSString *)productID
348
347
  winBackOfferID:winBackOfferID
349
348
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
350
349
  } else {
351
- NSError *error = [self createUnsupportedErrorWithDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
352
- reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
350
+ [self rejectPromiseWithBlock:reject unsupportedErrorDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
353
351
  }
354
352
  }
355
353
 
@@ -364,8 +362,7 @@ RCT_EXPORT_METHOD(purchasePackageWithWinBackOffer:(nonnull NSString *)packageID
364
362
  winBackOfferID:winBackOfferID
365
363
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
366
364
  } else {
367
- NSError *error = [self createUnsupportedErrorWithDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
368
- reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
365
+ [self rejectPromiseWithBlock:reject unsupportedErrorDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
369
366
  }
370
367
  }
371
368
 
@@ -551,24 +548,18 @@ RCT_EXPORT_METHOD(showManageSubscriptions:
551
548
  if (@available(iOS 13.0, macOS 10.15, visionOS 1.0, *)) {
552
549
  [RCCommonFunctionality showManageSubscriptions:^(RCErrorContainer * _Nullable errorContainer) {
553
550
  if (errorContainer) {
554
- reject(
555
- [NSString stringWithFormat:@"%ld", (long)errorContainer.code],
556
- errorContainer.message,
557
- errorContainer.error
558
- );
551
+ [self rejectPromiseWithBlock:reject error:errorContainer];
559
552
  } else {
560
553
  resolve(nil);
561
554
  }
562
555
  }];
563
556
  } else {
564
557
  NSLog(@"[Purchases] Warning: tried to showManageSubscriptions in non supported iOS devices. Only available on iOS 13.0 or greater.");
565
- NSError *error = [self createUnsupportedErrorWithDescription:@"Tried to present manage subscriptions sheet, but this functionality is only available on iOS 13.0 or greater."];
566
- reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
558
+ [self rejectPromiseWithBlock:reject unsupportedErrorDescription:@"Tried to present manage subscriptions sheet, but this functionality is only available on iOS 13.0 or greater."];
567
559
  }
568
560
  #else
569
561
  NSLog(@"[Purchases] Warning: tried to showManageSubscriptions in non-ios devices. That's not supported.");
570
- NSError *error = [self createUnsupportedErrorWithDescription:@"Tried to present manage subscriptions sheet, but this functionality is only available on iOS devices."];
571
- reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
562
+ [self rejectPromiseWithBlock:reject unsupportedErrorDescription:@"Tried to present manage subscriptions sheet, but this functionality is only available on iOS devices."];
572
563
  #endif
573
564
  }
574
565
 
@@ -657,8 +648,7 @@ RCT_EXPORT_METHOD(recordPurchaseForProductID:(nonnull NSString *)productID
657
648
  completion:[self getResponseCompletionBlockWithResolve:resolve
658
649
  reject:reject]];
659
650
  } else {
660
- NSError *error = [self createUnsupportedErrorWithDescription:@"Tried to handle transaction made by your app, but this functionality is only available on iOS 15.0 or greater."];
661
- reject([NSString stringWithFormat:@"%ld", (long) error.code], [error localizedDescription], error);
651
+ [self rejectPromiseWithBlock:reject unsupportedErrorDescription:@"Tried to handle transaction made by your app, but this functionality is only available on iOS 15.0 or greater."];
662
652
  }
663
653
  }
664
654
 
@@ -749,7 +739,15 @@ readyForPromotedProduct:(RCStoreProduct *)product
749
739
  #pragma mark Helper Methods
750
740
 
751
741
  - (void)rejectPromiseWithBlock:(RCTPromiseRejectBlock)reject error:(RCErrorContainer *)error {
752
- reject([NSString stringWithFormat:@"%ld", (long) error.code], error.message, error.error);
742
+ // React Native forwards only the NSError's userInfo to the JS layer, never the error
743
+ // container's info dictionary, so the payload has to travel inside userInfo.
744
+ NSMutableDictionary *userInfo = [error.error.userInfo mutableCopy];
745
+ [userInfo addEntriesFromDictionary:error.info];
746
+ NSError *errorWithInfo = [NSError errorWithDomain:error.error.domain
747
+ code:error.error.code
748
+ userInfo:userInfo];
749
+
750
+ reject([NSString stringWithFormat:@"%ld", (long) error.code], error.message, errorWithInfo);
753
751
  }
754
752
 
755
753
  - (void (^)(NSDictionary *, RCErrorContainer *))getResponseCompletionBlockWithResolve:(RCTPromiseResolveBlock)resolve
@@ -778,10 +776,12 @@ readyForPromotedProduct:(RCStoreProduct *)product
778
776
  };
779
777
  }
780
778
 
781
- - (NSError *)createUnsupportedErrorWithDescription:(NSString *)description {
782
- return [[NSError alloc] initWithDomain:RCPurchasesErrorCodeDomain
783
- code:RCUnsupportedError
784
- userInfo:@{NSLocalizedDescriptionKey : description}];
779
+ - (void)rejectPromiseWithBlock:(RCTPromiseRejectBlock)reject unsupportedErrorDescription:(NSString *)description {
780
+ NSError *error = [[NSError alloc] initWithDomain:RCPurchasesErrorCodeDomain
781
+ code:RCUnsupportedError
782
+ userInfo:@{NSLocalizedDescriptionKey : description}];
783
+ [self rejectPromiseWithBlock:reject
784
+ error:[[RCErrorContainer alloc] initWithError:error extraPayload:@{}]];
785
785
  }
786
786
 
787
787
  - (NSString *)platformFlavor {
@@ -789,7 +789,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
789
789
  }
790
790
 
791
791
  - (NSString *)platformFlavorVersion {
792
- return @"10.10.1";
792
+ return @"10.11.0";
793
793
  }
794
794
 
795
795
  @end
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "10.10.1",
4
+ "version": "10.11.0",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  },
120
120
  "dependencies": {
121
- "@revenuecat/purchases-js-hybrid-mappings": "19.2.0",
122
- "@revenuecat/purchases-typescript-internal": "19.2.0"
121
+ "@revenuecat/purchases-js-hybrid-mappings": "19.5.0",
122
+ "@revenuecat/purchases-typescript-internal": "19.5.0"
123
123
  }
124
124
  }