react-native-iap 14.7.5 → 14.7.7

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.
Files changed (50) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +19 -0
  2. package/ios/HybridRnIap.swift +86 -1
  3. package/lib/module/index.js +94 -0
  4. package/lib/module/index.js.map +1 -1
  5. package/lib/module/types.js +22 -3
  6. package/lib/module/types.js.map +1 -1
  7. package/lib/typescript/src/index.d.ts +59 -2
  8. package/lib/typescript/src/index.d.ts.map +1 -1
  9. package/lib/typescript/src/specs/RnIap.nitro.d.ts +32 -1
  10. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  11. package/lib/typescript/src/types.d.ts +75 -6
  12. package/lib/typescript/src/types.d.ts.map +1 -1
  13. package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkNoticeResultIOS.hpp +62 -0
  14. package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkNoticeTypeIOS.hpp +59 -0
  15. package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkTokenResultIOS.hpp +62 -0
  16. package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkTokenTypeIOS.hpp +59 -0
  17. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +5 -1
  18. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +64 -0
  19. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +3 -0
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkNoticeResultIOS.kt +39 -0
  21. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkNoticeTypeIOS.kt +21 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkTokenResultIOS.kt +39 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkTokenTypeIOS.kt +21 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +5 -2
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +12 -0
  26. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -0
  27. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +92 -0
  28. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +12 -0
  29. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +36 -0
  30. package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkNoticeResultIOS.swift +65 -0
  31. package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkNoticeTypeIOS.swift +40 -0
  32. package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkTokenResultIOS.swift +84 -0
  33. package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkTokenTypeIOS.swift +40 -0
  34. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +31 -1
  35. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseCustomLinkNoticeResultIOS.swift +47 -0
  36. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseCustomLinkTokenResultIOS.swift +47 -0
  37. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +3 -0
  38. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +57 -0
  39. package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkNoticeResultIOS.hpp +80 -0
  40. package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkNoticeTypeIOS.hpp +76 -0
  41. package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkTokenResultIOS.hpp +80 -0
  42. package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkTokenTypeIOS.hpp +76 -0
  43. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +5 -1
  44. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +3 -0
  45. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +15 -0
  46. package/openiap-versions.json +4 -4
  47. package/package.json +1 -1
  48. package/src/index.ts +134 -16
  49. package/src/specs/RnIap.nitro.ts +95 -4
  50. package/src/types.ts +81 -6
package/src/types.ts CHANGED
@@ -386,7 +386,40 @@ export interface ExternalOfferReportingDetailsAndroid {
386
386
  externalTransactionToken: string;
387
387
  }
388
388
 
389
- /** Result of presenting an external purchase link (iOS 18.2+) */
389
+ /** Result of showing ExternalPurchaseCustomLink notice (iOS 18.1+). */
390
+ export interface ExternalPurchaseCustomLinkNoticeResultIOS {
391
+ /** Whether the user chose to continue to external purchase */
392
+ continued: boolean;
393
+ /** Optional error message if the presentation failed */
394
+ error?: (string | null);
395
+ }
396
+
397
+ /**
398
+ * Notice types for ExternalPurchaseCustomLink (iOS 18.1+).
399
+ * Determines the style of disclosure notice to display.
400
+ * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/noticetype
401
+ */
402
+ export type ExternalPurchaseCustomLinkNoticeTypeIOS = 'browser';
403
+
404
+ /** Result of requesting an ExternalPurchaseCustomLink token (iOS 18.1+). */
405
+ export interface ExternalPurchaseCustomLinkTokenResultIOS {
406
+ /** Optional error message if token retrieval failed */
407
+ error?: (string | null);
408
+ /**
409
+ * The external purchase token string.
410
+ * Report this token to Apple's External Purchase Server API.
411
+ */
412
+ token?: (string | null);
413
+ }
414
+
415
+ /**
416
+ * Token types for ExternalPurchaseCustomLink (iOS 18.1+).
417
+ * Used to request different types of external purchase tokens for reporting to Apple.
418
+ * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
419
+ */
420
+ export type ExternalPurchaseCustomLinkTokenTypeIOS = 'acquisition' | 'services';
421
+
422
+ /** Result of presenting an external purchase link */
390
423
  export interface ExternalPurchaseLinkResultIOS {
391
424
  /** Optional error message if the presentation failed */
392
425
  error?: (string | null);
@@ -394,13 +427,22 @@ export interface ExternalPurchaseLinkResultIOS {
394
427
  success: boolean;
395
428
  }
396
429
 
397
- /** User actions on external purchase notice sheet (iOS 18.2+) */
430
+ /** User actions on external purchase notice sheet (iOS 17.4+) */
398
431
  export type ExternalPurchaseNoticeAction = 'continue' | 'dismissed';
399
432
 
400
- /** Result of presenting external purchase notice sheet (iOS 18.2+) */
433
+ /**
434
+ * Result of presenting external purchase notice sheet (iOS 17.4+)
435
+ * Returns the token when user continues to external purchase.
436
+ */
401
437
  export interface ExternalPurchaseNoticeResultIOS {
402
438
  /** Optional error message if the presentation failed */
403
439
  error?: (string | null);
440
+ /**
441
+ * External purchase token returned when user continues (iOS 17.4+).
442
+ * This token should be reported to Apple's External Purchase Server API.
443
+ * Only present when result is Continue.
444
+ */
445
+ externalPurchaseToken?: (string | null);
404
446
  /** Notice result indicating user action */
405
447
  result: ExternalPurchaseNoticeAction;
406
448
  }
@@ -527,9 +569,13 @@ export interface Mutation {
527
569
  launchExternalLinkAndroid: Promise<boolean>;
528
570
  /** Present the App Store code redemption sheet */
529
571
  presentCodeRedemptionSheetIOS: Promise<boolean>;
530
- /** Present external purchase custom link with StoreKit UI (iOS 18.2+) */
572
+ /** Present external purchase custom link with StoreKit UI */
531
573
  presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;
532
- /** Present external purchase notice sheet (iOS 18.2+) */
574
+ /**
575
+ * Present external purchase notice sheet (iOS 17.4+).
576
+ * Uses ExternalPurchase.presentNoticeSheet() which returns a token when user continues.
577
+ * Reference: https://developer.apple.com/documentation/storekit/externalpurchase/presentnoticesheet()
578
+ */
533
579
  presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;
534
580
  /** Initiate a purchase flow; rely on events for final state */
535
581
  requestPurchase?: Promise<(Purchase | Purchase[] | null)>;
@@ -553,6 +599,13 @@ export interface Mutation {
553
599
  * Throws OpenIapError.NotPrepared if billing client not ready
554
600
  */
555
601
  showAlternativeBillingDialogAndroid: Promise<boolean>;
602
+ /**
603
+ * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).
604
+ * Displays the system disclosure notice sheet for custom external purchase links.
605
+ * Call this after a deliberate customer interaction before linking out to external purchases.
606
+ * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
607
+ */
608
+ showExternalPurchaseCustomLinkNoticeIOS: Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
556
609
  /** Open subscription management UI and return changed purchases (iOS 15+) */
557
610
  showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;
558
611
  /** Force a StoreKit sync for transactions (iOS 15+) */
@@ -611,6 +664,8 @@ export type MutationRequestPurchaseArgs =
611
664
  };
612
665
 
613
666
 
667
+ export type MutationShowExternalPurchaseCustomLinkNoticeIosArgs = ExternalPurchaseCustomLinkNoticeTypeIOS;
668
+
614
669
  export type MutationValidateReceiptArgs = VerifyPurchaseProps;
615
670
 
616
671
  export type MutationVerifyPurchaseArgs = VerifyPurchaseProps;
@@ -1053,7 +1108,10 @@ export type PurchaseState = 'pending' | 'purchased' | 'unknown';
1053
1108
  export type PurchaseVerificationProvider = 'iapkit';
1054
1109
 
1055
1110
  export interface Query {
1056
- /** Check if external purchase notice sheet can be presented (iOS 18.2+) */
1111
+ /**
1112
+ * Check if external purchase notice sheet can be presented (iOS 17.4+)
1113
+ * Uses ExternalPurchase.canPresent
1114
+ */
1057
1115
  canPresentExternalPurchaseNoticeIOS: Promise<boolean>;
1058
1116
  /** Get current StoreKit 2 entitlements (iOS 15+) */
1059
1117
  currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;
@@ -1065,6 +1123,12 @@ export interface Query {
1065
1123
  getAppTransactionIOS?: Promise<(AppTransaction | null)>;
1066
1124
  /** Get all available purchases for the current user */
1067
1125
  getAvailablePurchases: Promise<Purchase[]>;
1126
+ /**
1127
+ * Get external purchase token for reporting to Apple (iOS 18.1+).
1128
+ * Use this token with Apple's External Purchase Server API to report transactions.
1129
+ * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
1130
+ */
1131
+ getExternalPurchaseCustomLinkTokenIOS: Promise<ExternalPurchaseCustomLinkTokenResultIOS>;
1068
1132
  /** Retrieve all pending transactions in the StoreKit queue */
1069
1133
  getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
1070
1134
  /** Get the currently promoted product (iOS 11+) */
@@ -1082,6 +1146,12 @@ export interface Query {
1082
1146
  getTransactionJwsIOS?: Promise<(string | null)>;
1083
1147
  /** Check whether the user has active subscriptions */
1084
1148
  hasActiveSubscriptions: Promise<boolean>;
1149
+ /**
1150
+ * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).
1151
+ * Returns true if the app can use custom external purchase links.
1152
+ * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible
1153
+ */
1154
+ isEligibleForExternalPurchaseCustomLinkIOS: Promise<boolean>;
1085
1155
  /** Check introductory offer eligibility for a subscription group */
1086
1156
  isEligibleForIntroOfferIOS: Promise<boolean>;
1087
1157
  /** Verify a StoreKit 2 transaction signature */
@@ -1107,6 +1177,8 @@ export type QueryGetActiveSubscriptionsArgs = (string[] | null) | undefined;
1107
1177
 
1108
1178
  export type QueryGetAvailablePurchasesArgs = (PurchaseOptions | null) | undefined;
1109
1179
 
1180
+ export type QueryGetExternalPurchaseCustomLinkTokenIosArgs = ExternalPurchaseCustomLinkTokenTypeIOS;
1181
+
1110
1182
  export type QueryGetTransactionJwsIosArgs = string;
1111
1183
 
1112
1184
  export type QueryHasActiveSubscriptionsArgs = (string[] | null) | undefined;
@@ -1742,6 +1814,7 @@ export type QueryArgsMap = {
1742
1814
  getActiveSubscriptions: QueryGetActiveSubscriptionsArgs;
1743
1815
  getAppTransactionIOS: never;
1744
1816
  getAvailablePurchases: QueryGetAvailablePurchasesArgs;
1817
+ getExternalPurchaseCustomLinkTokenIOS: QueryGetExternalPurchaseCustomLinkTokenIosArgs;
1745
1818
  getPendingTransactionsIOS: never;
1746
1819
  getPromotedProductIOS: never;
1747
1820
  getReceiptDataIOS: never;
@@ -1749,6 +1822,7 @@ export type QueryArgsMap = {
1749
1822
  getStorefrontIOS: never;
1750
1823
  getTransactionJwsIOS: QueryGetTransactionJwsIosArgs;
1751
1824
  hasActiveSubscriptions: QueryHasActiveSubscriptionsArgs;
1825
+ isEligibleForExternalPurchaseCustomLinkIOS: never;
1752
1826
  isEligibleForIntroOfferIOS: QueryIsEligibleForIntroOfferIosArgs;
1753
1827
  isTransactionVerifiedIOS: QueryIsTransactionVerifiedIosArgs;
1754
1828
  latestTransactionIOS: QueryLatestTransactionIosArgs;
@@ -1790,6 +1864,7 @@ export type MutationArgsMap = {
1790
1864
  requestPurchaseOnPromotedProductIOS: never;
1791
1865
  restorePurchases: never;
1792
1866
  showAlternativeBillingDialogAndroid: never;
1867
+ showExternalPurchaseCustomLinkNoticeIOS: MutationShowExternalPurchaseCustomLinkNoticeIosArgs;
1793
1868
  showManageSubscriptionsIOS: never;
1794
1869
  syncIOS: never;
1795
1870
  validateReceipt: MutationValidateReceiptArgs;