react-native-iap 14.4.47 → 14.5.1-rc.1
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/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +76 -16
- package/ios/HybridRnIap.swift +17 -5
- package/ios/RnIapHelper.swift +8 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/index.js +6 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +35 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +21 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +71 -4
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +155 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +13 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +32 -4
- package/nitrogen/generated/android/c++/{JIapkitStore.hpp → JIapStore.hpp} +19 -13
- package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +70 -3
- package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +35 -5
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +13 -3
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +11 -3
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +6 -6
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderError.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +24 -16
- package/nitrogen/generated/android/c++/JPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +11 -1
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +7 -1
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +2 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{IapkitStore.kt → IapStore.kt} +7 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountAmountAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +30 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderError.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderResult.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +8 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +5 -2
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +178 -26
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +24 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +24 -3
- package/nitrogen/generated/ios/swift/{IapkitStore.swift → IapStore.swift} +14 -6
- package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +70 -0
- package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +211 -2
- package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +26 -7
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +43 -2
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +47 -1
- package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +2 -2
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderError.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderResult.swift +55 -13
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +44 -3
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +13 -2
- package/nitrogen/generated/shared/c++/{IapkitStore.hpp → IapStore.hpp} +23 -15
- package/nitrogen/generated/shared/c++/NitroDiscountAmountAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +55 -3
- package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -5
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +13 -2
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +10 -2
- package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +8 -8
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderError.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderResult.hpp +13 -5
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +12 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +8 -5
- package/src/specs/RnIap.nitro.ts +79 -4
- package/src/types.ts +163 -11
- package/src/utils/type-bridge.ts +23 -0
package/src/types.ts
CHANGED
|
@@ -72,6 +72,34 @@ export interface DeepLinkOptions {
|
|
|
72
72
|
skuAndroid?: (string | null);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Discount amount details for one-time purchase offers (Android)
|
|
77
|
+
* Available in Google Play Billing Library 7.0+
|
|
78
|
+
*/
|
|
79
|
+
export interface DiscountAmountAndroid {
|
|
80
|
+
/** Discount amount in micro-units (1,000,000 = 1 unit of currency) */
|
|
81
|
+
discountAmountMicros: string;
|
|
82
|
+
/** Formatted discount amount with currency sign (e.g., "$4.99") */
|
|
83
|
+
formattedDiscountAmount: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Discount display information for one-time purchase offers (Android)
|
|
88
|
+
* Available in Google Play Billing Library 7.0+
|
|
89
|
+
*/
|
|
90
|
+
export interface DiscountDisplayInfoAndroid {
|
|
91
|
+
/**
|
|
92
|
+
* Absolute discount amount details
|
|
93
|
+
* Only returned for fixed amount discounts
|
|
94
|
+
*/
|
|
95
|
+
discountAmount?: (DiscountAmountAndroid | null);
|
|
96
|
+
/**
|
|
97
|
+
* Percentage discount (e.g., 33 for 33% off)
|
|
98
|
+
* Only returned for percentage-based discounts
|
|
99
|
+
*/
|
|
100
|
+
percentageDiscount?: (number | null);
|
|
101
|
+
}
|
|
102
|
+
|
|
75
103
|
export interface DiscountIOS {
|
|
76
104
|
identifier: string;
|
|
77
105
|
localizedPrice?: (string | null);
|
|
@@ -180,11 +208,11 @@ export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product
|
|
|
180
208
|
|
|
181
209
|
export type IapPlatform = 'ios' | 'android';
|
|
182
210
|
|
|
211
|
+
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
212
|
+
|
|
183
213
|
/** Unified purchase states from IAPKit verification response. */
|
|
184
214
|
export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
|
|
185
215
|
|
|
186
|
-
export type IapkitStore = 'apple' | 'google';
|
|
187
|
-
|
|
188
216
|
/** Connection initialization configuration */
|
|
189
217
|
export interface InitConnectionConfig {
|
|
190
218
|
/**
|
|
@@ -194,6 +222,17 @@ export interface InitConnectionConfig {
|
|
|
194
222
|
alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);
|
|
195
223
|
}
|
|
196
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Limited quantity information for one-time purchase offers (Android)
|
|
227
|
+
* Available in Google Play Billing Library 7.0+
|
|
228
|
+
*/
|
|
229
|
+
export interface LimitedQuantityInfoAndroid {
|
|
230
|
+
/** Maximum quantity a user can purchase */
|
|
231
|
+
maximumQuantity: number;
|
|
232
|
+
/** Remaining quantity the user can still purchase */
|
|
233
|
+
remainingQuantity: number;
|
|
234
|
+
}
|
|
235
|
+
|
|
197
236
|
export interface Mutation {
|
|
198
237
|
/** Acknowledge a non-consumable purchase or subscription */
|
|
199
238
|
acknowledgePurchaseAndroid: Promise<boolean>;
|
|
@@ -310,6 +349,23 @@ export type MutationVerifyPurchaseWithProviderArgs = VerifyPurchaseWithProviderP
|
|
|
310
349
|
|
|
311
350
|
export type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';
|
|
312
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Pre-order details for one-time purchase products (Android)
|
|
354
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
355
|
+
*/
|
|
356
|
+
export interface PreorderDetailsAndroid {
|
|
357
|
+
/**
|
|
358
|
+
* Pre-order presale end time in milliseconds since epoch.
|
|
359
|
+
* This is when the presale period ends and the product will be released.
|
|
360
|
+
*/
|
|
361
|
+
preorderPresaleEndTimeMillis: string;
|
|
362
|
+
/**
|
|
363
|
+
* Pre-order release time in milliseconds since epoch.
|
|
364
|
+
* This is when the product will be available to users who pre-ordered.
|
|
365
|
+
*/
|
|
366
|
+
preorderReleaseTimeMillis: string;
|
|
367
|
+
}
|
|
368
|
+
|
|
313
369
|
export interface PricingPhaseAndroid {
|
|
314
370
|
billingCycleCount: number;
|
|
315
371
|
billingPeriod: string;
|
|
@@ -333,7 +389,11 @@ export interface ProductAndroid extends ProductCommon {
|
|
|
333
389
|
displayPrice: string;
|
|
334
390
|
id: string;
|
|
335
391
|
nameAndroid: string;
|
|
336
|
-
|
|
392
|
+
/**
|
|
393
|
+
* One-time purchase offer details including discounts (Android)
|
|
394
|
+
* Returns all eligible offers. Available in Google Play Billing Library 7.0+
|
|
395
|
+
*/
|
|
396
|
+
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail[] | null);
|
|
337
397
|
platform: 'android';
|
|
338
398
|
price?: (number | null);
|
|
339
399
|
subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);
|
|
@@ -341,10 +401,41 @@ export interface ProductAndroid extends ProductCommon {
|
|
|
341
401
|
type: 'in-app';
|
|
342
402
|
}
|
|
343
403
|
|
|
404
|
+
/**
|
|
405
|
+
* One-time purchase offer details (Android)
|
|
406
|
+
* Available in Google Play Billing Library 7.0+
|
|
407
|
+
*/
|
|
344
408
|
export interface ProductAndroidOneTimePurchaseOfferDetail {
|
|
409
|
+
/**
|
|
410
|
+
* Discount display information
|
|
411
|
+
* Only available for discounted offers
|
|
412
|
+
*/
|
|
413
|
+
discountDisplayInfo?: (DiscountDisplayInfoAndroid | null);
|
|
345
414
|
formattedPrice: string;
|
|
415
|
+
/**
|
|
416
|
+
* Full (non-discounted) price in micro-units
|
|
417
|
+
* Only available for discounted offers
|
|
418
|
+
*/
|
|
419
|
+
fullPriceMicros?: (string | null);
|
|
420
|
+
/** Limited quantity information */
|
|
421
|
+
limitedQuantityInfo?: (LimitedQuantityInfoAndroid | null);
|
|
422
|
+
/** Offer ID */
|
|
423
|
+
offerId?: (string | null);
|
|
424
|
+
/** List of offer tags */
|
|
425
|
+
offerTags: string[];
|
|
426
|
+
/** Offer token for use in BillingFlowParams when purchasing */
|
|
427
|
+
offerToken: string;
|
|
428
|
+
/**
|
|
429
|
+
* Pre-order details for products available for pre-order
|
|
430
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
431
|
+
*/
|
|
432
|
+
preorderDetailsAndroid?: (PreorderDetailsAndroid | null);
|
|
346
433
|
priceAmountMicros: string;
|
|
347
434
|
priceCurrencyCode: string;
|
|
435
|
+
/** Rental details for rental offers */
|
|
436
|
+
rentalDetailsAndroid?: (RentalDetailsAndroid | null);
|
|
437
|
+
/** Valid time window for the offer */
|
|
438
|
+
validTimeWindow?: (ValidTimeWindowAndroid | null);
|
|
348
439
|
}
|
|
349
440
|
|
|
350
441
|
export interface ProductCommon {
|
|
@@ -397,7 +488,11 @@ export interface ProductSubscriptionAndroid extends ProductCommon {
|
|
|
397
488
|
displayPrice: string;
|
|
398
489
|
id: string;
|
|
399
490
|
nameAndroid: string;
|
|
400
|
-
|
|
491
|
+
/**
|
|
492
|
+
* One-time purchase offer details including discounts (Android)
|
|
493
|
+
* Returns all eligible offers. Available in Google Play Billing Library 7.0+
|
|
494
|
+
*/
|
|
495
|
+
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail[] | null);
|
|
401
496
|
platform: 'android';
|
|
402
497
|
price?: (number | null);
|
|
403
498
|
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
@@ -454,15 +549,26 @@ export interface PurchaseAndroid extends PurchaseCommon {
|
|
|
454
549
|
ids?: (string[] | null);
|
|
455
550
|
isAcknowledgedAndroid?: (boolean | null);
|
|
456
551
|
isAutoRenewing: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Whether the subscription is suspended (Android)
|
|
554
|
+
* A suspended subscription means the user's payment method failed and they need to fix it.
|
|
555
|
+
* Users should be directed to the subscription center to resolve the issue.
|
|
556
|
+
* Do NOT grant entitlements for suspended subscriptions.
|
|
557
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
558
|
+
*/
|
|
559
|
+
isSuspendedAndroid?: (boolean | null);
|
|
457
560
|
obfuscatedAccountIdAndroid?: (string | null);
|
|
458
561
|
obfuscatedProfileIdAndroid?: (string | null);
|
|
459
562
|
packageNameAndroid?: (string | null);
|
|
563
|
+
/** @deprecated Use store instead */
|
|
460
564
|
platform: IapPlatform;
|
|
461
565
|
productId: string;
|
|
462
566
|
purchaseState: PurchaseState;
|
|
463
567
|
purchaseToken?: (string | null);
|
|
464
568
|
quantity: number;
|
|
465
569
|
signatureAndroid?: (string | null);
|
|
570
|
+
/** Store where purchase was made */
|
|
571
|
+
store: IapStore;
|
|
466
572
|
transactionDate: number;
|
|
467
573
|
transactionId?: (string | null);
|
|
468
574
|
}
|
|
@@ -478,12 +584,15 @@ export interface PurchaseCommon {
|
|
|
478
584
|
id: string;
|
|
479
585
|
ids?: (string[] | null);
|
|
480
586
|
isAutoRenewing: boolean;
|
|
587
|
+
/** @deprecated Use store instead */
|
|
481
588
|
platform: IapPlatform;
|
|
482
589
|
productId: string;
|
|
483
590
|
purchaseState: PurchaseState;
|
|
484
591
|
/** Unified purchase token (iOS JWS, Android purchaseToken) */
|
|
485
592
|
purchaseToken?: (string | null);
|
|
486
593
|
quantity: number;
|
|
594
|
+
/** Store where purchase was made */
|
|
595
|
+
store: IapStore;
|
|
487
596
|
transactionDate: number;
|
|
488
597
|
}
|
|
489
598
|
|
|
@@ -510,6 +619,7 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
510
619
|
originalTransactionDateIOS?: (number | null);
|
|
511
620
|
originalTransactionIdentifierIOS?: (string | null);
|
|
512
621
|
ownershipTypeIOS?: (string | null);
|
|
622
|
+
/** @deprecated Use store instead */
|
|
513
623
|
platform: IapPlatform;
|
|
514
624
|
productId: string;
|
|
515
625
|
purchaseState: PurchaseState;
|
|
@@ -521,6 +631,8 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
521
631
|
renewalInfoIOS?: (RenewalInfoIOS | null);
|
|
522
632
|
revocationDateIOS?: (number | null);
|
|
523
633
|
revocationReasonIOS?: (string | null);
|
|
634
|
+
/** Store where purchase was made */
|
|
635
|
+
store: IapStore;
|
|
524
636
|
storefrontCountryCodeIOS?: (string | null);
|
|
525
637
|
subscriptionGroupIdIOS?: (string | null);
|
|
526
638
|
transactionDate: number;
|
|
@@ -669,6 +781,20 @@ export interface RenewalInfoIOS {
|
|
|
669
781
|
willAutoRenew: boolean;
|
|
670
782
|
}
|
|
671
783
|
|
|
784
|
+
/**
|
|
785
|
+
* Rental details for one-time purchase products that can be rented (Android)
|
|
786
|
+
* Available in Google Play Billing Library 7.0+
|
|
787
|
+
*/
|
|
788
|
+
export interface RentalDetailsAndroid {
|
|
789
|
+
/**
|
|
790
|
+
* Rental expiration period in ISO 8601 format
|
|
791
|
+
* Time after rental period ends when user can still extend
|
|
792
|
+
*/
|
|
793
|
+
rentalExpirationPeriod?: (string | null);
|
|
794
|
+
/** Rental period in ISO 8601 format (e.g., P7D for 7 days) */
|
|
795
|
+
rentalPeriod: string;
|
|
796
|
+
}
|
|
797
|
+
|
|
672
798
|
export interface RequestPurchaseAndroidProps {
|
|
673
799
|
/** Personalized offer flag */
|
|
674
800
|
isOfferPersonalized?: (boolean | null);
|
|
@@ -710,9 +836,13 @@ export type RequestPurchaseProps =
|
|
|
710
836
|
};
|
|
711
837
|
|
|
712
838
|
export interface RequestPurchasePropsByPlatforms {
|
|
713
|
-
/**
|
|
839
|
+
/** @deprecated Use google instead */
|
|
714
840
|
android?: (RequestPurchaseAndroidProps | null);
|
|
715
|
-
/**
|
|
841
|
+
/** Apple-specific purchase parameters */
|
|
842
|
+
apple?: (RequestPurchaseIosProps | null);
|
|
843
|
+
/** Google-specific purchase parameters */
|
|
844
|
+
google?: (RequestPurchaseAndroidProps | null);
|
|
845
|
+
/** @deprecated Use apple instead */
|
|
716
846
|
ios?: (RequestPurchaseIosProps | null);
|
|
717
847
|
}
|
|
718
848
|
|
|
@@ -744,9 +874,13 @@ export interface RequestSubscriptionIosProps {
|
|
|
744
874
|
}
|
|
745
875
|
|
|
746
876
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
747
|
-
/**
|
|
877
|
+
/** @deprecated Use google instead */
|
|
748
878
|
android?: (RequestSubscriptionAndroidProps | null);
|
|
749
|
-
/**
|
|
879
|
+
/** Apple-specific subscription parameters */
|
|
880
|
+
apple?: (RequestSubscriptionIosProps | null);
|
|
881
|
+
/** Google-specific subscription parameters */
|
|
882
|
+
google?: (RequestSubscriptionAndroidProps | null);
|
|
883
|
+
/** @deprecated Use apple instead */
|
|
750
884
|
ios?: (RequestSubscriptionIosProps | null);
|
|
751
885
|
}
|
|
752
886
|
|
|
@@ -774,7 +908,7 @@ export interface RequestVerifyPurchaseWithIapkitResult {
|
|
|
774
908
|
isValid: boolean;
|
|
775
909
|
/** The current state of the purchase. */
|
|
776
910
|
state: IapkitPurchaseState;
|
|
777
|
-
store:
|
|
911
|
+
store: IapStore;
|
|
778
912
|
}
|
|
779
913
|
|
|
780
914
|
export interface Subscription {
|
|
@@ -834,6 +968,17 @@ export interface UserChoiceBillingDetails {
|
|
|
834
968
|
products: string[];
|
|
835
969
|
}
|
|
836
970
|
|
|
971
|
+
/**
|
|
972
|
+
* Valid time window for when an offer is available (Android)
|
|
973
|
+
* Available in Google Play Billing Library 7.0+
|
|
974
|
+
*/
|
|
975
|
+
export interface ValidTimeWindowAndroid {
|
|
976
|
+
/** End time in milliseconds since epoch */
|
|
977
|
+
endTimeMillis: string;
|
|
978
|
+
/** Start time in milliseconds since epoch */
|
|
979
|
+
startTimeMillis: string;
|
|
980
|
+
}
|
|
981
|
+
|
|
837
982
|
export interface VerifyPurchaseAndroidOptions {
|
|
838
983
|
accessToken: string;
|
|
839
984
|
isSub?: (boolean | null);
|
|
@@ -882,14 +1027,21 @@ export interface VerifyPurchaseResultIOS {
|
|
|
882
1027
|
receiptData: string;
|
|
883
1028
|
}
|
|
884
1029
|
|
|
1030
|
+
export interface VerifyPurchaseWithProviderError {
|
|
1031
|
+
code?: (string | null);
|
|
1032
|
+
message: string;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
885
1035
|
export interface VerifyPurchaseWithProviderProps {
|
|
886
1036
|
iapkit?: (RequestVerifyPurchaseWithIapkitProps | null);
|
|
887
1037
|
provider: PurchaseVerificationProvider;
|
|
888
1038
|
}
|
|
889
1039
|
|
|
890
1040
|
export interface VerifyPurchaseWithProviderResult {
|
|
891
|
-
/**
|
|
892
|
-
|
|
1041
|
+
/** Error details if verification failed */
|
|
1042
|
+
errors?: (VerifyPurchaseWithProviderError[] | null);
|
|
1043
|
+
/** IAPKit verification result */
|
|
1044
|
+
iapkit?: (RequestVerifyPurchaseWithIapkitResult | null);
|
|
893
1045
|
provider: PurchaseVerificationProvider;
|
|
894
1046
|
}
|
|
895
1047
|
|
package/src/utils/type-bridge.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
} from '../specs/RnIap.nitro';
|
|
13
13
|
import type {
|
|
14
14
|
IapPlatform,
|
|
15
|
+
IapStore,
|
|
15
16
|
PaymentModeIOS,
|
|
16
17
|
ProductType,
|
|
17
18
|
ProductTypeIOS,
|
|
@@ -30,6 +31,10 @@ import {RnIapConsole} from './debug';
|
|
|
30
31
|
|
|
31
32
|
const PLATFORM_IOS: IapPlatform = 'ios';
|
|
32
33
|
const PLATFORM_ANDROID: IapPlatform = 'android';
|
|
34
|
+
const STORE_UNKNOWN: IapStore = 'unknown';
|
|
35
|
+
const STORE_APPLE: IapStore = 'apple';
|
|
36
|
+
const STORE_GOOGLE: IapStore = 'google';
|
|
37
|
+
const STORE_HORIZON: IapStore = 'horizon';
|
|
33
38
|
const PRODUCT_TYPE_SUBS: ProductType = 'subs';
|
|
34
39
|
const PRODUCT_TYPE_IN_APP: ProductType = 'in-app';
|
|
35
40
|
const PURCHASE_STATE_DEFERRED: PurchaseState = 'deferred';
|
|
@@ -57,6 +62,19 @@ function normalizePlatform(value?: Nullable<string>): IapPlatform {
|
|
|
57
62
|
: PLATFORM_ANDROID;
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
function normalizeStore(value?: Nullable<string>): IapStore {
|
|
66
|
+
switch (value?.toLowerCase()) {
|
|
67
|
+
case 'apple':
|
|
68
|
+
return STORE_APPLE;
|
|
69
|
+
case 'google':
|
|
70
|
+
return STORE_GOOGLE;
|
|
71
|
+
case 'horizon':
|
|
72
|
+
return STORE_HORIZON;
|
|
73
|
+
default:
|
|
74
|
+
return STORE_UNKNOWN;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
60
78
|
function normalizeProductType(value?: Nullable<string>): ProductType {
|
|
61
79
|
return value?.toLowerCase() === PRODUCT_TYPE_SUBS
|
|
62
80
|
? PRODUCT_TYPE_SUBS
|
|
@@ -332,6 +350,8 @@ export function convertNitroPurchaseToPurchase(
|
|
|
332
350
|
purchaseState = normalizePurchaseState(nitroPurchase.purchaseStateAndroid);
|
|
333
351
|
}
|
|
334
352
|
|
|
353
|
+
const store = normalizeStore(nitroPurchase.store);
|
|
354
|
+
|
|
335
355
|
if (platform === PLATFORM_IOS) {
|
|
336
356
|
const iosPurchase: PurchaseIOS = {
|
|
337
357
|
id: nitroPurchase.id,
|
|
@@ -339,6 +359,7 @@ export function convertNitroPurchaseToPurchase(
|
|
|
339
359
|
transactionDate: nitroPurchase.transactionDate ?? Date.now(),
|
|
340
360
|
purchaseToken: nitroPurchase.purchaseToken ?? null,
|
|
341
361
|
platform,
|
|
362
|
+
store,
|
|
342
363
|
quantity: nitroPurchase.quantity ?? 1,
|
|
343
364
|
purchaseState,
|
|
344
365
|
isAutoRenewing: Boolean(nitroPurchase.isAutoRenewing),
|
|
@@ -433,6 +454,7 @@ export function convertNitroPurchaseToPurchase(
|
|
|
433
454
|
purchaseToken:
|
|
434
455
|
nitroPurchase.purchaseToken ?? nitroPurchase.purchaseTokenAndroid ?? null,
|
|
435
456
|
platform,
|
|
457
|
+
store,
|
|
436
458
|
quantity: nitroPurchase.quantity ?? 1,
|
|
437
459
|
purchaseState,
|
|
438
460
|
isAutoRenewing: Boolean(nitroPurchase.isAutoRenewing),
|
|
@@ -456,6 +478,7 @@ export function convertNitroPurchaseToPurchase(
|
|
|
456
478
|
developerPayloadAndroid: toNullableString(
|
|
457
479
|
nitroPurchase.developerPayloadAndroid,
|
|
458
480
|
),
|
|
481
|
+
isSuspendedAndroid: toNullableBoolean(nitroPurchase.isSuspendedAndroid),
|
|
459
482
|
};
|
|
460
483
|
|
|
461
484
|
return androidPurchase;
|