react-native-iap 16.4.1 → 16.5.1

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 (71) hide show
  1. package/README.md +2 -0
  2. package/android/build.gradle +19 -21
  3. package/android/fix-prefab.gradle +11 -24
  4. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +200 -142
  5. package/android/src/main/java/com/margelo/nitro/iap/TokenizedListenerRegistry.kt +0 -1
  6. package/ios/HybridRnIap.swift +832 -165
  7. package/ios/RnIapHelper.swift +1 -1
  8. package/lib/module/hooks/useIAP.js +48 -32
  9. package/lib/module/hooks/useIAP.js.map +1 -1
  10. package/lib/module/index.js +207 -153
  11. package/lib/module/index.js.map +1 -1
  12. package/lib/module/index.kepler.js +1 -0
  13. package/lib/module/index.kepler.js.map +1 -1
  14. package/lib/module/kit-api.js +9 -5
  15. package/lib/module/kit-api.js.map +1 -1
  16. package/lib/module/types.js +1 -0
  17. package/lib/module/types.js.map +1 -1
  18. package/lib/module/utils/error.js +5 -4
  19. package/lib/module/utils/error.js.map +1 -1
  20. package/lib/module/vega-adapter.js +4 -1
  21. package/lib/module/vega-adapter.js.map +1 -1
  22. package/lib/typescript/src/hooks/useIAP.d.ts +31 -15
  23. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  24. package/lib/typescript/src/index.d.ts +28 -14
  25. package/lib/typescript/src/index.d.ts.map +1 -1
  26. package/lib/typescript/src/index.kepler.d.ts.map +1 -1
  27. package/lib/typescript/src/kit-api.d.ts +9 -5
  28. package/lib/typescript/src/kit-api.d.ts.map +1 -1
  29. package/lib/typescript/src/specs/RnIap.nitro.d.ts +10 -0
  30. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  31. package/lib/typescript/src/types.d.ts +12 -2
  32. package/lib/typescript/src/types.d.ts.map +1 -1
  33. package/lib/typescript/src/utils/error.d.ts.map +1 -1
  34. package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
  35. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
  36. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
  37. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +7 -1
  38. package/nitrogen/generated/android/c++/JNitroPurchaseRequestType.hpp +58 -0
  39. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitHorizonProps.hpp +66 -0
  40. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +8 -1
  41. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderProps.hpp +3 -0
  42. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.cpp +26 -0
  43. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.hpp +74 -0
  44. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitProps.hpp +3 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +8 -3
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequestType.kt +23 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitHorizonProps.kt +56 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +7 -2
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.kt +62 -0
  50. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +65 -0
  51. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
  52. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
  53. package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +13 -2
  54. package/nitrogen/generated/ios/swift/NitroPurchaseRequestType.swift +40 -0
  55. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitHorizonProps.swift +66 -0
  56. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
  57. package/nitrogen/generated/ios/swift/Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.swift +30 -0
  58. package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +9 -2
  59. package/nitrogen/generated/shared/c++/NitroPurchaseRequestType.hpp +76 -0
  60. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitHorizonProps.hpp +90 -0
  61. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +8 -1
  62. package/openiap-versions.json +3 -3
  63. package/package.json +1 -1
  64. package/src/hooks/useIAP.ts +96 -58
  65. package/src/index.kepler.ts +1 -0
  66. package/src/index.ts +249 -196
  67. package/src/kit-api.ts +10 -6
  68. package/src/specs/RnIap.nitro.ts +12 -0
  69. package/src/types.ts +13 -2
  70. package/src/utils/error.ts +7 -3
  71. package/src/vega-adapter.ts +9 -5
@@ -18,7 +18,7 @@ public extension NitroVerifyPurchaseWithIapkitProps {
18
18
  /**
19
19
  * Create a new instance of `NitroVerifyPurchaseWithIapkitProps`.
20
20
  */
21
- init(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?, includeClientPayload: Variant_NullType_Bool?) {
21
+ init(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?, horizon: Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps?, includeClientPayload: Variant_NullType_Bool?) {
22
22
  self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
23
23
  if let __unwrappedValue = apiKey {
24
24
  return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
@@ -84,6 +84,19 @@ public extension NitroVerifyPurchaseWithIapkitProps {
84
84
  } else {
85
85
  return .init()
86
86
  }
87
+ }(), { () -> bridge.std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__ in
88
+ if let __unwrappedValue = horizon {
89
+ return bridge.create_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__({ () -> bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_ in
90
+ switch __unwrappedValue {
91
+ case .first(let __value):
92
+ return bridge.create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(margelo.nitro.NullType.null)
93
+ case .second(let __value):
94
+ return bridge.create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(__value)
95
+ }
96
+ }().variant)
97
+ } else {
98
+ return .init()
99
+ }
87
100
  }(), { () -> bridge.std__optional_std__variant_nitro__NullType__bool__ in
88
101
  if let __unwrappedValue = includeClientPayload {
89
102
  return bridge.create_std__optional_std__variant_nitro__NullType__bool__({ () -> bridge.std__variant_nitro__NullType__bool_ in
@@ -220,6 +233,30 @@ public extension NitroVerifyPurchaseWithIapkitProps {
220
233
  }()
221
234
  }
222
235
 
236
+ @inline(__always)
237
+ var horizon: Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps? {
238
+ return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps? in
239
+ if bridge.has_value_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__(self.__horizon) {
240
+ let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__(self.__horizon)
241
+ return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps in
242
+ let __variant = bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(__unwrapped)
243
+ switch __variant.index() {
244
+ case 0:
245
+ let __actual = __variant.get_0()
246
+ return .first(NullType.null)
247
+ case 1:
248
+ let __actual = __variant.get_1()
249
+ return .second(__actual)
250
+ default:
251
+ fatalError("Variant can never have index \(__variant.index())!")
252
+ }
253
+ }()
254
+ } else {
255
+ return nil
256
+ }
257
+ }()
258
+ }
259
+
223
260
  @inline(__always)
224
261
  var includeClientPayload: Variant_NullType_Bool? {
225
262
  return { () -> Variant_NullType_Bool? in
@@ -0,0 +1,30 @@
1
+ ///
2
+ /// Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * An Swift enum with associated values representing a Variant/Union type.
12
+ * JS type: `null | struct`
13
+ */
14
+ @frozen
15
+ public indirect enum Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps {
16
+ case first(NullType)
17
+ case second(NitroVerifyPurchaseWithIapkitHorizonProps)
18
+ }
19
+
20
+ public extension Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps {
21
+ func asType<T>(_ type: T.Type = T.self) -> T? {
22
+ switch self {
23
+ case .first(let value): return value as? T
24
+ case .second(let value): return value as? T
25
+ }
26
+ }
27
+ func isType<T>(_ type: T.Type = T.self) -> Bool {
28
+ return self.asType(type) != nil
29
+ }
30
+ }
@@ -28,15 +28,18 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
+ // Forward declaration of `NitroPurchaseRequestType` to properly resolve imports.
32
+ namespace margelo::nitro::iap { enum class NitroPurchaseRequestType; }
31
33
  // Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
32
34
  namespace margelo::nitro::iap { struct NitroRequestPurchaseIos; }
33
35
  // Forward declaration of `NitroRequestPurchaseAndroid` to properly resolve imports.
34
36
  namespace margelo::nitro::iap { struct NitroRequestPurchaseAndroid; }
35
37
 
38
+ #include "NitroPurchaseRequestType.hpp"
39
+ #include <optional>
36
40
  #include <NitroModules/Null.hpp>
37
41
  #include "NitroRequestPurchaseIos.hpp"
38
42
  #include <variant>
39
- #include <optional>
40
43
  #include "NitroRequestPurchaseAndroid.hpp"
41
44
 
42
45
  namespace margelo::nitro::iap {
@@ -46,12 +49,13 @@ namespace margelo::nitro::iap {
46
49
  */
47
50
  struct NitroPurchaseRequest final {
48
51
  public:
52
+ std::optional<NitroPurchaseRequestType> type SWIFT_PRIVATE;
49
53
  std::optional<std::variant<nitro::NullType, NitroRequestPurchaseIos>> apple SWIFT_PRIVATE;
50
54
  std::optional<std::variant<nitro::NullType, NitroRequestPurchaseAndroid>> google SWIFT_PRIVATE;
51
55
 
52
56
  public:
53
57
  NitroPurchaseRequest() = default;
54
- explicit NitroPurchaseRequest(std::optional<std::variant<nitro::NullType, NitroRequestPurchaseIos>> apple, std::optional<std::variant<nitro::NullType, NitroRequestPurchaseAndroid>> google): apple(apple), google(google) {}
58
+ explicit NitroPurchaseRequest(std::optional<NitroPurchaseRequestType> type, std::optional<std::variant<nitro::NullType, NitroRequestPurchaseIos>> apple, std::optional<std::variant<nitro::NullType, NitroRequestPurchaseAndroid>> google): type(type), apple(apple), google(google) {}
55
59
 
56
60
  public:
57
61
  // NitroPurchaseRequest is not equatable because these properties are not equatable: google
@@ -67,12 +71,14 @@ namespace margelo::nitro {
67
71
  static inline margelo::nitro::iap::NitroPurchaseRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
68
72
  jsi::Object obj = arg.asObject(runtime);
69
73
  return margelo::nitro::iap::NitroPurchaseRequest(
74
+ JSIConverter<std::optional<margelo::nitro::iap::NitroPurchaseRequestType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
70
75
  JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRequestPurchaseIos>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple"))),
71
76
  JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRequestPurchaseAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))
72
77
  );
73
78
  }
74
79
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchaseRequest& arg) {
75
80
  jsi::Object obj(runtime);
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<std::optional<margelo::nitro::iap::NitroPurchaseRequestType>>::toJSI(runtime, arg.type));
76
82
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "apple"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRequestPurchaseIos>>>::toJSI(runtime, arg.apple));
77
83
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "google"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRequestPurchaseAndroid>>>::toJSI(runtime, arg.google));
78
84
  return obj;
@@ -85,6 +91,7 @@ namespace margelo::nitro {
85
91
  if (!nitro::isPlainObject(runtime, obj)) {
86
92
  return false;
87
93
  }
94
+ if (!JSIConverter<std::optional<margelo::nitro::iap::NitroPurchaseRequestType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
88
95
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRequestPurchaseIos>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple")))) return false;
89
96
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRequestPurchaseAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))) return false;
90
97
  return true;
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// NitroPurchaseRequestType.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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 (NitroPurchaseRequestType).
30
+ */
31
+ enum class NitroPurchaseRequestType {
32
+ IN_APP 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++ NitroPurchaseRequestType <> JS NitroPurchaseRequestType (union)
41
+ template <>
42
+ struct JSIConverter<margelo::nitro::iap::NitroPurchaseRequestType> final {
43
+ static inline margelo::nitro::iap::NitroPurchaseRequestType 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("in-app"): return margelo::nitro::iap::NitroPurchaseRequestType::IN_APP;
47
+ case hashString("subs"): return margelo::nitro::iap::NitroPurchaseRequestType::SUBS;
48
+ default: [[unlikely]]
49
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NitroPurchaseRequestType - invalid value!");
50
+ }
51
+ }
52
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::NitroPurchaseRequestType arg) {
53
+ switch (arg) {
54
+ case margelo::nitro::iap::NitroPurchaseRequestType::IN_APP: return JSIConverter<std::string>::toJSI(runtime, "in-app");
55
+ case margelo::nitro::iap::NitroPurchaseRequestType::SUBS: return JSIConverter<std::string>::toJSI(runtime, "subs");
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert NitroPurchaseRequestType 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("in-app"):
68
+ case hashString("subs"):
69
+ return true;
70
+ default:
71
+ return false;
72
+ }
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -0,0 +1,90 @@
1
+ ///
2
+ /// NitroVerifyPurchaseWithIapkitHorizonProps.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 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
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <string>
34
+ #include <NitroModules/Null.hpp>
35
+ #include <variant>
36
+ #include <optional>
37
+
38
+ namespace margelo::nitro::iap {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (NitroVerifyPurchaseWithIapkitHorizonProps).
42
+ */
43
+ struct NitroVerifyPurchaseWithIapkitHorizonProps final {
44
+ public:
45
+ std::string sku SWIFT_PRIVATE;
46
+ std::optional<std::variant<nitro::NullType, std::string>> userId SWIFT_PRIVATE;
47
+
48
+ public:
49
+ NitroVerifyPurchaseWithIapkitHorizonProps() = default;
50
+ explicit NitroVerifyPurchaseWithIapkitHorizonProps(std::string sku, std::optional<std::variant<nitro::NullType, std::string>> userId): sku(sku), userId(userId) {}
51
+
52
+ public:
53
+ friend bool operator==(const NitroVerifyPurchaseWithIapkitHorizonProps& lhs, const NitroVerifyPurchaseWithIapkitHorizonProps& rhs) = default;
54
+ };
55
+
56
+ } // namespace margelo::nitro::iap
57
+
58
+ namespace margelo::nitro {
59
+
60
+ // C++ NitroVerifyPurchaseWithIapkitHorizonProps <> JS NitroVerifyPurchaseWithIapkitHorizonProps (object)
61
+ template <>
62
+ struct JSIConverter<margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps> final {
63
+ static inline margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
+ jsi::Object obj = arg.asObject(runtime);
65
+ return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps(
66
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sku"))),
67
+ JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))
68
+ );
69
+ }
70
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps& arg) {
71
+ jsi::Object obj(runtime);
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sku"), JSIConverter<std::string>::toJSI(runtime, arg.sku));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "userId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.userId));
74
+ return obj;
75
+ }
76
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
77
+ if (!value.isObject()) {
78
+ return false;
79
+ }
80
+ jsi::Object obj = value.getObject(runtime);
81
+ if (!nitro::isPlainObject(runtime, obj)) {
82
+ return false;
83
+ }
84
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sku")))) return false;
85
+ if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))) return false;
86
+ return true;
87
+ }
88
+ };
89
+
90
+ } // namespace margelo::nitro
@@ -34,6 +34,8 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps;
34
34
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
35
35
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
36
36
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps; }
37
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitHorizonProps` to properly resolve imports.
38
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitHorizonProps; }
37
39
 
38
40
  #include <NitroModules/Null.hpp>
39
41
  #include <string>
@@ -42,6 +44,7 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps;
42
44
  #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
43
45
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
44
46
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
47
+ #include "NitroVerifyPurchaseWithIapkitHorizonProps.hpp"
45
48
 
46
49
  namespace margelo::nitro::iap {
47
50
 
@@ -55,11 +58,12 @@ namespace margelo::nitro::iap {
55
58
  std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple SWIFT_PRIVATE;
56
59
  std::optional<std::variant<nitro::NullType, std::string>> baseUrl SWIFT_PRIVATE;
57
60
  std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google SWIFT_PRIVATE;
61
+ std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>> horizon SWIFT_PRIVATE;
58
62
  std::optional<std::variant<nitro::NullType, bool>> includeClientPayload SWIFT_PRIVATE;
59
63
 
60
64
  public:
61
65
  NitroVerifyPurchaseWithIapkitProps() = default;
62
- explicit NitroVerifyPurchaseWithIapkitProps(std::optional<std::variant<nitro::NullType, std::string>> apiKey, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>> amazon, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple, std::optional<std::variant<nitro::NullType, std::string>> baseUrl, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google, std::optional<std::variant<nitro::NullType, bool>> includeClientPayload): apiKey(apiKey), amazon(amazon), apple(apple), baseUrl(baseUrl), google(google), includeClientPayload(includeClientPayload) {}
66
+ explicit NitroVerifyPurchaseWithIapkitProps(std::optional<std::variant<nitro::NullType, std::string>> apiKey, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>> amazon, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple, std::optional<std::variant<nitro::NullType, std::string>> baseUrl, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>> horizon, std::optional<std::variant<nitro::NullType, bool>> includeClientPayload): apiKey(apiKey), amazon(amazon), apple(apple), baseUrl(baseUrl), google(google), horizon(horizon), includeClientPayload(includeClientPayload) {}
63
67
 
64
68
  public:
65
69
  friend bool operator==(const NitroVerifyPurchaseWithIapkitProps& lhs, const NitroVerifyPurchaseWithIapkitProps& rhs) = default;
@@ -80,6 +84,7 @@ namespace margelo::nitro {
80
84
  JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple"))),
81
85
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "baseUrl"))),
82
86
  JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google"))),
87
+ JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "horizon"))),
83
88
  JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeClientPayload")))
84
89
  );
85
90
  }
@@ -90,6 +95,7 @@ namespace margelo::nitro {
90
95
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "apple"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::toJSI(runtime, arg.apple));
91
96
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "baseUrl"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.baseUrl));
92
97
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "google"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::toJSI(runtime, arg.google));
98
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "horizon"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps>>>::toJSI(runtime, arg.horizon));
93
99
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeClientPayload"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.includeClientPayload));
94
100
  return obj;
95
101
  }
@@ -106,6 +112,7 @@ namespace margelo::nitro {
106
112
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple")))) return false;
107
113
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "baseUrl")))) return false;
108
114
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))) return false;
115
+ if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitHorizonProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "horizon")))) return false;
109
116
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeClientPayload")))) return false;
110
117
  return true;
111
118
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "spec": "3.3.1",
3
- "google": "3.4.0",
4
- "apple": "3.3.1"
2
+ "spec": "3.4.0",
3
+ "google": "3.5.0",
4
+ "apple": "3.4.0"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "16.4.1",
3
+ "version": "16.5.1",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",