react-native-iap 14.4.10 → 14.4.12

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 (94) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +195 -12
  2. package/ios/HybridRnIap.swift +115 -2
  3. package/ios/RnIapHelper.swift +32 -1
  4. package/lib/module/hooks/useIAP.js +24 -3
  5. package/lib/module/hooks/useIAP.js.map +1 -1
  6. package/lib/module/index.js +275 -2
  7. package/lib/module/index.js.map +1 -1
  8. package/lib/module/types.js +18 -0
  9. package/lib/module/types.js.map +1 -1
  10. package/lib/module/utils/type-bridge.js +39 -1
  11. package/lib/module/utils/type-bridge.js.map +1 -1
  12. package/lib/typescript/plugin/src/withIAP.d.ts +27 -0
  13. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  14. package/lib/typescript/src/hooks/useIAP.d.ts +6 -1
  15. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  16. package/lib/typescript/src/index.d.ts +133 -0
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/specs/RnIap.nitro.d.ts +101 -2
  19. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  20. package/lib/typescript/src/types.d.ts +116 -13
  21. package/lib/typescript/src/types.d.ts.map +1 -1
  22. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  23. package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
  24. package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +62 -0
  25. package/nitrogen/generated/android/c++/JExternalPurchaseLinkResultIOS.hpp +58 -0
  26. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeAction.hpp +59 -0
  27. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +60 -0
  28. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
  29. package/nitrogen/generated/android/c++/JFunc_void_UserChoiceBillingDetails.hpp +78 -0
  30. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +136 -3
  31. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +9 -1
  32. package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +55 -0
  33. package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +61 -0
  34. package/nitrogen/generated/android/c++/JNitroProduct.hpp +16 -2
  35. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +74 -2
  36. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +4 -0
  37. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +4 -0
  38. package/nitrogen/generated/android/c++/JUserChoiceBillingDetails.hpp +75 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +22 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt +32 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeAction.kt +21 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +32 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +81 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +43 -1
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +29 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +35 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +10 -1
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +55 -1
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +3 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/UserChoiceBillingDetails.kt +32 -0
  52. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
  53. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +174 -0
  54. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +21 -0
  55. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +84 -3
  56. package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +44 -0
  57. package/nitrogen/generated/ios/swift/ExternalPurchaseLinkResultIOS.swift +65 -0
  58. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeAction.swift +40 -0
  59. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +65 -0
  60. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseLinkResultIOS.swift +47 -0
  61. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseNoticeResultIOS.swift +47 -0
  62. package/nitrogen/generated/ios/swift/Func_void_UserChoiceBillingDetails.swift +47 -0
  63. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +9 -1
  64. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +168 -2
  65. package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +47 -0
  66. package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +57 -0
  67. package/nitrogen/generated/ios/swift/NitroProduct.swift +91 -1
  68. package/nitrogen/generated/ios/swift/NitroPurchase.swift +520 -1
  69. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +31 -1
  70. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
  71. package/nitrogen/generated/ios/swift/UserChoiceBillingDetails.swift +58 -0
  72. package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +80 -0
  73. package/nitrogen/generated/shared/c++/ExternalPurchaseLinkResultIOS.hpp +72 -0
  74. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeAction.hpp +76 -0
  75. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +74 -0
  76. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +8 -0
  77. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +22 -2
  78. package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +69 -0
  79. package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +75 -0
  80. package/nitrogen/generated/shared/c++/NitroProduct.hpp +17 -2
  81. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +74 -2
  82. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +5 -1
  83. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +5 -1
  84. package/nitrogen/generated/shared/c++/UserChoiceBillingDetails.hpp +72 -0
  85. package/openiap-versions.json +3 -3
  86. package/package.json +3 -3
  87. package/plugin/build/withIAP.d.ts +27 -0
  88. package/plugin/build/withIAP.js +91 -1
  89. package/plugin/src/withIAP.ts +162 -0
  90. package/src/hooks/useIAP.ts +47 -1
  91. package/src/index.ts +313 -2
  92. package/src/specs/RnIap.nitro.ts +131 -1
  93. package/src/types.ts +124 -13
  94. package/src/utils/type-bridge.ts +76 -16
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_ExternalPurchaseLinkResultIOS.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: ExternalPurchaseLinkResultIOS) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_ExternalPurchaseLinkResultIOS {
16
+ public typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ private let closure: (_ value: ExternalPurchaseLinkResultIOS) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: ExternalPurchaseLinkResultIOS) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: ExternalPurchaseLinkResultIOS) -> Void {
26
+ self.closure(value)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_ExternalPurchaseLinkResultIOS`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_ExternalPurchaseLinkResultIOS>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_ExternalPurchaseLinkResultIOS {
45
+ return Unmanaged<Func_void_ExternalPurchaseLinkResultIOS>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_ExternalPurchaseNoticeResultIOS.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: ExternalPurchaseNoticeResultIOS) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_ExternalPurchaseNoticeResultIOS {
16
+ public typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ private let closure: (_ value: ExternalPurchaseNoticeResultIOS) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: ExternalPurchaseNoticeResultIOS) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: ExternalPurchaseNoticeResultIOS) -> Void {
26
+ self.closure(value)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_ExternalPurchaseNoticeResultIOS`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_ExternalPurchaseNoticeResultIOS>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_ExternalPurchaseNoticeResultIOS {
45
+ return Unmanaged<Func_void_ExternalPurchaseNoticeResultIOS>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_UserChoiceBillingDetails.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+
11
+ /**
12
+ * Wraps a Swift `(_ details: UserChoiceBillingDetails) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_UserChoiceBillingDetails {
16
+ public typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ private let closure: (_ details: UserChoiceBillingDetails) -> Void
19
+
20
+ public init(_ closure: @escaping (_ details: UserChoiceBillingDetails) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(details: UserChoiceBillingDetails) -> Void {
26
+ self.closure(details)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_UserChoiceBillingDetails`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_UserChoiceBillingDetails>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_UserChoiceBillingDetails {
45
+ return Unmanaged<Func_void_UserChoiceBillingDetails>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -14,7 +14,7 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
14
14
 
15
15
 
16
16
  // Methods
17
- func initConnection() throws -> Promise<Bool>
17
+ func initConnection(config: InitConnectionConfig?) throws -> Promise<Bool>
18
18
  func endConnection() throws -> Promise<Bool>
19
19
  func fetchProducts(skus: [String], type: String) throws -> Promise<[NitroProduct]>
20
20
  func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<RequestPurchaseResult?>
@@ -50,6 +50,14 @@ public protocol HybridRnIapSpec_protocol: HybridObject {
50
50
  func validateReceipt(params: NitroReceiptValidationParams) throws -> Promise<Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid>
51
51
  func getStorefront() throws -> Promise<String>
52
52
  func deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid) throws -> Promise<Void>
53
+ func checkAlternativeBillingAvailabilityAndroid() throws -> Promise<Bool>
54
+ func showAlternativeBillingDialogAndroid() throws -> Promise<Bool>
55
+ func createAlternativeBillingTokenAndroid(sku: String?) throws -> Promise<String?>
56
+ func addUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
57
+ func removeUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
58
+ func canPresentExternalPurchaseNoticeIOS() throws -> Promise<Bool>
59
+ func presentExternalPurchaseNoticeSheetIOS() throws -> Promise<ExternalPurchaseNoticeResultIOS>
60
+ func presentExternalPurchaseLinkIOS(url: String) throws -> Promise<ExternalPurchaseLinkResultIOS>
53
61
  }
54
62
 
55
63
  /// See ``HybridRnIapSpec``
@@ -110,9 +110,16 @@ open class HybridRnIapSpec_cxx {
110
110
 
111
111
  // Methods
112
112
  @inline(__always)
113
- public final func initConnection() -> bridge.Result_std__shared_ptr_Promise_bool___ {
113
+ public final func initConnection(config: bridge.std__optional_InitConnectionConfig_) -> bridge.Result_std__shared_ptr_Promise_bool___ {
114
114
  do {
115
- let __result = try self.__implementation.initConnection()
115
+ let __result = try self.__implementation.initConnection(config: { () -> InitConnectionConfig? in
116
+ if bridge.has_value_std__optional_InitConnectionConfig_(config) {
117
+ let __unwrapped = bridge.get_std__optional_InitConnectionConfig_(config)
118
+ return __unwrapped
119
+ } else {
120
+ return nil
121
+ }
122
+ }())
116
123
  let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
117
124
  let __promise = bridge.create_std__shared_ptr_Promise_bool__()
118
125
  let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
@@ -901,4 +908,163 @@ open class HybridRnIapSpec_cxx {
901
908
  return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
902
909
  }
903
910
  }
911
+
912
+ @inline(__always)
913
+ public final func checkAlternativeBillingAvailabilityAndroid() -> bridge.Result_std__shared_ptr_Promise_bool___ {
914
+ do {
915
+ let __result = try self.__implementation.checkAlternativeBillingAvailabilityAndroid()
916
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
917
+ let __promise = bridge.create_std__shared_ptr_Promise_bool__()
918
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
919
+ __result
920
+ .then({ __result in __promiseHolder.resolve(__result) })
921
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
922
+ return __promise
923
+ }()
924
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
925
+ } catch (let __error) {
926
+ let __exceptionPtr = __error.toCpp()
927
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
928
+ }
929
+ }
930
+
931
+ @inline(__always)
932
+ public final func showAlternativeBillingDialogAndroid() -> bridge.Result_std__shared_ptr_Promise_bool___ {
933
+ do {
934
+ let __result = try self.__implementation.showAlternativeBillingDialogAndroid()
935
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
936
+ let __promise = bridge.create_std__shared_ptr_Promise_bool__()
937
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
938
+ __result
939
+ .then({ __result in __promiseHolder.resolve(__result) })
940
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
941
+ return __promise
942
+ }()
943
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
944
+ } catch (let __error) {
945
+ let __exceptionPtr = __error.toCpp()
946
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
947
+ }
948
+ }
949
+
950
+ @inline(__always)
951
+ public final func createAlternativeBillingTokenAndroid(sku: bridge.std__optional_std__string_) -> bridge.Result_std__shared_ptr_Promise_std__optional_std__string____ {
952
+ do {
953
+ let __result = try self.__implementation.createAlternativeBillingTokenAndroid(sku: { () -> String? in
954
+ if bridge.has_value_std__optional_std__string_(sku) {
955
+ let __unwrapped = bridge.get_std__optional_std__string_(sku)
956
+ return String(__unwrapped)
957
+ } else {
958
+ return nil
959
+ }
960
+ }())
961
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__optional_std__string___ in
962
+ let __promise = bridge.create_std__shared_ptr_Promise_std__optional_std__string___()
963
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__optional_std__string___(__promise)
964
+ __result
965
+ .then({ __result in __promiseHolder.resolve({ () -> bridge.std__optional_std__string_ in
966
+ if let __unwrappedValue = __result {
967
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
968
+ } else {
969
+ return .init()
970
+ }
971
+ }()) })
972
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
973
+ return __promise
974
+ }()
975
+ return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__string____(__resultCpp)
976
+ } catch (let __error) {
977
+ let __exceptionPtr = __error.toCpp()
978
+ return bridge.create_Result_std__shared_ptr_Promise_std__optional_std__string____(__exceptionPtr)
979
+ }
980
+ }
981
+
982
+ @inline(__always)
983
+ public final func addUserChoiceBillingListenerAndroid(listener: bridge.Func_void_UserChoiceBillingDetails) -> bridge.Result_void_ {
984
+ do {
985
+ try self.__implementation.addUserChoiceBillingListenerAndroid(listener: { () -> (UserChoiceBillingDetails) -> Void in
986
+ let __wrappedFunction = bridge.wrap_Func_void_UserChoiceBillingDetails(listener)
987
+ return { (__details: UserChoiceBillingDetails) -> Void in
988
+ __wrappedFunction.call(__details)
989
+ }
990
+ }())
991
+ return bridge.create_Result_void_()
992
+ } catch (let __error) {
993
+ let __exceptionPtr = __error.toCpp()
994
+ return bridge.create_Result_void_(__exceptionPtr)
995
+ }
996
+ }
997
+
998
+ @inline(__always)
999
+ public final func removeUserChoiceBillingListenerAndroid(listener: bridge.Func_void_UserChoiceBillingDetails) -> bridge.Result_void_ {
1000
+ do {
1001
+ try self.__implementation.removeUserChoiceBillingListenerAndroid(listener: { () -> (UserChoiceBillingDetails) -> Void in
1002
+ let __wrappedFunction = bridge.wrap_Func_void_UserChoiceBillingDetails(listener)
1003
+ return { (__details: UserChoiceBillingDetails) -> Void in
1004
+ __wrappedFunction.call(__details)
1005
+ }
1006
+ }())
1007
+ return bridge.create_Result_void_()
1008
+ } catch (let __error) {
1009
+ let __exceptionPtr = __error.toCpp()
1010
+ return bridge.create_Result_void_(__exceptionPtr)
1011
+ }
1012
+ }
1013
+
1014
+ @inline(__always)
1015
+ public final func canPresentExternalPurchaseNoticeIOS() -> bridge.Result_std__shared_ptr_Promise_bool___ {
1016
+ do {
1017
+ let __result = try self.__implementation.canPresentExternalPurchaseNoticeIOS()
1018
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
1019
+ let __promise = bridge.create_std__shared_ptr_Promise_bool__()
1020
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
1021
+ __result
1022
+ .then({ __result in __promiseHolder.resolve(__result) })
1023
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
1024
+ return __promise
1025
+ }()
1026
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
1027
+ } catch (let __error) {
1028
+ let __exceptionPtr = __error.toCpp()
1029
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
1030
+ }
1031
+ }
1032
+
1033
+ @inline(__always)
1034
+ public final func presentExternalPurchaseNoticeSheetIOS() -> bridge.Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___ {
1035
+ do {
1036
+ let __result = try self.__implementation.presentExternalPurchaseNoticeSheetIOS()
1037
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__ in
1038
+ let __promise = bridge.create_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__()
1039
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__(__promise)
1040
+ __result
1041
+ .then({ __result in __promiseHolder.resolve(__result) })
1042
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
1043
+ return __promise
1044
+ }()
1045
+ return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___(__resultCpp)
1046
+ } catch (let __error) {
1047
+ let __exceptionPtr = __error.toCpp()
1048
+ return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___(__exceptionPtr)
1049
+ }
1050
+ }
1051
+
1052
+ @inline(__always)
1053
+ public final func presentExternalPurchaseLinkIOS(url: std.string) -> bridge.Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___ {
1054
+ do {
1055
+ let __result = try self.__implementation.presentExternalPurchaseLinkIOS(url: String(url))
1056
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__ in
1057
+ let __promise = bridge.create_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__()
1058
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__(__promise)
1059
+ __result
1060
+ .then({ __result in __promiseHolder.resolve(__result) })
1061
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
1062
+ return __promise
1063
+ }()
1064
+ return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___(__resultCpp)
1065
+ } catch (let __error) {
1066
+ let __exceptionPtr = __error.toCpp()
1067
+ return bridge.create_Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___(__exceptionPtr)
1068
+ }
1069
+ }
904
1070
  }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// InitConnectionConfig.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `InitConnectionConfig`, backed by a C++ struct.
12
+ */
13
+ public typealias InitConnectionConfig = margelo.nitro.iap.InitConnectionConfig
14
+
15
+ public extension InitConnectionConfig {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `InitConnectionConfig`.
20
+ */
21
+ init(alternativeBillingModeAndroid: AlternativeBillingModeAndroid?) {
22
+ self.init({ () -> bridge.std__optional_AlternativeBillingModeAndroid_ in
23
+ if let __unwrappedValue = alternativeBillingModeAndroid {
24
+ return bridge.create_std__optional_AlternativeBillingModeAndroid_(__unwrappedValue)
25
+ } else {
26
+ return .init()
27
+ }
28
+ }())
29
+ }
30
+
31
+ var alternativeBillingModeAndroid: AlternativeBillingModeAndroid? {
32
+ @inline(__always)
33
+ get {
34
+ return self.__alternativeBillingModeAndroid.value
35
+ }
36
+ @inline(__always)
37
+ set {
38
+ self.__alternativeBillingModeAndroid = { () -> bridge.std__optional_AlternativeBillingModeAndroid_ in
39
+ if let __unwrappedValue = newValue {
40
+ return bridge.create_std__optional_AlternativeBillingModeAndroid_(__unwrappedValue)
41
+ } else {
42
+ return .init()
43
+ }
44
+ }()
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,57 @@
1
+ ///
2
+ /// NitroOneTimePurchaseOfferDetail.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `NitroOneTimePurchaseOfferDetail`, backed by a C++ struct.
12
+ */
13
+ public typealias NitroOneTimePurchaseOfferDetail = margelo.nitro.iap.NitroOneTimePurchaseOfferDetail
14
+
15
+ public extension NitroOneTimePurchaseOfferDetail {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `NitroOneTimePurchaseOfferDetail`.
20
+ */
21
+ init(formattedPrice: String, priceAmountMicros: String, priceCurrencyCode: String) {
22
+ self.init(std.string(formattedPrice), std.string(priceAmountMicros), std.string(priceCurrencyCode))
23
+ }
24
+
25
+ var formattedPrice: String {
26
+ @inline(__always)
27
+ get {
28
+ return String(self.__formattedPrice)
29
+ }
30
+ @inline(__always)
31
+ set {
32
+ self.__formattedPrice = std.string(newValue)
33
+ }
34
+ }
35
+
36
+ var priceAmountMicros: String {
37
+ @inline(__always)
38
+ get {
39
+ return String(self.__priceAmountMicros)
40
+ }
41
+ @inline(__always)
42
+ set {
43
+ self.__priceAmountMicros = std.string(newValue)
44
+ }
45
+ }
46
+
47
+ var priceCurrencyCode: String {
48
+ @inline(__always)
49
+ get {
50
+ return String(self.__priceCurrencyCode)
51
+ }
52
+ @inline(__always)
53
+ set {
54
+ self.__priceCurrencyCode = std.string(newValue)
55
+ }
56
+ }
57
+ }
@@ -18,7 +18,7 @@ public extension NitroProduct {
18
18
  /**
19
19
  * Create a new instance of `NitroProduct`.
20
20
  */
21
- init(id: String, title: String, description: String, type: String, displayName: String?, displayPrice: String?, currency: String?, price: Double?, platform: IapPlatform, typeIOS: String?, isFamilyShareableIOS: Bool?, jsonRepresentationIOS: String?, introductoryPriceIOS: String?, introductoryPriceAsAmountIOS: Double?, introductoryPriceNumberOfPeriodsIOS: Double?, introductoryPricePaymentModeIOS: String?, introductoryPriceSubscriptionPeriodIOS: String?, subscriptionPeriodNumberIOS: Double?, subscriptionPeriodUnitIOS: String?, originalPriceAndroid: String?, originalPriceAmountMicrosAndroid: Double?, introductoryPriceCyclesAndroid: Double?, introductoryPricePeriodAndroid: String?, introductoryPriceValueAndroid: Double?, subscriptionPeriodAndroid: String?, freeTrialPeriodAndroid: String?, subscriptionOfferDetailsAndroid: String?) {
21
+ init(id: String, title: String, description: String, type: String, displayName: String?, displayPrice: String?, currency: String?, price: Double?, platform: IapPlatform, typeIOS: String?, isFamilyShareableIOS: Bool?, jsonRepresentationIOS: String?, discountsIOS: String?, introductoryPriceIOS: String?, introductoryPriceAsAmountIOS: Double?, introductoryPriceNumberOfPeriodsIOS: Double?, introductoryPricePaymentModeIOS: String?, introductoryPriceSubscriptionPeriodIOS: String?, subscriptionPeriodNumberIOS: Double?, subscriptionPeriodUnitIOS: String?, nameAndroid: String?, originalPriceAndroid: String?, originalPriceAmountMicrosAndroid: Double?, introductoryPriceCyclesAndroid: Double?, introductoryPricePeriodAndroid: String?, introductoryPriceValueAndroid: Double?, subscriptionPeriodAndroid: String?, freeTrialPeriodAndroid: String?, subscriptionOfferDetailsAndroid: String?, oneTimePurchaseOfferDetailsAndroid: NitroOneTimePurchaseOfferDetail?) {
22
22
  self.init(std.string(id), std.string(title), std.string(description), std.string(type), { () -> bridge.std__optional_std__string_ in
23
23
  if let __unwrappedValue = displayName {
24
24
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -61,6 +61,12 @@ public extension NitroProduct {
61
61
  } else {
62
62
  return .init()
63
63
  }
64
+ }(), { () -> bridge.std__optional_std__string_ in
65
+ if let __unwrappedValue = discountsIOS {
66
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
67
+ } else {
68
+ return .init()
69
+ }
64
70
  }(), { () -> bridge.std__optional_std__string_ in
65
71
  if let __unwrappedValue = introductoryPriceIOS {
66
72
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -103,6 +109,12 @@ public extension NitroProduct {
103
109
  } else {
104
110
  return .init()
105
111
  }
112
+ }(), { () -> bridge.std__optional_std__string_ in
113
+ if let __unwrappedValue = nameAndroid {
114
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
115
+ } else {
116
+ return .init()
117
+ }
106
118
  }(), { () -> bridge.std__optional_std__string_ in
107
119
  if let __unwrappedValue = originalPriceAndroid {
108
120
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -151,6 +163,12 @@ public extension NitroProduct {
151
163
  } else {
152
164
  return .init()
153
165
  }
166
+ }(), { () -> bridge.std__optional_NitroOneTimePurchaseOfferDetail_ in
167
+ if let __unwrappedValue = oneTimePurchaseOfferDetailsAndroid {
168
+ return bridge.create_std__optional_NitroOneTimePurchaseOfferDetail_(__unwrappedValue)
169
+ } else {
170
+ return .init()
171
+ }
154
172
  }())
155
173
  }
156
174
 
@@ -363,6 +381,30 @@ public extension NitroProduct {
363
381
  }
364
382
  }
365
383
 
384
+ var discountsIOS: String? {
385
+ @inline(__always)
386
+ get {
387
+ return { () -> String? in
388
+ if bridge.has_value_std__optional_std__string_(self.__discountsIOS) {
389
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__discountsIOS)
390
+ return String(__unwrapped)
391
+ } else {
392
+ return nil
393
+ }
394
+ }()
395
+ }
396
+ @inline(__always)
397
+ set {
398
+ self.__discountsIOS = { () -> bridge.std__optional_std__string_ in
399
+ if let __unwrappedValue = newValue {
400
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
401
+ } else {
402
+ return .init()
403
+ }
404
+ }()
405
+ }
406
+ }
407
+
366
408
  var introductoryPriceIOS: String? {
367
409
  @inline(__always)
368
410
  get {
@@ -510,6 +552,30 @@ public extension NitroProduct {
510
552
  }
511
553
  }
512
554
 
555
+ var nameAndroid: String? {
556
+ @inline(__always)
557
+ get {
558
+ return { () -> String? in
559
+ if bridge.has_value_std__optional_std__string_(self.__nameAndroid) {
560
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__nameAndroid)
561
+ return String(__unwrapped)
562
+ } else {
563
+ return nil
564
+ }
565
+ }()
566
+ }
567
+ @inline(__always)
568
+ set {
569
+ self.__nameAndroid = { () -> bridge.std__optional_std__string_ in
570
+ if let __unwrappedValue = newValue {
571
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
572
+ } else {
573
+ return .init()
574
+ }
575
+ }()
576
+ }
577
+ }
578
+
513
579
  var originalPriceAndroid: String? {
514
580
  @inline(__always)
515
581
  get {
@@ -680,4 +746,28 @@ public extension NitroProduct {
680
746
  }()
681
747
  }
682
748
  }
749
+
750
+ var oneTimePurchaseOfferDetailsAndroid: NitroOneTimePurchaseOfferDetail? {
751
+ @inline(__always)
752
+ get {
753
+ return { () -> NitroOneTimePurchaseOfferDetail? in
754
+ if bridge.has_value_std__optional_NitroOneTimePurchaseOfferDetail_(self.__oneTimePurchaseOfferDetailsAndroid) {
755
+ let __unwrapped = bridge.get_std__optional_NitroOneTimePurchaseOfferDetail_(self.__oneTimePurchaseOfferDetailsAndroid)
756
+ return __unwrapped
757
+ } else {
758
+ return nil
759
+ }
760
+ }()
761
+ }
762
+ @inline(__always)
763
+ set {
764
+ self.__oneTimePurchaseOfferDetailsAndroid = { () -> bridge.std__optional_NitroOneTimePurchaseOfferDetail_ in
765
+ if let __unwrappedValue = newValue {
766
+ return bridge.create_std__optional_NitroOneTimePurchaseOfferDetail_(__unwrappedValue)
767
+ } else {
768
+ return .init()
769
+ }
770
+ }()
771
+ }
772
+ }
683
773
  }