react-native-iap 16.1.0 → 16.2.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 (46) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +1 -1
  2. package/ios/RnIapHelper.swift +22 -0
  3. package/lib/module/index.js +4 -2
  4. package/lib/module/index.js.map +1 -1
  5. package/lib/module/types.js.map +1 -1
  6. package/lib/typescript/src/index.d.ts +4 -2
  7. package/lib/typescript/src/index.d.ts.map +1 -1
  8. package/lib/typescript/src/specs/RnIap.nitro.d.ts +4 -2
  9. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  10. package/lib/typescript/src/types.d.ts +23 -7
  11. package/lib/typescript/src/types.d.ts.map +1 -1
  12. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
  13. package/nitrogen/generated/android/c++/JAdvancedCommerceInfoIOS.hpp +10 -1
  14. package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +5 -0
  15. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
  16. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +5 -0
  17. package/nitrogen/generated/android/c++/JNitroPurchaseVerificationResultIOS.hpp +5 -0
  18. package/nitrogen/generated/android/c++/JPurchase.hpp +5 -0
  19. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +5 -0
  20. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +5 -0
  21. package/nitrogen/generated/android/c++/JSubscriptionPeriodIOS.hpp +67 -0
  22. package/nitrogen/generated/android/c++/JSubscriptionPeriodValueIOS.hpp +62 -0
  23. package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.hpp +5 -0
  24. package/nitrogen/generated/android/c++/JVariant_NullType_AdvancedCommerceInfoIOS.hpp +5 -0
  25. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchase.hpp +5 -0
  26. package/nitrogen/generated/android/c++/JVariant_NullType_SubscriptionPeriodValueIOS.cpp +26 -0
  27. package/nitrogen/generated/android/c++/JVariant_NullType_SubscriptionPeriodValueIOS.hpp +73 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AdvancedCommerceInfoIOS.kt +7 -2
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubscriptionPeriodIOS.kt +26 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubscriptionPeriodValueIOS.kt +56 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS.kt +62 -0
  32. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +50 -0
  33. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
  34. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
  35. package/nitrogen/generated/ios/swift/AdvancedCommerceInfoIOS.swift +38 -1
  36. package/nitrogen/generated/ios/swift/SubscriptionPeriodIOS.swift +52 -0
  37. package/nitrogen/generated/ios/swift/SubscriptionPeriodValueIOS.swift +34 -0
  38. package/nitrogen/generated/ios/swift/Variant_NullType_SubscriptionPeriodValueIOS.swift +30 -0
  39. package/nitrogen/generated/shared/c++/AdvancedCommerceInfoIOS.hpp +8 -1
  40. package/nitrogen/generated/shared/c++/SubscriptionPeriodIOS.hpp +88 -0
  41. package/nitrogen/generated/shared/c++/SubscriptionPeriodValueIOS.hpp +88 -0
  42. package/openiap-versions.json +3 -3
  43. package/package.json +1 -1
  44. package/src/index.ts +4 -2
  45. package/src/specs/RnIap.nitro.ts +9 -15
  46. package/src/types.ts +23 -7
@@ -0,0 +1,73 @@
1
+ ///
2
+ /// JVariant_NullType_SubscriptionPeriodValueIOS.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
+ #include <fbjni/fbjni.h>
11
+ #include <variant>
12
+
13
+ #include <NitroModules/Null.hpp>
14
+ #include "SubscriptionPeriodValueIOS.hpp"
15
+ #include <variant>
16
+ #include <NitroModules/JNull.hpp>
17
+ #include "JSubscriptionPeriodValueIOS.hpp"
18
+ #include "SubscriptionPeriodIOS.hpp"
19
+ #include "JSubscriptionPeriodIOS.hpp"
20
+
21
+ namespace margelo::nitro::iap {
22
+
23
+ using namespace facebook;
24
+
25
+ /**
26
+ * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_SubscriptionPeriodValueIOS".
27
+ */
28
+ class JVariant_NullType_SubscriptionPeriodValueIOS: public jni::JavaClass<JVariant_NullType_SubscriptionPeriodValueIOS> {
29
+ public:
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS;";
31
+
32
+ static jni::local_ref<JVariant_NullType_SubscriptionPeriodValueIOS> create_0(jni::alias_ref<JNull> value) {
33
+ static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_SubscriptionPeriodValueIOS(jni::alias_ref<JNull>)>("create");
34
+ return method(javaClassStatic(), value);
35
+ }
36
+ static jni::local_ref<JVariant_NullType_SubscriptionPeriodValueIOS> create_1(jni::alias_ref<JSubscriptionPeriodValueIOS> value) {
37
+ static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_SubscriptionPeriodValueIOS(jni::alias_ref<JSubscriptionPeriodValueIOS>)>("create");
38
+ return method(javaClassStatic(), value);
39
+ }
40
+
41
+ static jni::local_ref<JVariant_NullType_SubscriptionPeriodValueIOS> fromCpp(const std::variant<nitro::NullType, SubscriptionPeriodValueIOS>& variant) {
42
+ switch (variant.index()) {
43
+ case 0: return create_0(JNull::null());
44
+ case 1: return create_1(JSubscriptionPeriodValueIOS::fromCpp(std::get<1>(variant)));
45
+ default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
46
+ }
47
+ }
48
+
49
+ [[nodiscard]] std::variant<nitro::NullType, SubscriptionPeriodValueIOS> toCpp() const;
50
+ };
51
+
52
+ namespace JVariant_NullType_SubscriptionPeriodValueIOS_impl {
53
+ class First final: public jni::JavaClass<First, JVariant_NullType_SubscriptionPeriodValueIOS> {
54
+ public:
55
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS$First;";
56
+
57
+ [[nodiscard]] jni::local_ref<JNull> getValue() const {
58
+ static const auto field = javaClassStatic()->getField<JNull>("value");
59
+ return getFieldValue(field);
60
+ }
61
+ };
62
+
63
+ class Second final: public jni::JavaClass<Second, JVariant_NullType_SubscriptionPeriodValueIOS> {
64
+ public:
65
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_SubscriptionPeriodValueIOS$Second;";
66
+
67
+ [[nodiscard]] jni::local_ref<JSubscriptionPeriodValueIOS> getValue() const {
68
+ static const auto field = javaClassStatic()->getField<JSubscriptionPeriodValueIOS>("value");
69
+ return getFieldValue(field);
70
+ }
71
+ };
72
+ } // namespace JVariant_NullType_SubscriptionPeriodValueIOS_impl
73
+ } // namespace margelo::nitro::iap
@@ -32,6 +32,9 @@ data class AdvancedCommerceInfoIOS(
32
32
  val items: Array<AdvancedCommerceItemIOS>,
33
33
  @DoNotStrip
34
34
  @Keep
35
+ val period: Variant_NullType_SubscriptionPeriodValueIOS?,
36
+ @DoNotStrip
37
+ @Keep
35
38
  val requestReferenceId: Variant_NullType_String?,
36
39
  @DoNotStrip
37
40
  @Keep
@@ -52,6 +55,7 @@ data class AdvancedCommerceInfoIOS(
52
55
  && Objects.deepEquals(this.displayName, other.displayName)
53
56
  && Objects.deepEquals(this.estimatedTax, other.estimatedTax)
54
57
  && Objects.deepEquals(this.items, other.items)
58
+ && Objects.deepEquals(this.period, other.period)
55
59
  && Objects.deepEquals(this.requestReferenceId, other.requestReferenceId)
56
60
  && Objects.deepEquals(this.taxCode, other.taxCode)
57
61
  && Objects.deepEquals(this.taxExclusivePrice, other.taxExclusivePrice)
@@ -64,6 +68,7 @@ data class AdvancedCommerceInfoIOS(
64
68
  displayName,
65
69
  estimatedTax,
66
70
  items,
71
+ period,
67
72
  requestReferenceId,
68
73
  taxCode,
69
74
  taxExclusivePrice,
@@ -79,8 +84,8 @@ data class AdvancedCommerceInfoIOS(
79
84
  @Keep
80
85
  @Suppress("unused")
81
86
  @JvmStatic
82
- private fun fromCpp(description: Variant_NullType_String?, displayName: Variant_NullType_String?, estimatedTax: Variant_NullType_String?, items: Array<AdvancedCommerceItemIOS>, requestReferenceId: Variant_NullType_String?, taxCode: Variant_NullType_String?, taxExclusivePrice: Variant_NullType_String?, taxRate: Variant_NullType_String?): AdvancedCommerceInfoIOS {
83
- return AdvancedCommerceInfoIOS(description, displayName, estimatedTax, items, requestReferenceId, taxCode, taxExclusivePrice, taxRate)
87
+ private fun fromCpp(description: Variant_NullType_String?, displayName: Variant_NullType_String?, estimatedTax: Variant_NullType_String?, items: Array<AdvancedCommerceItemIOS>, period: Variant_NullType_SubscriptionPeriodValueIOS?, requestReferenceId: Variant_NullType_String?, taxCode: Variant_NullType_String?, taxExclusivePrice: Variant_NullType_String?, taxRate: Variant_NullType_String?): AdvancedCommerceInfoIOS {
88
+ return AdvancedCommerceInfoIOS(description, displayName, estimatedTax, items, period, requestReferenceId, taxCode, taxExclusivePrice, taxRate)
84
89
  }
85
90
  }
86
91
  }
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// SubscriptionPeriodIOS.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 "SubscriptionPeriodIOS".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class SubscriptionPeriodIOS(@DoNotStrip @Keep val value: Int) {
19
+ EMPTY(0),
20
+ DAY(1),
21
+ WEEK(2),
22
+ MONTH(3),
23
+ YEAR(4);
24
+
25
+ companion object
26
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// SubscriptionPeriodValueIOS.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
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "SubscriptionPeriodValueIOS".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class SubscriptionPeriodValueIOS(
21
+ @DoNotStrip
22
+ @Keep
23
+ val unit: SubscriptionPeriodIOS,
24
+ @DoNotStrip
25
+ @Keep
26
+ val value: Double
27
+ ) {
28
+ /* primary constructor */
29
+
30
+ override fun equals(other: Any?): Boolean {
31
+ if (this === other) return true
32
+ if (other !is SubscriptionPeriodValueIOS) return false
33
+ return Objects.deepEquals(this.unit, other.unit)
34
+ && Objects.deepEquals(this.value, other.value)
35
+ }
36
+
37
+ override fun hashCode(): Int {
38
+ return arrayOf<Any?>(
39
+ unit,
40
+ value
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(unit: SubscriptionPeriodIOS, value: Double): SubscriptionPeriodValueIOS {
53
+ return SubscriptionPeriodValueIOS(unit, value)
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// Variant_NullType_SubscriptionPeriodValueIOS.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 | SubscriptionPeriodValueIOS".
15
+ */
16
+ @Suppress("ClassName")
17
+ @DoNotStrip
18
+ sealed class Variant_NullType_SubscriptionPeriodValueIOS {
19
+ @DoNotStrip
20
+ data class First(@DoNotStrip val value: NullType): Variant_NullType_SubscriptionPeriodValueIOS()
21
+ @DoNotStrip
22
+ data class Second(@DoNotStrip val value: SubscriptionPeriodValueIOS): Variant_NullType_SubscriptionPeriodValueIOS()
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: (SubscriptionPeriodValueIOS) -> 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(): SubscriptionPeriodValueIOS? {
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_SubscriptionPeriodValueIOS = First(value)
58
+ @JvmStatic
59
+ @DoNotStrip
60
+ fun create(value: SubscriptionPeriodValueIOS): Variant_NullType_SubscriptionPeriodValueIOS = Second(value)
61
+ }
62
+ }
@@ -152,6 +152,10 @@ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
152
152
  namespace margelo::nitro::iap { enum class SubResponseCodeAndroid; }
153
153
  // Forward declaration of `SubscriptionBillingPlanTypeIOS` to properly resolve imports.
154
154
  namespace margelo::nitro::iap { enum class SubscriptionBillingPlanTypeIOS; }
155
+ // Forward declaration of `SubscriptionPeriodIOS` to properly resolve imports.
156
+ namespace margelo::nitro::iap { enum class SubscriptionPeriodIOS; }
157
+ // Forward declaration of `SubscriptionPeriodValueIOS` to properly resolve imports.
158
+ namespace margelo::nitro::iap { struct SubscriptionPeriodValueIOS; }
155
159
  // Forward declaration of `SubscriptionProductReplacementParamsAndroid` to properly resolve imports.
156
160
  namespace margelo::nitro::iap { struct SubscriptionProductReplacementParamsAndroid; }
157
161
  // Forward declaration of `SubscriptionReplacementModeAndroid` to properly resolve imports.
@@ -240,6 +244,8 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
240
244
  #include "RenewalInfoIOS.hpp"
241
245
  #include "SubResponseCodeAndroid.hpp"
242
246
  #include "SubscriptionBillingPlanTypeIOS.hpp"
247
+ #include "SubscriptionPeriodIOS.hpp"
248
+ #include "SubscriptionPeriodValueIOS.hpp"
243
249
  #include "SubscriptionProductReplacementParamsAndroid.hpp"
244
250
  #include "SubscriptionReplacementModeAndroid.hpp"
245
251
  #include "TransactionCommitmentInfoIOS.hpp"
@@ -795,6 +801,50 @@ namespace margelo::nitro::iap::bridge::swift {
795
801
  return vector;
796
802
  }
797
803
 
804
+ // pragma MARK: std::variant<nitro::NullType, SubscriptionPeriodValueIOS>
805
+ /**
806
+ * Wrapper struct for `std::variant<nitro::NullType, SubscriptionPeriodValueIOS>`.
807
+ * std::variant cannot be used in Swift because of a Swift bug.
808
+ * Not even specializing it works. So we create a wrapper struct.
809
+ */
810
+ struct std__variant_nitro__NullType__SubscriptionPeriodValueIOS_ final {
811
+ std::variant<nitro::NullType, SubscriptionPeriodValueIOS> variant;
812
+ std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(std::variant<nitro::NullType, SubscriptionPeriodValueIOS> variant): variant(variant) { }
813
+ operator std::variant<nitro::NullType, SubscriptionPeriodValueIOS>() const noexcept {
814
+ return variant;
815
+ }
816
+ inline size_t index() const noexcept {
817
+ return variant.index();
818
+ }
819
+ inline nitro::NullType get_0() const noexcept {
820
+ return std::get<0>(variant);
821
+ }
822
+ inline SubscriptionPeriodValueIOS get_1() const noexcept {
823
+ return std::get<1>(variant);
824
+ }
825
+ };
826
+ inline std__variant_nitro__NullType__SubscriptionPeriodValueIOS_ create_std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(nitro::NullType value) noexcept {
827
+ return std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(value);
828
+ }
829
+ inline std__variant_nitro__NullType__SubscriptionPeriodValueIOS_ create_std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(const SubscriptionPeriodValueIOS& value) noexcept {
830
+ return std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(value);
831
+ }
832
+
833
+ // pragma MARK: std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>>
834
+ /**
835
+ * Specialized version of `std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>>`.
836
+ */
837
+ using std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__ = std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>>;
838
+ inline std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>> create_std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__(const std::variant<nitro::NullType, SubscriptionPeriodValueIOS>& value) noexcept {
839
+ return std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>>(value);
840
+ }
841
+ inline bool has_value_std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__(const std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>>& optional) noexcept {
842
+ return optional.has_value();
843
+ }
844
+ inline std::variant<nitro::NullType, SubscriptionPeriodValueIOS> get_std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__(const std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>>& optional) noexcept {
845
+ return optional.value();
846
+ }
847
+
798
848
  // pragma MARK: std::variant<nitro::NullType, AdvancedCommerceInfoIOS>
799
849
  /**
800
850
  * Wrapper struct for `std::variant<nitro::NullType, AdvancedCommerceInfoIOS>`.
@@ -178,6 +178,10 @@ namespace margelo::nitro::iap { struct RenewalInfoIOS; }
178
178
  namespace margelo::nitro::iap { enum class SubResponseCodeAndroid; }
179
179
  // Forward declaration of `SubscriptionBillingPlanTypeIOS` to properly resolve imports.
180
180
  namespace margelo::nitro::iap { enum class SubscriptionBillingPlanTypeIOS; }
181
+ // Forward declaration of `SubscriptionPeriodIOS` to properly resolve imports.
182
+ namespace margelo::nitro::iap { enum class SubscriptionPeriodIOS; }
183
+ // Forward declaration of `SubscriptionPeriodValueIOS` to properly resolve imports.
184
+ namespace margelo::nitro::iap { struct SubscriptionPeriodValueIOS; }
181
185
  // Forward declaration of `SubscriptionProductReplacementParamsAndroid` to properly resolve imports.
182
186
  namespace margelo::nitro::iap { struct SubscriptionProductReplacementParamsAndroid; }
183
187
  // Forward declaration of `SubscriptionReplacementModeAndroid` to properly resolve imports.
@@ -275,6 +279,8 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
275
279
  #include "RenewalInfoIOS.hpp"
276
280
  #include "SubResponseCodeAndroid.hpp"
277
281
  #include "SubscriptionBillingPlanTypeIOS.hpp"
282
+ #include "SubscriptionPeriodIOS.hpp"
283
+ #include "SubscriptionPeriodValueIOS.hpp"
278
284
  #include "SubscriptionProductReplacementParamsAndroid.hpp"
279
285
  #include "SubscriptionReplacementModeAndroid.hpp"
280
286
  #include "TransactionCommitmentInfoIOS.hpp"
@@ -42,6 +42,10 @@ namespace margelo::nitro::iap { struct AdvancedCommerceItemIOS; }
42
42
  namespace margelo::nitro::iap { struct AdvancedCommerceItemDetailsIOS; }
43
43
  // Forward declaration of `AdvancedCommerceRefundIOS` to properly resolve imports.
44
44
  namespace margelo::nitro::iap { struct AdvancedCommerceRefundIOS; }
45
+ // Forward declaration of `SubscriptionPeriodValueIOS` to properly resolve imports.
46
+ namespace margelo::nitro::iap { struct SubscriptionPeriodValueIOS; }
47
+ // Forward declaration of `SubscriptionPeriodIOS` to properly resolve imports.
48
+ namespace margelo::nitro::iap { enum class SubscriptionPeriodIOS; }
45
49
  // Forward declaration of `SubscriptionBillingPlanTypeIOS` to properly resolve imports.
46
50
  namespace margelo::nitro::iap { enum class SubscriptionBillingPlanTypeIOS; }
47
51
  // Forward declaration of `TransactionCommitmentInfoIOS` to properly resolve imports.
@@ -212,6 +216,8 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
212
216
  #include "AdvancedCommerceItemIOS.hpp"
213
217
  #include "AdvancedCommerceItemDetailsIOS.hpp"
214
218
  #include "AdvancedCommerceRefundIOS.hpp"
219
+ #include "SubscriptionPeriodValueIOS.hpp"
220
+ #include "SubscriptionPeriodIOS.hpp"
215
221
  #include "SubscriptionBillingPlanTypeIOS.hpp"
216
222
  #include "TransactionCommitmentInfoIOS.hpp"
217
223
  #include "PurchaseOfferIOS.hpp"
@@ -18,7 +18,7 @@ public extension AdvancedCommerceInfoIOS {
18
18
  /**
19
19
  * Create a new instance of `AdvancedCommerceInfoIOS`.
20
20
  */
21
- init(description: Variant_NullType_String?, displayName: Variant_NullType_String?, estimatedTax: Variant_NullType_String?, items: [AdvancedCommerceItemIOS], requestReferenceId: Variant_NullType_String?, taxCode: Variant_NullType_String?, taxExclusivePrice: Variant_NullType_String?, taxRate: Variant_NullType_String?) {
21
+ init(description: Variant_NullType_String?, displayName: Variant_NullType_String?, estimatedTax: Variant_NullType_String?, items: [AdvancedCommerceItemIOS], period: Variant_NullType_SubscriptionPeriodValueIOS?, requestReferenceId: Variant_NullType_String?, taxCode: Variant_NullType_String?, taxExclusivePrice: Variant_NullType_String?, taxRate: Variant_NullType_String?) {
22
22
  self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
23
23
  if let __unwrappedValue = description {
24
24
  return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
@@ -64,6 +64,19 @@ public extension AdvancedCommerceInfoIOS {
64
64
  __vector.push_back(__item)
65
65
  }
66
66
  return __vector
67
+ }(), { () -> bridge.std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__ in
68
+ if let __unwrappedValue = period {
69
+ return bridge.create_std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__({ () -> bridge.std__variant_nitro__NullType__SubscriptionPeriodValueIOS_ in
70
+ switch __unwrappedValue {
71
+ case .first(let __value):
72
+ return bridge.create_std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(margelo.nitro.NullType.null)
73
+ case .second(let __value):
74
+ return bridge.create_std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(__value)
75
+ }
76
+ }().variant)
77
+ } else {
78
+ return .init()
79
+ }
67
80
  }(), { () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
68
81
  if let __unwrappedValue = requestReferenceId {
69
82
  return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
@@ -196,6 +209,30 @@ public extension AdvancedCommerceInfoIOS {
196
209
  return self.__items.map({ __item in __item })
197
210
  }
198
211
 
212
+ @inline(__always)
213
+ var period: Variant_NullType_SubscriptionPeriodValueIOS? {
214
+ return { () -> Variant_NullType_SubscriptionPeriodValueIOS? in
215
+ if bridge.has_value_std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__(self.__period) {
216
+ let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__SubscriptionPeriodValueIOS__(self.__period)
217
+ return { () -> Variant_NullType_SubscriptionPeriodValueIOS in
218
+ let __variant = bridge.std__variant_nitro__NullType__SubscriptionPeriodValueIOS_(__unwrapped)
219
+ switch __variant.index() {
220
+ case 0:
221
+ let __actual = __variant.get_0()
222
+ return .first(NullType.null)
223
+ case 1:
224
+ let __actual = __variant.get_1()
225
+ return .second(__actual)
226
+ default:
227
+ fatalError("Variant can never have index \(__variant.index())!")
228
+ }
229
+ }()
230
+ } else {
231
+ return nil
232
+ }
233
+ }()
234
+ }
235
+
199
236
  @inline(__always)
200
237
  var requestReferenceId: Variant_NullType_String? {
201
238
  return { () -> Variant_NullType_String? in
@@ -0,0 +1,52 @@
1
+ ///
2
+ /// SubscriptionPeriodIOS.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 `SubscriptionPeriodIOS`, backed by a C++ enum.
10
+ */
11
+ public typealias SubscriptionPeriodIOS = margelo.nitro.iap.SubscriptionPeriodIOS
12
+
13
+ public extension SubscriptionPeriodIOS {
14
+ /**
15
+ * Get a SubscriptionPeriodIOS 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 "empty":
21
+ self = .empty
22
+ case "day":
23
+ self = .day
24
+ case "week":
25
+ self = .week
26
+ case "month":
27
+ self = .month
28
+ case "year":
29
+ self = .year
30
+ default:
31
+ return nil
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Get the String value this SubscriptionPeriodIOS represents.
37
+ */
38
+ var stringValue: String {
39
+ switch self {
40
+ case .empty:
41
+ return "empty"
42
+ case .day:
43
+ return "day"
44
+ case .week:
45
+ return "week"
46
+ case .month:
47
+ return "month"
48
+ case .year:
49
+ return "year"
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// SubscriptionPeriodValueIOS.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 `SubscriptionPeriodValueIOS`, backed by a C++ struct.
12
+ */
13
+ public typealias SubscriptionPeriodValueIOS = margelo.nitro.iap.SubscriptionPeriodValueIOS
14
+
15
+ public extension SubscriptionPeriodValueIOS {
16
+ private typealias bridge = margelo.nitro.iap.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `SubscriptionPeriodValueIOS`.
20
+ */
21
+ init(unit: SubscriptionPeriodIOS, value: Double) {
22
+ self.init(unit, value)
23
+ }
24
+
25
+ @inline(__always)
26
+ var unit: SubscriptionPeriodIOS {
27
+ return self.__unit
28
+ }
29
+
30
+ @inline(__always)
31
+ var value: Double {
32
+ return self.__value
33
+ }
34
+ }
@@ -0,0 +1,30 @@
1
+ ///
2
+ /// Variant_NullType_SubscriptionPeriodValueIOS.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_SubscriptionPeriodValueIOS {
16
+ case first(NullType)
17
+ case second(SubscriptionPeriodValueIOS)
18
+ }
19
+
20
+ public extension Variant_NullType_SubscriptionPeriodValueIOS {
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
+ }
@@ -30,6 +30,8 @@
30
30
 
31
31
  // Forward declaration of `AdvancedCommerceItemIOS` to properly resolve imports.
32
32
  namespace margelo::nitro::iap { struct AdvancedCommerceItemIOS; }
33
+ // Forward declaration of `SubscriptionPeriodValueIOS` to properly resolve imports.
34
+ namespace margelo::nitro::iap { struct SubscriptionPeriodValueIOS; }
33
35
 
34
36
  #include <NitroModules/Null.hpp>
35
37
  #include <string>
@@ -37,6 +39,7 @@ namespace margelo::nitro::iap { struct AdvancedCommerceItemIOS; }
37
39
  #include <optional>
38
40
  #include "AdvancedCommerceItemIOS.hpp"
39
41
  #include <vector>
42
+ #include "SubscriptionPeriodValueIOS.hpp"
40
43
 
41
44
  namespace margelo::nitro::iap {
42
45
 
@@ -49,6 +52,7 @@ namespace margelo::nitro::iap {
49
52
  std::optional<std::variant<nitro::NullType, std::string>> displayName SWIFT_PRIVATE;
50
53
  std::optional<std::variant<nitro::NullType, std::string>> estimatedTax SWIFT_PRIVATE;
51
54
  std::vector<AdvancedCommerceItemIOS> items SWIFT_PRIVATE;
55
+ std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>> period SWIFT_PRIVATE;
52
56
  std::optional<std::variant<nitro::NullType, std::string>> requestReferenceId SWIFT_PRIVATE;
53
57
  std::optional<std::variant<nitro::NullType, std::string>> taxCode SWIFT_PRIVATE;
54
58
  std::optional<std::variant<nitro::NullType, std::string>> taxExclusivePrice SWIFT_PRIVATE;
@@ -56,7 +60,7 @@ namespace margelo::nitro::iap {
56
60
 
57
61
  public:
58
62
  AdvancedCommerceInfoIOS() = default;
59
- explicit AdvancedCommerceInfoIOS(std::optional<std::variant<nitro::NullType, std::string>> description, std::optional<std::variant<nitro::NullType, std::string>> displayName, std::optional<std::variant<nitro::NullType, std::string>> estimatedTax, std::vector<AdvancedCommerceItemIOS> items, std::optional<std::variant<nitro::NullType, std::string>> requestReferenceId, std::optional<std::variant<nitro::NullType, std::string>> taxCode, std::optional<std::variant<nitro::NullType, std::string>> taxExclusivePrice, std::optional<std::variant<nitro::NullType, std::string>> taxRate): description(description), displayName(displayName), estimatedTax(estimatedTax), items(items), requestReferenceId(requestReferenceId), taxCode(taxCode), taxExclusivePrice(taxExclusivePrice), taxRate(taxRate) {}
63
+ explicit AdvancedCommerceInfoIOS(std::optional<std::variant<nitro::NullType, std::string>> description, std::optional<std::variant<nitro::NullType, std::string>> displayName, std::optional<std::variant<nitro::NullType, std::string>> estimatedTax, std::vector<AdvancedCommerceItemIOS> items, std::optional<std::variant<nitro::NullType, SubscriptionPeriodValueIOS>> period, std::optional<std::variant<nitro::NullType, std::string>> requestReferenceId, std::optional<std::variant<nitro::NullType, std::string>> taxCode, std::optional<std::variant<nitro::NullType, std::string>> taxExclusivePrice, std::optional<std::variant<nitro::NullType, std::string>> taxRate): description(description), displayName(displayName), estimatedTax(estimatedTax), items(items), period(period), requestReferenceId(requestReferenceId), taxCode(taxCode), taxExclusivePrice(taxExclusivePrice), taxRate(taxRate) {}
60
64
 
61
65
  public:
62
66
  // AdvancedCommerceInfoIOS is not equatable because these properties are not equatable: items
@@ -76,6 +80,7 @@ namespace margelo::nitro {
76
80
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "displayName"))),
77
81
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedTax"))),
78
82
  JSIConverter<std::vector<margelo::nitro::iap::AdvancedCommerceItemIOS>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "items"))),
83
+ JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::SubscriptionPeriodValueIOS>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "period"))),
79
84
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "requestReferenceId"))),
80
85
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "taxCode"))),
81
86
  JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "taxExclusivePrice"))),
@@ -88,6 +93,7 @@ namespace margelo::nitro {
88
93
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "displayName"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.displayName));
89
94
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedTax"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.estimatedTax));
90
95
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "items"), JSIConverter<std::vector<margelo::nitro::iap::AdvancedCommerceItemIOS>>::toJSI(runtime, arg.items));
96
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "period"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::SubscriptionPeriodValueIOS>>>::toJSI(runtime, arg.period));
91
97
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "requestReferenceId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.requestReferenceId));
92
98
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "taxCode"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.taxCode));
93
99
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "taxExclusivePrice"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.taxExclusivePrice));
@@ -106,6 +112,7 @@ namespace margelo::nitro {
106
112
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "displayName")))) return false;
107
113
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedTax")))) return false;
108
114
  if (!JSIConverter<std::vector<margelo::nitro::iap::AdvancedCommerceItemIOS>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "items")))) return false;
115
+ if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::SubscriptionPeriodValueIOS>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "period")))) return false;
109
116
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "requestReferenceId")))) return false;
110
117
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "taxCode")))) return false;
111
118
  if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "taxExclusivePrice")))) return false;