react-native-purchases 8.2.7 → 8.4.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/RNPurchases.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
30
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
31
|
versionCode 1
|
|
32
|
-
versionName '8.
|
|
32
|
+
versionName '8.4.0'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
121
121
|
dependencies {
|
|
122
122
|
//noinspection GradleDynamicVersion
|
|
123
123
|
api 'com.facebook.react:react-native:+'
|
|
124
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.12.0'
|
|
125
125
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
126
126
|
}
|
|
@@ -47,7 +47,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
47
47
|
private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
|
|
48
48
|
private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
|
|
49
49
|
public static final String PLATFORM_NAME = "react-native";
|
|
50
|
-
public static final String PLUGIN_VERSION = "8.
|
|
50
|
+
public static final String PLUGIN_VERSION = "8.4.0";
|
|
51
51
|
|
|
52
52
|
private final ReactApplicationContext reactContext;
|
|
53
53
|
|
|
@@ -391,6 +391,16 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
391
391
|
SubscriberAttributesKt.setFirebaseAppInstanceID(firebaseAppInstanceId);
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
@ReactMethod
|
|
395
|
+
public void setTenjinAnalyticsInstallationID(String tenjinAnalyticsInstallationID) {
|
|
396
|
+
SubscriberAttributesKt.setTenjinAnalyticsInstallationID(tenjinAnalyticsInstallationID);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
@ReactMethod
|
|
400
|
+
public void setKochavaDeviceID(String kochavaDeviceID) {
|
|
401
|
+
SubscriberAttributesKt.setKochavaDeviceID(kochavaDeviceID);
|
|
402
|
+
}
|
|
403
|
+
|
|
394
404
|
@ReactMethod
|
|
395
405
|
public void setOnesignalID(String onesignalID) {
|
|
396
406
|
SubscriberAttributesKt.setOnesignalID(onesignalID);
|
package/dist/purchases.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PURCHASES_ERROR_CODE, UninitializedPurchasesError, UnsupportedPlatformError, CustomerInfo, PurchasesEntitlementInfo, PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount, SubscriptionOption, PRODUCT_CATEGORY, GoogleProductChangeInfo, PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, IN_APP_MESSAGE_TYPE, ENTITLEMENT_VERIFICATION_MODE, VERIFICATION_RESULT, STOREKIT_VERSION, PurchasesStoreTransaction, PurchasesOffering, PURCHASES_ARE_COMPLETED_BY_TYPE } from "@revenuecat/purchases-typescript-internal";
|
|
1
|
+
import { PURCHASES_ERROR_CODE, UninitializedPurchasesError, UnsupportedPlatformError, CustomerInfo, PurchasesEntitlementInfo, PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount, SubscriptionOption, PRODUCT_CATEGORY, GoogleProductChangeInfo, PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, IN_APP_MESSAGE_TYPE, ENTITLEMENT_VERIFICATION_MODE, VERIFICATION_RESULT, STOREKIT_VERSION, PurchasesStoreTransaction, PurchasesOffering, PURCHASES_ARE_COMPLETED_BY_TYPE, PurchasesWinBackOffer } from "@revenuecat/purchases-typescript-internal";
|
|
2
2
|
export { PURCHASE_TYPE, PurchasesAreCompletedBy, PurchasesAreCompletedByMyApp, PURCHASES_ARE_COMPLETED_BY_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, STOREKIT_VERSION, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, } from "@revenuecat/purchases-typescript-internal";
|
|
3
3
|
export default class Purchases {
|
|
4
4
|
/**
|
|
@@ -420,6 +420,52 @@ export default class Purchases {
|
|
|
420
420
|
* called yet or if there's an error getting the payment discount.
|
|
421
421
|
*/
|
|
422
422
|
static getPromotionalOffer(product: PurchasesStoreProduct, discount: PurchasesStoreProductDiscount): Promise<PurchasesPromotionalOffer | undefined>;
|
|
423
|
+
/**
|
|
424
|
+
* iOS only. Use this function to retrieve the eligible `PurchasesWinBackOffer`s that a subscriber
|
|
425
|
+
* is eligible for for a given `PurchasesProduct`.
|
|
426
|
+
*
|
|
427
|
+
* @param product The `PurchasesStoreProduct` the user intends to purchase.
|
|
428
|
+
* @returns { Promise<[PurchasesWinBackOffer]> } Returns an array of win-back offers that the subscriber is eligible for.
|
|
429
|
+
* Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been
|
|
430
|
+
* called yet or if there's an error getting the payment discount.
|
|
431
|
+
*/
|
|
432
|
+
static getEligibleWinBackOffersForProduct(product: PurchasesStoreProduct): Promise<[PurchasesWinBackOffer] | undefined>;
|
|
433
|
+
/**
|
|
434
|
+
* iOS only. Use this function to retrieve the eligible `PurchasesWinBackOffer`s that a subscriber
|
|
435
|
+
* is eligible for for a given `PurchasesPackage`.
|
|
436
|
+
*
|
|
437
|
+
* @param aPackage The `PurchasesPackage` the user intends to purchase.
|
|
438
|
+
* @returns { Promise<[PurchasesWinBackOffer]> } Returns an array of win-back offers that the subscriber is eligible for.
|
|
439
|
+
* Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been
|
|
440
|
+
* called yet or if there's an error getting the payment discount.
|
|
441
|
+
*/
|
|
442
|
+
static getEligibleWinBackOffersForPackage(aPackage: PurchasesPackage): Promise<[PurchasesWinBackOffer] | undefined>;
|
|
443
|
+
/**
|
|
444
|
+
* iOS only. Purchase a product applying a given win-back offer.
|
|
445
|
+
*
|
|
446
|
+
* Only available on iOS 18.0+ when StoreKit 2 is enabled.
|
|
447
|
+
*
|
|
448
|
+
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
449
|
+
* @param {PurchasesWinBackOffer} winBackOffer Win-back offer to apply to this package. Retrieve this offer using getEligibleWinBackOffers.
|
|
450
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
451
|
+
* a customer info object and a product identifier. Rejections return an error code,
|
|
452
|
+
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be
|
|
453
|
+
* rejected if configure has not been called yet.
|
|
454
|
+
*/
|
|
455
|
+
static purchaseProductWithWinBackOffer(product: PurchasesStoreProduct, winBackOffer: PurchasesWinBackOffer): Promise<MakePurchaseResult>;
|
|
456
|
+
/**
|
|
457
|
+
* iOS only. Purchase a package applying a given win-back offer.
|
|
458
|
+
*
|
|
459
|
+
* Only available on iOS 18.0+ when StoreKit 2 is enabled.
|
|
460
|
+
*
|
|
461
|
+
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
462
|
+
* @param {PurchasesWinBackOffer} winBackOffer Win-back offer to apply to this package. Retrieve this offer using getEligibleWinBackOffers.
|
|
463
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
464
|
+
* a customer info object and a product identifier. Rejections return an error code,
|
|
465
|
+
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be
|
|
466
|
+
* rejected if configure has not been called yet.
|
|
467
|
+
*/
|
|
468
|
+
static purchasePackageWithWinBackOffer(aPackage: PurchasesPackage, winBackOffer: PurchasesWinBackOffer): Promise<MakePurchaseResult>;
|
|
423
469
|
/**
|
|
424
470
|
* Invalidates the cache for customer information.
|
|
425
471
|
*
|
|
@@ -563,6 +609,24 @@ export default class Purchases {
|
|
|
563
609
|
* setting the Firebase App Instance ID.
|
|
564
610
|
*/
|
|
565
611
|
static setFirebaseAppInstanceID(firebaseAppInstanceID: string | null): Promise<void>;
|
|
612
|
+
/**
|
|
613
|
+
* Subscriber attribute associated with the Tenjin Analytics Installation ID for the user.
|
|
614
|
+
* Required for the RevenueCat Tenjin integration.
|
|
615
|
+
*
|
|
616
|
+
* @param tenjinAnalyticsInstallationID Tenjin analytics installation ID to use in the Tenjin integration. Empty String or null will delete the subscriber attribute.
|
|
617
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
|
|
618
|
+
* setting the Tenjin Analytics Installation ID.
|
|
619
|
+
*/
|
|
620
|
+
static setTenjinAnalyticsInstallationID(tenjinAnalyticsInstallationID: string | null): Promise<void>;
|
|
621
|
+
/**
|
|
622
|
+
* Subscriber attribute associated with the Kochava Device ID for the user.
|
|
623
|
+
* Required for the RevenueCat Kochava integration.
|
|
624
|
+
*
|
|
625
|
+
* @param kochavaDeviceID Kochava device ID to use in the Kochava integration. Empty String or null will delete the subscriber attribute.
|
|
626
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
|
|
627
|
+
* setting the Kochava Device ID.
|
|
628
|
+
*/
|
|
629
|
+
static setKochavaDeviceID(kochavaDeviceID: string | null): Promise<void>;
|
|
566
630
|
/**
|
|
567
631
|
* Subscriber attribute associated with the OneSignal Player Id for the user
|
|
568
632
|
* Required for the RevenueCat OneSignal integration
|
package/dist/purchases.js
CHANGED
|
@@ -802,6 +802,122 @@ var Purchases = /** @class */ (function () {
|
|
|
802
802
|
});
|
|
803
803
|
});
|
|
804
804
|
};
|
|
805
|
+
/**
|
|
806
|
+
* iOS only. Use this function to retrieve the eligible `PurchasesWinBackOffer`s that a subscriber
|
|
807
|
+
* is eligible for for a given `PurchasesProduct`.
|
|
808
|
+
*
|
|
809
|
+
* @param product The `PurchasesStoreProduct` the user intends to purchase.
|
|
810
|
+
* @returns { Promise<[PurchasesWinBackOffer]> } Returns an array of win-back offers that the subscriber is eligible for.
|
|
811
|
+
* Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been
|
|
812
|
+
* called yet or if there's an error getting the payment discount.
|
|
813
|
+
*/
|
|
814
|
+
Purchases.getEligibleWinBackOffersForProduct = function (product) {
|
|
815
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
816
|
+
return __generator(this, function (_a) {
|
|
817
|
+
switch (_a.label) {
|
|
818
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
819
|
+
case 1:
|
|
820
|
+
_a.sent();
|
|
821
|
+
if (react_native_2.Platform.OS === "android") {
|
|
822
|
+
return [2 /*return*/, Promise.resolve(undefined)];
|
|
823
|
+
}
|
|
824
|
+
return [2 /*return*/, RNPurchases.eligibleWinBackOffersForProductIdentifier(product.identifier)];
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
});
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* iOS only. Use this function to retrieve the eligible `PurchasesWinBackOffer`s that a subscriber
|
|
831
|
+
* is eligible for for a given `PurchasesPackage`.
|
|
832
|
+
*
|
|
833
|
+
* @param aPackage The `PurchasesPackage` the user intends to purchase.
|
|
834
|
+
* @returns { Promise<[PurchasesWinBackOffer]> } Returns an array of win-back offers that the subscriber is eligible for.
|
|
835
|
+
* Null is returned for Android and incompatible iOS versions. The promise will be rejected if configure has not been
|
|
836
|
+
* called yet or if there's an error getting the payment discount.
|
|
837
|
+
*/
|
|
838
|
+
Purchases.getEligibleWinBackOffersForPackage = function (aPackage) {
|
|
839
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
840
|
+
return __generator(this, function (_a) {
|
|
841
|
+
switch (_a.label) {
|
|
842
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
843
|
+
case 1:
|
|
844
|
+
_a.sent();
|
|
845
|
+
if (react_native_2.Platform.OS === "android") {
|
|
846
|
+
return [2 /*return*/, Promise.resolve(undefined)];
|
|
847
|
+
}
|
|
848
|
+
return [2 /*return*/, RNPurchases.eligibleWinBackOffersForProductIdentifier(aPackage.product.identifier)];
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
});
|
|
852
|
+
};
|
|
853
|
+
/**
|
|
854
|
+
* iOS only. Purchase a product applying a given win-back offer.
|
|
855
|
+
*
|
|
856
|
+
* Only available on iOS 18.0+ when StoreKit 2 is enabled.
|
|
857
|
+
*
|
|
858
|
+
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
859
|
+
* @param {PurchasesWinBackOffer} winBackOffer Win-back offer to apply to this package. Retrieve this offer using getEligibleWinBackOffers.
|
|
860
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
861
|
+
* a customer info object and a product identifier. Rejections return an error code,
|
|
862
|
+
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be
|
|
863
|
+
* rejected if configure has not been called yet.
|
|
864
|
+
*/
|
|
865
|
+
Purchases.purchaseProductWithWinBackOffer = function (product, winBackOffer) {
|
|
866
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
867
|
+
return __generator(this, function (_a) {
|
|
868
|
+
switch (_a.label) {
|
|
869
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
870
|
+
case 1:
|
|
871
|
+
_a.sent();
|
|
872
|
+
if (typeof winBackOffer === "undefined" || winBackOffer == null) {
|
|
873
|
+
throw new Error("A win-back offer is required");
|
|
874
|
+
}
|
|
875
|
+
if (react_native_2.Platform.OS === "android") {
|
|
876
|
+
throw new purchases_typescript_internal_1.UnsupportedPlatformError();
|
|
877
|
+
}
|
|
878
|
+
return [2 /*return*/, RNPurchases.purchaseProductWithWinBackOffer(product.identifier, winBackOffer.identifier).catch(function (error) {
|
|
879
|
+
error.userCancelled =
|
|
880
|
+
error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
|
|
881
|
+
throw error;
|
|
882
|
+
})];
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* iOS only. Purchase a package applying a given win-back offer.
|
|
889
|
+
*
|
|
890
|
+
* Only available on iOS 18.0+ when StoreKit 2 is enabled.
|
|
891
|
+
*
|
|
892
|
+
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
893
|
+
* @param {PurchasesWinBackOffer} winBackOffer Win-back offer to apply to this package. Retrieve this offer using getEligibleWinBackOffers.
|
|
894
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
895
|
+
* a customer info object and a product identifier. Rejections return an error code,
|
|
896
|
+
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be
|
|
897
|
+
* rejected if configure has not been called yet.
|
|
898
|
+
*/
|
|
899
|
+
Purchases.purchasePackageWithWinBackOffer = function (aPackage, winBackOffer) {
|
|
900
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
901
|
+
return __generator(this, function (_a) {
|
|
902
|
+
switch (_a.label) {
|
|
903
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
904
|
+
case 1:
|
|
905
|
+
_a.sent();
|
|
906
|
+
if (typeof winBackOffer === "undefined" || winBackOffer == null) {
|
|
907
|
+
throw new Error("A win-back offer is required");
|
|
908
|
+
}
|
|
909
|
+
if (react_native_2.Platform.OS === "android") {
|
|
910
|
+
throw new purchases_typescript_internal_1.UnsupportedPlatformError();
|
|
911
|
+
}
|
|
912
|
+
return [2 /*return*/, RNPurchases.purchasePackageWithWinBackOffer(aPackage.identifier, aPackage.presentedOfferingContext, winBackOffer.identifier).catch(function (error) {
|
|
913
|
+
error.userCancelled =
|
|
914
|
+
error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
|
|
915
|
+
throw error;
|
|
916
|
+
})];
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
});
|
|
920
|
+
};
|
|
805
921
|
/**
|
|
806
922
|
* Invalidates the cache for customer information.
|
|
807
923
|
*
|
|
@@ -1132,6 +1248,48 @@ var Purchases = /** @class */ (function () {
|
|
|
1132
1248
|
});
|
|
1133
1249
|
});
|
|
1134
1250
|
};
|
|
1251
|
+
/**
|
|
1252
|
+
* Subscriber attribute associated with the Tenjin Analytics Installation ID for the user.
|
|
1253
|
+
* Required for the RevenueCat Tenjin integration.
|
|
1254
|
+
*
|
|
1255
|
+
* @param tenjinAnalyticsInstallationID Tenjin analytics installation ID to use in the Tenjin integration. Empty String or null will delete the subscriber attribute.
|
|
1256
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
|
|
1257
|
+
* setting the Tenjin Analytics Installation ID.
|
|
1258
|
+
*/
|
|
1259
|
+
Purchases.setTenjinAnalyticsInstallationID = function (tenjinAnalyticsInstallationID) {
|
|
1260
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1261
|
+
return __generator(this, function (_a) {
|
|
1262
|
+
switch (_a.label) {
|
|
1263
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1264
|
+
case 1:
|
|
1265
|
+
_a.sent();
|
|
1266
|
+
RNPurchases.setTenjinAnalyticsInstallationID(tenjinAnalyticsInstallationID);
|
|
1267
|
+
return [2 /*return*/];
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
});
|
|
1271
|
+
};
|
|
1272
|
+
/**
|
|
1273
|
+
* Subscriber attribute associated with the Kochava Device ID for the user.
|
|
1274
|
+
* Required for the RevenueCat Kochava integration.
|
|
1275
|
+
*
|
|
1276
|
+
* @param kochavaDeviceID Kochava device ID to use in the Kochava integration. Empty String or null will delete the subscriber attribute.
|
|
1277
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
|
|
1278
|
+
* setting the Kochava Device ID.
|
|
1279
|
+
*/
|
|
1280
|
+
Purchases.setKochavaDeviceID = function (kochavaDeviceID) {
|
|
1281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1282
|
+
return __generator(this, function (_a) {
|
|
1283
|
+
switch (_a.label) {
|
|
1284
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1285
|
+
case 1:
|
|
1286
|
+
_a.sent();
|
|
1287
|
+
RNPurchases.setKochavaDeviceID(kochavaDeviceID);
|
|
1288
|
+
return [2 /*return*/];
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
});
|
|
1292
|
+
};
|
|
1135
1293
|
/**
|
|
1136
1294
|
* Subscriber attribute associated with the OneSignal Player Id for the user
|
|
1137
1295
|
* Required for the RevenueCat OneSignal integration
|
package/ios/RNPurchases.m
CHANGED
|
@@ -246,6 +246,60 @@ static void logUnavailablePresentCodeRedemptionSheet() {
|
|
|
246
246
|
NSLog(@"[Purchases] Warning: tried to present codeRedemptionSheet, but it's only available on iOS 14.0 or greater.");
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
#pragma mark - Win-Back getOfferings
|
|
250
|
+
RCT_EXPORT_METHOD(eligibleWinBackOffersForProductIdentifier:(nonnull NSString *)productID
|
|
251
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
252
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
253
|
+
if (@available(iOS 18.0, macOS 15.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *)) {
|
|
254
|
+
[RCCommonFunctionality eligibleWinBackOffersForProductIdentifier:productID
|
|
255
|
+
completionBlock:^(NSArray<NSDictionary *> * _Nullable offers, RCErrorContainer * _Nullable errorContainer) {
|
|
256
|
+
if (errorContainer) {
|
|
257
|
+
reject(
|
|
258
|
+
[NSString stringWithFormat:@"%ld", (long)errorContainer.code],
|
|
259
|
+
errorContainer.message,
|
|
260
|
+
errorContainer.error
|
|
261
|
+
);
|
|
262
|
+
} else {
|
|
263
|
+
resolve(offers ?: @[]);
|
|
264
|
+
}
|
|
265
|
+
}];
|
|
266
|
+
} else {
|
|
267
|
+
NSError *error = [self createUnsupportedErrorWithDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
|
|
268
|
+
reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
RCT_EXPORT_METHOD(purchaseProductWithWinBackOffer:(nonnull NSString *)productID
|
|
273
|
+
winBackOfferID:(nonnull NSString *)winBackOfferID
|
|
274
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
275
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
276
|
+
if (@available(iOS 18.0, macOS 15.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *)) {
|
|
277
|
+
[RCCommonFunctionality purchaseProduct:productID
|
|
278
|
+
winBackOfferID:winBackOfferID
|
|
279
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
280
|
+
} else {
|
|
281
|
+
NSError *error = [self createUnsupportedErrorWithDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
|
|
282
|
+
reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
RCT_EXPORT_METHOD(purchasePackageWithWinBackOffer:(nonnull NSString *)packageID
|
|
287
|
+
presentedOfferingContext:(NSDictionary *)presentedOfferingContext
|
|
288
|
+
winBackOfferID:(nonnull NSString *)winBackOfferID
|
|
289
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
290
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
291
|
+
if (@available(iOS 18.0, macOS 15.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *)) {
|
|
292
|
+
[RCCommonFunctionality purchasePackage:packageID
|
|
293
|
+
presentedOfferingContext:presentedOfferingContext
|
|
294
|
+
winBackOfferID:winBackOfferID
|
|
295
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
296
|
+
} else {
|
|
297
|
+
NSError *error = [self createUnsupportedErrorWithDescription:@"iOS win-back offers are only available on iOS 18.0 or greater."];
|
|
298
|
+
reject([NSString stringWithFormat:@"%ld", (long)error.code], [error localizedDescription], error);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
|
|
249
303
|
#pragma mark - Subscriber Attributes
|
|
250
304
|
|
|
251
305
|
RCT_EXPORT_METHOD(setProxyURLString:(nullable NSString *)proxyURLString
|
|
@@ -309,6 +363,14 @@ RCT_EXPORT_METHOD(setFirebaseAppInstanceID:(NSString *)firebaseAppInstanceId) {
|
|
|
309
363
|
[RCCommonFunctionality setFirebaseAppInstanceID:firebaseAppInstanceId];
|
|
310
364
|
}
|
|
311
365
|
|
|
366
|
+
RCT_EXPORT_METHOD(setTenjinAnalyticsInstallationID:(NSString *)tenjinAnalyticsInstallationID) {
|
|
367
|
+
[RCCommonFunctionality setTenjinAnalyticsInstallationID:tenjinAnalyticsInstallationID];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
RCT_EXPORT_METHOD(setKochavaDeviceID:(NSString *)kochavaDeviceID) {
|
|
371
|
+
[RCCommonFunctionality setKochavaDeviceID:kochavaDeviceID];
|
|
372
|
+
}
|
|
373
|
+
|
|
312
374
|
RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
|
|
313
375
|
[RCCommonFunctionality setOnesignalID:onesignalID];
|
|
314
376
|
}
|
|
@@ -443,10 +505,7 @@ RCT_EXPORT_METHOD(recordPurchaseForProductID:(nonnull NSString *)productID
|
|
|
443
505
|
completion:[self getResponseCompletionBlockWithResolve:resolve
|
|
444
506
|
reject:reject]];
|
|
445
507
|
} else {
|
|
446
|
-
|
|
447
|
-
NSError* error = [[NSError alloc] initWithDomain: RCPurchasesErrorCodeDomain
|
|
448
|
-
code: RCUnsupportedError
|
|
449
|
-
userInfo: @{NSLocalizedDescriptionKey : description}];
|
|
508
|
+
NSError *error = [self createUnsupportedErrorWithDescription:@"Tried to handle transaction made by your app, but this functionality is only available on iOS 15.0 or greater."];
|
|
450
509
|
reject([NSString stringWithFormat:@"%ld", (long) error.code], [error localizedDescription], error);
|
|
451
510
|
}
|
|
452
511
|
}
|
|
@@ -502,12 +561,18 @@ readyForPromotedProduct:(RCStoreProduct *)product
|
|
|
502
561
|
};
|
|
503
562
|
}
|
|
504
563
|
|
|
564
|
+
- (NSError *)createUnsupportedErrorWithDescription:(NSString *)description {
|
|
565
|
+
return [[NSError alloc] initWithDomain:RCPurchasesErrorCodeDomain
|
|
566
|
+
code:RCUnsupportedError
|
|
567
|
+
userInfo:@{NSLocalizedDescriptionKey : description}];
|
|
568
|
+
}
|
|
569
|
+
|
|
505
570
|
- (NSString *)platformFlavor {
|
|
506
571
|
return @"react-native";
|
|
507
572
|
}
|
|
508
573
|
|
|
509
574
|
- (NSString *)platformFlavorVersion {
|
|
510
|
-
return @"8.
|
|
575
|
+
return @"8.4.0";
|
|
511
576
|
}
|
|
512
577
|
|
|
513
578
|
@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": "8.
|
|
4
|
+
"version": "8.4.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
|
"types": "dist/index.d.ts",
|
|
@@ -100,6 +100,6 @@
|
|
|
100
100
|
]
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@revenuecat/purchases-typescript-internal": "13.
|
|
103
|
+
"@revenuecat/purchases-typescript-internal": "13.12.0"
|
|
104
104
|
}
|
|
105
105
|
}
|