react-native-purchases 8.6.2 → 8.7.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", '13.19.0'
28
+ spec.dependency "PurchasesHybridCommon", '13.21.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '8.6.2'
32
+ versionName '8.7.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.19.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.21.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.6.2";
50
+ public static final String PLUGIN_VERSION = "8.7.0";
51
51
 
52
52
  private final ReactApplicationContext reactContext;
53
53
 
package/ios/RNPurchases.m CHANGED
@@ -17,6 +17,13 @@ typedef void (^StartPurchaseBlock)(PurchaseCompletedBlock);
17
17
 
18
18
  @end
19
19
 
20
+ @interface NSObject (NSNullMapping)
21
+
22
+ - (id)mappingNSNullToNil;
23
+
24
+ @end
25
+
26
+
20
27
 
21
28
  NSString *RNPurchasesCustomerInfoUpdatedEvent = @"Purchases-CustomerInfoUpdated";
22
29
  NSString *RNPurchasesShouldPurchasePromoProductEvent = @"Purchases-ShouldPurchasePromoProduct";
@@ -47,16 +54,16 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
47
54
  entitlementVerificationMode:(nullable NSString *)entitlementVerificationMode
48
55
  pendingTransactionsForPrepaidPlansEnabled:(BOOL)pendingTransactionsForPrepaidPlansEnabled
49
56
  diagnosticsEnabled:(BOOL)diagnosticsEnabled) {
50
- RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey
51
- appUserID:appUserID
52
- purchasesAreCompletedBy:purchasesAreCompletedBy
53
- userDefaultsSuiteName:userDefaultsSuiteName
57
+ RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey.mappingNSNullToNil
58
+ appUserID:appUserID.mappingNSNullToNil
59
+ purchasesAreCompletedBy:purchasesAreCompletedBy.mappingNSNullToNil
60
+ userDefaultsSuiteName:userDefaultsSuiteName.mappingNSNullToNil
54
61
  platformFlavor:self.platformFlavor
55
62
  platformFlavorVersion:self.platformFlavorVersion
56
- storeKitVersion:storeKitVersion
63
+ storeKitVersion:storeKitVersion.mappingNSNullToNil
57
64
  dangerousSettings:nil
58
65
  shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically
59
- verificationMode:entitlementVerificationMode
66
+ verificationMode:entitlementVerificationMode.mappingNSNullToNil
60
67
  diagnosticsEnabled:diagnosticsEnabled];
61
68
  purchases.delegate = self;
62
69
  }
@@ -86,7 +93,7 @@ RCT_EXPORT_METHOD(getCurrentOfferingForPlacement:(NSString *)placementIdentifier
86
93
  resolve:(RCTPromiseResolveBlock)resolve
87
94
  reject:(RCTPromiseRejectBlock)reject) {
88
95
 
89
- [RCCommonFunctionality getCurrentOfferingForPlacement:placementIdentifier completionBlock:^(NSDictionary *offeringObject, RCErrorContainer *error) {
96
+ [RCCommonFunctionality getCurrentOfferingForPlacement:placementIdentifier.mappingNSNullToNil completionBlock:^(NSDictionary *offeringObject, RCErrorContainer *error) {
90
97
  resolve(offeringObject);
91
98
  }];
92
99
  }
@@ -97,7 +104,7 @@ RCT_EXPORT_METHOD(getProductInfo:(NSArray *)products
97
104
  type:(NSString *)type
98
105
  resolve:(RCTPromiseResolveBlock)resolve
99
106
  reject:(RCTPromiseRejectBlock)reject) {
100
- [RCCommonFunctionality getProductInfo:products completionBlock:^(NSArray<NSDictionary *> *productObjects) {
107
+ [RCCommonFunctionality getProductInfo:products.mappingNSNullToNil completionBlock:^(NSArray<NSDictionary *> *productObjects) {
101
108
  resolve(productObjects);
102
109
  }];
103
110
  }
@@ -111,8 +118,8 @@ RCT_REMAP_METHOD(purchaseProduct,
111
118
  presentedOfferingContext:(NSDictionary *)presentedOfferingDictionary
112
119
  resolve:(RCTPromiseResolveBlock)resolve
113
120
  reject:(RCTPromiseRejectBlock)reject) {
114
- [RCCommonFunctionality purchaseProduct:productIdentifier
115
- signedDiscountTimestamp:signedDiscountTimestamp
121
+ [RCCommonFunctionality purchaseProduct:productIdentifier.mappingNSNullToNil
122
+ signedDiscountTimestamp:signedDiscountTimestamp.mappingNSNullToNil
116
123
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
117
124
  }
118
125
 
@@ -125,9 +132,9 @@ RCT_REMAP_METHOD(purchasePackage,
125
132
  googleInfo:(NSDictionary *)googleInfo
126
133
  resolve:(RCTPromiseResolveBlock)resolve
127
134
  reject:(RCTPromiseRejectBlock)reject) {
128
- [RCCommonFunctionality purchasePackage:packageIdentifier
129
- presentedOfferingContext:presentedOfferingContext
130
- signedDiscountTimestamp:signedDiscountTimestamp
135
+ [RCCommonFunctionality purchasePackage:packageIdentifier.mappingNSNullToNil
136
+ presentedOfferingContext:presentedOfferingContext.mappingNSNullToNil
137
+ signedDiscountTimestamp:signedDiscountTimestamp.mappingNSNullToNil
131
138
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
132
139
  }
133
140
 
@@ -151,7 +158,7 @@ RCT_REMAP_METHOD(getAppUserID,
151
158
  RCT_EXPORT_METHOD(logIn:(nonnull NSString *)appUserID
152
159
  resolve:(RCTPromiseResolveBlock)resolve
153
160
  reject:(RCTPromiseRejectBlock)reject) {
154
- [RCCommonFunctionality logInWithAppUserID:appUserID
161
+ [RCCommonFunctionality logInWithAppUserID:appUserID.mappingNSNullToNil
155
162
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
156
163
  }
157
164
 
@@ -168,7 +175,7 @@ RCT_REMAP_METHOD(setDebugLogsEnabled,
168
175
 
169
176
  RCT_EXPORT_METHOD(setLogLevel:(NSString *)level)
170
177
  {
171
- [RCCommonFunctionality setLogLevel:level];
178
+ [RCCommonFunctionality setLogLevel:level.mappingNSNullToNil];
172
179
  }
173
180
 
174
181
  RCT_EXPORT_METHOD(setSimulatesAskToBuyInSandbox:(BOOL)simulatesAskToBuyInSandbox)
@@ -212,7 +219,7 @@ RCT_EXPORT_METHOD(makeDeferredPurchase:(nonnull NSNumber *)callbackID
212
219
  RCT_EXPORT_METHOD(checkTrialOrIntroductoryPriceEligibility:(NSArray *)products
213
220
  resolve:(RCTPromiseResolveBlock)resolve
214
221
  reject:(RCTPromiseRejectBlock)reject) {
215
- [RCCommonFunctionality checkTrialOrIntroductoryPriceEligibility:products
222
+ [RCCommonFunctionality checkTrialOrIntroductoryPriceEligibility:products.mappingNSNullToNil
216
223
  completionBlock:^(NSDictionary<NSString *,RCIntroEligibility *> * _Nonnull responseDictionary) {
217
224
  resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
218
225
  }];
@@ -227,8 +234,8 @@ RCT_REMAP_METHOD(getPromotionalOffer,
227
234
  discount:(NSString *)discount
228
235
  resolve:(RCTPromiseResolveBlock)resolve
229
236
  reject:(RCTPromiseRejectBlock)reject) {
230
- [RCCommonFunctionality promotionalOfferForProductIdentifier:productIdentifier
231
- discount:discount
237
+ [RCCommonFunctionality promotionalOfferForProductIdentifier:productIdentifier.mappingNSNullToNil
238
+ discount:discount.mappingNSNullToNil
232
239
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
233
240
  }
234
241
 
@@ -292,7 +299,7 @@ RCT_EXPORT_METHOD(purchasePackageWithWinBackOffer:(nonnull NSString *)packageID
292
299
  reject:(RCTPromiseRejectBlock)reject) {
293
300
  if (@available(iOS 18.0, macOS 15.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *)) {
294
301
  [RCCommonFunctionality purchasePackage:packageID
295
- presentedOfferingContext:presentedOfferingContext
302
+ presentedOfferingContext:presentedOfferingContext.mappingNSNullToNil
296
303
  winBackOfferID:winBackOfferID
297
304
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
298
305
  } else {
@@ -307,28 +314,28 @@ RCT_EXPORT_METHOD(purchasePackageWithWinBackOffer:(nonnull NSString *)packageID
307
314
  RCT_EXPORT_METHOD(setProxyURLString:(nullable NSString *)proxyURLString
308
315
  resolver:(RCTPromiseResolveBlock)resolve
309
316
  rejecter:(RCTPromiseRejectBlock)reject) {
310
- [RCCommonFunctionality setProxyURLString:proxyURLString];
317
+ [RCCommonFunctionality setProxyURLString:proxyURLString.mappingNSNullToNil];
311
318
  resolve(nil); // Resolve the promise with no value
312
319
  }
313
320
 
314
321
  RCT_EXPORT_METHOD(setAttributes:(NSDictionary *)attributes) {
315
- [RCCommonFunctionality setAttributes:attributes];
322
+ [RCCommonFunctionality setAttributes:attributes.mappingNSNullToNil];
316
323
  }
317
324
 
318
325
  RCT_EXPORT_METHOD(setEmail:(NSString *)email) {
319
- [RCCommonFunctionality setEmail:email];
326
+ [RCCommonFunctionality setEmail:email.mappingNSNullToNil];
320
327
  }
321
328
 
322
329
  RCT_EXPORT_METHOD(setPhoneNumber:(NSString *)phoneNumber) {
323
- [RCCommonFunctionality setPhoneNumber:phoneNumber];
330
+ [RCCommonFunctionality setPhoneNumber:phoneNumber.mappingNSNullToNil];
324
331
  }
325
332
 
326
333
  RCT_EXPORT_METHOD(setDisplayName:(NSString *)displayName) {
327
- [RCCommonFunctionality setDisplayName:displayName];
334
+ [RCCommonFunctionality setDisplayName:displayName.mappingNSNullToNil];
328
335
  }
329
336
 
330
337
  RCT_EXPORT_METHOD(setPushToken:(NSString *)pushToken) {
331
- [RCCommonFunctionality setPushToken:pushToken];
338
+ [RCCommonFunctionality setPushToken:pushToken.mappingNSNullToNil];
332
339
  }
333
340
 
334
341
  # pragma mark Attribution IDs
@@ -338,80 +345,80 @@ RCT_EXPORT_METHOD(collectDeviceIdentifiers) {
338
345
  }
339
346
 
340
347
  RCT_EXPORT_METHOD(setAdjustID:(NSString *)adjustID) {
341
- [RCCommonFunctionality setAdjustID:adjustID];
348
+ [RCCommonFunctionality setAdjustID:adjustID.mappingNSNullToNil];
342
349
  }
343
350
 
344
351
  RCT_EXPORT_METHOD(setAppsflyerID:(NSString *)appsflyerID) {
345
- [RCCommonFunctionality setAppsflyerID:appsflyerID];
352
+ [RCCommonFunctionality setAppsflyerID:appsflyerID.mappingNSNullToNil];
346
353
  }
347
354
 
348
355
  RCT_EXPORT_METHOD(setFBAnonymousID:(NSString *)fbAnonymousID) {
349
- [RCCommonFunctionality setFBAnonymousID:fbAnonymousID];
356
+ [RCCommonFunctionality setFBAnonymousID:fbAnonymousID.mappingNSNullToNil];
350
357
  }
351
358
 
352
359
  RCT_EXPORT_METHOD(setMparticleID:(NSString *)mparticleID) {
353
- [RCCommonFunctionality setMparticleID:mparticleID];
360
+ [RCCommonFunctionality setMparticleID:mparticleID.mappingNSNullToNil];
354
361
  }
355
362
 
356
363
  RCT_EXPORT_METHOD(setCleverTapID:(NSString *)cleverTapID) {
357
- [RCCommonFunctionality setCleverTapID:cleverTapID];
364
+ [RCCommonFunctionality setCleverTapID:cleverTapID.mappingNSNullToNil];
358
365
  }
359
366
 
360
367
  RCT_EXPORT_METHOD(setMixpanelDistinctID:(NSString *)mixpanelDistinctID) {
361
- [RCCommonFunctionality setMixpanelDistinctID:mixpanelDistinctID];
368
+ [RCCommonFunctionality setMixpanelDistinctID:mixpanelDistinctID.mappingNSNullToNil];
362
369
  }
363
370
 
364
371
  RCT_EXPORT_METHOD(setFirebaseAppInstanceID:(NSString *)firebaseAppInstanceId) {
365
- [RCCommonFunctionality setFirebaseAppInstanceID:firebaseAppInstanceId];
372
+ [RCCommonFunctionality setFirebaseAppInstanceID:firebaseAppInstanceId.mappingNSNullToNil];
366
373
  }
367
374
 
368
375
  RCT_EXPORT_METHOD(setTenjinAnalyticsInstallationID:(NSString *)tenjinAnalyticsInstallationID) {
369
- [RCCommonFunctionality setTenjinAnalyticsInstallationID:tenjinAnalyticsInstallationID];
376
+ [RCCommonFunctionality setTenjinAnalyticsInstallationID:tenjinAnalyticsInstallationID.mappingNSNullToNil];
370
377
  }
371
378
 
372
379
  RCT_EXPORT_METHOD(setKochavaDeviceID:(NSString *)kochavaDeviceID) {
373
- [RCCommonFunctionality setKochavaDeviceID:kochavaDeviceID];
380
+ [RCCommonFunctionality setKochavaDeviceID:kochavaDeviceID.mappingNSNullToNil];
374
381
  }
375
382
 
376
383
  RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
377
- [RCCommonFunctionality setOnesignalID:onesignalID];
384
+ [RCCommonFunctionality setOnesignalID:onesignalID.mappingNSNullToNil];
378
385
  }
379
386
 
380
387
  RCT_EXPORT_METHOD(setAirshipChannelID:(NSString *)airshipChannelID) {
381
- [RCCommonFunctionality setAirshipChannelID:airshipChannelID];
388
+ [RCCommonFunctionality setAirshipChannelID:airshipChannelID.mappingNSNullToNil];
382
389
  }
383
390
 
384
391
  # pragma mark Campaign parameters
385
392
 
386
393
  RCT_EXPORT_METHOD(setMediaSource:(NSString *)mediaSource) {
387
- [RCCommonFunctionality setMediaSource:mediaSource];
394
+ [RCCommonFunctionality setMediaSource:mediaSource.mappingNSNullToNil];
388
395
  }
389
396
 
390
397
  RCT_EXPORT_METHOD(setCampaign:(NSString *)campaign) {
391
- [RCCommonFunctionality setCampaign:campaign];
398
+ [RCCommonFunctionality setCampaign:campaign.mappingNSNullToNil];
392
399
  }
393
400
 
394
401
  RCT_EXPORT_METHOD(setAdGroup:(NSString *)adGroup) {
395
- [RCCommonFunctionality setAdGroup:adGroup];
402
+ [RCCommonFunctionality setAdGroup:adGroup.mappingNSNullToNil];
396
403
  }
397
404
 
398
405
  RCT_EXPORT_METHOD(setAd:(NSString *)ad) {
399
- [RCCommonFunctionality setAd:ad];
406
+ [RCCommonFunctionality setAd:ad.mappingNSNullToNil];
400
407
  }
401
408
 
402
409
  RCT_EXPORT_METHOD(setKeyword:(NSString *)keyword) {
403
- [RCCommonFunctionality setKeyword:keyword];
410
+ [RCCommonFunctionality setKeyword:keyword.mappingNSNullToNil];
404
411
  }
405
412
 
406
413
  RCT_EXPORT_METHOD(setCreative:(NSString *)creative) {
407
- [RCCommonFunctionality setCreative:creative];
414
+ [RCCommonFunctionality setCreative:creative.mappingNSNullToNil];
408
415
  }
409
416
 
410
417
  RCT_REMAP_METHOD(canMakePayments,
411
418
  canMakePaymentsWithFeatures:(NSArray<NSNumber *> *)features
412
419
  resolve:(RCTPromiseResolveBlock)resolve
413
420
  reject:(RCTPromiseRejectBlock)reject) {
414
- resolve(@([RCCommonFunctionality canMakePaymentsWithFeatures:features]));
421
+ resolve(@([RCCommonFunctionality canMakePaymentsWithFeatures:features.mappingNSNullToNil]));
415
422
  }
416
423
 
417
424
  RCT_EXPORT_METHOD(beginRefundRequestForActiveEntitlement:(RCTPromiseResolveBlock)resolve
@@ -433,7 +440,7 @@ RCT_EXPORT_METHOD(beginRefundRequestForEntitlementId:(NSString *)entitlementIden
433
440
  reject:(RCTPromiseRejectBlock)reject) {
434
441
  #if TARGET_OS_IPHONE && !TARGET_OS_TV
435
442
  if (@available(iOS 15.0, *)) {
436
- [RCCommonFunctionality beginRefundRequestEntitlementId:entitlementIdentifier
443
+ [RCCommonFunctionality beginRefundRequestEntitlementId:entitlementIdentifier.mappingNSNullToNil
437
444
  completionBlock:[self getBeginRefundResponseCompletionBlockWithResolve:resolve
438
445
  reject:reject]];
439
446
  } else {
@@ -449,7 +456,7 @@ RCT_EXPORT_METHOD(beginRefundRequestForProductId:(NSString *)productIdentifier
449
456
  reject:(RCTPromiseRejectBlock)reject) {
450
457
  #if TARGET_OS_IPHONE && !TARGET_OS_TV
451
458
  if (@available(iOS 15.0, *)) {
452
- [RCCommonFunctionality beginRefundRequestProductId:productIdentifier
459
+ [RCCommonFunctionality beginRefundRequestProductId:productIdentifier.mappingNSNullToNil
453
460
  completionBlock:[self getBeginRefundResponseCompletionBlockWithResolve:resolve
454
461
  reject:reject]];
455
462
  } else {
@@ -470,7 +477,7 @@ RCT_EXPORT_METHOD(showInAppMessages:(NSArray<NSNumber *> *)messageTypes
470
477
  resolve(nil);
471
478
  }];
472
479
  } else {
473
- NSSet *types = [[NSSet alloc] initWithArray:messageTypes];
480
+ NSSet *types = [[NSSet alloc] initWithArray:messageTypes.mappingNSNullToNil];
474
481
  [RCCommonFunctionality showStoreMessagesForTypes:types completion:^{
475
482
  resolve(nil);
476
483
  }];
@@ -500,13 +507,13 @@ RCT_EXPORT_METHOD(setLogHandler) {
500
507
  RCT_EXPORT_METHOD(isWebPurchaseRedemptionURL:(NSString *)urlString
501
508
  resolve:(RCTPromiseResolveBlock)resolve
502
509
  reject:(RCTPromiseRejectBlock)reject) {
503
- resolve(@([RCCommonFunctionality isWebPurchaseRedemptionURL:urlString]));
510
+ resolve(@([RCCommonFunctionality isWebPurchaseRedemptionURL:urlString.mappingNSNullToNil]));
504
511
  }
505
512
 
506
513
  RCT_EXPORT_METHOD(redeemWebPurchase:(NSString *)urlString
507
514
  resolve:(RCTPromiseResolveBlock)resolve
508
515
  reject:(RCTPromiseRejectBlock)reject) {
509
- [RCCommonFunctionality redeemWebPurchaseWithUrlString:urlString
516
+ [RCCommonFunctionality redeemWebPurchaseWithUrlString:urlString.mappingNSNullToNil
510
517
  completion:[self getResponseCompletionBlockWithResolve:resolve
511
518
  reject:reject]];
512
519
  }
@@ -588,7 +595,47 @@ readyForPromotedProduct:(RCStoreProduct *)product
588
595
  }
589
596
 
590
597
  - (NSString *)platformFlavorVersion {
591
- return @"8.6.2";
598
+ return @"8.7.0";
599
+ }
600
+
601
+ @end
602
+
603
+ @implementation NSObject (NSNullMapping)
604
+
605
+ - (id)mappingNSNullToNil {
606
+ if ([self isKindOfClass:[NSNull class]]) {
607
+ return nil;
608
+ } else if ([self isKindOfClass:NSDictionary.class]) {
609
+ NSMutableDictionary *filteredDict = [NSMutableDictionary dictionary];
610
+ NSDictionary *originalDict = (NSDictionary *)self;
611
+
612
+ for (id key in originalDict) {
613
+ id value = [originalDict[key] mappingNSNullToNil];
614
+ if (value) {
615
+ // Only add non-nil values to the dictionary
616
+ filteredDict[key] = value;
617
+ }
618
+ }
619
+
620
+ return [NSDictionary dictionaryWithDictionary:filteredDict];
621
+
622
+ } else if ([self isKindOfClass:NSArray.class]) {
623
+ NSMutableArray *filteredArray = [NSMutableArray array];
624
+ NSArray *originalArray = (NSArray *)self;
625
+
626
+ for (id value in originalArray) {
627
+ id newValue = [value mappingNSNullToNil];
628
+ if (newValue) {
629
+ // Only add non-nil values to the array
630
+ [filteredArray addObject:newValue];
631
+ }
632
+
633
+ return [NSArray arrayWithArray:filteredArray];
634
+
635
+ }
636
+ }
637
+
638
+ return self;
592
639
  }
593
640
 
594
641
  @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.6.2",
4
+ "version": "8.7.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.19.0"
103
+ "@revenuecat/purchases-typescript-internal": "13.21.0"
104
104
  }
105
105
  }