react-native-iap 14.3.7 → 14.3.9

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 (98) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +74 -14
  4. package/ios/HybridRnIap.swift +47 -12
  5. package/lib/module/hooks/useIAP.js +31 -21
  6. package/lib/module/hooks/useIAP.js.map +1 -1
  7. package/lib/module/index.js +580 -695
  8. package/lib/module/index.js.map +1 -1
  9. package/lib/module/types.js +12 -0
  10. package/lib/module/types.js.map +1 -1
  11. package/lib/module/utils/purchase.js +22 -0
  12. package/lib/module/utils/purchase.js.map +1 -0
  13. package/lib/module/utils.js +43 -0
  14. package/lib/module/utils.js.map +1 -0
  15. package/lib/typescript/plugin/src/withIAP.d.ts +1 -0
  16. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  17. package/lib/typescript/src/hooks/useIAP.d.ts +4 -5
  18. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  19. package/lib/typescript/src/index.d.ts +57 -176
  20. package/lib/typescript/src/index.d.ts.map +1 -1
  21. package/lib/typescript/src/specs/RnIap.nitro.d.ts +113 -154
  22. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  23. package/lib/typescript/src/types.d.ts +99 -76
  24. package/lib/typescript/src/types.d.ts.map +1 -1
  25. package/lib/typescript/src/utils/purchase.d.ts +4 -0
  26. package/lib/typescript/src/utils/purchase.d.ts.map +1 -0
  27. package/lib/typescript/src/utils.d.ts +8 -0
  28. package/lib/typescript/src/utils.d.ts.map +1 -0
  29. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -1
  30. package/nitrogen/generated/android/c++/{JNitroSubscriptionOffer.hpp → JAndroidSubscriptionOfferInput.hpp} +15 -15
  31. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
  32. package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +4 -0
  33. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +16 -16
  34. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
  35. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +6 -5
  36. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidType.hpp +59 -0
  37. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesOptions.hpp +2 -1
  38. package/nitrogen/generated/android/c++/JNitroProduct.hpp +22 -20
  39. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +12 -8
  40. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +2 -2
  41. package/nitrogen/generated/android/c++/JNitroReceiptValidationAndroidOptions.hpp +10 -10
  42. package/nitrogen/generated/android/c++/JNitroReceiptValidationResultAndroid.hpp +6 -6
  43. package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +4 -0
  44. package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +7 -7
  45. package/nitrogen/generated/android/c++/JRequestPurchaseResult.cpp +39 -0
  46. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +68 -53
  47. package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +4 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroSubscriptionOffer.kt → AndroidSubscriptionOfferInput.kt} +5 -5
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +1 -1
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidType.kt +21 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +11 -11
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +2 -2
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationAndroidOptions.kt +4 -4
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultAndroid.kt +2 -2
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +1 -1
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +31 -13
  58. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +4 -4
  59. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +99 -64
  60. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -6
  61. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +10 -10
  62. package/nitrogen/generated/ios/swift/{NitroSubscriptionOffer.swift → AndroidSubscriptionOfferInput.swift} +13 -13
  63. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____.swift +81 -0
  64. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
  65. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +35 -7
  66. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidOptions.swift +7 -14
  67. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidType.swift +40 -0
  68. package/nitrogen/generated/ios/swift/NitroProduct.swift +72 -72
  69. package/nitrogen/generated/ios/swift/NitroPurchase.swift +8 -8
  70. package/nitrogen/generated/ios/swift/NitroReceiptValidationAndroidOptions.swift +21 -21
  71. package/nitrogen/generated/ios/swift/NitroReceiptValidationResultAndroid.swift +37 -11
  72. package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +11 -11
  73. package/nitrogen/generated/ios/swift/RequestPurchaseResult.swift +8 -137
  74. package/nitrogen/generated/shared/c++/{NitroSubscriptionOffer.hpp → AndroidSubscriptionOfferInput.hpp} +15 -15
  75. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +9 -6
  76. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +8 -7
  77. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidType.hpp +76 -0
  78. package/nitrogen/generated/shared/c++/NitroProduct.hpp +24 -22
  79. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +15 -10
  80. package/nitrogen/generated/shared/c++/NitroReceiptValidationAndroidOptions.hpp +10 -10
  81. package/nitrogen/generated/shared/c++/NitroReceiptValidationResultAndroid.hpp +9 -9
  82. package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +8 -8
  83. package/package.json +2 -2
  84. package/plugin/build/withIAP.d.ts +1 -0
  85. package/plugin/build/withIAP.js +8 -2
  86. package/plugin/src/withIAP.ts +13 -3
  87. package/src/hooks/useIAP.ts +63 -32
  88. package/src/index.ts +716 -790
  89. package/src/specs/RnIap.nitro.ts +131 -163
  90. package/src/types.ts +131 -85
  91. package/src/utils/purchase.ts +32 -0
  92. package/src/utils.ts +68 -0
  93. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp +0 -26
  94. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.hpp +0 -80
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_PurchaseAndroid_PurchaseIOS.kt +0 -42
  96. package/nitrogen/generated/ios/swift/Func_void_RequestPurchaseResult.swift +0 -47
  97. package/nitrogen/generated/ios/swift/Variant_PurchaseAndroid_PurchaseIOS.swift +0 -18
  98. package/nitrogen/generated/shared/c++/RequestPurchaseResult.hpp +0 -78
@@ -18,7 +18,7 @@ public extension NitroRequestPurchaseAndroid {
18
18
  /**
19
19
  * Create a new instance of `NitroRequestPurchaseAndroid`.
20
20
  */
21
- init(skus: [String], obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?, isOfferPersonalized: Bool?, subscriptionOffers: [NitroSubscriptionOffer]?, replacementModeAndroid: Double?, purchaseTokenAndroid: String?) {
21
+ init(skus: [String], obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?, isOfferPersonalized: Bool?, subscriptionOffers: [AndroidSubscriptionOfferInput]?, replacementModeAndroid: Double?, purchaseTokenAndroid: String?) {
22
22
  self.init({ () -> bridge.std__vector_std__string_ in
23
23
  var __vector = bridge.create_std__vector_std__string_(skus.count)
24
24
  for __item in skus {
@@ -43,10 +43,10 @@ public extension NitroRequestPurchaseAndroid {
43
43
  } else {
44
44
  return .init()
45
45
  }
46
- }(), { () -> bridge.std__optional_std__vector_NitroSubscriptionOffer__ in
46
+ }(), { () -> bridge.std__optional_std__vector_AndroidSubscriptionOfferInput__ in
47
47
  if let __unwrappedValue = subscriptionOffers {
48
- return bridge.create_std__optional_std__vector_NitroSubscriptionOffer__({ () -> bridge.std__vector_NitroSubscriptionOffer_ in
49
- var __vector = bridge.create_std__vector_NitroSubscriptionOffer_(__unwrappedValue.count)
48
+ return bridge.create_std__optional_std__vector_AndroidSubscriptionOfferInput__({ () -> bridge.std__vector_AndroidSubscriptionOfferInput_ in
49
+ var __vector = bridge.create_std__vector_AndroidSubscriptionOfferInput_(__unwrappedValue.count)
50
50
  for __item in __unwrappedValue {
51
51
  __vector.push_back(__item)
52
52
  }
@@ -152,12 +152,12 @@ public extension NitroRequestPurchaseAndroid {
152
152
  }
153
153
  }
154
154
 
155
- var subscriptionOffers: [NitroSubscriptionOffer]? {
155
+ var subscriptionOffers: [AndroidSubscriptionOfferInput]? {
156
156
  @inline(__always)
157
157
  get {
158
- return { () -> [NitroSubscriptionOffer]? in
159
- if bridge.has_value_std__optional_std__vector_NitroSubscriptionOffer__(self.__subscriptionOffers) {
160
- let __unwrapped = bridge.get_std__optional_std__vector_NitroSubscriptionOffer__(self.__subscriptionOffers)
158
+ return { () -> [AndroidSubscriptionOfferInput]? in
159
+ if bridge.has_value_std__optional_std__vector_AndroidSubscriptionOfferInput__(self.__subscriptionOffers) {
160
+ let __unwrapped = bridge.get_std__optional_std__vector_AndroidSubscriptionOfferInput__(self.__subscriptionOffers)
161
161
  return __unwrapped.map({ __item in __item })
162
162
  } else {
163
163
  return nil
@@ -166,10 +166,10 @@ public extension NitroRequestPurchaseAndroid {
166
166
  }
167
167
  @inline(__always)
168
168
  set {
169
- self.__subscriptionOffers = { () -> bridge.std__optional_std__vector_NitroSubscriptionOffer__ in
169
+ self.__subscriptionOffers = { () -> bridge.std__optional_std__vector_AndroidSubscriptionOfferInput__ in
170
170
  if let __unwrappedValue = newValue {
171
- return bridge.create_std__optional_std__vector_NitroSubscriptionOffer__({ () -> bridge.std__vector_NitroSubscriptionOffer_ in
172
- var __vector = bridge.create_std__vector_NitroSubscriptionOffer_(__unwrappedValue.count)
171
+ return bridge.create_std__optional_std__vector_AndroidSubscriptionOfferInput__({ () -> bridge.std__vector_AndroidSubscriptionOfferInput_ in
172
+ var __vector = bridge.create_std__vector_AndroidSubscriptionOfferInput_(__unwrappedValue.count)
173
173
  for __item in __unwrappedValue {
174
174
  __vector.push_back(__item)
175
175
  }
@@ -5,144 +5,15 @@
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import NitroModules
8
+
9
9
 
10
10
  /**
11
- * Represents an instance of `RequestPurchaseResult`, backed by a C++ struct.
11
+ * An Swift enum with associated values representing a Variant/Union type.
12
+ * JS type: `struct | struct | array`
12
13
  */
13
- public typealias RequestPurchaseResult = margelo.nitro.iap.RequestPurchaseResult
14
-
15
- public extension RequestPurchaseResult {
16
- private typealias bridge = margelo.nitro.iap.bridge.swift
17
-
18
- /**
19
- * Create a new instance of `RequestPurchaseResult`.
20
- */
21
- init(purchase: Variant_PurchaseAndroid_PurchaseIOS?, purchases: [Purchase]?) {
22
- self.init({ () -> bridge.std__optional_std__variant_PurchaseAndroid__PurchaseIOS__ in
23
- if let __unwrappedValue = purchase {
24
- return bridge.create_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__({ () -> bridge.std__variant_PurchaseAndroid__PurchaseIOS_ in
25
- switch __unwrappedValue {
26
- case .first(let __value):
27
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
28
- case .second(let __value):
29
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
30
- }
31
- }().variant)
32
- } else {
33
- return .init()
34
- }
35
- }(), { () -> bridge.std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ in
36
- if let __unwrappedValue = purchases {
37
- return bridge.create_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___({ () -> bridge.std__vector_std__variant_PurchaseAndroid__PurchaseIOS__ in
38
- var __vector = bridge.create_std__vector_std__variant_PurchaseAndroid__PurchaseIOS__(__unwrappedValue.count)
39
- for __item in __unwrappedValue {
40
- __vector.push_back({ () -> bridge.std__variant_PurchaseAndroid__PurchaseIOS_ in
41
- switch __item {
42
- case .first(let __value):
43
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
44
- case .second(let __value):
45
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
46
- }
47
- }().variant)
48
- }
49
- return __vector
50
- }())
51
- } else {
52
- return .init()
53
- }
54
- }())
55
- }
56
-
57
- var purchase: Variant_PurchaseAndroid_PurchaseIOS? {
58
- @inline(__always)
59
- get {
60
- return { () -> Variant_PurchaseAndroid_PurchaseIOS? in
61
- if bridge.has_value_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__(self.__purchase) {
62
- let __unwrapped = bridge.get_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__(self.__purchase)
63
- return { () -> Variant_PurchaseAndroid_PurchaseIOS in
64
- let __variant = bridge.std__variant_PurchaseAndroid__PurchaseIOS_(__unwrapped)
65
- switch __variant.index() {
66
- case 0:
67
- let __actual = __variant.get_0()
68
- return .first(__actual)
69
- case 1:
70
- let __actual = __variant.get_1()
71
- return .second(__actual)
72
- default:
73
- fatalError("Variant can never have index \(__variant.index())!")
74
- }
75
- }()
76
- } else {
77
- return nil
78
- }
79
- }()
80
- }
81
- @inline(__always)
82
- set {
83
- self.__purchase = { () -> bridge.std__optional_std__variant_PurchaseAndroid__PurchaseIOS__ in
84
- if let __unwrappedValue = newValue {
85
- return bridge.create_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__({ () -> bridge.std__variant_PurchaseAndroid__PurchaseIOS_ in
86
- switch __unwrappedValue {
87
- case .first(let __value):
88
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
89
- case .second(let __value):
90
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
91
- }
92
- }().variant)
93
- } else {
94
- return .init()
95
- }
96
- }()
97
- }
98
- }
99
-
100
- var purchases: [Purchase]? {
101
- @inline(__always)
102
- get {
103
- return { () -> [Purchase]? in
104
- if bridge.has_value_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(self.__purchases) {
105
- let __unwrapped = bridge.get_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___(self.__purchases)
106
- return __unwrapped.map({ __item in { () -> Purchase in
107
- let __variant = bridge.std__variant_PurchaseAndroid__PurchaseIOS_(__item)
108
- switch __variant.index() {
109
- case 0:
110
- let __actual = __variant.get_0()
111
- return .first(__actual)
112
- case 1:
113
- let __actual = __variant.get_1()
114
- return .second(__actual)
115
- default:
116
- fatalError("Variant can never have index \(__variant.index())!")
117
- }
118
- }() })
119
- } else {
120
- return nil
121
- }
122
- }()
123
- }
124
- @inline(__always)
125
- set {
126
- self.__purchases = { () -> bridge.std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___ in
127
- if let __unwrappedValue = newValue {
128
- return bridge.create_std__optional_std__vector_std__variant_PurchaseAndroid__PurchaseIOS___({ () -> bridge.std__vector_std__variant_PurchaseAndroid__PurchaseIOS__ in
129
- var __vector = bridge.create_std__vector_std__variant_PurchaseAndroid__PurchaseIOS__(__unwrappedValue.count)
130
- for __item in __unwrappedValue {
131
- __vector.push_back({ () -> bridge.std__variant_PurchaseAndroid__PurchaseIOS_ in
132
- switch __item {
133
- case .first(let __value):
134
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
135
- case .second(let __value):
136
- return bridge.create_std__variant_PurchaseAndroid__PurchaseIOS_(__value)
137
- }
138
- }().variant)
139
- }
140
- return __vector
141
- }())
142
- } else {
143
- return .init()
144
- }
145
- }()
146
- }
147
- }
14
+ @frozen
15
+ public indirect enum RequestPurchaseResult {
16
+ case first(PurchaseAndroid)
17
+ case second(PurchaseIOS)
18
+ case third([Purchase])
148
19
  }
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// NitroSubscriptionOffer.hpp
2
+ /// AndroidSubscriptionOfferInput.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
@@ -25,36 +25,36 @@
25
25
  namespace margelo::nitro::iap {
26
26
 
27
27
  /**
28
- * A struct which can be represented as a JavaScript object (NitroSubscriptionOffer).
28
+ * A struct which can be represented as a JavaScript object (AndroidSubscriptionOfferInput).
29
29
  */
30
- struct NitroSubscriptionOffer {
30
+ struct AndroidSubscriptionOfferInput {
31
31
  public:
32
- std::string sku SWIFT_PRIVATE;
33
32
  std::string offerToken SWIFT_PRIVATE;
33
+ std::string sku SWIFT_PRIVATE;
34
34
 
35
35
  public:
36
- NitroSubscriptionOffer() = default;
37
- explicit NitroSubscriptionOffer(std::string sku, std::string offerToken): sku(sku), offerToken(offerToken) {}
36
+ AndroidSubscriptionOfferInput() = default;
37
+ explicit AndroidSubscriptionOfferInput(std::string offerToken, std::string sku): offerToken(offerToken), sku(sku) {}
38
38
  };
39
39
 
40
40
  } // namespace margelo::nitro::iap
41
41
 
42
42
  namespace margelo::nitro {
43
43
 
44
- // C++ NitroSubscriptionOffer <> JS NitroSubscriptionOffer (object)
44
+ // C++ AndroidSubscriptionOfferInput <> JS AndroidSubscriptionOfferInput (object)
45
45
  template <>
46
- struct JSIConverter<margelo::nitro::iap::NitroSubscriptionOffer> final {
47
- static inline margelo::nitro::iap::NitroSubscriptionOffer fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ struct JSIConverter<margelo::nitro::iap::AndroidSubscriptionOfferInput> final {
47
+ static inline margelo::nitro::iap::AndroidSubscriptionOfferInput fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
48
48
  jsi::Object obj = arg.asObject(runtime);
49
- return margelo::nitro::iap::NitroSubscriptionOffer(
50
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "sku")),
51
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "offerToken"))
49
+ return margelo::nitro::iap::AndroidSubscriptionOfferInput(
50
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "offerToken")),
51
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "sku"))
52
52
  );
53
53
  }
54
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroSubscriptionOffer& arg) {
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::AndroidSubscriptionOfferInput& arg) {
55
55
  jsi::Object obj(runtime);
56
- obj.setProperty(runtime, "sku", JSIConverter<std::string>::toJSI(runtime, arg.sku));
57
56
  obj.setProperty(runtime, "offerToken", JSIConverter<std::string>::toJSI(runtime, arg.offerToken));
57
+ obj.setProperty(runtime, "sku", JSIConverter<std::string>::toJSI(runtime, arg.sku));
58
58
  return obj;
59
59
  }
60
60
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -62,8 +62,8 @@ namespace margelo::nitro {
62
62
  return false;
63
63
  }
64
64
  jsi::Object obj = value.getObject(runtime);
65
- if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "sku"))) return false;
66
65
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "offerToken"))) return false;
66
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "sku"))) return false;
67
67
  return true;
68
68
  }
69
69
  };
@@ -15,8 +15,10 @@
15
15
 
16
16
  // Forward declaration of `NitroProduct` to properly resolve imports.
17
17
  namespace margelo::nitro::iap { struct NitroProduct; }
18
- // Forward declaration of `RequestPurchaseResult` to properly resolve imports.
19
- namespace margelo::nitro::iap { struct RequestPurchaseResult; }
18
+ // Forward declaration of `PurchaseAndroid` to properly resolve imports.
19
+ namespace margelo::nitro::iap { struct PurchaseAndroid; }
20
+ // Forward declaration of `PurchaseIOS` to properly resolve imports.
21
+ namespace margelo::nitro::iap { struct PurchaseIOS; }
20
22
  // Forward declaration of `NitroPurchaseRequest` to properly resolve imports.
21
23
  namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
22
24
  // Forward declaration of `NitroPurchase` to properly resolve imports.
@@ -42,13 +44,14 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
42
44
  #include "NitroProduct.hpp"
43
45
  #include <vector>
44
46
  #include <string>
45
- #include "RequestPurchaseResult.hpp"
47
+ #include "PurchaseAndroid.hpp"
48
+ #include "PurchaseIOS.hpp"
49
+ #include <variant>
50
+ #include <optional>
46
51
  #include "NitroPurchaseRequest.hpp"
47
52
  #include "NitroPurchase.hpp"
48
53
  #include "NitroAvailablePurchasesOptions.hpp"
49
- #include <optional>
50
54
  #include "NitroPurchaseResult.hpp"
51
- #include <variant>
52
55
  #include "NitroFinishTransactionParams.hpp"
53
56
  #include <functional>
54
57
  #include "NitroSubscriptionStatus.hpp"
@@ -91,7 +94,7 @@ namespace margelo::nitro::iap {
91
94
  virtual std::shared_ptr<Promise<bool>> initConnection() = 0;
92
95
  virtual std::shared_ptr<Promise<bool>> endConnection() = 0;
93
96
  virtual std::shared_ptr<Promise<std::vector<NitroProduct>>> fetchProducts(const std::vector<std::string>& skus, const std::string& type) = 0;
94
- virtual std::shared_ptr<Promise<RequestPurchaseResult>> requestPurchase(const NitroPurchaseRequest& request) = 0;
97
+ virtual std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> requestPurchase(const NitroPurchaseRequest& request) = 0;
95
98
  virtual std::shared_ptr<Promise<std::vector<NitroPurchase>>> getAvailablePurchases(const std::optional<NitroAvailablePurchasesOptions>& options) = 0;
96
99
  virtual std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>> finishTransaction(const NitroFinishTransactionParams& params) = 0;
97
100
  virtual void addPurchaseUpdatedListener(const std::function<void(const NitroPurchase& /* purchase */)>& listener) = 0;
@@ -18,9 +18,10 @@
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
20
 
21
+ // Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
22
+ namespace margelo::nitro::iap { enum class NitroAvailablePurchasesAndroidType; }
21
23
 
22
-
23
- #include <string>
24
+ #include "NitroAvailablePurchasesAndroidType.hpp"
24
25
  #include <optional>
25
26
 
26
27
  namespace margelo::nitro::iap {
@@ -30,11 +31,11 @@ namespace margelo::nitro::iap {
30
31
  */
31
32
  struct NitroAvailablePurchasesAndroidOptions {
32
33
  public:
33
- std::optional<std::string> type SWIFT_PRIVATE;
34
+ std::optional<NitroAvailablePurchasesAndroidType> type SWIFT_PRIVATE;
34
35
 
35
36
  public:
36
37
  NitroAvailablePurchasesAndroidOptions() = default;
37
- explicit NitroAvailablePurchasesAndroidOptions(std::optional<std::string> type): type(type) {}
38
+ explicit NitroAvailablePurchasesAndroidOptions(std::optional<NitroAvailablePurchasesAndroidType> type): type(type) {}
38
39
  };
39
40
 
40
41
  } // namespace margelo::nitro::iap
@@ -47,12 +48,12 @@ namespace margelo::nitro {
47
48
  static inline margelo::nitro::iap::NitroAvailablePurchasesAndroidOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
48
49
  jsi::Object obj = arg.asObject(runtime);
49
50
  return margelo::nitro::iap::NitroAvailablePurchasesAndroidOptions(
50
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "type"))
51
+ JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::fromJSI(runtime, obj.getProperty(runtime, "type"))
51
52
  );
52
53
  }
53
54
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroAvailablePurchasesAndroidOptions& arg) {
54
55
  jsi::Object obj(runtime);
55
- obj.setProperty(runtime, "type", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.type));
56
+ obj.setProperty(runtime, "type", JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::toJSI(runtime, arg.type));
56
57
  return obj;
57
58
  }
58
59
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -60,7 +61,7 @@ namespace margelo::nitro {
60
61
  return false;
61
62
  }
62
63
  jsi::Object obj = value.getObject(runtime);
63
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
64
+ if (!JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
64
65
  return true;
65
66
  }
66
67
  };
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// NitroAvailablePurchasesAndroidType.hpp
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
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::iap {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (NitroAvailablePurchasesAndroidType).
30
+ */
31
+ enum class NitroAvailablePurchasesAndroidType {
32
+ INAPP SWIFT_NAME(inapp) = 0,
33
+ SUBS SWIFT_NAME(subs) = 1,
34
+ } CLOSED_ENUM;
35
+
36
+ } // namespace margelo::nitro::iap
37
+
38
+ namespace margelo::nitro {
39
+
40
+ // C++ NitroAvailablePurchasesAndroidType <> JS NitroAvailablePurchasesAndroidType (union)
41
+ template <>
42
+ struct JSIConverter<margelo::nitro::iap::NitroAvailablePurchasesAndroidType> final {
43
+ static inline margelo::nitro::iap::NitroAvailablePurchasesAndroidType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
44
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
45
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
46
+ case hashString("inapp"): return margelo::nitro::iap::NitroAvailablePurchasesAndroidType::INAPP;
47
+ case hashString("subs"): return margelo::nitro::iap::NitroAvailablePurchasesAndroidType::SUBS;
48
+ default: [[unlikely]]
49
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NitroAvailablePurchasesAndroidType - invalid value!");
50
+ }
51
+ }
52
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::NitroAvailablePurchasesAndroidType arg) {
53
+ switch (arg) {
54
+ case margelo::nitro::iap::NitroAvailablePurchasesAndroidType::INAPP: return JSIConverter<std::string>::toJSI(runtime, "inapp");
55
+ case margelo::nitro::iap::NitroAvailablePurchasesAndroidType::SUBS: return JSIConverter<std::string>::toJSI(runtime, "subs");
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert NitroAvailablePurchasesAndroidType to JS - invalid value: "
58
+ + std::to_string(static_cast<int>(arg)) + "!");
59
+ }
60
+ }
61
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
62
+ if (!value.isString()) {
63
+ return false;
64
+ }
65
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
66
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
67
+ case hashString("inapp"):
68
+ case hashString("subs"):
69
+ return true;
70
+ default:
71
+ return false;
72
+ }
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -18,10 +18,12 @@
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
20
 
21
-
21
+ // Forward declaration of `IapPlatform` to properly resolve imports.
22
+ namespace margelo::nitro::iap { enum class IapPlatform; }
22
23
 
23
24
  #include <string>
24
25
  #include <optional>
26
+ #include "IapPlatform.hpp"
25
27
 
26
28
  namespace margelo::nitro::iap {
27
29
 
@@ -38,29 +40,29 @@ namespace margelo::nitro::iap {
38
40
  std::optional<std::string> displayPrice SWIFT_PRIVATE;
39
41
  std::optional<std::string> currency SWIFT_PRIVATE;
40
42
  std::optional<double> price SWIFT_PRIVATE;
41
- std::string platform SWIFT_PRIVATE;
43
+ IapPlatform platform SWIFT_PRIVATE;
42
44
  std::optional<std::string> typeIOS SWIFT_PRIVATE;
43
45
  std::optional<bool> isFamilyShareableIOS SWIFT_PRIVATE;
44
46
  std::optional<std::string> jsonRepresentationIOS SWIFT_PRIVATE;
45
- std::optional<std::string> subscriptionPeriodUnitIOS SWIFT_PRIVATE;
46
- std::optional<double> subscriptionPeriodNumberIOS SWIFT_PRIVATE;
47
47
  std::optional<std::string> introductoryPriceIOS SWIFT_PRIVATE;
48
48
  std::optional<double> introductoryPriceAsAmountIOS SWIFT_PRIVATE;
49
- std::optional<std::string> introductoryPricePaymentModeIOS SWIFT_PRIVATE;
50
49
  std::optional<double> introductoryPriceNumberOfPeriodsIOS SWIFT_PRIVATE;
50
+ std::optional<std::string> introductoryPricePaymentModeIOS SWIFT_PRIVATE;
51
51
  std::optional<std::string> introductoryPriceSubscriptionPeriodIOS SWIFT_PRIVATE;
52
+ std::optional<double> subscriptionPeriodNumberIOS SWIFT_PRIVATE;
53
+ std::optional<std::string> subscriptionPeriodUnitIOS SWIFT_PRIVATE;
52
54
  std::optional<std::string> originalPriceAndroid SWIFT_PRIVATE;
53
55
  std::optional<double> originalPriceAmountMicrosAndroid SWIFT_PRIVATE;
54
- std::optional<double> introductoryPriceValueAndroid SWIFT_PRIVATE;
55
56
  std::optional<double> introductoryPriceCyclesAndroid SWIFT_PRIVATE;
56
57
  std::optional<std::string> introductoryPricePeriodAndroid SWIFT_PRIVATE;
58
+ std::optional<double> introductoryPriceValueAndroid SWIFT_PRIVATE;
57
59
  std::optional<std::string> subscriptionPeriodAndroid SWIFT_PRIVATE;
58
60
  std::optional<std::string> freeTrialPeriodAndroid SWIFT_PRIVATE;
59
61
  std::optional<std::string> subscriptionOfferDetailsAndroid SWIFT_PRIVATE;
60
62
 
61
63
  public:
62
64
  NitroProduct() = default;
63
- explicit NitroProduct(std::string id, std::string title, std::string description, std::string type, std::optional<std::string> displayName, std::optional<std::string> displayPrice, std::optional<std::string> currency, std::optional<double> price, std::string platform, std::optional<std::string> typeIOS, std::optional<bool> isFamilyShareableIOS, std::optional<std::string> jsonRepresentationIOS, std::optional<std::string> subscriptionPeriodUnitIOS, std::optional<double> subscriptionPeriodNumberIOS, std::optional<std::string> introductoryPriceIOS, std::optional<double> introductoryPriceAsAmountIOS, std::optional<std::string> introductoryPricePaymentModeIOS, std::optional<double> introductoryPriceNumberOfPeriodsIOS, std::optional<std::string> introductoryPriceSubscriptionPeriodIOS, std::optional<std::string> originalPriceAndroid, std::optional<double> originalPriceAmountMicrosAndroid, std::optional<double> introductoryPriceValueAndroid, std::optional<double> introductoryPriceCyclesAndroid, std::optional<std::string> introductoryPricePeriodAndroid, std::optional<std::string> subscriptionPeriodAndroid, std::optional<std::string> freeTrialPeriodAndroid, std::optional<std::string> subscriptionOfferDetailsAndroid): id(id), title(title), description(description), type(type), displayName(displayName), displayPrice(displayPrice), currency(currency), price(price), platform(platform), typeIOS(typeIOS), isFamilyShareableIOS(isFamilyShareableIOS), jsonRepresentationIOS(jsonRepresentationIOS), subscriptionPeriodUnitIOS(subscriptionPeriodUnitIOS), subscriptionPeriodNumberIOS(subscriptionPeriodNumberIOS), introductoryPriceIOS(introductoryPriceIOS), introductoryPriceAsAmountIOS(introductoryPriceAsAmountIOS), introductoryPricePaymentModeIOS(introductoryPricePaymentModeIOS), introductoryPriceNumberOfPeriodsIOS(introductoryPriceNumberOfPeriodsIOS), introductoryPriceSubscriptionPeriodIOS(introductoryPriceSubscriptionPeriodIOS), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid) {}
65
+ explicit NitroProduct(std::string id, std::string title, std::string description, std::string type, std::optional<std::string> displayName, std::optional<std::string> displayPrice, std::optional<std::string> currency, std::optional<double> price, IapPlatform platform, std::optional<std::string> typeIOS, std::optional<bool> isFamilyShareableIOS, std::optional<std::string> jsonRepresentationIOS, std::optional<std::string> introductoryPriceIOS, std::optional<double> introductoryPriceAsAmountIOS, std::optional<double> introductoryPriceNumberOfPeriodsIOS, std::optional<std::string> introductoryPricePaymentModeIOS, std::optional<std::string> introductoryPriceSubscriptionPeriodIOS, std::optional<double> subscriptionPeriodNumberIOS, std::optional<std::string> subscriptionPeriodUnitIOS, std::optional<std::string> originalPriceAndroid, std::optional<double> originalPriceAmountMicrosAndroid, std::optional<double> introductoryPriceCyclesAndroid, std::optional<std::string> introductoryPricePeriodAndroid, std::optional<double> introductoryPriceValueAndroid, std::optional<std::string> subscriptionPeriodAndroid, std::optional<std::string> freeTrialPeriodAndroid, std::optional<std::string> subscriptionOfferDetailsAndroid): id(id), title(title), description(description), type(type), displayName(displayName), displayPrice(displayPrice), currency(currency), price(price), platform(platform), typeIOS(typeIOS), isFamilyShareableIOS(isFamilyShareableIOS), jsonRepresentationIOS(jsonRepresentationIOS), introductoryPriceIOS(introductoryPriceIOS), introductoryPriceAsAmountIOS(introductoryPriceAsAmountIOS), introductoryPriceNumberOfPeriodsIOS(introductoryPriceNumberOfPeriodsIOS), introductoryPricePaymentModeIOS(introductoryPricePaymentModeIOS), introductoryPriceSubscriptionPeriodIOS(introductoryPriceSubscriptionPeriodIOS), subscriptionPeriodNumberIOS(subscriptionPeriodNumberIOS), subscriptionPeriodUnitIOS(subscriptionPeriodUnitIOS), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid) {}
64
66
  };
65
67
 
66
68
  } // namespace margelo::nitro::iap
@@ -81,22 +83,22 @@ namespace margelo::nitro {
81
83
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "displayPrice")),
82
84
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "currency")),
83
85
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "price")),
84
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "platform")),
86
+ JSIConverter<margelo::nitro::iap::IapPlatform>::fromJSI(runtime, obj.getProperty(runtime, "platform")),
85
87
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "typeIOS")),
86
88
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isFamilyShareableIOS")),
87
89
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "jsonRepresentationIOS")),
88
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodUnitIOS")),
89
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodNumberIOS")),
90
90
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceIOS")),
91
91
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceAsAmountIOS")),
92
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPricePaymentModeIOS")),
93
92
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceNumberOfPeriodsIOS")),
93
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPricePaymentModeIOS")),
94
94
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceSubscriptionPeriodIOS")),
95
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodNumberIOS")),
96
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodUnitIOS")),
95
97
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "originalPriceAndroid")),
96
98
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "originalPriceAmountMicrosAndroid")),
97
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceValueAndroid")),
98
99
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceCyclesAndroid")),
99
100
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPricePeriodAndroid")),
101
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryPriceValueAndroid")),
100
102
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid")),
101
103
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid")),
102
104
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid"))
@@ -112,22 +114,22 @@ namespace margelo::nitro {
112
114
  obj.setProperty(runtime, "displayPrice", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.displayPrice));
113
115
  obj.setProperty(runtime, "currency", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currency));
114
116
  obj.setProperty(runtime, "price", JSIConverter<std::optional<double>>::toJSI(runtime, arg.price));
115
- obj.setProperty(runtime, "platform", JSIConverter<std::string>::toJSI(runtime, arg.platform));
117
+ obj.setProperty(runtime, "platform", JSIConverter<margelo::nitro::iap::IapPlatform>::toJSI(runtime, arg.platform));
116
118
  obj.setProperty(runtime, "typeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.typeIOS));
117
119
  obj.setProperty(runtime, "isFamilyShareableIOS", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isFamilyShareableIOS));
118
120
  obj.setProperty(runtime, "jsonRepresentationIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.jsonRepresentationIOS));
119
- obj.setProperty(runtime, "subscriptionPeriodUnitIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionPeriodUnitIOS));
120
- obj.setProperty(runtime, "subscriptionPeriodNumberIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.subscriptionPeriodNumberIOS));
121
121
  obj.setProperty(runtime, "introductoryPriceIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPriceIOS));
122
122
  obj.setProperty(runtime, "introductoryPriceAsAmountIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceAsAmountIOS));
123
- obj.setProperty(runtime, "introductoryPricePaymentModeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPricePaymentModeIOS));
124
123
  obj.setProperty(runtime, "introductoryPriceNumberOfPeriodsIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceNumberOfPeriodsIOS));
124
+ obj.setProperty(runtime, "introductoryPricePaymentModeIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPricePaymentModeIOS));
125
125
  obj.setProperty(runtime, "introductoryPriceSubscriptionPeriodIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPriceSubscriptionPeriodIOS));
126
+ obj.setProperty(runtime, "subscriptionPeriodNumberIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.subscriptionPeriodNumberIOS));
127
+ obj.setProperty(runtime, "subscriptionPeriodUnitIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionPeriodUnitIOS));
126
128
  obj.setProperty(runtime, "originalPriceAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.originalPriceAndroid));
127
129
  obj.setProperty(runtime, "originalPriceAmountMicrosAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.originalPriceAmountMicrosAndroid));
128
- obj.setProperty(runtime, "introductoryPriceValueAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceValueAndroid));
129
130
  obj.setProperty(runtime, "introductoryPriceCyclesAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceCyclesAndroid));
130
131
  obj.setProperty(runtime, "introductoryPricePeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.introductoryPricePeriodAndroid));
132
+ obj.setProperty(runtime, "introductoryPriceValueAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.introductoryPriceValueAndroid));
131
133
  obj.setProperty(runtime, "subscriptionPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionPeriodAndroid));
132
134
  obj.setProperty(runtime, "freeTrialPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.freeTrialPeriodAndroid));
133
135
  obj.setProperty(runtime, "subscriptionOfferDetailsAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionOfferDetailsAndroid));
@@ -146,22 +148,22 @@ namespace margelo::nitro {
146
148
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "displayPrice"))) return false;
147
149
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "currency"))) return false;
148
150
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "price"))) return false;
149
- if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
151
+ if (!JSIConverter<margelo::nitro::iap::IapPlatform>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
150
152
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "typeIOS"))) return false;
151
153
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isFamilyShareableIOS"))) return false;
152
154
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "jsonRepresentationIOS"))) return false;
153
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodUnitIOS"))) return false;
154
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodNumberIOS"))) return false;
155
155
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceIOS"))) return false;
156
156
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceAsAmountIOS"))) return false;
157
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPricePaymentModeIOS"))) return false;
158
157
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceNumberOfPeriodsIOS"))) return false;
158
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPricePaymentModeIOS"))) return false;
159
159
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceSubscriptionPeriodIOS"))) return false;
160
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodNumberIOS"))) return false;
161
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodUnitIOS"))) return false;
160
162
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "originalPriceAndroid"))) return false;
161
163
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "originalPriceAmountMicrosAndroid"))) return false;
162
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceValueAndroid"))) return false;
163
164
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceCyclesAndroid"))) return false;
164
165
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPricePeriodAndroid"))) return false;
166
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "introductoryPriceValueAndroid"))) return false;
165
167
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid"))) return false;
166
168
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid"))) return false;
167
169
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid"))) return false;