react-native-iap 14.4.47 → 14.5.1-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.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +76 -16
- package/ios/HybridRnIap.swift +17 -5
- package/ios/RnIapHelper.swift +8 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/index.js +6 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +35 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +21 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +71 -4
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +155 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +13 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +32 -4
- package/nitrogen/generated/android/c++/{JIapkitStore.hpp → JIapStore.hpp} +19 -13
- package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +70 -3
- package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +35 -5
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +13 -3
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +11 -3
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +6 -6
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderError.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +24 -16
- package/nitrogen/generated/android/c++/JPurchase.hpp +2 -0
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +11 -1
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +7 -1
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +2 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{IapkitStore.kt → IapStore.kt} +7 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountAmountAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +30 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +9 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderError.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithProviderResult.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +8 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +5 -2
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +178 -26
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +24 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +24 -3
- package/nitrogen/generated/ios/swift/{IapkitStore.swift → IapStore.swift} +14 -6
- package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +70 -0
- package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +211 -2
- package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +26 -7
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +43 -2
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +47 -1
- package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +2 -2
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderError.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithProviderResult.swift +55 -13
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +44 -3
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +13 -2
- package/nitrogen/generated/shared/c++/{IapkitStore.hpp → IapStore.hpp} +23 -15
- package/nitrogen/generated/shared/c++/NitroDiscountAmountAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +55 -3
- package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -5
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +13 -2
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +10 -2
- package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +8 -8
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderError.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithProviderResult.hpp +13 -5
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +12 -1
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +8 -5
- package/src/specs/RnIap.nitro.ts +79 -4
- package/src/types.ts +163 -11
- package/src/utils/type-bridge.ts +23 -0
|
@@ -23,9 +23,25 @@
|
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
+
// Forward declaration of `NitroDiscountDisplayInfoAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { struct NitroDiscountDisplayInfoAndroid; }
|
|
28
|
+
// Forward declaration of `NitroLimitedQuantityInfoAndroid` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { struct NitroLimitedQuantityInfoAndroid; }
|
|
30
|
+
// Forward declaration of `NitroPreorderDetailsAndroid` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::iap { struct NitroPreorderDetailsAndroid; }
|
|
32
|
+
// Forward declaration of `NitroRentalDetailsAndroid` to properly resolve imports.
|
|
33
|
+
namespace margelo::nitro::iap { struct NitroRentalDetailsAndroid; }
|
|
34
|
+
// Forward declaration of `NitroValidTimeWindowAndroid` to properly resolve imports.
|
|
35
|
+
namespace margelo::nitro::iap { struct NitroValidTimeWindowAndroid; }
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
#include "NitroDiscountDisplayInfoAndroid.hpp"
|
|
38
|
+
#include <optional>
|
|
28
39
|
#include <string>
|
|
40
|
+
#include "NitroLimitedQuantityInfoAndroid.hpp"
|
|
41
|
+
#include <vector>
|
|
42
|
+
#include "NitroPreorderDetailsAndroid.hpp"
|
|
43
|
+
#include "NitroRentalDetailsAndroid.hpp"
|
|
44
|
+
#include "NitroValidTimeWindowAndroid.hpp"
|
|
29
45
|
|
|
30
46
|
namespace margelo::nitro::iap {
|
|
31
47
|
|
|
@@ -34,13 +50,22 @@ namespace margelo::nitro::iap {
|
|
|
34
50
|
*/
|
|
35
51
|
struct NitroOneTimePurchaseOfferDetail {
|
|
36
52
|
public:
|
|
53
|
+
std::optional<NitroDiscountDisplayInfoAndroid> discountDisplayInfo SWIFT_PRIVATE;
|
|
37
54
|
std::string formattedPrice SWIFT_PRIVATE;
|
|
55
|
+
std::optional<std::string> fullPriceMicros SWIFT_PRIVATE;
|
|
56
|
+
std::optional<NitroLimitedQuantityInfoAndroid> limitedQuantityInfo SWIFT_PRIVATE;
|
|
57
|
+
std::optional<std::string> offerId SWIFT_PRIVATE;
|
|
58
|
+
std::vector<std::string> offerTags SWIFT_PRIVATE;
|
|
59
|
+
std::string offerToken SWIFT_PRIVATE;
|
|
60
|
+
std::optional<NitroPreorderDetailsAndroid> preorderDetailsAndroid SWIFT_PRIVATE;
|
|
38
61
|
std::string priceAmountMicros SWIFT_PRIVATE;
|
|
39
62
|
std::string priceCurrencyCode SWIFT_PRIVATE;
|
|
63
|
+
std::optional<NitroRentalDetailsAndroid> rentalDetailsAndroid SWIFT_PRIVATE;
|
|
64
|
+
std::optional<NitroValidTimeWindowAndroid> validTimeWindow SWIFT_PRIVATE;
|
|
40
65
|
|
|
41
66
|
public:
|
|
42
67
|
NitroOneTimePurchaseOfferDetail() = default;
|
|
43
|
-
explicit NitroOneTimePurchaseOfferDetail(std::string formattedPrice, std::string priceAmountMicros, std::string priceCurrencyCode): formattedPrice(formattedPrice), priceAmountMicros(priceAmountMicros), priceCurrencyCode(priceCurrencyCode) {}
|
|
68
|
+
explicit NitroOneTimePurchaseOfferDetail(std::optional<NitroDiscountDisplayInfoAndroid> discountDisplayInfo, std::string formattedPrice, std::optional<std::string> fullPriceMicros, std::optional<NitroLimitedQuantityInfoAndroid> limitedQuantityInfo, std::optional<std::string> offerId, std::vector<std::string> offerTags, std::string offerToken, std::optional<NitroPreorderDetailsAndroid> preorderDetailsAndroid, std::string priceAmountMicros, std::string priceCurrencyCode, std::optional<NitroRentalDetailsAndroid> rentalDetailsAndroid, std::optional<NitroValidTimeWindowAndroid> validTimeWindow): discountDisplayInfo(discountDisplayInfo), formattedPrice(formattedPrice), fullPriceMicros(fullPriceMicros), limitedQuantityInfo(limitedQuantityInfo), offerId(offerId), offerTags(offerTags), offerToken(offerToken), preorderDetailsAndroid(preorderDetailsAndroid), priceAmountMicros(priceAmountMicros), priceCurrencyCode(priceCurrencyCode), rentalDetailsAndroid(rentalDetailsAndroid), validTimeWindow(validTimeWindow) {}
|
|
44
69
|
};
|
|
45
70
|
|
|
46
71
|
} // namespace margelo::nitro::iap
|
|
@@ -53,16 +78,34 @@ namespace margelo::nitro {
|
|
|
53
78
|
static inline margelo::nitro::iap::NitroOneTimePurchaseOfferDetail fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
79
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
80
|
return margelo::nitro::iap::NitroOneTimePurchaseOfferDetail(
|
|
81
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountDisplayInfoAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "discountDisplayInfo")),
|
|
56
82
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "formattedPrice")),
|
|
83
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "fullPriceMicros")),
|
|
84
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroLimitedQuantityInfoAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "limitedQuantityInfo")),
|
|
85
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "offerId")),
|
|
86
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "offerTags")),
|
|
87
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "offerToken")),
|
|
88
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroPreorderDetailsAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "preorderDetailsAndroid")),
|
|
57
89
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "priceAmountMicros")),
|
|
58
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "priceCurrencyCode"))
|
|
90
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "priceCurrencyCode")),
|
|
91
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRentalDetailsAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "rentalDetailsAndroid")),
|
|
92
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroValidTimeWindowAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "validTimeWindow"))
|
|
59
93
|
);
|
|
60
94
|
}
|
|
61
95
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroOneTimePurchaseOfferDetail& arg) {
|
|
62
96
|
jsi::Object obj(runtime);
|
|
97
|
+
obj.setProperty(runtime, "discountDisplayInfo", JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountDisplayInfoAndroid>>::toJSI(runtime, arg.discountDisplayInfo));
|
|
63
98
|
obj.setProperty(runtime, "formattedPrice", JSIConverter<std::string>::toJSI(runtime, arg.formattedPrice));
|
|
99
|
+
obj.setProperty(runtime, "fullPriceMicros", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.fullPriceMicros));
|
|
100
|
+
obj.setProperty(runtime, "limitedQuantityInfo", JSIConverter<std::optional<margelo::nitro::iap::NitroLimitedQuantityInfoAndroid>>::toJSI(runtime, arg.limitedQuantityInfo));
|
|
101
|
+
obj.setProperty(runtime, "offerId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.offerId));
|
|
102
|
+
obj.setProperty(runtime, "offerTags", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.offerTags));
|
|
103
|
+
obj.setProperty(runtime, "offerToken", JSIConverter<std::string>::toJSI(runtime, arg.offerToken));
|
|
104
|
+
obj.setProperty(runtime, "preorderDetailsAndroid", JSIConverter<std::optional<margelo::nitro::iap::NitroPreorderDetailsAndroid>>::toJSI(runtime, arg.preorderDetailsAndroid));
|
|
64
105
|
obj.setProperty(runtime, "priceAmountMicros", JSIConverter<std::string>::toJSI(runtime, arg.priceAmountMicros));
|
|
65
106
|
obj.setProperty(runtime, "priceCurrencyCode", JSIConverter<std::string>::toJSI(runtime, arg.priceCurrencyCode));
|
|
107
|
+
obj.setProperty(runtime, "rentalDetailsAndroid", JSIConverter<std::optional<margelo::nitro::iap::NitroRentalDetailsAndroid>>::toJSI(runtime, arg.rentalDetailsAndroid));
|
|
108
|
+
obj.setProperty(runtime, "validTimeWindow", JSIConverter<std::optional<margelo::nitro::iap::NitroValidTimeWindowAndroid>>::toJSI(runtime, arg.validTimeWindow));
|
|
66
109
|
return obj;
|
|
67
110
|
}
|
|
68
111
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -73,9 +116,18 @@ namespace margelo::nitro {
|
|
|
73
116
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
74
117
|
return false;
|
|
75
118
|
}
|
|
119
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroDiscountDisplayInfoAndroid>>::canConvert(runtime, obj.getProperty(runtime, "discountDisplayInfo"))) return false;
|
|
76
120
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "formattedPrice"))) return false;
|
|
121
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "fullPriceMicros"))) return false;
|
|
122
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroLimitedQuantityInfoAndroid>>::canConvert(runtime, obj.getProperty(runtime, "limitedQuantityInfo"))) return false;
|
|
123
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "offerId"))) return false;
|
|
124
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "offerTags"))) return false;
|
|
125
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "offerToken"))) return false;
|
|
126
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroPreorderDetailsAndroid>>::canConvert(runtime, obj.getProperty(runtime, "preorderDetailsAndroid"))) return false;
|
|
77
127
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "priceAmountMicros"))) return false;
|
|
78
128
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "priceCurrencyCode"))) return false;
|
|
129
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRentalDetailsAndroid>>::canConvert(runtime, obj.getProperty(runtime, "rentalDetailsAndroid"))) return false;
|
|
130
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroValidTimeWindowAndroid>>::canConvert(runtime, obj.getProperty(runtime, "validTimeWindow"))) return false;
|
|
79
131
|
return true;
|
|
80
132
|
}
|
|
81
133
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroPreorderDetailsAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::iap {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (NitroPreorderDetailsAndroid).
|
|
34
|
+
*/
|
|
35
|
+
struct NitroPreorderDetailsAndroid {
|
|
36
|
+
public:
|
|
37
|
+
std::string preorderPresaleEndTimeMillis SWIFT_PRIVATE;
|
|
38
|
+
std::string preorderReleaseTimeMillis SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroPreorderDetailsAndroid() = default;
|
|
42
|
+
explicit NitroPreorderDetailsAndroid(std::string preorderPresaleEndTimeMillis, std::string preorderReleaseTimeMillis): preorderPresaleEndTimeMillis(preorderPresaleEndTimeMillis), preorderReleaseTimeMillis(preorderReleaseTimeMillis) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroPreorderDetailsAndroid <> JS NitroPreorderDetailsAndroid (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroPreorderDetailsAndroid> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroPreorderDetailsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroPreorderDetailsAndroid(
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "preorderPresaleEndTimeMillis")),
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "preorderReleaseTimeMillis"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPreorderDetailsAndroid& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "preorderPresaleEndTimeMillis", JSIConverter<std::string>::toJSI(runtime, arg.preorderPresaleEndTimeMillis));
|
|
62
|
+
obj.setProperty(runtime, "preorderReleaseTimeMillis", JSIConverter<std::string>::toJSI(runtime, arg.preorderReleaseTimeMillis));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "preorderPresaleEndTimeMillis"))) return false;
|
|
74
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "preorderReleaseTimeMillis"))) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro
|
|
@@ -35,6 +35,7 @@ namespace margelo::nitro::iap { struct NitroOneTimePurchaseOfferDetail; }
|
|
|
35
35
|
#include "IapPlatform.hpp"
|
|
36
36
|
#include "PaymentModeIOS.hpp"
|
|
37
37
|
#include "NitroOneTimePurchaseOfferDetail.hpp"
|
|
38
|
+
#include <vector>
|
|
38
39
|
|
|
39
40
|
namespace margelo::nitro::iap {
|
|
40
41
|
|
|
@@ -72,11 +73,11 @@ namespace margelo::nitro::iap {
|
|
|
72
73
|
std::optional<std::string> subscriptionPeriodAndroid SWIFT_PRIVATE;
|
|
73
74
|
std::optional<std::string> freeTrialPeriodAndroid SWIFT_PRIVATE;
|
|
74
75
|
std::optional<std::string> subscriptionOfferDetailsAndroid SWIFT_PRIVATE;
|
|
75
|
-
std::optional<NitroOneTimePurchaseOfferDetail
|
|
76
|
+
std::optional<std::vector<NitroOneTimePurchaseOfferDetail>> oneTimePurchaseOfferDetailsAndroid SWIFT_PRIVATE;
|
|
76
77
|
|
|
77
78
|
public:
|
|
78
79
|
NitroProduct() = default;
|
|
79
|
-
explicit NitroProduct(std::string id, std::string title, std::string description, std::string type, std::optional<std::string> displayName, std::optional<std::string> displayPrice, std::optional<std::string> currency, std::optional<double> price, IapPlatform platform, std::optional<std::string> typeIOS, std::optional<bool> isFamilyShareableIOS, std::optional<std::string> jsonRepresentationIOS, std::optional<std::string> discountsIOS, std::optional<std::string> introductoryPriceIOS, std::optional<double> introductoryPriceAsAmountIOS, std::optional<double> introductoryPriceNumberOfPeriodsIOS, PaymentModeIOS introductoryPricePaymentModeIOS, std::optional<std::string> introductoryPriceSubscriptionPeriodIOS, std::optional<double> subscriptionPeriodNumberIOS, std::optional<std::string> subscriptionPeriodUnitIOS, std::optional<std::string> nameAndroid, std::optional<std::string> originalPriceAndroid, std::optional<double> originalPriceAmountMicrosAndroid, std::optional<double> introductoryPriceCyclesAndroid, std::optional<std::string> introductoryPricePeriodAndroid, std::optional<double> introductoryPriceValueAndroid, std::optional<std::string> subscriptionPeriodAndroid, std::optional<std::string> freeTrialPeriodAndroid, std::optional<std::string> subscriptionOfferDetailsAndroid, std::optional<NitroOneTimePurchaseOfferDetail
|
|
80
|
+
explicit NitroProduct(std::string id, std::string title, std::string description, std::string type, std::optional<std::string> displayName, std::optional<std::string> displayPrice, std::optional<std::string> currency, std::optional<double> price, IapPlatform platform, std::optional<std::string> typeIOS, std::optional<bool> isFamilyShareableIOS, std::optional<std::string> jsonRepresentationIOS, std::optional<std::string> discountsIOS, std::optional<std::string> introductoryPriceIOS, std::optional<double> introductoryPriceAsAmountIOS, std::optional<double> introductoryPriceNumberOfPeriodsIOS, PaymentModeIOS introductoryPricePaymentModeIOS, std::optional<std::string> introductoryPriceSubscriptionPeriodIOS, std::optional<double> subscriptionPeriodNumberIOS, std::optional<std::string> subscriptionPeriodUnitIOS, std::optional<std::string> nameAndroid, std::optional<std::string> originalPriceAndroid, std::optional<double> originalPriceAmountMicrosAndroid, std::optional<double> introductoryPriceCyclesAndroid, std::optional<std::string> introductoryPricePeriodAndroid, std::optional<double> introductoryPriceValueAndroid, std::optional<std::string> subscriptionPeriodAndroid, std::optional<std::string> freeTrialPeriodAndroid, std::optional<std::string> subscriptionOfferDetailsAndroid, std::optional<std::vector<NitroOneTimePurchaseOfferDetail>> oneTimePurchaseOfferDetailsAndroid): id(id), title(title), description(description), type(type), displayName(displayName), displayPrice(displayPrice), currency(currency), price(price), platform(platform), typeIOS(typeIOS), isFamilyShareableIOS(isFamilyShareableIOS), jsonRepresentationIOS(jsonRepresentationIOS), discountsIOS(discountsIOS), introductoryPriceIOS(introductoryPriceIOS), introductoryPriceAsAmountIOS(introductoryPriceAsAmountIOS), introductoryPriceNumberOfPeriodsIOS(introductoryPriceNumberOfPeriodsIOS), introductoryPricePaymentModeIOS(introductoryPricePaymentModeIOS), introductoryPriceSubscriptionPeriodIOS(introductoryPriceSubscriptionPeriodIOS), subscriptionPeriodNumberIOS(subscriptionPeriodNumberIOS), subscriptionPeriodUnitIOS(subscriptionPeriodUnitIOS), nameAndroid(nameAndroid), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid), oneTimePurchaseOfferDetailsAndroid(oneTimePurchaseOfferDetailsAndroid) {}
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
} // namespace margelo::nitro::iap
|
|
@@ -118,7 +119,7 @@ namespace margelo::nitro {
|
|
|
118
119
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid")),
|
|
119
120
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid")),
|
|
120
121
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid")),
|
|
121
|
-
JSIConverter<std::optional<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail
|
|
122
|
+
JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::fromJSI(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid"))
|
|
122
123
|
);
|
|
123
124
|
}
|
|
124
125
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroProduct& arg) {
|
|
@@ -152,7 +153,7 @@ namespace margelo::nitro {
|
|
|
152
153
|
obj.setProperty(runtime, "subscriptionPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionPeriodAndroid));
|
|
153
154
|
obj.setProperty(runtime, "freeTrialPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.freeTrialPeriodAndroid));
|
|
154
155
|
obj.setProperty(runtime, "subscriptionOfferDetailsAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionOfferDetailsAndroid));
|
|
155
|
-
obj.setProperty(runtime, "oneTimePurchaseOfferDetailsAndroid", JSIConverter<std::optional<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail
|
|
156
|
+
obj.setProperty(runtime, "oneTimePurchaseOfferDetailsAndroid", JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::toJSI(runtime, arg.oneTimePurchaseOfferDetailsAndroid));
|
|
156
157
|
return obj;
|
|
157
158
|
}
|
|
158
159
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -192,7 +193,7 @@ namespace margelo::nitro {
|
|
|
192
193
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid"))) return false;
|
|
193
194
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid"))) return false;
|
|
194
195
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid"))) return false;
|
|
195
|
-
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail
|
|
196
|
+
if (!JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::canConvert(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid"))) return false;
|
|
196
197
|
return true;
|
|
197
198
|
}
|
|
198
199
|
};
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `IapPlatform` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
28
|
+
// Forward declaration of `IapStore` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class IapStore; }
|
|
28
30
|
// Forward declaration of `PurchaseState` to properly resolve imports.
|
|
29
31
|
namespace margelo::nitro::iap { enum class PurchaseState; }
|
|
30
32
|
// Forward declaration of `NitroRenewalInfoIOS` to properly resolve imports.
|
|
@@ -33,6 +35,7 @@ namespace margelo::nitro::iap { struct NitroRenewalInfoIOS; }
|
|
|
33
35
|
#include <string>
|
|
34
36
|
#include <optional>
|
|
35
37
|
#include "IapPlatform.hpp"
|
|
38
|
+
#include "IapStore.hpp"
|
|
36
39
|
#include "PurchaseState.hpp"
|
|
37
40
|
#include "NitroRenewalInfoIOS.hpp"
|
|
38
41
|
|
|
@@ -48,6 +51,7 @@ namespace margelo::nitro::iap {
|
|
|
48
51
|
double transactionDate SWIFT_PRIVATE;
|
|
49
52
|
std::optional<std::string> purchaseToken SWIFT_PRIVATE;
|
|
50
53
|
IapPlatform platform SWIFT_PRIVATE;
|
|
54
|
+
IapStore store SWIFT_PRIVATE;
|
|
51
55
|
double quantity SWIFT_PRIVATE;
|
|
52
56
|
PurchaseState purchaseState SWIFT_PRIVATE;
|
|
53
57
|
bool isAutoRenewing SWIFT_PRIVATE;
|
|
@@ -83,10 +87,11 @@ namespace margelo::nitro::iap {
|
|
|
83
87
|
std::optional<std::string> obfuscatedAccountIdAndroid SWIFT_PRIVATE;
|
|
84
88
|
std::optional<std::string> obfuscatedProfileIdAndroid SWIFT_PRIVATE;
|
|
85
89
|
std::optional<std::string> developerPayloadAndroid SWIFT_PRIVATE;
|
|
90
|
+
std::optional<bool> isSuspendedAndroid SWIFT_PRIVATE;
|
|
86
91
|
|
|
87
92
|
public:
|
|
88
93
|
NitroPurchase() = default;
|
|
89
|
-
explicit NitroPurchase(std::string id, std::string productId, double transactionDate, std::optional<std::string> purchaseToken, IapPlatform platform, double quantity, PurchaseState purchaseState, bool isAutoRenewing, std::optional<double> quantityIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::optional<bool> isUpgradedIOS, std::optional<std::string> offerIOS, std::optional<std::string> ownershipTypeIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS, std::optional<NitroRenewalInfoIOS> renewalInfoIOS, std::optional<std::string> purchaseTokenAndroid, std::optional<std::string> dataAndroid, std::optional<std::string> signatureAndroid, std::optional<bool> autoRenewingAndroid, std::optional<double> purchaseStateAndroid, std::optional<bool> isAcknowledgedAndroid, std::optional<std::string> packageNameAndroid, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> developerPayloadAndroid): id(id), productId(productId), transactionDate(transactionDate), purchaseToken(purchaseToken), platform(platform), quantity(quantity), purchaseState(purchaseState), isAutoRenewing(isAutoRenewing), quantityIOS(quantityIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), ownershipTypeIOS(ownershipTypeIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS), renewalInfoIOS(renewalInfoIOS), purchaseTokenAndroid(purchaseTokenAndroid), dataAndroid(dataAndroid), signatureAndroid(signatureAndroid), autoRenewingAndroid(autoRenewingAndroid), purchaseStateAndroid(purchaseStateAndroid), isAcknowledgedAndroid(isAcknowledgedAndroid), packageNameAndroid(packageNameAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), developerPayloadAndroid(developerPayloadAndroid) {}
|
|
94
|
+
explicit NitroPurchase(std::string id, std::string productId, double transactionDate, std::optional<std::string> purchaseToken, IapPlatform platform, IapStore store, double quantity, PurchaseState purchaseState, bool isAutoRenewing, std::optional<double> quantityIOS, std::optional<double> originalTransactionDateIOS, std::optional<std::string> originalTransactionIdentifierIOS, std::optional<std::string> appAccountToken, std::optional<std::string> appBundleIdIOS, std::optional<std::string> countryCodeIOS, std::optional<std::string> currencyCodeIOS, std::optional<std::string> currencySymbolIOS, std::optional<std::string> environmentIOS, std::optional<double> expirationDateIOS, std::optional<bool> isUpgradedIOS, std::optional<std::string> offerIOS, std::optional<std::string> ownershipTypeIOS, std::optional<std::string> reasonIOS, std::optional<std::string> reasonStringRepresentationIOS, std::optional<double> revocationDateIOS, std::optional<std::string> revocationReasonIOS, std::optional<std::string> storefrontCountryCodeIOS, std::optional<std::string> subscriptionGroupIdIOS, std::optional<std::string> transactionReasonIOS, std::optional<std::string> webOrderLineItemIdIOS, std::optional<NitroRenewalInfoIOS> renewalInfoIOS, std::optional<std::string> purchaseTokenAndroid, std::optional<std::string> dataAndroid, std::optional<std::string> signatureAndroid, std::optional<bool> autoRenewingAndroid, std::optional<double> purchaseStateAndroid, std::optional<bool> isAcknowledgedAndroid, std::optional<std::string> packageNameAndroid, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<std::string> developerPayloadAndroid, std::optional<bool> isSuspendedAndroid): id(id), productId(productId), transactionDate(transactionDate), purchaseToken(purchaseToken), platform(platform), store(store), quantity(quantity), purchaseState(purchaseState), isAutoRenewing(isAutoRenewing), quantityIOS(quantityIOS), originalTransactionDateIOS(originalTransactionDateIOS), originalTransactionIdentifierIOS(originalTransactionIdentifierIOS), appAccountToken(appAccountToken), appBundleIdIOS(appBundleIdIOS), countryCodeIOS(countryCodeIOS), currencyCodeIOS(currencyCodeIOS), currencySymbolIOS(currencySymbolIOS), environmentIOS(environmentIOS), expirationDateIOS(expirationDateIOS), isUpgradedIOS(isUpgradedIOS), offerIOS(offerIOS), ownershipTypeIOS(ownershipTypeIOS), reasonIOS(reasonIOS), reasonStringRepresentationIOS(reasonStringRepresentationIOS), revocationDateIOS(revocationDateIOS), revocationReasonIOS(revocationReasonIOS), storefrontCountryCodeIOS(storefrontCountryCodeIOS), subscriptionGroupIdIOS(subscriptionGroupIdIOS), transactionReasonIOS(transactionReasonIOS), webOrderLineItemIdIOS(webOrderLineItemIdIOS), renewalInfoIOS(renewalInfoIOS), purchaseTokenAndroid(purchaseTokenAndroid), dataAndroid(dataAndroid), signatureAndroid(signatureAndroid), autoRenewingAndroid(autoRenewingAndroid), purchaseStateAndroid(purchaseStateAndroid), isAcknowledgedAndroid(isAcknowledgedAndroid), packageNameAndroid(packageNameAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), developerPayloadAndroid(developerPayloadAndroid), isSuspendedAndroid(isSuspendedAndroid) {}
|
|
90
95
|
};
|
|
91
96
|
|
|
92
97
|
} // namespace margelo::nitro::iap
|
|
@@ -104,6 +109,7 @@ namespace margelo::nitro {
|
|
|
104
109
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "transactionDate")),
|
|
105
110
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseToken")),
|
|
106
111
|
JSIConverter<margelo::nitro::iap::IapPlatform>::fromJSI(runtime, obj.getProperty(runtime, "platform")),
|
|
112
|
+
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, "store")),
|
|
107
113
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
|
|
108
114
|
JSIConverter<margelo::nitro::iap::PurchaseState>::fromJSI(runtime, obj.getProperty(runtime, "purchaseState")),
|
|
109
115
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isAutoRenewing")),
|
|
@@ -138,7 +144,8 @@ namespace margelo::nitro {
|
|
|
138
144
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "packageNameAndroid")),
|
|
139
145
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedAccountIdAndroid")),
|
|
140
146
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid")),
|
|
141
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "developerPayloadAndroid"))
|
|
147
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "developerPayloadAndroid")),
|
|
148
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isSuspendedAndroid"))
|
|
142
149
|
);
|
|
143
150
|
}
|
|
144
151
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchase& arg) {
|
|
@@ -148,6 +155,7 @@ namespace margelo::nitro {
|
|
|
148
155
|
obj.setProperty(runtime, "transactionDate", JSIConverter<double>::toJSI(runtime, arg.transactionDate));
|
|
149
156
|
obj.setProperty(runtime, "purchaseToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseToken));
|
|
150
157
|
obj.setProperty(runtime, "platform", JSIConverter<margelo::nitro::iap::IapPlatform>::toJSI(runtime, arg.platform));
|
|
158
|
+
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
151
159
|
obj.setProperty(runtime, "quantity", JSIConverter<double>::toJSI(runtime, arg.quantity));
|
|
152
160
|
obj.setProperty(runtime, "purchaseState", JSIConverter<margelo::nitro::iap::PurchaseState>::toJSI(runtime, arg.purchaseState));
|
|
153
161
|
obj.setProperty(runtime, "isAutoRenewing", JSIConverter<bool>::toJSI(runtime, arg.isAutoRenewing));
|
|
@@ -183,6 +191,7 @@ namespace margelo::nitro {
|
|
|
183
191
|
obj.setProperty(runtime, "obfuscatedAccountIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedAccountIdAndroid));
|
|
184
192
|
obj.setProperty(runtime, "obfuscatedProfileIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedProfileIdAndroid));
|
|
185
193
|
obj.setProperty(runtime, "developerPayloadAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.developerPayloadAndroid));
|
|
194
|
+
obj.setProperty(runtime, "isSuspendedAndroid", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isSuspendedAndroid));
|
|
186
195
|
return obj;
|
|
187
196
|
}
|
|
188
197
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -198,6 +207,7 @@ namespace margelo::nitro {
|
|
|
198
207
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "transactionDate"))) return false;
|
|
199
208
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseToken"))) return false;
|
|
200
209
|
if (!JSIConverter<margelo::nitro::iap::IapPlatform>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
|
|
210
|
+
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, "store"))) return false;
|
|
201
211
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
|
|
202
212
|
if (!JSIConverter<margelo::nitro::iap::PurchaseState>::canConvert(runtime, obj.getProperty(runtime, "purchaseState"))) return false;
|
|
203
213
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isAutoRenewing"))) return false;
|
|
@@ -233,6 +243,7 @@ namespace margelo::nitro {
|
|
|
233
243
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedAccountIdAndroid"))) return false;
|
|
234
244
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid"))) return false;
|
|
235
245
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "developerPayloadAndroid"))) return false;
|
|
246
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isSuspendedAndroid"))) return false;
|
|
236
247
|
return true;
|
|
237
248
|
}
|
|
238
249
|
};
|
|
@@ -41,10 +41,12 @@ namespace margelo::nitro::iap {
|
|
|
41
41
|
public:
|
|
42
42
|
std::optional<NitroRequestPurchaseIos> ios SWIFT_PRIVATE;
|
|
43
43
|
std::optional<NitroRequestPurchaseAndroid> android SWIFT_PRIVATE;
|
|
44
|
+
std::optional<NitroRequestPurchaseIos> apple SWIFT_PRIVATE;
|
|
45
|
+
std::optional<NitroRequestPurchaseAndroid> google SWIFT_PRIVATE;
|
|
44
46
|
|
|
45
47
|
public:
|
|
46
48
|
NitroPurchaseRequest() = default;
|
|
47
|
-
explicit NitroPurchaseRequest(std::optional<NitroRequestPurchaseIos> ios, std::optional<NitroRequestPurchaseAndroid> android): ios(ios), android(android) {}
|
|
49
|
+
explicit NitroPurchaseRequest(std::optional<NitroRequestPurchaseIos> ios, std::optional<NitroRequestPurchaseAndroid> android, std::optional<NitroRequestPurchaseIos> apple, std::optional<NitroRequestPurchaseAndroid> google): ios(ios), android(android), apple(apple), google(google) {}
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
} // namespace margelo::nitro::iap
|
|
@@ -58,13 +60,17 @@ namespace margelo::nitro {
|
|
|
58
60
|
jsi::Object obj = arg.asObject(runtime);
|
|
59
61
|
return margelo::nitro::iap::NitroPurchaseRequest(
|
|
60
62
|
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::fromJSI(runtime, obj.getProperty(runtime, "ios")),
|
|
61
|
-
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "android"))
|
|
63
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "android")),
|
|
64
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::fromJSI(runtime, obj.getProperty(runtime, "apple")),
|
|
65
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "google"))
|
|
62
66
|
);
|
|
63
67
|
}
|
|
64
68
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroPurchaseRequest& arg) {
|
|
65
69
|
jsi::Object obj(runtime);
|
|
66
70
|
obj.setProperty(runtime, "ios", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::toJSI(runtime, arg.ios));
|
|
67
71
|
obj.setProperty(runtime, "android", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::toJSI(runtime, arg.android));
|
|
72
|
+
obj.setProperty(runtime, "apple", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::toJSI(runtime, arg.apple));
|
|
73
|
+
obj.setProperty(runtime, "google", JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::toJSI(runtime, arg.google));
|
|
68
74
|
return obj;
|
|
69
75
|
}
|
|
70
76
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -77,6 +83,8 @@ namespace margelo::nitro {
|
|
|
77
83
|
}
|
|
78
84
|
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::canConvert(runtime, obj.getProperty(runtime, "ios"))) return false;
|
|
79
85
|
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::canConvert(runtime, obj.getProperty(runtime, "android"))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseIos>>::canConvert(runtime, obj.getProperty(runtime, "apple"))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroRequestPurchaseAndroid>>::canConvert(runtime, obj.getProperty(runtime, "google"))) return false;
|
|
80
88
|
return true;
|
|
81
89
|
}
|
|
82
90
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroRentalDetailsAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
#include <optional>
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::iap {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (NitroRentalDetailsAndroid).
|
|
35
|
+
*/
|
|
36
|
+
struct NitroRentalDetailsAndroid {
|
|
37
|
+
public:
|
|
38
|
+
std::optional<std::string> rentalExpirationPeriod SWIFT_PRIVATE;
|
|
39
|
+
std::string rentalPeriod SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
NitroRentalDetailsAndroid() = default;
|
|
43
|
+
explicit NitroRentalDetailsAndroid(std::optional<std::string> rentalExpirationPeriod, std::string rentalPeriod): rentalExpirationPeriod(rentalExpirationPeriod), rentalPeriod(rentalPeriod) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::iap
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ NitroRentalDetailsAndroid <> JS NitroRentalDetailsAndroid (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::iap::NitroRentalDetailsAndroid> final {
|
|
53
|
+
static inline margelo::nitro::iap::NitroRentalDetailsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::iap::NitroRentalDetailsAndroid(
|
|
56
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "rentalExpirationPeriod")),
|
|
57
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "rentalPeriod"))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroRentalDetailsAndroid& arg) {
|
|
61
|
+
jsi::Object obj(runtime);
|
|
62
|
+
obj.setProperty(runtime, "rentalExpirationPeriod", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.rentalExpirationPeriod));
|
|
63
|
+
obj.setProperty(runtime, "rentalPeriod", JSIConverter<std::string>::toJSI(runtime, arg.rentalPeriod));
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
67
|
+
if (!value.isObject()) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
jsi::Object obj = value.getObject(runtime);
|
|
71
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "rentalExpirationPeriod"))) return false;
|
|
75
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "rentalPeriod"))) return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroValidTimeWindowAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::iap {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (NitroValidTimeWindowAndroid).
|
|
34
|
+
*/
|
|
35
|
+
struct NitroValidTimeWindowAndroid {
|
|
36
|
+
public:
|
|
37
|
+
std::string endTimeMillis SWIFT_PRIVATE;
|
|
38
|
+
std::string startTimeMillis SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroValidTimeWindowAndroid() = default;
|
|
42
|
+
explicit NitroValidTimeWindowAndroid(std::string endTimeMillis, std::string startTimeMillis): endTimeMillis(endTimeMillis), startTimeMillis(startTimeMillis) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroValidTimeWindowAndroid <> JS NitroValidTimeWindowAndroid (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroValidTimeWindowAndroid> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroValidTimeWindowAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroValidTimeWindowAndroid(
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "endTimeMillis")),
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "startTimeMillis"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroValidTimeWindowAndroid& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "endTimeMillis", JSIConverter<std::string>::toJSI(runtime, arg.endTimeMillis));
|
|
62
|
+
obj.setProperty(runtime, "startTimeMillis", JSIConverter<std::string>::toJSI(runtime, arg.startTimeMillis));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "endTimeMillis"))) return false;
|
|
74
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "startTimeMillis"))) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
28
|
-
// Forward declaration of `
|
|
29
|
-
namespace margelo::nitro::iap { enum class
|
|
28
|
+
// Forward declaration of `IapStore` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class IapStore; }
|
|
30
30
|
|
|
31
31
|
#include "IapkitPurchaseState.hpp"
|
|
32
|
-
#include "
|
|
32
|
+
#include "IapStore.hpp"
|
|
33
33
|
|
|
34
34
|
namespace margelo::nitro::iap {
|
|
35
35
|
|
|
@@ -40,11 +40,11 @@ namespace margelo::nitro::iap {
|
|
|
40
40
|
public:
|
|
41
41
|
bool isValid SWIFT_PRIVATE;
|
|
42
42
|
IapkitPurchaseState state SWIFT_PRIVATE;
|
|
43
|
-
|
|
43
|
+
IapStore store SWIFT_PRIVATE;
|
|
44
44
|
|
|
45
45
|
public:
|
|
46
46
|
NitroVerifyPurchaseWithIapkitResult() = default;
|
|
47
|
-
explicit NitroVerifyPurchaseWithIapkitResult(bool isValid, IapkitPurchaseState state,
|
|
47
|
+
explicit NitroVerifyPurchaseWithIapkitResult(bool isValid, IapkitPurchaseState state, IapStore store): isValid(isValid), state(state), store(store) {}
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
} // namespace margelo::nitro::iap
|
|
@@ -59,14 +59,14 @@ namespace margelo::nitro {
|
|
|
59
59
|
return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult(
|
|
60
60
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isValid")),
|
|
61
61
|
JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::fromJSI(runtime, obj.getProperty(runtime, "state")),
|
|
62
|
-
JSIConverter<margelo::nitro::iap::
|
|
62
|
+
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, "store"))
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult& arg) {
|
|
66
66
|
jsi::Object obj(runtime);
|
|
67
67
|
obj.setProperty(runtime, "isValid", JSIConverter<bool>::toJSI(runtime, arg.isValid));
|
|
68
68
|
obj.setProperty(runtime, "state", JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::toJSI(runtime, arg.state));
|
|
69
|
-
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::
|
|
69
|
+
obj.setProperty(runtime, "store", JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
70
70
|
return obj;
|
|
71
71
|
}
|
|
72
72
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -79,7 +79,7 @@ namespace margelo::nitro {
|
|
|
79
79
|
}
|
|
80
80
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isValid"))) return false;
|
|
81
81
|
if (!JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
|
|
82
|
-
if (!JSIConverter<margelo::nitro::iap::
|
|
82
|
+
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, "store"))) return false;
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
85
|
};
|