react-native-iap 14.4.11 → 14.4.13

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 (76) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +159 -10
  2. package/ios/HybridRnIap.swift +115 -2
  3. package/lib/module/hooks/useIAP.js +24 -3
  4. package/lib/module/hooks/useIAP.js.map +1 -1
  5. package/lib/module/index.js +275 -2
  6. package/lib/module/index.js.map +1 -1
  7. package/lib/module/types.js +18 -0
  8. package/lib/module/types.js.map +1 -1
  9. package/lib/typescript/plugin/src/withIAP.d.ts +27 -0
  10. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  11. package/lib/typescript/src/hooks/useIAP.d.ts +6 -1
  12. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  13. package/lib/typescript/src/index.d.ts +133 -0
  14. package/lib/typescript/src/index.d.ts.map +1 -1
  15. package/lib/typescript/src/specs/RnIap.nitro.d.ts +72 -2
  16. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  17. package/lib/typescript/src/types.d.ts +116 -13
  18. package/lib/typescript/src/types.d.ts.map +1 -1
  19. package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
  20. package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +62 -0
  21. package/nitrogen/generated/android/c++/JExternalPurchaseLinkResultIOS.hpp +58 -0
  22. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeAction.hpp +59 -0
  23. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +60 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_UserChoiceBillingDetails.hpp +78 -0
  25. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +132 -3
  26. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +9 -1
  27. package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +55 -0
  28. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +4 -0
  29. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +4 -0
  30. package/nitrogen/generated/android/c++/JUserChoiceBillingDetails.hpp +75 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +22 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt +32 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeAction.kt +21 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +32 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +81 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +43 -1
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +29 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +3 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/UserChoiceBillingDetails.kt +32 -0
  41. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
  42. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +156 -0
  43. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
  44. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +81 -3
  45. package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +44 -0
  46. package/nitrogen/generated/ios/swift/ExternalPurchaseLinkResultIOS.swift +65 -0
  47. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeAction.swift +40 -0
  48. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +65 -0
  49. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseLinkResultIOS.swift +47 -0
  50. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseNoticeResultIOS.swift +47 -0
  51. package/nitrogen/generated/ios/swift/Func_void_UserChoiceBillingDetails.swift +47 -0
  52. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +9 -1
  53. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +168 -2
  54. package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +47 -0
  55. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +31 -1
  56. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
  57. package/nitrogen/generated/ios/swift/UserChoiceBillingDetails.swift +58 -0
  58. package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +80 -0
  59. package/nitrogen/generated/shared/c++/ExternalPurchaseLinkResultIOS.hpp +72 -0
  60. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeAction.hpp +76 -0
  61. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +74 -0
  62. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +8 -0
  63. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +22 -2
  64. package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +69 -0
  65. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +5 -1
  66. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +5 -1
  67. package/nitrogen/generated/shared/c++/UserChoiceBillingDetails.hpp +72 -0
  68. package/openiap-versions.json +3 -3
  69. package/package.json +1 -1
  70. package/plugin/build/withIAP.d.ts +27 -0
  71. package/plugin/build/withIAP.js +91 -1
  72. package/plugin/src/withIAP.ts +162 -0
  73. package/src/hooks/useIAP.ts +47 -1
  74. package/src/index.ts +313 -2
  75. package/src/specs/RnIap.nitro.ts +99 -1
  76. package/src/types.ts +124 -13
@@ -8,12 +8,22 @@
8
8
  #pragma once
9
9
 
10
10
  // Forward declarations of C++ defined types
11
+ // Forward declaration of `AlternativeBillingModeAndroid` to properly resolve imports.
12
+ namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
11
13
  // Forward declaration of `AndroidSubscriptionOfferInput` to properly resolve imports.
12
14
  namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
15
+ // Forward declaration of `ExternalPurchaseLinkResultIOS` to properly resolve imports.
16
+ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
17
+ // Forward declaration of `ExternalPurchaseNoticeAction` to properly resolve imports.
18
+ namespace margelo::nitro::iap { enum class ExternalPurchaseNoticeAction; }
19
+ // Forward declaration of `ExternalPurchaseNoticeResultIOS` to properly resolve imports.
20
+ namespace margelo::nitro::iap { struct ExternalPurchaseNoticeResultIOS; }
13
21
  // Forward declaration of `HybridRnIapSpec` to properly resolve imports.
14
22
  namespace margelo::nitro::iap { class HybridRnIapSpec; }
15
23
  // Forward declaration of `IapPlatform` to properly resolve imports.
16
24
  namespace margelo::nitro::iap { enum class IapPlatform; }
25
+ // Forward declaration of `InitConnectionConfig` to properly resolve imports.
26
+ namespace margelo::nitro::iap { struct InitConnectionConfig; }
17
27
  // Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
18
28
  namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
19
29
  // Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
@@ -56,15 +66,22 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
56
66
  namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
57
67
  // Forward declaration of `PurchaseState` to properly resolve imports.
58
68
  namespace margelo::nitro::iap { enum class PurchaseState; }
69
+ // Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
70
+ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
59
71
 
60
72
  // Forward declarations of Swift defined types
61
73
  // Forward declaration of `HybridRnIapSpec_cxx` to properly resolve imports.
62
74
  namespace NitroIap { class HybridRnIapSpec_cxx; }
63
75
 
64
76
  // Include C++ defined types
77
+ #include "AlternativeBillingModeAndroid.hpp"
65
78
  #include "AndroidSubscriptionOfferInput.hpp"
79
+ #include "ExternalPurchaseLinkResultIOS.hpp"
80
+ #include "ExternalPurchaseNoticeAction.hpp"
81
+ #include "ExternalPurchaseNoticeResultIOS.hpp"
66
82
  #include "HybridRnIapSpec.hpp"
67
83
  #include "IapPlatform.hpp"
84
+ #include "InitConnectionConfig.hpp"
68
85
  #include "NitroAvailablePurchasesAndroidOptions.hpp"
69
86
  #include "NitroAvailablePurchasesAndroidType.hpp"
70
87
  #include "NitroAvailablePurchasesIosOptions.hpp"
@@ -86,6 +103,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
86
103
  #include "PurchaseIOS.hpp"
87
104
  #include "PurchaseOfferIOS.hpp"
88
105
  #include "PurchaseState.hpp"
106
+ #include "UserChoiceBillingDetails.hpp"
89
107
  #include <NitroModules/Promise.hpp>
90
108
  #include <NitroModules/PromiseHolder.hpp>
91
109
  #include <NitroModules/Result.hpp>
@@ -160,6 +178,36 @@ namespace margelo::nitro::iap::bridge::swift {
160
178
  return Func_void_std__exception_ptr_Wrapper(std::move(value));
161
179
  }
162
180
 
181
+ // pragma MARK: std::optional<AlternativeBillingModeAndroid>
182
+ /**
183
+ * Specialized version of `std::optional<AlternativeBillingModeAndroid>`.
184
+ */
185
+ using std__optional_AlternativeBillingModeAndroid_ = std::optional<AlternativeBillingModeAndroid>;
186
+ inline std::optional<AlternativeBillingModeAndroid> create_std__optional_AlternativeBillingModeAndroid_(const AlternativeBillingModeAndroid& value) noexcept {
187
+ return std::optional<AlternativeBillingModeAndroid>(value);
188
+ }
189
+ inline bool has_value_std__optional_AlternativeBillingModeAndroid_(const std::optional<AlternativeBillingModeAndroid>& optional) noexcept {
190
+ return optional.has_value();
191
+ }
192
+ inline AlternativeBillingModeAndroid get_std__optional_AlternativeBillingModeAndroid_(const std::optional<AlternativeBillingModeAndroid>& optional) noexcept {
193
+ return *optional;
194
+ }
195
+
196
+ // pragma MARK: std::optional<InitConnectionConfig>
197
+ /**
198
+ * Specialized version of `std::optional<InitConnectionConfig>`.
199
+ */
200
+ using std__optional_InitConnectionConfig_ = std::optional<InitConnectionConfig>;
201
+ inline std::optional<InitConnectionConfig> create_std__optional_InitConnectionConfig_(const InitConnectionConfig& value) noexcept {
202
+ return std::optional<InitConnectionConfig>(value);
203
+ }
204
+ inline bool has_value_std__optional_InitConnectionConfig_(const std::optional<InitConnectionConfig>& optional) noexcept {
205
+ return optional.has_value();
206
+ }
207
+ inline InitConnectionConfig get_std__optional_InitConnectionConfig_(const std::optional<InitConnectionConfig>& optional) noexcept {
208
+ return *optional;
209
+ }
210
+
163
211
  // pragma MARK: std::optional<std::string>
164
212
  /**
165
213
  * Specialized version of `std::optional<std::string>`.
@@ -1143,6 +1191,96 @@ namespace margelo::nitro::iap::bridge::swift {
1143
1191
  return *optional;
1144
1192
  }
1145
1193
 
1194
+ // pragma MARK: std::function<void(const UserChoiceBillingDetails& /* details */)>
1195
+ /**
1196
+ * Specialized version of `std::function<void(const UserChoiceBillingDetails&)>`.
1197
+ */
1198
+ using Func_void_UserChoiceBillingDetails = std::function<void(const UserChoiceBillingDetails& /* details */)>;
1199
+ /**
1200
+ * Wrapper class for a `std::function<void(const UserChoiceBillingDetails& / * details * /)>`, this can be used from Swift.
1201
+ */
1202
+ class Func_void_UserChoiceBillingDetails_Wrapper final {
1203
+ public:
1204
+ explicit Func_void_UserChoiceBillingDetails_Wrapper(std::function<void(const UserChoiceBillingDetails& /* details */)>&& func): _function(std::make_unique<std::function<void(const UserChoiceBillingDetails& /* details */)>>(std::move(func))) {}
1205
+ inline void call(UserChoiceBillingDetails details) const noexcept {
1206
+ _function->operator()(details);
1207
+ }
1208
+ private:
1209
+ std::unique_ptr<std::function<void(const UserChoiceBillingDetails& /* details */)>> _function;
1210
+ } SWIFT_NONCOPYABLE;
1211
+ Func_void_UserChoiceBillingDetails create_Func_void_UserChoiceBillingDetails(void* _Nonnull swiftClosureWrapper) noexcept;
1212
+ inline Func_void_UserChoiceBillingDetails_Wrapper wrap_Func_void_UserChoiceBillingDetails(Func_void_UserChoiceBillingDetails value) noexcept {
1213
+ return Func_void_UserChoiceBillingDetails_Wrapper(std::move(value));
1214
+ }
1215
+
1216
+ // pragma MARK: std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>
1217
+ /**
1218
+ * Specialized version of `std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>`.
1219
+ */
1220
+ using std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__ = std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>;
1221
+ inline std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>> create_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__() noexcept {
1222
+ return Promise<ExternalPurchaseNoticeResultIOS>::create();
1223
+ }
1224
+ inline PromiseHolder<ExternalPurchaseNoticeResultIOS> wrap_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS__(std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>> promise) noexcept {
1225
+ return PromiseHolder<ExternalPurchaseNoticeResultIOS>(std::move(promise));
1226
+ }
1227
+
1228
+ // pragma MARK: std::function<void(const ExternalPurchaseNoticeResultIOS& /* result */)>
1229
+ /**
1230
+ * Specialized version of `std::function<void(const ExternalPurchaseNoticeResultIOS&)>`.
1231
+ */
1232
+ using Func_void_ExternalPurchaseNoticeResultIOS = std::function<void(const ExternalPurchaseNoticeResultIOS& /* result */)>;
1233
+ /**
1234
+ * Wrapper class for a `std::function<void(const ExternalPurchaseNoticeResultIOS& / * result * /)>`, this can be used from Swift.
1235
+ */
1236
+ class Func_void_ExternalPurchaseNoticeResultIOS_Wrapper final {
1237
+ public:
1238
+ explicit Func_void_ExternalPurchaseNoticeResultIOS_Wrapper(std::function<void(const ExternalPurchaseNoticeResultIOS& /* result */)>&& func): _function(std::make_unique<std::function<void(const ExternalPurchaseNoticeResultIOS& /* result */)>>(std::move(func))) {}
1239
+ inline void call(ExternalPurchaseNoticeResultIOS result) const noexcept {
1240
+ _function->operator()(result);
1241
+ }
1242
+ private:
1243
+ std::unique_ptr<std::function<void(const ExternalPurchaseNoticeResultIOS& /* result */)>> _function;
1244
+ } SWIFT_NONCOPYABLE;
1245
+ Func_void_ExternalPurchaseNoticeResultIOS create_Func_void_ExternalPurchaseNoticeResultIOS(void* _Nonnull swiftClosureWrapper) noexcept;
1246
+ inline Func_void_ExternalPurchaseNoticeResultIOS_Wrapper wrap_Func_void_ExternalPurchaseNoticeResultIOS(Func_void_ExternalPurchaseNoticeResultIOS value) noexcept {
1247
+ return Func_void_ExternalPurchaseNoticeResultIOS_Wrapper(std::move(value));
1248
+ }
1249
+
1250
+ // pragma MARK: std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>
1251
+ /**
1252
+ * Specialized version of `std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>`.
1253
+ */
1254
+ using std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__ = std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>;
1255
+ inline std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>> create_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__() noexcept {
1256
+ return Promise<ExternalPurchaseLinkResultIOS>::create();
1257
+ }
1258
+ inline PromiseHolder<ExternalPurchaseLinkResultIOS> wrap_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS__(std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>> promise) noexcept {
1259
+ return PromiseHolder<ExternalPurchaseLinkResultIOS>(std::move(promise));
1260
+ }
1261
+
1262
+ // pragma MARK: std::function<void(const ExternalPurchaseLinkResultIOS& /* result */)>
1263
+ /**
1264
+ * Specialized version of `std::function<void(const ExternalPurchaseLinkResultIOS&)>`.
1265
+ */
1266
+ using Func_void_ExternalPurchaseLinkResultIOS = std::function<void(const ExternalPurchaseLinkResultIOS& /* result */)>;
1267
+ /**
1268
+ * Wrapper class for a `std::function<void(const ExternalPurchaseLinkResultIOS& / * result * /)>`, this can be used from Swift.
1269
+ */
1270
+ class Func_void_ExternalPurchaseLinkResultIOS_Wrapper final {
1271
+ public:
1272
+ explicit Func_void_ExternalPurchaseLinkResultIOS_Wrapper(std::function<void(const ExternalPurchaseLinkResultIOS& /* result */)>&& func): _function(std::make_unique<std::function<void(const ExternalPurchaseLinkResultIOS& /* result */)>>(std::move(func))) {}
1273
+ inline void call(ExternalPurchaseLinkResultIOS result) const noexcept {
1274
+ _function->operator()(result);
1275
+ }
1276
+ private:
1277
+ std::unique_ptr<std::function<void(const ExternalPurchaseLinkResultIOS& /* result */)>> _function;
1278
+ } SWIFT_NONCOPYABLE;
1279
+ Func_void_ExternalPurchaseLinkResultIOS create_Func_void_ExternalPurchaseLinkResultIOS(void* _Nonnull swiftClosureWrapper) noexcept;
1280
+ inline Func_void_ExternalPurchaseLinkResultIOS_Wrapper wrap_Func_void_ExternalPurchaseLinkResultIOS(Func_void_ExternalPurchaseLinkResultIOS value) noexcept {
1281
+ return Func_void_ExternalPurchaseLinkResultIOS_Wrapper(std::move(value));
1282
+ }
1283
+
1146
1284
  // pragma MARK: std::shared_ptr<HybridRnIapSpec>
1147
1285
  /**
1148
1286
  * Specialized version of `std::shared_ptr<HybridRnIapSpec>`.
@@ -1271,5 +1409,23 @@ namespace margelo::nitro::iap::bridge::swift {
1271
1409
  inline Result_std__shared_ptr_Promise_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid____ create_Result_std__shared_ptr_Promise_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid____(const std::exception_ptr& error) noexcept {
1272
1410
  return Result<std::shared_ptr<Promise<std::variant<NitroReceiptValidationResultIOS, NitroReceiptValidationResultAndroid>>>>::withError(error);
1273
1411
  }
1412
+
1413
+ // pragma MARK: Result<std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>>
1414
+ using Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___ = Result<std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>>;
1415
+ inline Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___ create_Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___(const std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>& value) noexcept {
1416
+ return Result<std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>>::withValue(value);
1417
+ }
1418
+ inline Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___ create_Result_std__shared_ptr_Promise_ExternalPurchaseNoticeResultIOS___(const std::exception_ptr& error) noexcept {
1419
+ return Result<std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>>>::withError(error);
1420
+ }
1421
+
1422
+ // pragma MARK: Result<std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>>
1423
+ using Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___ = Result<std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>>;
1424
+ inline Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___ create_Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___(const std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>& value) noexcept {
1425
+ return Result<std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>>::withValue(value);
1426
+ }
1427
+ inline Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___ create_Result_std__shared_ptr_Promise_ExternalPurchaseLinkResultIOS___(const std::exception_ptr& error) noexcept {
1428
+ return Result<std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>>>::withError(error);
1429
+ }
1274
1430
 
1275
1431
  } // namespace margelo::nitro::iap::bridge::swift
@@ -8,12 +8,22 @@
8
8
  #pragma once
9
9
 
10
10
  // Forward declarations of C++ defined types
11
+ // Forward declaration of `AlternativeBillingModeAndroid` to properly resolve imports.
12
+ namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
11
13
  // Forward declaration of `AndroidSubscriptionOfferInput` to properly resolve imports.
12
14
  namespace margelo::nitro::iap { struct AndroidSubscriptionOfferInput; }
15
+ // Forward declaration of `ExternalPurchaseLinkResultIOS` to properly resolve imports.
16
+ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
17
+ // Forward declaration of `ExternalPurchaseNoticeAction` to properly resolve imports.
18
+ namespace margelo::nitro::iap { enum class ExternalPurchaseNoticeAction; }
19
+ // Forward declaration of `ExternalPurchaseNoticeResultIOS` to properly resolve imports.
20
+ namespace margelo::nitro::iap { struct ExternalPurchaseNoticeResultIOS; }
13
21
  // Forward declaration of `HybridRnIapSpec` to properly resolve imports.
14
22
  namespace margelo::nitro::iap { class HybridRnIapSpec; }
15
23
  // Forward declaration of `IapPlatform` to properly resolve imports.
16
24
  namespace margelo::nitro::iap { enum class IapPlatform; }
25
+ // Forward declaration of `InitConnectionConfig` to properly resolve imports.
26
+ namespace margelo::nitro::iap { struct InitConnectionConfig; }
17
27
  // Forward declaration of `NitroAvailablePurchasesAndroidOptions` to properly resolve imports.
18
28
  namespace margelo::nitro::iap { struct NitroAvailablePurchasesAndroidOptions; }
19
29
  // Forward declaration of `NitroAvailablePurchasesAndroidType` to properly resolve imports.
@@ -64,11 +74,18 @@ namespace margelo::nitro::iap { struct PurchaseIOS; }
64
74
  namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
65
75
  // Forward declaration of `PurchaseState` to properly resolve imports.
66
76
  namespace margelo::nitro::iap { enum class PurchaseState; }
77
+ // Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
78
+ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
67
79
 
68
80
  // Include C++ defined types
81
+ #include "AlternativeBillingModeAndroid.hpp"
69
82
  #include "AndroidSubscriptionOfferInput.hpp"
83
+ #include "ExternalPurchaseLinkResultIOS.hpp"
84
+ #include "ExternalPurchaseNoticeAction.hpp"
85
+ #include "ExternalPurchaseNoticeResultIOS.hpp"
70
86
  #include "HybridRnIapSpec.hpp"
71
87
  #include "IapPlatform.hpp"
88
+ #include "InitConnectionConfig.hpp"
72
89
  #include "NitroAvailablePurchasesAndroidOptions.hpp"
73
90
  #include "NitroAvailablePurchasesAndroidType.hpp"
74
91
  #include "NitroAvailablePurchasesIosOptions.hpp"
@@ -94,6 +111,7 @@ namespace margelo::nitro::iap { enum class PurchaseState; }
94
111
  #include "PurchaseIOS.hpp"
95
112
  #include "PurchaseOfferIOS.hpp"
96
113
  #include "PurchaseState.hpp"
114
+ #include "UserChoiceBillingDetails.hpp"
97
115
  #include <NitroModules/Promise.hpp>
98
116
  #include <NitroModules/Result.hpp>
99
117
  #include <exception>
@@ -12,6 +12,10 @@
12
12
  // Forward declaration of `HybridRnIapSpec_cxx` to properly resolve imports.
13
13
  namespace NitroIap { class HybridRnIapSpec_cxx; }
14
14
 
15
+ // Forward declaration of `InitConnectionConfig` to properly resolve imports.
16
+ namespace margelo::nitro::iap { struct InitConnectionConfig; }
17
+ // Forward declaration of `AlternativeBillingModeAndroid` to properly resolve imports.
18
+ namespace margelo::nitro::iap { enum class AlternativeBillingModeAndroid; }
15
19
  // Forward declaration of `NitroProduct` to properly resolve imports.
16
20
  namespace margelo::nitro::iap { struct NitroProduct; }
17
21
  // Forward declaration of `IapPlatform` to properly resolve imports.
@@ -66,12 +70,22 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationParams; }
66
70
  namespace margelo::nitro::iap { struct NitroReceiptValidationAndroidOptions; }
67
71
  // Forward declaration of `NitroDeepLinkOptionsAndroid` to properly resolve imports.
68
72
  namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
73
+ // Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
74
+ namespace margelo::nitro::iap { struct UserChoiceBillingDetails; }
75
+ // Forward declaration of `ExternalPurchaseNoticeResultIOS` to properly resolve imports.
76
+ namespace margelo::nitro::iap { struct ExternalPurchaseNoticeResultIOS; }
77
+ // Forward declaration of `ExternalPurchaseNoticeAction` to properly resolve imports.
78
+ namespace margelo::nitro::iap { enum class ExternalPurchaseNoticeAction; }
79
+ // Forward declaration of `ExternalPurchaseLinkResultIOS` to properly resolve imports.
80
+ namespace margelo::nitro::iap { struct ExternalPurchaseLinkResultIOS; }
69
81
 
70
82
  #include <NitroModules/Promise.hpp>
83
+ #include "InitConnectionConfig.hpp"
84
+ #include <optional>
85
+ #include "AlternativeBillingModeAndroid.hpp"
71
86
  #include "NitroProduct.hpp"
72
87
  #include <vector>
73
88
  #include <string>
74
- #include <optional>
75
89
  #include "IapPlatform.hpp"
76
90
  #include "NitroOneTimePurchaseOfferDetail.hpp"
77
91
  #include "PurchaseAndroid.hpp"
@@ -101,6 +115,10 @@ namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
101
115
  #include "NitroReceiptValidationParams.hpp"
102
116
  #include "NitroReceiptValidationAndroidOptions.hpp"
103
117
  #include "NitroDeepLinkOptionsAndroid.hpp"
118
+ #include "UserChoiceBillingDetails.hpp"
119
+ #include "ExternalPurchaseNoticeResultIOS.hpp"
120
+ #include "ExternalPurchaseNoticeAction.hpp"
121
+ #include "ExternalPurchaseLinkResultIOS.hpp"
104
122
 
105
123
  #include "NitroIap-Swift-Cxx-Umbrella.hpp"
106
124
 
@@ -143,8 +161,8 @@ namespace margelo::nitro::iap {
143
161
 
144
162
  public:
145
163
  // Methods
146
- inline std::shared_ptr<Promise<bool>> initConnection() override {
147
- auto __result = _swiftPart.initConnection();
164
+ inline std::shared_ptr<Promise<bool>> initConnection(const std::optional<InitConnectionConfig>& config) override {
165
+ auto __result = _swiftPart.initConnection(config);
148
166
  if (__result.hasError()) [[unlikely]] {
149
167
  std::rethrow_exception(__result.error());
150
168
  }
@@ -419,6 +437,66 @@ namespace margelo::nitro::iap {
419
437
  auto __value = std::move(__result.value());
420
438
  return __value;
421
439
  }
440
+ inline std::shared_ptr<Promise<bool>> checkAlternativeBillingAvailabilityAndroid() override {
441
+ auto __result = _swiftPart.checkAlternativeBillingAvailabilityAndroid();
442
+ if (__result.hasError()) [[unlikely]] {
443
+ std::rethrow_exception(__result.error());
444
+ }
445
+ auto __value = std::move(__result.value());
446
+ return __value;
447
+ }
448
+ inline std::shared_ptr<Promise<bool>> showAlternativeBillingDialogAndroid() override {
449
+ auto __result = _swiftPart.showAlternativeBillingDialogAndroid();
450
+ if (__result.hasError()) [[unlikely]] {
451
+ std::rethrow_exception(__result.error());
452
+ }
453
+ auto __value = std::move(__result.value());
454
+ return __value;
455
+ }
456
+ inline std::shared_ptr<Promise<std::optional<std::string>>> createAlternativeBillingTokenAndroid(const std::optional<std::string>& sku) override {
457
+ auto __result = _swiftPart.createAlternativeBillingTokenAndroid(sku);
458
+ if (__result.hasError()) [[unlikely]] {
459
+ std::rethrow_exception(__result.error());
460
+ }
461
+ auto __value = std::move(__result.value());
462
+ return __value;
463
+ }
464
+ inline void addUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) override {
465
+ auto __result = _swiftPart.addUserChoiceBillingListenerAndroid(listener);
466
+ if (__result.hasError()) [[unlikely]] {
467
+ std::rethrow_exception(__result.error());
468
+ }
469
+ }
470
+ inline void removeUserChoiceBillingListenerAndroid(const std::function<void(const UserChoiceBillingDetails& /* details */)>& listener) override {
471
+ auto __result = _swiftPart.removeUserChoiceBillingListenerAndroid(listener);
472
+ if (__result.hasError()) [[unlikely]] {
473
+ std::rethrow_exception(__result.error());
474
+ }
475
+ }
476
+ inline std::shared_ptr<Promise<bool>> canPresentExternalPurchaseNoticeIOS() override {
477
+ auto __result = _swiftPart.canPresentExternalPurchaseNoticeIOS();
478
+ if (__result.hasError()) [[unlikely]] {
479
+ std::rethrow_exception(__result.error());
480
+ }
481
+ auto __value = std::move(__result.value());
482
+ return __value;
483
+ }
484
+ inline std::shared_ptr<Promise<ExternalPurchaseNoticeResultIOS>> presentExternalPurchaseNoticeSheetIOS() override {
485
+ auto __result = _swiftPart.presentExternalPurchaseNoticeSheetIOS();
486
+ if (__result.hasError()) [[unlikely]] {
487
+ std::rethrow_exception(__result.error());
488
+ }
489
+ auto __value = std::move(__result.value());
490
+ return __value;
491
+ }
492
+ inline std::shared_ptr<Promise<ExternalPurchaseLinkResultIOS>> presentExternalPurchaseLinkIOS(const std::string& url) override {
493
+ auto __result = _swiftPart.presentExternalPurchaseLinkIOS(url);
494
+ if (__result.hasError()) [[unlikely]] {
495
+ std::rethrow_exception(__result.error());
496
+ }
497
+ auto __value = std::move(__result.value());
498
+ return __value;
499
+ }
422
500
 
423
501
  private:
424
502
  NitroIap::HybridRnIapSpec_cxx _swiftPart;
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// AlternativeBillingModeAndroid.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
+ /**
9
+ * Represents the JS union `AlternativeBillingModeAndroid`, backed by a C++ enum.
10
+ */
11
+ public typealias AlternativeBillingModeAndroid = margelo.nitro.iap.AlternativeBillingModeAndroid
12
+
13
+ public extension AlternativeBillingModeAndroid {
14
+ /**
15
+ * Get a AlternativeBillingModeAndroid for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "none":
21
+ self = .none
22
+ case "user-choice":
23
+ self = .userChoice
24
+ case "alternative-only":
25
+ self = .alternativeOnly
26
+ default:
27
+ return nil
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Get the String value this AlternativeBillingModeAndroid represents.
33
+ */
34
+ var stringValue: String {
35
+ switch self {
36
+ case .none:
37
+ return "none"
38
+ case .userChoice:
39
+ return "user-choice"
40
+ case .alternativeOnly:
41
+ return "alternative-only"
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// 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
+ * Represents an instance of `ExternalPurchaseLinkResultIOS`, backed by a C++ struct.
12
+ */
13
+ public typealias ExternalPurchaseLinkResultIOS = margelo.nitro.iap.ExternalPurchaseLinkResultIOS
14
+
15
+ public extension ExternalPurchaseLinkResultIOS {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `ExternalPurchaseLinkResultIOS`.
20
+ */
21
+ init(error: String?, success: Bool) {
22
+ self.init({ () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = error {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), success)
29
+ }
30
+
31
+ var error: String? {
32
+ @inline(__always)
33
+ get {
34
+ return { () -> String? in
35
+ if bridge.has_value_std__optional_std__string_(self.__error) {
36
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__error)
37
+ return String(__unwrapped)
38
+ } else {
39
+ return nil
40
+ }
41
+ }()
42
+ }
43
+ @inline(__always)
44
+ set {
45
+ self.__error = { () -> bridge.std__optional_std__string_ in
46
+ if let __unwrappedValue = newValue {
47
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
48
+ } else {
49
+ return .init()
50
+ }
51
+ }()
52
+ }
53
+ }
54
+
55
+ var success: Bool {
56
+ @inline(__always)
57
+ get {
58
+ return self.__success
59
+ }
60
+ @inline(__always)
61
+ set {
62
+ self.__success = newValue
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// ExternalPurchaseNoticeAction.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
+ /**
9
+ * Represents the JS union `ExternalPurchaseNoticeAction`, backed by a C++ enum.
10
+ */
11
+ public typealias ExternalPurchaseNoticeAction = margelo.nitro.iap.ExternalPurchaseNoticeAction
12
+
13
+ public extension ExternalPurchaseNoticeAction {
14
+ /**
15
+ * Get a ExternalPurchaseNoticeAction for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "continue":
21
+ self = .continue
22
+ case "dismissed":
23
+ self = .dismissed
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this ExternalPurchaseNoticeAction represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .continue:
35
+ return "continue"
36
+ case .dismissed:
37
+ return "dismissed"
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// 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
+ * Represents an instance of `ExternalPurchaseNoticeResultIOS`, backed by a C++ struct.
12
+ */
13
+ public typealias ExternalPurchaseNoticeResultIOS = margelo.nitro.iap.ExternalPurchaseNoticeResultIOS
14
+
15
+ public extension ExternalPurchaseNoticeResultIOS {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `ExternalPurchaseNoticeResultIOS`.
20
+ */
21
+ init(error: String?, result: ExternalPurchaseNoticeAction) {
22
+ self.init({ () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = error {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), result)
29
+ }
30
+
31
+ var error: String? {
32
+ @inline(__always)
33
+ get {
34
+ return { () -> String? in
35
+ if bridge.has_value_std__optional_std__string_(self.__error) {
36
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__error)
37
+ return String(__unwrapped)
38
+ } else {
39
+ return nil
40
+ }
41
+ }()
42
+ }
43
+ @inline(__always)
44
+ set {
45
+ self.__error = { () -> bridge.std__optional_std__string_ in
46
+ if let __unwrappedValue = newValue {
47
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
48
+ } else {
49
+ return .init()
50
+ }
51
+ }()
52
+ }
53
+ }
54
+
55
+ var result: ExternalPurchaseNoticeAction {
56
+ @inline(__always)
57
+ get {
58
+ return self.__result
59
+ }
60
+ @inline(__always)
61
+ set {
62
+ self.__result = newValue
63
+ }
64
+ }
65
+ }
@@ -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
+ }