react-native-iap 16.4.1 → 16.5.0

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 (63) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +200 -142
  2. package/android/src/main/java/com/margelo/nitro/iap/TokenizedListenerRegistry.kt +0 -1
  3. package/ios/HybridRnIap.swift +832 -165
  4. package/ios/RnIapHelper.swift +1 -1
  5. package/lib/module/hooks/useIAP.js +48 -32
  6. package/lib/module/hooks/useIAP.js.map +1 -1
  7. package/lib/module/index.js +206 -152
  8. package/lib/module/index.js.map +1 -1
  9. package/lib/module/index.kepler.js +1 -0
  10. package/lib/module/index.kepler.js.map +1 -1
  11. package/lib/module/types.js +1 -0
  12. package/lib/module/types.js.map +1 -1
  13. package/lib/module/utils/error.js +5 -4
  14. package/lib/module/utils/error.js.map +1 -1
  15. package/lib/module/vega-adapter.js +4 -1
  16. package/lib/module/vega-adapter.js.map +1 -1
  17. package/lib/typescript/src/hooks/useIAP.d.ts +31 -15
  18. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  19. package/lib/typescript/src/index.d.ts +28 -14
  20. package/lib/typescript/src/index.d.ts.map +1 -1
  21. package/lib/typescript/src/index.kepler.d.ts.map +1 -1
  22. package/lib/typescript/src/specs/RnIap.nitro.d.ts +10 -0
  23. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  24. package/lib/typescript/src/types.d.ts +11 -2
  25. package/lib/typescript/src/types.d.ts.map +1 -1
  26. package/lib/typescript/src/utils/error.d.ts.map +1 -1
  27. package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
  28. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
  29. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
  30. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +7 -1
  31. package/nitrogen/generated/android/c++/JNitroPurchaseRequestType.hpp +58 -0
  32. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitHorizonProps.hpp +66 -0
  33. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +8 -1
  34. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderProps.hpp +3 -0
  35. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.cpp +26 -0
  36. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.hpp +74 -0
  37. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitProps.hpp +3 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +8 -3
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequestType.kt +23 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitHorizonProps.kt +56 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +7 -2
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.kt +62 -0
  43. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +65 -0
  44. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
  45. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
  46. package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +13 -2
  47. package/nitrogen/generated/ios/swift/NitroPurchaseRequestType.swift +40 -0
  48. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitHorizonProps.swift +66 -0
  49. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
  50. package/nitrogen/generated/ios/swift/Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.swift +30 -0
  51. package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +9 -2
  52. package/nitrogen/generated/shared/c++/NitroPurchaseRequestType.hpp +76 -0
  53. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitHorizonProps.hpp +90 -0
  54. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +8 -1
  55. package/openiap-versions.json +3 -3
  56. package/package.json +1 -1
  57. package/src/hooks/useIAP.ts +96 -58
  58. package/src/index.kepler.ts +1 -0
  59. package/src/index.ts +248 -195
  60. package/src/specs/RnIap.nitro.ts +12 -0
  61. package/src/types.ts +12 -2
  62. package/src/utils/error.ts +7 -3
  63. package/src/vega-adapter.ts +9 -5
@@ -28,6 +28,9 @@
28
28
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
29
29
  #include "JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
30
30
  #include "JNitroVerifyPurchaseWithIapkitGoogleProps.hpp"
31
+ #include "NitroVerifyPurchaseWithIapkitHorizonProps.hpp"
32
+ #include "JVariant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.hpp"
33
+ #include "JNitroVerifyPurchaseWithIapkitHorizonProps.hpp"
31
34
 
32
35
  namespace margelo::nitro::iap {
33
36
 
@@ -18,6 +18,9 @@ import com.margelo.nitro.core.NullType
18
18
  @DoNotStrip
19
19
  @Keep
20
20
  data class NitroPurchaseRequest(
21
+ @DoNotStrip
22
+ @Keep
23
+ val type: NitroPurchaseRequestType?,
21
24
  @DoNotStrip
22
25
  @Keep
23
26
  val apple: Variant_NullType_NitroRequestPurchaseIos?,
@@ -30,12 +33,14 @@ data class NitroPurchaseRequest(
30
33
  override fun equals(other: Any?): Boolean {
31
34
  if (this === other) return true
32
35
  if (other !is NitroPurchaseRequest) return false
33
- return Objects.deepEquals(this.apple, other.apple)
36
+ return Objects.deepEquals(this.type, other.type)
37
+ && Objects.deepEquals(this.apple, other.apple)
34
38
  && Objects.deepEquals(this.google, other.google)
35
39
  }
36
40
 
37
41
  override fun hashCode(): Int {
38
42
  return arrayOf<Any?>(
43
+ type,
39
44
  apple,
40
45
  google
41
46
  ).contentDeepHashCode()
@@ -49,8 +54,8 @@ data class NitroPurchaseRequest(
49
54
  @Keep
50
55
  @Suppress("unused")
51
56
  @JvmStatic
52
- private fun fromCpp(apple: Variant_NullType_NitroRequestPurchaseIos?, google: Variant_NullType_NitroRequestPurchaseAndroid?): NitroPurchaseRequest {
53
- return NitroPurchaseRequest(apple, google)
57
+ private fun fromCpp(type: NitroPurchaseRequestType?, apple: Variant_NullType_NitroRequestPurchaseIos?, google: Variant_NullType_NitroRequestPurchaseAndroid?): NitroPurchaseRequest {
58
+ return NitroPurchaseRequest(type, apple, google)
54
59
  }
55
60
  }
56
61
  }
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// NitroPurchaseRequestType.kt
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
+ package com.margelo.nitro.iap
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "NitroPurchaseRequestType".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class NitroPurchaseRequestType(@DoNotStrip @Keep val value: Int) {
19
+ IN_APP(0),
20
+ SUBS(1);
21
+
22
+ companion object
23
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// NitroVerifyPurchaseWithIapkitHorizonProps.kt
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
+ package com.margelo.nitro.iap
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+ import com.margelo.nitro.core.NullType
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NitroVerifyPurchaseWithIapkitHorizonProps".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NitroVerifyPurchaseWithIapkitHorizonProps(
21
+ @DoNotStrip
22
+ @Keep
23
+ val sku: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val userId: Variant_NullType_String?
27
+ ) {
28
+ /* primary constructor */
29
+
30
+ override fun equals(other: Any?): Boolean {
31
+ if (this === other) return true
32
+ if (other !is NitroVerifyPurchaseWithIapkitHorizonProps) return false
33
+ return Objects.deepEquals(this.sku, other.sku)
34
+ && Objects.deepEquals(this.userId, other.userId)
35
+ }
36
+
37
+ override fun hashCode(): Int {
38
+ return arrayOf<Any?>(
39
+ sku,
40
+ userId
41
+ ).contentDeepHashCode()
42
+ }
43
+
44
+ companion object {
45
+ /**
46
+ * Constructor called from C++
47
+ */
48
+ @DoNotStrip
49
+ @Keep
50
+ @Suppress("unused")
51
+ @JvmStatic
52
+ private fun fromCpp(sku: String, userId: Variant_NullType_String?): NitroVerifyPurchaseWithIapkitHorizonProps {
53
+ return NitroVerifyPurchaseWithIapkitHorizonProps(sku, userId)
54
+ }
55
+ }
56
+ }
@@ -35,6 +35,9 @@ data class NitroVerifyPurchaseWithIapkitProps(
35
35
  val google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?,
36
36
  @DoNotStrip
37
37
  @Keep
38
+ val horizon: Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps?,
39
+ @DoNotStrip
40
+ @Keep
38
41
  val includeClientPayload: Variant_NullType_Boolean?
39
42
  ) {
40
43
  /* primary constructor */
@@ -47,6 +50,7 @@ data class NitroVerifyPurchaseWithIapkitProps(
47
50
  && Objects.deepEquals(this.apple, other.apple)
48
51
  && Objects.deepEquals(this.baseUrl, other.baseUrl)
49
52
  && Objects.deepEquals(this.google, other.google)
53
+ && Objects.deepEquals(this.horizon, other.horizon)
50
54
  && Objects.deepEquals(this.includeClientPayload, other.includeClientPayload)
51
55
  }
52
56
 
@@ -57,6 +61,7 @@ data class NitroVerifyPurchaseWithIapkitProps(
57
61
  apple,
58
62
  baseUrl,
59
63
  google,
64
+ horizon,
60
65
  includeClientPayload
61
66
  ).contentDeepHashCode()
62
67
  }
@@ -69,8 +74,8 @@ data class NitroVerifyPurchaseWithIapkitProps(
69
74
  @Keep
70
75
  @Suppress("unused")
71
76
  @JvmStatic
72
- private fun fromCpp(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?, includeClientPayload: Variant_NullType_Boolean?): NitroVerifyPurchaseWithIapkitProps {
73
- return NitroVerifyPurchaseWithIapkitProps(apiKey, amazon, apple, baseUrl, google, includeClientPayload)
77
+ private fun fromCpp(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_Boolean?): NitroVerifyPurchaseWithIapkitProps {
78
+ return NitroVerifyPurchaseWithIapkitProps(apiKey, amazon, apple, baseUrl, google, horizon, includeClientPayload)
74
79
  }
75
80
  }
76
81
  }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps.kt
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
+ package com.margelo.nitro.iap
9
+
10
+ import com.facebook.proguard.annotations.DoNotStrip
11
+ import com.margelo.nitro.core.NullType
12
+
13
+ /**
14
+ * Represents the TypeScript variant "NullType | NitroVerifyPurchaseWithIapkitHorizonProps".
15
+ */
16
+ @Suppress("ClassName")
17
+ @DoNotStrip
18
+ sealed class Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps {
19
+ @DoNotStrip
20
+ data class First(@DoNotStrip val value: NullType): Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps()
21
+ @DoNotStrip
22
+ data class Second(@DoNotStrip val value: NitroVerifyPurchaseWithIapkitHorizonProps): Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps()
23
+
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (NullType) -> R, second: (NitroVerifyPurchaseWithIapkitHorizonProps) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
38
+ }
39
+
40
+ val isFirst: Boolean
41
+ get() = this is First
42
+ val isSecond: Boolean
43
+ get() = this is Second
44
+
45
+ fun asFirstOrNull(): NullType? {
46
+ val value = (this as? First)?.value ?: return null
47
+ return value
48
+ }
49
+ fun asSecondOrNull(): NitroVerifyPurchaseWithIapkitHorizonProps? {
50
+ val value = (this as? Second)?.value ?: return null
51
+ return value
52
+ }
53
+
54
+ companion object {
55
+ @JvmStatic
56
+ @DoNotStrip
57
+ fun create(value: NullType): Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps = First(value)
58
+ @JvmStatic
59
+ @DoNotStrip
60
+ fun create(value: NitroVerifyPurchaseWithIapkitHorizonProps): Variant_NullType_NitroVerifyPurchaseWithIapkitHorizonProps = Second(value)
61
+ }
62
+ }
@@ -88,6 +88,8 @@ namespace margelo::nitro::iap { struct NitroInAppMessageParamsAndroid; }
88
88
  namespace margelo::nitro::iap { struct NitroInAppMessageResultAndroid; }
89
89
  // Forward declaration of `NitroProduct` to properly resolve imports.
90
90
  namespace margelo::nitro::iap { struct NitroProduct; }
91
+ // Forward declaration of `NitroPurchaseRequestType` to properly resolve imports.
92
+ namespace margelo::nitro::iap { enum class NitroPurchaseRequestType; }
91
93
  // Forward declaration of `NitroPurchaseResult` to properly resolve imports.
92
94
  namespace margelo::nitro::iap { struct NitroPurchaseResult; }
93
95
  // Forward declaration of `NitroPurchaseVerificationAppleOptions` to properly resolve imports.
@@ -118,6 +120,8 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps;
118
120
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
119
121
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
120
122
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps; }
123
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitHorizonProps` to properly resolve imports.
124
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitHorizonProps; }
121
125
  // Forward declaration of `NitroVerifyPurchaseWithIapkitProps` to properly resolve imports.
122
126
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitProps; }
123
127
  // Forward declaration of `NitroVerifyPurchaseWithIapkitResult` to properly resolve imports.
@@ -215,6 +219,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
215
219
  #include "NitroInAppMessageResultAndroid.hpp"
216
220
  #include "NitroProduct.hpp"
217
221
  #include "NitroPurchase.hpp"
222
+ #include "NitroPurchaseRequestType.hpp"
218
223
  #include "NitroPurchaseResult.hpp"
219
224
  #include "NitroPurchaseVerificationAppleOptions.hpp"
220
225
  #include "NitroPurchaseVerificationGoogleOptions.hpp"
@@ -229,6 +234,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
229
234
  #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
230
235
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
231
236
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
237
+ #include "NitroVerifyPurchaseWithIapkitHorizonProps.hpp"
232
238
  #include "NitroVerifyPurchaseWithIapkitProps.hpp"
233
239
  #include "NitroVerifyPurchaseWithIapkitResult.hpp"
234
240
  #include "NitroVerifyPurchaseWithProviderError.hpp"
@@ -1198,6 +1204,21 @@ namespace margelo::nitro::iap::bridge::swift {
1198
1204
  return Func_void_std__variant_nitro__NullType__PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____Wrapper(std::move(value));
1199
1205
  }
1200
1206
 
1207
+ // pragma MARK: std::optional<NitroPurchaseRequestType>
1208
+ /**
1209
+ * Specialized version of `std::optional<NitroPurchaseRequestType>`.
1210
+ */
1211
+ using std__optional_NitroPurchaseRequestType_ = std::optional<NitroPurchaseRequestType>;
1212
+ inline std::optional<NitroPurchaseRequestType> create_std__optional_NitroPurchaseRequestType_(const NitroPurchaseRequestType& value) noexcept {
1213
+ return std::optional<NitroPurchaseRequestType>(value);
1214
+ }
1215
+ inline bool has_value_std__optional_NitroPurchaseRequestType_(const std::optional<NitroPurchaseRequestType>& optional) noexcept {
1216
+ return optional.has_value();
1217
+ }
1218
+ inline NitroPurchaseRequestType get_std__optional_NitroPurchaseRequestType_(const std::optional<NitroPurchaseRequestType>& optional) noexcept {
1219
+ return optional.value();
1220
+ }
1221
+
1201
1222
  // pragma MARK: std::unordered_map<std::string, std::string>
1202
1223
  /**
1203
1224
  * Specialized version of `std::unordered_map<std::string, std::string>`.
@@ -2957,6 +2978,50 @@ namespace margelo::nitro::iap::bridge::swift {
2957
2978
  return optional.value();
2958
2979
  }
2959
2980
 
2981
+ // pragma MARK: std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>
2982
+ /**
2983
+ * Wrapper struct for `std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>`.
2984
+ * std::variant cannot be used in Swift because of a Swift bug.
2985
+ * Not even specializing it works. So we create a wrapper struct.
2986
+ */
2987
+ struct std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_ final {
2988
+ std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps> variant;
2989
+ std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps> variant): variant(variant) { }
2990
+ operator std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>() const noexcept {
2991
+ return variant;
2992
+ }
2993
+ inline size_t index() const noexcept {
2994
+ return variant.index();
2995
+ }
2996
+ inline nitro::NullType get_0() const noexcept {
2997
+ return std::get<0>(variant);
2998
+ }
2999
+ inline NitroVerifyPurchaseWithIapkitHorizonProps get_1() const noexcept {
3000
+ return std::get<1>(variant);
3001
+ }
3002
+ };
3003
+ inline std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_ create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(nitro::NullType value) noexcept {
3004
+ return std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(value);
3005
+ }
3006
+ inline std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_ create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(const NitroVerifyPurchaseWithIapkitHorizonProps& value) noexcept {
3007
+ return std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps_(value);
3008
+ }
3009
+
3010
+ // pragma MARK: std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>>
3011
+ /**
3012
+ * Specialized version of `std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>>`.
3013
+ */
3014
+ using std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__ = std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>>;
3015
+ inline std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>> create_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__(const std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>& value) noexcept {
3016
+ return std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>>(value);
3017
+ }
3018
+ inline bool has_value_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__(const std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>>& optional) noexcept {
3019
+ return optional.has_value();
3020
+ }
3021
+ inline std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps> get_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitHorizonProps__(const std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitHorizonProps>>& optional) noexcept {
3022
+ return optional.value();
3023
+ }
3024
+
2960
3025
  // pragma MARK: std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitProps>
2961
3026
  /**
2962
3027
  * Wrapper struct for `std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitProps>`.
@@ -108,6 +108,8 @@ namespace margelo::nitro::iap { struct NitroInAppMessageResultAndroid; }
108
108
  namespace margelo::nitro::iap { struct NitroLaunchExternalLinkParamsAndroid; }
109
109
  // Forward declaration of `NitroProduct` to properly resolve imports.
110
110
  namespace margelo::nitro::iap { struct NitroProduct; }
111
+ // Forward declaration of `NitroPurchaseRequestType` to properly resolve imports.
112
+ namespace margelo::nitro::iap { enum class NitroPurchaseRequestType; }
111
113
  // Forward declaration of `NitroPurchaseRequest` to properly resolve imports.
112
114
  namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
113
115
  // Forward declaration of `NitroPurchaseResult` to properly resolve imports.
@@ -142,6 +144,8 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps;
142
144
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
143
145
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
144
146
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps; }
147
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitHorizonProps` to properly resolve imports.
148
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitHorizonProps; }
145
149
  // Forward declaration of `NitroVerifyPurchaseWithIapkitProps` to properly resolve imports.
146
150
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitProps; }
147
151
  // Forward declaration of `NitroVerifyPurchaseWithIapkitResult` to properly resolve imports.
@@ -248,6 +252,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
248
252
  #include "NitroProduct.hpp"
249
253
  #include "NitroPurchase.hpp"
250
254
  #include "NitroPurchaseRequest.hpp"
255
+ #include "NitroPurchaseRequestType.hpp"
251
256
  #include "NitroPurchaseResult.hpp"
252
257
  #include "NitroPurchaseVerificationAppleOptions.hpp"
253
258
  #include "NitroPurchaseVerificationGoogleOptions.hpp"
@@ -263,6 +268,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
263
268
  #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
264
269
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
265
270
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
271
+ #include "NitroVerifyPurchaseWithIapkitHorizonProps.hpp"
266
272
  #include "NitroVerifyPurchaseWithIapkitProps.hpp"
267
273
  #include "NitroVerifyPurchaseWithIapkitResult.hpp"
268
274
  #include "NitroVerifyPurchaseWithProviderError.hpp"
@@ -58,6 +58,8 @@ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
58
58
  namespace margelo::nitro::iap { struct RenewalCommitmentInfoIOS; }
59
59
  // Forward declaration of `NitroPurchaseRequest` to properly resolve imports.
60
60
  namespace margelo::nitro::iap { struct NitroPurchaseRequest; }
61
+ // Forward declaration of `NitroPurchaseRequestType` to properly resolve imports.
62
+ namespace margelo::nitro::iap { enum class NitroPurchaseRequestType; }
61
63
  // Forward declaration of `NitroRequestPurchaseIos` to properly resolve imports.
62
64
  namespace margelo::nitro::iap { struct NitroRequestPurchaseIos; }
63
65
  // Forward declaration of `PromotionalOfferJwsInputIOS` to properly resolve imports.
@@ -142,6 +144,8 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps;
142
144
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
143
145
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
144
146
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps; }
147
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitHorizonProps` to properly resolve imports.
148
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitHorizonProps; }
145
149
  // Forward declaration of `NitroDeepLinkOptionsAndroid` to properly resolve imports.
146
150
  namespace margelo::nitro::iap { struct NitroDeepLinkOptionsAndroid; }
147
151
  // Forward declaration of `UserChoiceBillingDetails` to properly resolve imports.
@@ -226,6 +230,7 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
226
230
  #include "RenewalInfoIOS.hpp"
227
231
  #include "RenewalCommitmentInfoIOS.hpp"
228
232
  #include "NitroPurchaseRequest.hpp"
233
+ #include "NitroPurchaseRequestType.hpp"
229
234
  #include "NitroRequestPurchaseIos.hpp"
230
235
  #include <unordered_map>
231
236
  #include "PromotionalOfferJwsInputIOS.hpp"
@@ -270,6 +275,7 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
270
275
  #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
271
276
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
272
277
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
278
+ #include "NitroVerifyPurchaseWithIapkitHorizonProps.hpp"
273
279
  #include "NitroDeepLinkOptionsAndroid.hpp"
274
280
  #include "UserChoiceBillingDetails.hpp"
275
281
  #include "DeveloperProvidedBillingProductAndroid.hpp"
@@ -18,8 +18,14 @@ public extension NitroPurchaseRequest {
18
18
  /**
19
19
  * Create a new instance of `NitroPurchaseRequest`.
20
20
  */
21
- init(apple: Variant_NullType_NitroRequestPurchaseIos?, google: Variant_NullType_NitroRequestPurchaseAndroid?) {
22
- self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__NitroRequestPurchaseIos__ in
21
+ init(type: NitroPurchaseRequestType?, apple: Variant_NullType_NitroRequestPurchaseIos?, google: Variant_NullType_NitroRequestPurchaseAndroid?) {
22
+ self.init({ () -> bridge.std__optional_NitroPurchaseRequestType_ in
23
+ if let __unwrappedValue = type {
24
+ return bridge.create_std__optional_NitroPurchaseRequestType_(__unwrappedValue)
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_std__variant_nitro__NullType__NitroRequestPurchaseIos__ in
23
29
  if let __unwrappedValue = apple {
24
30
  return bridge.create_std__optional_std__variant_nitro__NullType__NitroRequestPurchaseIos__({ () -> bridge.std__variant_nitro__NullType__NitroRequestPurchaseIos_ in
25
31
  switch __unwrappedValue {
@@ -48,6 +54,11 @@ public extension NitroPurchaseRequest {
48
54
  }())
49
55
  }
50
56
 
57
+ @inline(__always)
58
+ var type: NitroPurchaseRequestType? {
59
+ return self.__type.value
60
+ }
61
+
51
62
  @inline(__always)
52
63
  var apple: Variant_NullType_NitroRequestPurchaseIos? {
53
64
  return { () -> Variant_NullType_NitroRequestPurchaseIos? in
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// NitroPurchaseRequestType.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
+ /**
9
+ * Represents the JS union `NitroPurchaseRequestType`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroPurchaseRequestType = margelo.nitro.iap.NitroPurchaseRequestType
12
+
13
+ public extension NitroPurchaseRequestType {
14
+ /**
15
+ * Get a NitroPurchaseRequestType 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 "in-app":
21
+ self = .inApp
22
+ case "subs":
23
+ self = .subs
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this NitroPurchaseRequestType represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .inApp:
35
+ return "in-app"
36
+ case .subs:
37
+ return "subs"
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// 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
+ * Represents an instance of `NitroVerifyPurchaseWithIapkitHorizonProps`, backed by a C++ struct.
12
+ */
13
+ public typealias NitroVerifyPurchaseWithIapkitHorizonProps = margelo.nitro.iap.NitroVerifyPurchaseWithIapkitHorizonProps
14
+
15
+ public extension NitroVerifyPurchaseWithIapkitHorizonProps {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `NitroVerifyPurchaseWithIapkitHorizonProps`.
20
+ */
21
+ init(sku: String, userId: Variant_NullType_String?) {
22
+ self.init(std.string(sku), { () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
23
+ if let __unwrappedValue = userId {
24
+ return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
25
+ switch __unwrappedValue {
26
+ case .first(let __value):
27
+ return bridge.create_std__variant_nitro__NullType__std__string_(margelo.nitro.NullType.null)
28
+ case .second(let __value):
29
+ return bridge.create_std__variant_nitro__NullType__std__string_(std.string(__value))
30
+ }
31
+ }().variant)
32
+ } else {
33
+ return .init()
34
+ }
35
+ }())
36
+ }
37
+
38
+ @inline(__always)
39
+ var sku: String {
40
+ return String(self.__sku)
41
+ }
42
+
43
+ @inline(__always)
44
+ var userId: Variant_NullType_String? {
45
+ return { () -> Variant_NullType_String? in
46
+ if bridge.has_value_std__optional_std__variant_nitro__NullType__std__string__(self.__userId) {
47
+ let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__std__string__(self.__userId)
48
+ return { () -> Variant_NullType_String in
49
+ let __variant = bridge.std__variant_nitro__NullType__std__string_(__unwrapped)
50
+ switch __variant.index() {
51
+ case 0:
52
+ let __actual = __variant.get_0()
53
+ return .first(NullType.null)
54
+ case 1:
55
+ let __actual = __variant.get_1()
56
+ return .second(String(__actual))
57
+ default:
58
+ fatalError("Variant can never have index \(__variant.index())!")
59
+ }
60
+ }()
61
+ } else {
62
+ return nil
63
+ }
64
+ }()
65
+ }
66
+ }
@@ -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
+ }