react-native-iap 15.3.6 → 15.4.0-rc.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 (81) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +13 -5
  3. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +16 -3
  4. package/ios/HybridRnIap.swift +12 -0
  5. package/lib/module/index.js +56 -16
  6. package/lib/module/index.js.map +1 -1
  7. package/lib/module/index.kepler.js +170 -0
  8. package/lib/module/index.kepler.js.map +1 -0
  9. package/lib/module/types/amazon-devices-kepler/index.d.js +2 -0
  10. package/lib/module/types/amazon-devices-kepler/index.d.js.map +1 -0
  11. package/lib/module/types.js +5 -2
  12. package/lib/module/types.js.map +1 -1
  13. package/lib/module/utils/error.js +2 -2
  14. package/lib/module/utils/error.js.map +1 -1
  15. package/lib/module/utils/type-bridge.js +4 -1
  16. package/lib/module/utils/type-bridge.js.map +1 -1
  17. package/lib/module/vega-adapter.js +981 -0
  18. package/lib/module/vega-adapter.js.map +1 -0
  19. package/lib/module/vega.js +10 -0
  20. package/lib/module/vega.js.map +1 -0
  21. package/lib/module/vega.kepler.js +18 -0
  22. package/lib/module/vega.kepler.js.map +1 -0
  23. package/lib/typescript/plugin/src/withIAP.d.ts +33 -0
  24. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  25. package/lib/typescript/src/index.d.ts +9 -2
  26. package/lib/typescript/src/index.d.ts.map +1 -1
  27. package/lib/typescript/src/index.kepler.d.ts +55 -0
  28. package/lib/typescript/src/index.kepler.d.ts.map +1 -0
  29. package/lib/typescript/src/specs/RnIap.nitro.d.ts +10 -1
  30. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  31. package/lib/typescript/src/types.d.ts +16 -3
  32. package/lib/typescript/src/types.d.ts.map +1 -1
  33. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  34. package/lib/typescript/src/vega-adapter.d.ts +76 -0
  35. package/lib/typescript/src/vega-adapter.d.ts.map +1 -0
  36. package/lib/typescript/src/vega.d.ts +4 -0
  37. package/lib/typescript/src/vega.d.ts.map +1 -0
  38. package/lib/typescript/src/vega.kepler.d.ts +4 -0
  39. package/lib/typescript/src/vega.kepler.d.ts.map +1 -0
  40. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
  41. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +5 -0
  42. package/nitrogen/generated/android/c++/JIapStore.hpp +3 -0
  43. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitAmazonProps.hpp +71 -0
  44. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +9 -1
  45. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderProps.hpp +4 -0
  46. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.cpp +26 -0
  47. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.hpp +75 -0
  48. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitProps.hpp +4 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapStore.kt +2 -1
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitAmazonProps.kt +44 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +5 -2
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.kt +53 -0
  53. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +47 -0
  54. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
  55. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +3 -0
  56. package/nitrogen/generated/ios/swift/IapStore.swift +4 -0
  57. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitAmazonProps.swift +103 -0
  58. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
  59. package/nitrogen/generated/ios/swift/Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.swift +18 -0
  60. package/nitrogen/generated/shared/c++/IapStore.hpp +4 -0
  61. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitAmazonProps.hpp +94 -0
  62. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +8 -1
  63. package/openiap-versions.json +1 -1
  64. package/package.json +17 -4
  65. package/plugin/build/withIAP.d.ts +33 -0
  66. package/plugin/build/withIAP.js +109 -42
  67. package/plugin/src/withIAP.ts +185 -55
  68. package/src/index.kepler.ts +311 -0
  69. package/src/index.ts +65 -19
  70. package/src/specs/RnIap.nitro.ts +13 -2
  71. package/src/types/amazon-devices-kepler/index.d.ts +14 -0
  72. package/src/types.ts +17 -3
  73. package/src/utils/error.ts +2 -2
  74. package/src/utils/type-bridge.ts +4 -1
  75. package/src/vega-adapter.ts +1503 -0
  76. package/src/vega.kepler.ts +21 -0
  77. package/src/vega.ts +10 -0
  78. package/android/src/test/java/com/margelo/nitro/iap/ListenerThreadSafetyTest.kt +0 -154
  79. package/android/src/test/java/com/margelo/nitro/iap/OpenIapExceptionTest.kt +0 -93
  80. package/android/src/test/java/com/margelo/nitro/iap/ProductQueryHelpersTest.kt +0 -140
  81. package/plugin/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// NitroVerifyPurchaseWithIapkitAmazonProps.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 com.margelo.nitro.core.NullType
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "NitroVerifyPurchaseWithIapkitAmazonProps".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class NitroVerifyPurchaseWithIapkitAmazonProps(
20
+ @DoNotStrip
21
+ @Keep
22
+ val receiptId: String,
23
+ @DoNotStrip
24
+ @Keep
25
+ val sandbox: Variant_NullType_Boolean?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val userId: Variant_NullType_String?
29
+ ) {
30
+ /* primary constructor */
31
+
32
+ companion object {
33
+ /**
34
+ * Constructor called from C++
35
+ */
36
+ @DoNotStrip
37
+ @Keep
38
+ @Suppress("unused")
39
+ @JvmStatic
40
+ private fun fromCpp(receiptId: String, sandbox: Variant_NullType_Boolean?, userId: Variant_NullType_String?): NitroVerifyPurchaseWithIapkitAmazonProps {
41
+ return NitroVerifyPurchaseWithIapkitAmazonProps(receiptId, sandbox, userId)
42
+ }
43
+ }
44
+ }
@@ -22,6 +22,9 @@ data class NitroVerifyPurchaseWithIapkitProps(
22
22
  val apiKey: Variant_NullType_String?,
23
23
  @DoNotStrip
24
24
  @Keep
25
+ val amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?,
26
+ @DoNotStrip
27
+ @Keep
25
28
  val apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?,
26
29
  @DoNotStrip
27
30
  @Keep
@@ -37,8 +40,8 @@ data class NitroVerifyPurchaseWithIapkitProps(
37
40
  @Keep
38
41
  @Suppress("unused")
39
42
  @JvmStatic
40
- private fun fromCpp(apiKey: Variant_NullType_String?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?): NitroVerifyPurchaseWithIapkitProps {
41
- return NitroVerifyPurchaseWithIapkitProps(apiKey, apple, google)
43
+ private fun fromCpp(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?): NitroVerifyPurchaseWithIapkitProps {
44
+ return NitroVerifyPurchaseWithIapkitProps(apiKey, amazon, apple, google)
42
45
  }
43
46
  }
44
47
  }
@@ -0,0 +1,53 @@
1
+ ///
2
+ /// Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.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 | NitroVerifyPurchaseWithIapkitAmazonProps".
15
+ */
16
+ @Suppress("ClassName")
17
+ @DoNotStrip
18
+ sealed class Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps {
19
+ @DoNotStrip
20
+ data class First(@DoNotStrip val value: NullType): Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps()
21
+ @DoNotStrip
22
+ data class Second(@DoNotStrip val value: NitroVerifyPurchaseWithIapkitAmazonProps): Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps()
23
+
24
+ val isFirst: Boolean
25
+ get() = this is First
26
+ val isSecond: Boolean
27
+ get() = this is Second
28
+
29
+ fun asFirstOrNull(): NullType? {
30
+ val value = (this as? First)?.value ?: return null
31
+ return value
32
+ }
33
+ fun asSecondOrNull(): NitroVerifyPurchaseWithIapkitAmazonProps? {
34
+ val value = (this as? Second)?.value ?: return null
35
+ return value
36
+ }
37
+
38
+ inline fun <R> match(first: (NullType) -> R, second: (NitroVerifyPurchaseWithIapkitAmazonProps) -> R): R {
39
+ return when (this) {
40
+ is First -> first(value)
41
+ is Second -> second(value)
42
+ }
43
+ }
44
+
45
+ companion object {
46
+ @JvmStatic
47
+ @DoNotStrip
48
+ fun create(value: NullType): Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps = First(value)
49
+ @JvmStatic
50
+ @DoNotStrip
51
+ fun create(value: NitroVerifyPurchaseWithIapkitAmazonProps): Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps = Second(value)
52
+ }
53
+ }
@@ -102,6 +102,8 @@ namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
102
102
  namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
103
103
  // Forward declaration of `NitroValidTimeWindowAndroid` to properly resolve imports.
104
104
  namespace margelo::nitro::iap { struct NitroValidTimeWindowAndroid; }
105
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitAmazonProps` to properly resolve imports.
106
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps; }
105
107
  // Forward declaration of `NitroVerifyPurchaseWithIapkitAppleProps` to properly resolve imports.
106
108
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
107
109
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
@@ -201,6 +203,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
201
203
  #include "NitroSubscriptionRenewalInfo.hpp"
202
204
  #include "NitroSubscriptionStatus.hpp"
203
205
  #include "NitroValidTimeWindowAndroid.hpp"
206
+ #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
204
207
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
205
208
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
206
209
  #include "NitroVerifyPurchaseWithIapkitProps.hpp"
@@ -2975,6 +2978,50 @@ namespace margelo::nitro::iap::bridge::swift {
2975
2978
  return Func_void_NitroVerifyPurchaseWithProviderResult_Wrapper(std::move(value));
2976
2979
  }
2977
2980
 
2981
+ // pragma MARK: std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>
2982
+ /**
2983
+ * Wrapper struct for `std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>`.
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__NitroVerifyPurchaseWithIapkitAmazonProps_ final {
2988
+ std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps> variant;
2989
+ std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps> variant): variant(variant) { }
2990
+ operator std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>() 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 NitroVerifyPurchaseWithIapkitAmazonProps get_1() const noexcept {
3000
+ return std::get<1>(variant);
3001
+ }
3002
+ };
3003
+ inline std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_ create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(nitro::NullType value) noexcept {
3004
+ return std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(value);
3005
+ }
3006
+ inline std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_ create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(const NitroVerifyPurchaseWithIapkitAmazonProps& value) noexcept {
3007
+ return std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(value);
3008
+ }
3009
+
3010
+ // pragma MARK: std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>>
3011
+ /**
3012
+ * Specialized version of `std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>>`.
3013
+ */
3014
+ using std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__ = std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>>;
3015
+ inline std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>> create_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__(const std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>& value) noexcept {
3016
+ return std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>>(value);
3017
+ }
3018
+ inline bool has_value_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__(const std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>>& optional) noexcept {
3019
+ return optional.has_value();
3020
+ }
3021
+ inline std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps> get_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__(const std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>>& optional) noexcept {
3022
+ return optional.value();
3023
+ }
3024
+
2978
3025
  // pragma MARK: std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>
2979
3026
  /**
2980
3027
  * Wrapper struct for `std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>`.
@@ -120,6 +120,8 @@ namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
120
120
  namespace margelo::nitro::iap { struct NitroSubscriptionStatus; }
121
121
  // Forward declaration of `NitroValidTimeWindowAndroid` to properly resolve imports.
122
122
  namespace margelo::nitro::iap { struct NitroValidTimeWindowAndroid; }
123
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitAmazonProps` to properly resolve imports.
124
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps; }
123
125
  // Forward declaration of `NitroVerifyPurchaseWithIapkitAppleProps` to properly resolve imports.
124
126
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
125
127
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
@@ -226,6 +228,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
226
228
  #include "NitroSubscriptionRenewalInfo.hpp"
227
229
  #include "NitroSubscriptionStatus.hpp"
228
230
  #include "NitroValidTimeWindowAndroid.hpp"
231
+ #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
229
232
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
230
233
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
231
234
  #include "NitroVerifyPurchaseWithIapkitProps.hpp"
@@ -136,6 +136,8 @@ namespace margelo::nitro::iap { enum class PurchaseVerificationProvider; }
136
136
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderProps; }
137
137
  // Forward declaration of `NitroVerifyPurchaseWithIapkitProps` to properly resolve imports.
138
138
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitProps; }
139
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitAmazonProps` to properly resolve imports.
140
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps; }
139
141
  // Forward declaration of `NitroVerifyPurchaseWithIapkitAppleProps` to properly resolve imports.
140
142
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
141
143
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
@@ -241,6 +243,7 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
241
243
  #include "PurchaseVerificationProvider.hpp"
242
244
  #include "NitroVerifyPurchaseWithProviderProps.hpp"
243
245
  #include "NitroVerifyPurchaseWithIapkitProps.hpp"
246
+ #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
244
247
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
245
248
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
246
249
  #include "NitroDeepLinkOptionsAndroid.hpp"
@@ -25,6 +25,8 @@ public extension IapStore {
25
25
  self = .google
26
26
  case "horizon":
27
27
  self = .horizon
28
+ case "amazon":
29
+ self = .amazon
28
30
  default:
29
31
  return nil
30
32
  }
@@ -43,6 +45,8 @@ public extension IapStore {
43
45
  return "google"
44
46
  case .horizon:
45
47
  return "horizon"
48
+ case .amazon:
49
+ return "amazon"
46
50
  }
47
51
  }
48
52
  }
@@ -0,0 +1,103 @@
1
+ ///
2
+ /// NitroVerifyPurchaseWithIapkitAmazonProps.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 `NitroVerifyPurchaseWithIapkitAmazonProps`, backed by a C++ struct.
12
+ */
13
+ public typealias NitroVerifyPurchaseWithIapkitAmazonProps = margelo.nitro.iap.NitroVerifyPurchaseWithIapkitAmazonProps
14
+
15
+ public extension NitroVerifyPurchaseWithIapkitAmazonProps {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `NitroVerifyPurchaseWithIapkitAmazonProps`.
20
+ */
21
+ init(receiptId: String, sandbox: Variant_NullType_Bool?, userId: Variant_NullType_String?) {
22
+ self.init(std.string(receiptId), { () -> bridge.std__optional_std__variant_nitro__NullType__bool__ in
23
+ if let __unwrappedValue = sandbox {
24
+ return bridge.create_std__optional_std__variant_nitro__NullType__bool__({ () -> bridge.std__variant_nitro__NullType__bool_ in
25
+ switch __unwrappedValue {
26
+ case .first(let __value):
27
+ return bridge.create_std__variant_nitro__NullType__bool_(margelo.nitro.NullType.null)
28
+ case .second(let __value):
29
+ return bridge.create_std__variant_nitro__NullType__bool_(__value)
30
+ }
31
+ }().variant)
32
+ } else {
33
+ return .init()
34
+ }
35
+ }(), { () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
36
+ if let __unwrappedValue = userId {
37
+ return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
38
+ switch __unwrappedValue {
39
+ case .first(let __value):
40
+ return bridge.create_std__variant_nitro__NullType__std__string_(margelo.nitro.NullType.null)
41
+ case .second(let __value):
42
+ return bridge.create_std__variant_nitro__NullType__std__string_(std.string(__value))
43
+ }
44
+ }().variant)
45
+ } else {
46
+ return .init()
47
+ }
48
+ }())
49
+ }
50
+
51
+ @inline(__always)
52
+ var receiptId: String {
53
+ return String(self.__receiptId)
54
+ }
55
+
56
+ @inline(__always)
57
+ var sandbox: Variant_NullType_Bool? {
58
+ return { () -> Variant_NullType_Bool? in
59
+ if bridge.has_value_std__optional_std__variant_nitro__NullType__bool__(self.__sandbox) {
60
+ let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__bool__(self.__sandbox)
61
+ return { () -> Variant_NullType_Bool in
62
+ let __variant = bridge.std__variant_nitro__NullType__bool_(__unwrapped)
63
+ switch __variant.index() {
64
+ case 0:
65
+ let __actual = __variant.get_0()
66
+ return .first(NullType.null)
67
+ case 1:
68
+ let __actual = __variant.get_1()
69
+ return .second(__actual)
70
+ default:
71
+ fatalError("Variant can never have index \(__variant.index())!")
72
+ }
73
+ }()
74
+ } else {
75
+ return nil
76
+ }
77
+ }()
78
+ }
79
+
80
+ @inline(__always)
81
+ var userId: Variant_NullType_String? {
82
+ return { () -> Variant_NullType_String? in
83
+ if bridge.has_value_std__optional_std__variant_nitro__NullType__std__string__(self.__userId) {
84
+ let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__std__string__(self.__userId)
85
+ return { () -> Variant_NullType_String in
86
+ let __variant = bridge.std__variant_nitro__NullType__std__string_(__unwrapped)
87
+ switch __variant.index() {
88
+ case 0:
89
+ let __actual = __variant.get_0()
90
+ return .first(NullType.null)
91
+ case 1:
92
+ let __actual = __variant.get_1()
93
+ return .second(String(__actual))
94
+ default:
95
+ fatalError("Variant can never have index \(__variant.index())!")
96
+ }
97
+ }()
98
+ } else {
99
+ return nil
100
+ }
101
+ }()
102
+ }
103
+ }
@@ -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?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?) {
21
+ init(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?) {
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
@@ -32,6 +32,19 @@ public extension NitroVerifyPurchaseWithIapkitProps {
32
32
  } else {
33
33
  return .init()
34
34
  }
35
+ }(), { () -> bridge.std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__ in
36
+ if let __unwrappedValue = amazon {
37
+ return bridge.create_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__({ () -> bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_ in
38
+ switch __unwrappedValue {
39
+ case .first(let __value):
40
+ return bridge.create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(margelo.nitro.NullType.null)
41
+ case .second(let __value):
42
+ return bridge.create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(__value)
43
+ }
44
+ }().variant)
45
+ } else {
46
+ return .init()
47
+ }
35
48
  }(), { () -> bridge.std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAppleProps__ in
36
49
  if let __unwrappedValue = apple {
37
50
  return bridge.create_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAppleProps__({ () -> bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAppleProps_ in
@@ -85,6 +98,30 @@ public extension NitroVerifyPurchaseWithIapkitProps {
85
98
  }()
86
99
  }
87
100
 
101
+ @inline(__always)
102
+ var amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps? {
103
+ return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps? in
104
+ if bridge.has_value_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__(self.__amazon) {
105
+ let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps__(self.__amazon)
106
+ return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps in
107
+ let __variant = bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitAmazonProps_(__unwrapped)
108
+ switch __variant.index() {
109
+ case 0:
110
+ let __actual = __variant.get_0()
111
+ return .first(NullType.null)
112
+ case 1:
113
+ let __actual = __variant.get_1()
114
+ return .second(__actual)
115
+ default:
116
+ fatalError("Variant can never have index \(__variant.index())!")
117
+ }
118
+ }()
119
+ } else {
120
+ return nil
121
+ }
122
+ }()
123
+ }
124
+
88
125
  @inline(__always)
89
126
  var apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps? {
90
127
  return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps? in
@@ -0,0 +1,18 @@
1
+ ///
2
+ /// Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.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_NitroVerifyPurchaseWithIapkitAmazonProps {
16
+ case first(NullType)
17
+ case second(NitroVerifyPurchaseWithIapkitAmazonProps)
18
+ }
@@ -33,6 +33,7 @@ namespace margelo::nitro::iap {
33
33
  APPLE SWIFT_NAME(apple) = 1,
34
34
  GOOGLE SWIFT_NAME(google) = 2,
35
35
  HORIZON SWIFT_NAME(horizon) = 3,
36
+ AMAZON SWIFT_NAME(amazon) = 4,
36
37
  } CLOSED_ENUM;
37
38
 
38
39
  } // namespace margelo::nitro::iap
@@ -49,6 +50,7 @@ namespace margelo::nitro {
49
50
  case hashString("apple"): return margelo::nitro::iap::IapStore::APPLE;
50
51
  case hashString("google"): return margelo::nitro::iap::IapStore::GOOGLE;
51
52
  case hashString("horizon"): return margelo::nitro::iap::IapStore::HORIZON;
53
+ case hashString("amazon"): return margelo::nitro::iap::IapStore::AMAZON;
52
54
  default: [[unlikely]]
53
55
  throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum IapStore - invalid value!");
54
56
  }
@@ -59,6 +61,7 @@ namespace margelo::nitro {
59
61
  case margelo::nitro::iap::IapStore::APPLE: return JSIConverter<std::string>::toJSI(runtime, "apple");
60
62
  case margelo::nitro::iap::IapStore::GOOGLE: return JSIConverter<std::string>::toJSI(runtime, "google");
61
63
  case margelo::nitro::iap::IapStore::HORIZON: return JSIConverter<std::string>::toJSI(runtime, "horizon");
64
+ case margelo::nitro::iap::IapStore::AMAZON: return JSIConverter<std::string>::toJSI(runtime, "amazon");
62
65
  default: [[unlikely]]
63
66
  throw std::invalid_argument("Cannot convert IapStore to JS - invalid value: "
64
67
  + std::to_string(static_cast<int>(arg)) + "!");
@@ -74,6 +77,7 @@ namespace margelo::nitro {
74
77
  case hashString("apple"):
75
78
  case hashString("google"):
76
79
  case hashString("horizon"):
80
+ case hashString("amazon"):
77
81
  return true;
78
82
  default:
79
83
  return false;
@@ -0,0 +1,94 @@
1
+ ///
2
+ /// NitroVerifyPurchaseWithIapkitAmazonProps.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 (NitroVerifyPurchaseWithIapkitAmazonProps).
42
+ */
43
+ struct NitroVerifyPurchaseWithIapkitAmazonProps final {
44
+ public:
45
+ std::string receiptId SWIFT_PRIVATE;
46
+ std::optional<std::variant<nitro::NullType, bool>> sandbox SWIFT_PRIVATE;
47
+ std::optional<std::variant<nitro::NullType, std::string>> userId SWIFT_PRIVATE;
48
+
49
+ public:
50
+ NitroVerifyPurchaseWithIapkitAmazonProps() = default;
51
+ explicit NitroVerifyPurchaseWithIapkitAmazonProps(std::string receiptId, std::optional<std::variant<nitro::NullType, bool>> sandbox, std::optional<std::variant<nitro::NullType, std::string>> userId): receiptId(receiptId), sandbox(sandbox), userId(userId) {}
52
+
53
+ public:
54
+ friend bool operator==(const NitroVerifyPurchaseWithIapkitAmazonProps& lhs, const NitroVerifyPurchaseWithIapkitAmazonProps& rhs) = default;
55
+ };
56
+
57
+ } // namespace margelo::nitro::iap
58
+
59
+ namespace margelo::nitro {
60
+
61
+ // C++ NitroVerifyPurchaseWithIapkitAmazonProps <> JS NitroVerifyPurchaseWithIapkitAmazonProps (object)
62
+ template <>
63
+ struct JSIConverter<margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps> final {
64
+ static inline margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ jsi::Object obj = arg.asObject(runtime);
66
+ return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps(
67
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptId"))),
68
+ JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sandbox"))),
69
+ JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))
70
+ );
71
+ }
72
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps& arg) {
73
+ jsi::Object obj(runtime);
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "receiptId"), JSIConverter<std::string>::toJSI(runtime, arg.receiptId));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sandbox"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.sandbox));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "userId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.userId));
77
+ return obj;
78
+ }
79
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
80
+ if (!value.isObject()) {
81
+ return false;
82
+ }
83
+ jsi::Object obj = value.getObject(runtime);
84
+ if (!nitro::isPlainObject(runtime, obj)) {
85
+ return false;
86
+ }
87
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receiptId")))) return false;
88
+ if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sandbox")))) return false;
89
+ if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))) return false;
90
+ return true;
91
+ }
92
+ };
93
+
94
+ } // namespace margelo::nitro
@@ -28,6 +28,8 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
+ // Forward declaration of `NitroVerifyPurchaseWithIapkitAmazonProps` to properly resolve imports.
32
+ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAmazonProps; }
31
33
  // Forward declaration of `NitroVerifyPurchaseWithIapkitAppleProps` to properly resolve imports.
32
34
  namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitAppleProps; }
33
35
  // Forward declaration of `NitroVerifyPurchaseWithIapkitGoogleProps` to properly resolve imports.
@@ -37,6 +39,7 @@ namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitGoogleProps;
37
39
  #include <string>
38
40
  #include <variant>
39
41
  #include <optional>
42
+ #include "NitroVerifyPurchaseWithIapkitAmazonProps.hpp"
40
43
  #include "NitroVerifyPurchaseWithIapkitAppleProps.hpp"
41
44
  #include "NitroVerifyPurchaseWithIapkitGoogleProps.hpp"
42
45
 
@@ -48,12 +51,13 @@ namespace margelo::nitro::iap {
48
51
  struct NitroVerifyPurchaseWithIapkitProps final {
49
52
  public:
50
53
  std::optional<std::variant<nitro::NullType, std::string>> apiKey SWIFT_PRIVATE;
54
+ std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>> amazon SWIFT_PRIVATE;
51
55
  std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple SWIFT_PRIVATE;
52
56
  std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google SWIFT_PRIVATE;
53
57
 
54
58
  public:
55
59
  NitroVerifyPurchaseWithIapkitProps() = default;
56
- explicit NitroVerifyPurchaseWithIapkitProps(std::optional<std::variant<nitro::NullType, std::string>> apiKey, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google): apiKey(apiKey), apple(apple), google(google) {}
60
+ 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, NitroVerifyPurchaseWithIapkitGoogleProps>> google): apiKey(apiKey), amazon(amazon), apple(apple), google(google) {}
57
61
 
58
62
  public:
59
63
  friend bool operator==(const NitroVerifyPurchaseWithIapkitProps& lhs, const NitroVerifyPurchaseWithIapkitProps& rhs) = default;
@@ -70,6 +74,7 @@ namespace margelo::nitro {
70
74
  jsi::Object obj = arg.asObject(runtime);
71
75
  return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitProps(
72
76
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apiKey"))),
77
+ JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amazon"))),
73
78
  JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple"))),
74
79
  JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))
75
80
  );
@@ -77,6 +82,7 @@ namespace margelo::nitro {
77
82
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitProps& arg) {
78
83
  jsi::Object obj(runtime);
79
84
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "apiKey"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.apiKey));
85
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "amazon"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps>>>::toJSI(runtime, arg.amazon));
80
86
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "apple"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::toJSI(runtime, arg.apple));
81
87
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "google"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::toJSI(runtime, arg.google));
82
88
  return obj;
@@ -90,6 +96,7 @@ namespace margelo::nitro {
90
96
  return false;
91
97
  }
92
98
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apiKey")))) return false;
99
+ if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amazon")))) return false;
93
100
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple")))) return false;
94
101
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))) return false;
95
102
  return true;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "spec": "2.0.3",
3
- "google": "2.2.4",
3
+ "google": "2.3.0-rc.1",
4
4
  "apple": "2.2.4"
5
5
  }