react-native-iap 14.4.15 → 14.4.17

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 (48) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +55 -0
  2. package/ios/HybridRnIap.swift +17 -0
  3. package/ios/RnIapHelper.swift +45 -0
  4. package/lib/module/index.js +123 -33
  5. package/lib/module/index.js.map +1 -1
  6. package/lib/module/types.js +5 -0
  7. package/lib/module/types.js.map +1 -1
  8. package/lib/typescript/src/index.d.ts +9 -6
  9. package/lib/typescript/src/index.d.ts.map +1 -1
  10. package/lib/typescript/src/specs/RnIap.nitro.d.ts +41 -1
  11. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  12. package/lib/typescript/src/types.d.ts +47 -0
  13. package/lib/typescript/src/types.d.ts.map +1 -1
  14. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +45 -0
  15. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -0
  16. package/nitrogen/generated/android/c++/JNitroActiveSubscription.hpp +108 -0
  17. package/nitrogen/generated/android/c++/JNitroRenewalInfoIOS.hpp +90 -0
  18. package/nitrogen/generated/android/c++/JPurchase.hpp +2 -0
  19. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +6 -0
  20. package/nitrogen/generated/android/c++/JRenewalInfoIOS.hpp +94 -0
  21. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +2 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +4 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroActiveSubscription.kt +68 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRenewalInfoIOS.kt +56 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RenewalInfoIOS.kt +59 -0
  27. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +8 -0
  28. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +93 -0
  29. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +9 -0
  30. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +17 -0
  31. package/nitrogen/generated/ios/swift/Func_void_std__vector_NitroActiveSubscription_.swift +47 -0
  32. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -0
  33. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +32 -0
  34. package/nitrogen/generated/ios/swift/NitroActiveSubscription.swift +340 -0
  35. package/nitrogen/generated/ios/swift/NitroRenewalInfoIOS.swift +296 -0
  36. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
  37. package/nitrogen/generated/ios/swift/RenewalInfoIOS.swift +314 -0
  38. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +1 -0
  39. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +4 -0
  40. package/nitrogen/generated/shared/c++/NitroActiveSubscription.hpp +122 -0
  41. package/nitrogen/generated/shared/c++/NitroRenewalInfoIOS.hpp +104 -0
  42. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
  43. package/nitrogen/generated/shared/c++/RenewalInfoIOS.hpp +108 -0
  44. package/openiap-versions.json +3 -3
  45. package/package.json +1 -1
  46. package/src/index.ts +87 -4
  47. package/src/specs/RnIap.nitro.ts +48 -0
  48. package/src/types.ts +47 -0
@@ -18,7 +18,7 @@ public extension PurchaseIOS {
18
18
  /**
19
19
  * Create a new instance of `PurchaseIOS`.
20
20
  */
21
- init(appAccountToken: String?, appBundleIdIOS: String?, countryCodeIOS: String?, currencyCodeIOS: String?, currencySymbolIOS: String?, currentPlanId: String?, environmentIOS: String?, expirationDateIOS: Double?, id: String, ids: [String]?, isAutoRenewing: Bool, isUpgradedIOS: Bool?, offerIOS: PurchaseOfferIOS?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, ownershipTypeIOS: String?, platform: IapPlatform, productId: String, purchaseState: PurchaseState, purchaseToken: String?, quantity: Double, quantityIOS: Double?, reasonIOS: String?, reasonStringRepresentationIOS: String?, revocationDateIOS: Double?, revocationReasonIOS: String?, storefrontCountryCodeIOS: String?, subscriptionGroupIdIOS: String?, transactionDate: Double, transactionId: String, transactionReasonIOS: String?, webOrderLineItemIdIOS: String?) {
21
+ init(appAccountToken: String?, appBundleIdIOS: String?, countryCodeIOS: String?, currencyCodeIOS: String?, currencySymbolIOS: String?, currentPlanId: String?, environmentIOS: String?, expirationDateIOS: Double?, id: String, ids: [String]?, isAutoRenewing: Bool, isUpgradedIOS: Bool?, offerIOS: PurchaseOfferIOS?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, ownershipTypeIOS: String?, platform: IapPlatform, productId: String, purchaseState: PurchaseState, purchaseToken: String?, quantity: Double, quantityIOS: Double?, reasonIOS: String?, reasonStringRepresentationIOS: String?, renewalInfoIOS: RenewalInfoIOS?, revocationDateIOS: Double?, revocationReasonIOS: String?, storefrontCountryCodeIOS: String?, subscriptionGroupIdIOS: String?, transactionDate: Double, transactionId: String, transactionReasonIOS: String?, webOrderLineItemIdIOS: String?) {
22
22
  self.init({ () -> bridge.std__optional_std__string_ in
23
23
  if let __unwrappedValue = appAccountToken {
24
24
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -133,6 +133,12 @@ public extension PurchaseIOS {
133
133
  } else {
134
134
  return .init()
135
135
  }
136
+ }(), { () -> bridge.std__optional_RenewalInfoIOS_ in
137
+ if let __unwrappedValue = renewalInfoIOS {
138
+ return bridge.create_std__optional_RenewalInfoIOS_(__unwrappedValue)
139
+ } else {
140
+ return .init()
141
+ }
136
142
  }(), { () -> bridge.std__optional_double_ in
137
143
  if let __unwrappedValue = revocationDateIOS {
138
144
  return bridge.create_std__optional_double_(__unwrappedValue)
@@ -648,6 +654,30 @@ public extension PurchaseIOS {
648
654
  }
649
655
  }
650
656
 
657
+ var renewalInfoIOS: RenewalInfoIOS? {
658
+ @inline(__always)
659
+ get {
660
+ return { () -> RenewalInfoIOS? in
661
+ if bridge.has_value_std__optional_RenewalInfoIOS_(self.__renewalInfoIOS) {
662
+ let __unwrapped = bridge.get_std__optional_RenewalInfoIOS_(self.__renewalInfoIOS)
663
+ return __unwrapped
664
+ } else {
665
+ return nil
666
+ }
667
+ }()
668
+ }
669
+ @inline(__always)
670
+ set {
671
+ self.__renewalInfoIOS = { () -> bridge.std__optional_RenewalInfoIOS_ in
672
+ if let __unwrappedValue = newValue {
673
+ return bridge.create_std__optional_RenewalInfoIOS_(__unwrappedValue)
674
+ } else {
675
+ return .init()
676
+ }
677
+ }()
678
+ }
679
+ }
680
+
651
681
  var revocationDateIOS: Double? {
652
682
  @inline(__always)
653
683
  get {
@@ -0,0 +1,314 @@
1
+ ///
2
+ /// RenewalInfoIOS.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 `RenewalInfoIOS`, backed by a C++ struct.
12
+ */
13
+ public typealias RenewalInfoIOS = margelo.nitro.iap.RenewalInfoIOS
14
+
15
+ public extension RenewalInfoIOS {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `RenewalInfoIOS`.
20
+ */
21
+ init(autoRenewPreference: String?, expirationReason: String?, gracePeriodExpirationDate: Double?, isInBillingRetry: Bool?, jsonRepresentation: String?, pendingUpgradeProductId: String?, priceIncreaseStatus: String?, renewalDate: Double?, renewalOfferId: String?, renewalOfferType: String?, willAutoRenew: Bool) {
22
+ self.init({ () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = autoRenewPreference {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_std__string_ in
29
+ if let __unwrappedValue = expirationReason {
30
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
31
+ } else {
32
+ return .init()
33
+ }
34
+ }(), { () -> bridge.std__optional_double_ in
35
+ if let __unwrappedValue = gracePeriodExpirationDate {
36
+ return bridge.create_std__optional_double_(__unwrappedValue)
37
+ } else {
38
+ return .init()
39
+ }
40
+ }(), { () -> bridge.std__optional_bool_ in
41
+ if let __unwrappedValue = isInBillingRetry {
42
+ return bridge.create_std__optional_bool_(__unwrappedValue)
43
+ } else {
44
+ return .init()
45
+ }
46
+ }(), { () -> bridge.std__optional_std__string_ in
47
+ if let __unwrappedValue = jsonRepresentation {
48
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
49
+ } else {
50
+ return .init()
51
+ }
52
+ }(), { () -> bridge.std__optional_std__string_ in
53
+ if let __unwrappedValue = pendingUpgradeProductId {
54
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
55
+ } else {
56
+ return .init()
57
+ }
58
+ }(), { () -> bridge.std__optional_std__string_ in
59
+ if let __unwrappedValue = priceIncreaseStatus {
60
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
61
+ } else {
62
+ return .init()
63
+ }
64
+ }(), { () -> bridge.std__optional_double_ in
65
+ if let __unwrappedValue = renewalDate {
66
+ return bridge.create_std__optional_double_(__unwrappedValue)
67
+ } else {
68
+ return .init()
69
+ }
70
+ }(), { () -> bridge.std__optional_std__string_ in
71
+ if let __unwrappedValue = renewalOfferId {
72
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
73
+ } else {
74
+ return .init()
75
+ }
76
+ }(), { () -> bridge.std__optional_std__string_ in
77
+ if let __unwrappedValue = renewalOfferType {
78
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
79
+ } else {
80
+ return .init()
81
+ }
82
+ }(), willAutoRenew)
83
+ }
84
+
85
+ var autoRenewPreference: String? {
86
+ @inline(__always)
87
+ get {
88
+ return { () -> String? in
89
+ if bridge.has_value_std__optional_std__string_(self.__autoRenewPreference) {
90
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__autoRenewPreference)
91
+ return String(__unwrapped)
92
+ } else {
93
+ return nil
94
+ }
95
+ }()
96
+ }
97
+ @inline(__always)
98
+ set {
99
+ self.__autoRenewPreference = { () -> bridge.std__optional_std__string_ in
100
+ if let __unwrappedValue = newValue {
101
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
102
+ } else {
103
+ return .init()
104
+ }
105
+ }()
106
+ }
107
+ }
108
+
109
+ var expirationReason: String? {
110
+ @inline(__always)
111
+ get {
112
+ return { () -> String? in
113
+ if bridge.has_value_std__optional_std__string_(self.__expirationReason) {
114
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__expirationReason)
115
+ return String(__unwrapped)
116
+ } else {
117
+ return nil
118
+ }
119
+ }()
120
+ }
121
+ @inline(__always)
122
+ set {
123
+ self.__expirationReason = { () -> bridge.std__optional_std__string_ in
124
+ if let __unwrappedValue = newValue {
125
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
126
+ } else {
127
+ return .init()
128
+ }
129
+ }()
130
+ }
131
+ }
132
+
133
+ var gracePeriodExpirationDate: Double? {
134
+ @inline(__always)
135
+ get {
136
+ return self.__gracePeriodExpirationDate.value
137
+ }
138
+ @inline(__always)
139
+ set {
140
+ self.__gracePeriodExpirationDate = { () -> bridge.std__optional_double_ in
141
+ if let __unwrappedValue = newValue {
142
+ return bridge.create_std__optional_double_(__unwrappedValue)
143
+ } else {
144
+ return .init()
145
+ }
146
+ }()
147
+ }
148
+ }
149
+
150
+ var isInBillingRetry: Bool? {
151
+ @inline(__always)
152
+ get {
153
+ return self.__isInBillingRetry.value
154
+ }
155
+ @inline(__always)
156
+ set {
157
+ self.__isInBillingRetry = { () -> bridge.std__optional_bool_ in
158
+ if let __unwrappedValue = newValue {
159
+ return bridge.create_std__optional_bool_(__unwrappedValue)
160
+ } else {
161
+ return .init()
162
+ }
163
+ }()
164
+ }
165
+ }
166
+
167
+ var jsonRepresentation: String? {
168
+ @inline(__always)
169
+ get {
170
+ return { () -> String? in
171
+ if bridge.has_value_std__optional_std__string_(self.__jsonRepresentation) {
172
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__jsonRepresentation)
173
+ return String(__unwrapped)
174
+ } else {
175
+ return nil
176
+ }
177
+ }()
178
+ }
179
+ @inline(__always)
180
+ set {
181
+ self.__jsonRepresentation = { () -> bridge.std__optional_std__string_ in
182
+ if let __unwrappedValue = newValue {
183
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
184
+ } else {
185
+ return .init()
186
+ }
187
+ }()
188
+ }
189
+ }
190
+
191
+ var pendingUpgradeProductId: String? {
192
+ @inline(__always)
193
+ get {
194
+ return { () -> String? in
195
+ if bridge.has_value_std__optional_std__string_(self.__pendingUpgradeProductId) {
196
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__pendingUpgradeProductId)
197
+ return String(__unwrapped)
198
+ } else {
199
+ return nil
200
+ }
201
+ }()
202
+ }
203
+ @inline(__always)
204
+ set {
205
+ self.__pendingUpgradeProductId = { () -> bridge.std__optional_std__string_ in
206
+ if let __unwrappedValue = newValue {
207
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
208
+ } else {
209
+ return .init()
210
+ }
211
+ }()
212
+ }
213
+ }
214
+
215
+ var priceIncreaseStatus: String? {
216
+ @inline(__always)
217
+ get {
218
+ return { () -> String? in
219
+ if bridge.has_value_std__optional_std__string_(self.__priceIncreaseStatus) {
220
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__priceIncreaseStatus)
221
+ return String(__unwrapped)
222
+ } else {
223
+ return nil
224
+ }
225
+ }()
226
+ }
227
+ @inline(__always)
228
+ set {
229
+ self.__priceIncreaseStatus = { () -> bridge.std__optional_std__string_ in
230
+ if let __unwrappedValue = newValue {
231
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
232
+ } else {
233
+ return .init()
234
+ }
235
+ }()
236
+ }
237
+ }
238
+
239
+ var renewalDate: Double? {
240
+ @inline(__always)
241
+ get {
242
+ return self.__renewalDate.value
243
+ }
244
+ @inline(__always)
245
+ set {
246
+ self.__renewalDate = { () -> bridge.std__optional_double_ in
247
+ if let __unwrappedValue = newValue {
248
+ return bridge.create_std__optional_double_(__unwrappedValue)
249
+ } else {
250
+ return .init()
251
+ }
252
+ }()
253
+ }
254
+ }
255
+
256
+ var renewalOfferId: String? {
257
+ @inline(__always)
258
+ get {
259
+ return { () -> String? in
260
+ if bridge.has_value_std__optional_std__string_(self.__renewalOfferId) {
261
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__renewalOfferId)
262
+ return String(__unwrapped)
263
+ } else {
264
+ return nil
265
+ }
266
+ }()
267
+ }
268
+ @inline(__always)
269
+ set {
270
+ self.__renewalOfferId = { () -> bridge.std__optional_std__string_ in
271
+ if let __unwrappedValue = newValue {
272
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
273
+ } else {
274
+ return .init()
275
+ }
276
+ }()
277
+ }
278
+ }
279
+
280
+ var renewalOfferType: String? {
281
+ @inline(__always)
282
+ get {
283
+ return { () -> String? in
284
+ if bridge.has_value_std__optional_std__string_(self.__renewalOfferType) {
285
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__renewalOfferType)
286
+ return String(__unwrapped)
287
+ } else {
288
+ return nil
289
+ }
290
+ }()
291
+ }
292
+ @inline(__always)
293
+ set {
294
+ self.__renewalOfferType = { () -> bridge.std__optional_std__string_ in
295
+ if let __unwrappedValue = newValue {
296
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
297
+ } else {
298
+ return .init()
299
+ }
300
+ }()
301
+ }
302
+ }
303
+
304
+ var willAutoRenew: Bool {
305
+ @inline(__always)
306
+ get {
307
+ return self.__willAutoRenew
308
+ }
309
+ @inline(__always)
310
+ set {
311
+ self.__willAutoRenew = newValue
312
+ }
313
+ }
314
+ }
@@ -19,6 +19,7 @@ namespace margelo::nitro::iap {
19
19
  prototype.registerHybridMethod("fetchProducts", &HybridRnIapSpec::fetchProducts);
20
20
  prototype.registerHybridMethod("requestPurchase", &HybridRnIapSpec::requestPurchase);
21
21
  prototype.registerHybridMethod("getAvailablePurchases", &HybridRnIapSpec::getAvailablePurchases);
22
+ prototype.registerHybridMethod("getActiveSubscriptions", &HybridRnIapSpec::getActiveSubscriptions);
22
23
  prototype.registerHybridMethod("finishTransaction", &HybridRnIapSpec::finishTransaction);
23
24
  prototype.registerHybridMethod("addPurchaseUpdatedListener", &HybridRnIapSpec::addPurchaseUpdatedListener);
24
25
  prototype.registerHybridMethod("addPurchaseErrorListener", &HybridRnIapSpec::addPurchaseErrorListener);
@@ -27,6 +27,8 @@ namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
27
27
  namespace margelo::nitro::iap { struct NitroPurchase; }
28
28
  // Forward declaration of `NitroAvailablePurchasesOptions` to properly resolve imports.
29
29
  namespace margelo::nitro::iap { struct NitroAvailablePurchasesOptions; }
30
+ // Forward declaration of `NitroActiveSubscription` to properly resolve imports.
31
+ namespace margelo::nitro::iap { struct NitroActiveSubscription; }
30
32
  // Forward declaration of `NitroPurchaseResult` to properly resolve imports.
31
33
  namespace margelo::nitro::iap { struct NitroPurchaseResult; }
32
34
  // Forward declaration of `NitroFinishTransactionParams` to properly resolve imports.
@@ -60,6 +62,7 @@ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
60
62
  #include "NitroPurchaseRequest.hpp"
61
63
  #include "NitroPurchase.hpp"
62
64
  #include "NitroAvailablePurchasesOptions.hpp"
65
+ #include "NitroActiveSubscription.hpp"
63
66
  #include "NitroPurchaseResult.hpp"
64
67
  #include "NitroFinishTransactionParams.hpp"
65
68
  #include <functional>
@@ -108,6 +111,7 @@ namespace margelo::nitro::iap {
108
111
  virtual std::shared_ptr<Promise<std::vector<NitroProduct>>> fetchProducts(const std::vector<std::string>& skus, const std::string& type) = 0;
109
112
  virtual std::shared_ptr<Promise<std::optional<std::variant<PurchaseAndroid, PurchaseIOS, std::vector<std::variant<PurchaseAndroid, PurchaseIOS>>>>>> requestPurchase(const NitroPurchaseRequest& request) = 0;
110
113
  virtual std::shared_ptr<Promise<std::vector<NitroPurchase>>> getAvailablePurchases(const std::optional<NitroAvailablePurchasesOptions>& options) = 0;
114
+ virtual std::shared_ptr<Promise<std::vector<NitroActiveSubscription>>> getActiveSubscriptions(const std::optional<std::vector<std::string>>& subscriptionIds) = 0;
111
115
  virtual std::shared_ptr<Promise<std::variant<bool, NitroPurchaseResult>>> finishTransaction(const NitroFinishTransactionParams& params) = 0;
112
116
  virtual void addPurchaseUpdatedListener(const std::function<void(const NitroPurchase& /* purchase */)>& listener) = 0;
113
117
  virtual void addPurchaseErrorListener(const std::function<void(const NitroPurchaseResult& /* error */)>& listener) = 0;
@@ -0,0 +1,122 @@
1
+ ///
2
+ /// NitroActiveSubscription.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/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+
21
+ // Forward declaration of `NitroRenewalInfoIOS` to properly resolve imports.
22
+ namespace margelo::nitro::iap { struct NitroRenewalInfoIOS; }
23
+
24
+ #include <string>
25
+ #include <optional>
26
+ #include "NitroRenewalInfoIOS.hpp"
27
+
28
+ namespace margelo::nitro::iap {
29
+
30
+ /**
31
+ * A struct which can be represented as a JavaScript object (NitroActiveSubscription).
32
+ */
33
+ struct NitroActiveSubscription {
34
+ public:
35
+ std::string productId SWIFT_PRIVATE;
36
+ bool isActive SWIFT_PRIVATE;
37
+ std::string transactionId SWIFT_PRIVATE;
38
+ std::optional<std::string> purchaseToken SWIFT_PRIVATE;
39
+ double transactionDate SWIFT_PRIVATE;
40
+ std::optional<double> expirationDateIOS SWIFT_PRIVATE;
41
+ std::optional<std::string> environmentIOS SWIFT_PRIVATE;
42
+ std::optional<bool> willExpireSoon SWIFT_PRIVATE;
43
+ std::optional<double> daysUntilExpirationIOS SWIFT_PRIVATE;
44
+ std::optional<NitroRenewalInfoIOS> renewalInfoIOS SWIFT_PRIVATE;
45
+ std::optional<bool> autoRenewingAndroid SWIFT_PRIVATE;
46
+ std::optional<std::string> basePlanIdAndroid SWIFT_PRIVATE;
47
+ std::optional<std::string> currentPlanId SWIFT_PRIVATE;
48
+ std::optional<std::string> purchaseTokenAndroid SWIFT_PRIVATE;
49
+
50
+ public:
51
+ NitroActiveSubscription() = default;
52
+ explicit NitroActiveSubscription(std::string productId, bool isActive, std::string transactionId, std::optional<std::string> purchaseToken, double transactionDate, std::optional<double> expirationDateIOS, std::optional<std::string> environmentIOS, std::optional<bool> willExpireSoon, std::optional<double> daysUntilExpirationIOS, std::optional<NitroRenewalInfoIOS> renewalInfoIOS, std::optional<bool> autoRenewingAndroid, std::optional<std::string> basePlanIdAndroid, std::optional<std::string> currentPlanId, std::optional<std::string> purchaseTokenAndroid): productId(productId), isActive(isActive), transactionId(transactionId), purchaseToken(purchaseToken), transactionDate(transactionDate), expirationDateIOS(expirationDateIOS), environmentIOS(environmentIOS), willExpireSoon(willExpireSoon), daysUntilExpirationIOS(daysUntilExpirationIOS), renewalInfoIOS(renewalInfoIOS), autoRenewingAndroid(autoRenewingAndroid), basePlanIdAndroid(basePlanIdAndroid), currentPlanId(currentPlanId), purchaseTokenAndroid(purchaseTokenAndroid) {}
53
+ };
54
+
55
+ } // namespace margelo::nitro::iap
56
+
57
+ namespace margelo::nitro {
58
+
59
+ // C++ NitroActiveSubscription <> JS NitroActiveSubscription (object)
60
+ template <>
61
+ struct JSIConverter<margelo::nitro::iap::NitroActiveSubscription> final {
62
+ static inline margelo::nitro::iap::NitroActiveSubscription fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ jsi::Object obj = arg.asObject(runtime);
64
+ return margelo::nitro::iap::NitroActiveSubscription(
65
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "productId")),
66
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isActive")),
67
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "transactionId")),
68
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseToken")),
69
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "transactionDate")),
70
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "expirationDateIOS")),
71
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "environmentIOS")),
72
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "willExpireSoon")),
73
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "daysUntilExpirationIOS")),
74
+ JSIConverter<std::optional<margelo::nitro::iap::NitroRenewalInfoIOS>>::fromJSI(runtime, obj.getProperty(runtime, "renewalInfoIOS")),
75
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "autoRenewingAndroid")),
76
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "basePlanIdAndroid")),
77
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "currentPlanId")),
78
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseTokenAndroid"))
79
+ );
80
+ }
81
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroActiveSubscription& arg) {
82
+ jsi::Object obj(runtime);
83
+ obj.setProperty(runtime, "productId", JSIConverter<std::string>::toJSI(runtime, arg.productId));
84
+ obj.setProperty(runtime, "isActive", JSIConverter<bool>::toJSI(runtime, arg.isActive));
85
+ obj.setProperty(runtime, "transactionId", JSIConverter<std::string>::toJSI(runtime, arg.transactionId));
86
+ obj.setProperty(runtime, "purchaseToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseToken));
87
+ obj.setProperty(runtime, "transactionDate", JSIConverter<double>::toJSI(runtime, arg.transactionDate));
88
+ obj.setProperty(runtime, "expirationDateIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.expirationDateIOS));
89
+ obj.setProperty(runtime, "environmentIOS", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.environmentIOS));
90
+ obj.setProperty(runtime, "willExpireSoon", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.willExpireSoon));
91
+ obj.setProperty(runtime, "daysUntilExpirationIOS", JSIConverter<std::optional<double>>::toJSI(runtime, arg.daysUntilExpirationIOS));
92
+ obj.setProperty(runtime, "renewalInfoIOS", JSIConverter<std::optional<margelo::nitro::iap::NitroRenewalInfoIOS>>::toJSI(runtime, arg.renewalInfoIOS));
93
+ obj.setProperty(runtime, "autoRenewingAndroid", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.autoRenewingAndroid));
94
+ obj.setProperty(runtime, "basePlanIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.basePlanIdAndroid));
95
+ obj.setProperty(runtime, "currentPlanId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currentPlanId));
96
+ obj.setProperty(runtime, "purchaseTokenAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseTokenAndroid));
97
+ return obj;
98
+ }
99
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
100
+ if (!value.isObject()) {
101
+ return false;
102
+ }
103
+ jsi::Object obj = value.getObject(runtime);
104
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "productId"))) return false;
105
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isActive"))) return false;
106
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "transactionId"))) return false;
107
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseToken"))) return false;
108
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "transactionDate"))) return false;
109
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "expirationDateIOS"))) return false;
110
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "environmentIOS"))) return false;
111
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "willExpireSoon"))) return false;
112
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "daysUntilExpirationIOS"))) return false;
113
+ if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRenewalInfoIOS>>::canConvert(runtime, obj.getProperty(runtime, "renewalInfoIOS"))) return false;
114
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "autoRenewingAndroid"))) return false;
115
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "basePlanIdAndroid"))) return false;
116
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "currentPlanId"))) return false;
117
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseTokenAndroid"))) return false;
118
+ return true;
119
+ }
120
+ };
121
+
122
+ } // namespace margelo::nitro
@@ -0,0 +1,104 @@
1
+ ///
2
+ /// NitroRenewalInfoIOS.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/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+
21
+
22
+
23
+ #include <optional>
24
+ #include <string>
25
+
26
+ namespace margelo::nitro::iap {
27
+
28
+ /**
29
+ * A struct which can be represented as a JavaScript object (NitroRenewalInfoIOS).
30
+ */
31
+ struct NitroRenewalInfoIOS {
32
+ public:
33
+ std::optional<bool> willAutoRenew SWIFT_PRIVATE;
34
+ std::optional<std::string> autoRenewPreference SWIFT_PRIVATE;
35
+ std::optional<std::string> pendingUpgradeProductId SWIFT_PRIVATE;
36
+ std::optional<double> renewalDate SWIFT_PRIVATE;
37
+ std::optional<std::string> expirationReason SWIFT_PRIVATE;
38
+ std::optional<bool> isInBillingRetry SWIFT_PRIVATE;
39
+ std::optional<double> gracePeriodExpirationDate SWIFT_PRIVATE;
40
+ std::optional<std::string> priceIncreaseStatus SWIFT_PRIVATE;
41
+ std::optional<std::string> offerType SWIFT_PRIVATE;
42
+ std::optional<std::string> offerIdentifier SWIFT_PRIVATE;
43
+
44
+ public:
45
+ NitroRenewalInfoIOS() = default;
46
+ explicit NitroRenewalInfoIOS(std::optional<bool> willAutoRenew, std::optional<std::string> autoRenewPreference, std::optional<std::string> pendingUpgradeProductId, std::optional<double> renewalDate, std::optional<std::string> expirationReason, std::optional<bool> isInBillingRetry, std::optional<double> gracePeriodExpirationDate, std::optional<std::string> priceIncreaseStatus, std::optional<std::string> offerType, std::optional<std::string> offerIdentifier): willAutoRenew(willAutoRenew), autoRenewPreference(autoRenewPreference), pendingUpgradeProductId(pendingUpgradeProductId), renewalDate(renewalDate), expirationReason(expirationReason), isInBillingRetry(isInBillingRetry), gracePeriodExpirationDate(gracePeriodExpirationDate), priceIncreaseStatus(priceIncreaseStatus), offerType(offerType), offerIdentifier(offerIdentifier) {}
47
+ };
48
+
49
+ } // namespace margelo::nitro::iap
50
+
51
+ namespace margelo::nitro {
52
+
53
+ // C++ NitroRenewalInfoIOS <> JS NitroRenewalInfoIOS (object)
54
+ template <>
55
+ struct JSIConverter<margelo::nitro::iap::NitroRenewalInfoIOS> final {
56
+ static inline margelo::nitro::iap::NitroRenewalInfoIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
57
+ jsi::Object obj = arg.asObject(runtime);
58
+ return margelo::nitro::iap::NitroRenewalInfoIOS(
59
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "willAutoRenew")),
60
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "autoRenewPreference")),
61
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "pendingUpgradeProductId")),
62
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "renewalDate")),
63
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "expirationReason")),
64
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isInBillingRetry")),
65
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "gracePeriodExpirationDate")),
66
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "priceIncreaseStatus")),
67
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "offerType")),
68
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "offerIdentifier"))
69
+ );
70
+ }
71
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroRenewalInfoIOS& arg) {
72
+ jsi::Object obj(runtime);
73
+ obj.setProperty(runtime, "willAutoRenew", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.willAutoRenew));
74
+ obj.setProperty(runtime, "autoRenewPreference", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.autoRenewPreference));
75
+ obj.setProperty(runtime, "pendingUpgradeProductId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.pendingUpgradeProductId));
76
+ obj.setProperty(runtime, "renewalDate", JSIConverter<std::optional<double>>::toJSI(runtime, arg.renewalDate));
77
+ obj.setProperty(runtime, "expirationReason", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.expirationReason));
78
+ obj.setProperty(runtime, "isInBillingRetry", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isInBillingRetry));
79
+ obj.setProperty(runtime, "gracePeriodExpirationDate", JSIConverter<std::optional<double>>::toJSI(runtime, arg.gracePeriodExpirationDate));
80
+ obj.setProperty(runtime, "priceIncreaseStatus", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.priceIncreaseStatus));
81
+ obj.setProperty(runtime, "offerType", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.offerType));
82
+ obj.setProperty(runtime, "offerIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.offerIdentifier));
83
+ return obj;
84
+ }
85
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
86
+ if (!value.isObject()) {
87
+ return false;
88
+ }
89
+ jsi::Object obj = value.getObject(runtime);
90
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "willAutoRenew"))) return false;
91
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "autoRenewPreference"))) return false;
92
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "pendingUpgradeProductId"))) return false;
93
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "renewalDate"))) return false;
94
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "expirationReason"))) return false;
95
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isInBillingRetry"))) return false;
96
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "gracePeriodExpirationDate"))) return false;
97
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "priceIncreaseStatus"))) return false;
98
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "offerType"))) return false;
99
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "offerIdentifier"))) return false;
100
+ return true;
101
+ }
102
+ };
103
+
104
+ } // namespace margelo::nitro