react-native-iap 14.7.2 → 14.7.4
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 +32 -13
- package/ios/HybridRnIap.swift +13 -0
- package/lib/module/hooks/useIAP.js +18 -8
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +19 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +31 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +3 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +2 -0
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +48 -6
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +127 -12
- 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++/JHybridRnIapSpec.cpp +8 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +7 -3
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesIosOptions.hpp +5 -1
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +7 -3
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +21 -17
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseIos.hpp +19 -3
- package/nitrogen/generated/android/c++/JPromotionalOfferJwsInputIOS.hpp +61 -0
- package/nitrogen/generated/android/c++/JWinBackOfferInputIOS.hpp +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesIosOptions.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +9 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseIos.kt +12 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PromotionalOfferJwsInputIOS.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/WinBackOfferInputIOS.kt +36 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +36 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidOptions.swift +31 -1
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesIosOptions.swift +31 -1
- package/nitrogen/generated/ios/swift/NitroProduct.swift +31 -1
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +50 -20
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseIos.swift +77 -1
- package/nitrogen/generated/ios/swift/PromotionalOfferJwsInputIOS.swift +46 -0
- package/nitrogen/generated/ios/swift/WinBackOfferInputIOS.swift +35 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +6 -2
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesIosOptions.hpp +5 -1
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -2
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +21 -17
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseIos.hpp +20 -3
- package/nitrogen/generated/shared/c++/PromotionalOfferJwsInputIOS.hpp +79 -0
- package/nitrogen/generated/shared/c++/WinBackOfferInputIOS.hpp +75 -0
- package/openiap-versions.json +4 -4
- package/package.json +1 -1
- package/src/hooks/useIAP.ts +22 -8
- package/src/index.ts +20 -12
- package/src/specs/RnIap.nitro.ts +49 -5
- package/src/types.ts +131 -12
- package/src/utils/type-bridge.ts +2 -0
|
@@ -18,7 +18,7 @@ public extension NitroRequestPurchaseIos {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroRequestPurchaseIos`.
|
|
20
20
|
*/
|
|
21
|
-
init(sku: String, andDangerouslyFinishTransactionAutomatically: Bool?, appAccountToken: String?, quantity: Double?, withOffer: Dictionary<String, String>?, advancedCommerceData: String?) {
|
|
21
|
+
init(sku: String, andDangerouslyFinishTransactionAutomatically: Bool?, appAccountToken: String?, quantity: Double?, withOffer: Dictionary<String, String>?, advancedCommerceData: String?, introductoryOfferEligibility: Bool?, promotionalOfferJWS: PromotionalOfferJwsInputIOS?, winBackOffer: WinBackOfferInputIOS?) {
|
|
22
22
|
self.init(std.string(sku), { () -> bridge.std__optional_bool_ in
|
|
23
23
|
if let __unwrappedValue = andDangerouslyFinishTransactionAutomatically {
|
|
24
24
|
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
@@ -55,6 +55,24 @@ public extension NitroRequestPurchaseIos {
|
|
|
55
55
|
} else {
|
|
56
56
|
return .init()
|
|
57
57
|
}
|
|
58
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
59
|
+
if let __unwrappedValue = introductoryOfferEligibility {
|
|
60
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
61
|
+
} else {
|
|
62
|
+
return .init()
|
|
63
|
+
}
|
|
64
|
+
}(), { () -> bridge.std__optional_PromotionalOfferJwsInputIOS_ in
|
|
65
|
+
if let __unwrappedValue = promotionalOfferJWS {
|
|
66
|
+
return bridge.create_std__optional_PromotionalOfferJwsInputIOS_(__unwrappedValue)
|
|
67
|
+
} else {
|
|
68
|
+
return .init()
|
|
69
|
+
}
|
|
70
|
+
}(), { () -> bridge.std__optional_WinBackOfferInputIOS_ in
|
|
71
|
+
if let __unwrappedValue = winBackOffer {
|
|
72
|
+
return bridge.create_std__optional_WinBackOfferInputIOS_(__unwrappedValue)
|
|
73
|
+
} else {
|
|
74
|
+
return .init()
|
|
75
|
+
}
|
|
58
76
|
}())
|
|
59
77
|
}
|
|
60
78
|
|
|
@@ -195,4 +213,62 @@ public extension NitroRequestPurchaseIos {
|
|
|
195
213
|
}()
|
|
196
214
|
}
|
|
197
215
|
}
|
|
216
|
+
|
|
217
|
+
var introductoryOfferEligibility: Bool? {
|
|
218
|
+
@inline(__always)
|
|
219
|
+
get {
|
|
220
|
+
return { () -> Bool? in
|
|
221
|
+
if bridge.has_value_std__optional_bool_(self.__introductoryOfferEligibility) {
|
|
222
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__introductoryOfferEligibility)
|
|
223
|
+
return __unwrapped
|
|
224
|
+
} else {
|
|
225
|
+
return nil
|
|
226
|
+
}
|
|
227
|
+
}()
|
|
228
|
+
}
|
|
229
|
+
@inline(__always)
|
|
230
|
+
set {
|
|
231
|
+
self.__introductoryOfferEligibility = { () -> bridge.std__optional_bool_ in
|
|
232
|
+
if let __unwrappedValue = newValue {
|
|
233
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
234
|
+
} else {
|
|
235
|
+
return .init()
|
|
236
|
+
}
|
|
237
|
+
}()
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
var promotionalOfferJWS: PromotionalOfferJwsInputIOS? {
|
|
242
|
+
@inline(__always)
|
|
243
|
+
get {
|
|
244
|
+
return self.__promotionalOfferJWS.value
|
|
245
|
+
}
|
|
246
|
+
@inline(__always)
|
|
247
|
+
set {
|
|
248
|
+
self.__promotionalOfferJWS = { () -> bridge.std__optional_PromotionalOfferJwsInputIOS_ in
|
|
249
|
+
if let __unwrappedValue = newValue {
|
|
250
|
+
return bridge.create_std__optional_PromotionalOfferJwsInputIOS_(__unwrappedValue)
|
|
251
|
+
} else {
|
|
252
|
+
return .init()
|
|
253
|
+
}
|
|
254
|
+
}()
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var winBackOffer: WinBackOfferInputIOS? {
|
|
259
|
+
@inline(__always)
|
|
260
|
+
get {
|
|
261
|
+
return self.__winBackOffer.value
|
|
262
|
+
}
|
|
263
|
+
@inline(__always)
|
|
264
|
+
set {
|
|
265
|
+
self.__winBackOffer = { () -> bridge.std__optional_WinBackOfferInputIOS_ in
|
|
266
|
+
if let __unwrappedValue = newValue {
|
|
267
|
+
return bridge.create_std__optional_WinBackOfferInputIOS_(__unwrappedValue)
|
|
268
|
+
} else {
|
|
269
|
+
return .init()
|
|
270
|
+
}
|
|
271
|
+
}()
|
|
272
|
+
}
|
|
273
|
+
}
|
|
198
274
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PromotionalOfferJwsInputIOS.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `PromotionalOfferJwsInputIOS`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias PromotionalOfferJwsInputIOS = margelo.nitro.iap.PromotionalOfferJwsInputIOS
|
|
14
|
+
|
|
15
|
+
public extension PromotionalOfferJwsInputIOS {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `PromotionalOfferJwsInputIOS`.
|
|
20
|
+
*/
|
|
21
|
+
init(jws: String, offerId: String) {
|
|
22
|
+
self.init(std.string(jws), std.string(offerId))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var jws: String {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return String(self.__jws)
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__jws = std.string(newValue)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var offerId: String {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return String(self.__offerId)
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__offerId = std.string(newValue)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WinBackOfferInputIOS.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `WinBackOfferInputIOS`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias WinBackOfferInputIOS = margelo.nitro.iap.WinBackOfferInputIOS
|
|
14
|
+
|
|
15
|
+
public extension WinBackOfferInputIOS {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `WinBackOfferInputIOS`.
|
|
20
|
+
*/
|
|
21
|
+
init(offerId: String) {
|
|
22
|
+
self.init(std.string(offerId))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var offerId: String {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return String(self.__offerId)
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__offerId = std.string(newValue)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -37,10 +37,11 @@ namespace margelo::nitro::iap {
|
|
|
37
37
|
struct NitroAvailablePurchasesAndroidOptions {
|
|
38
38
|
public:
|
|
39
39
|
std::optional<NitroAvailablePurchasesAndroidType> type SWIFT_PRIVATE;
|
|
40
|
+
std::optional<bool> includeSuspended SWIFT_PRIVATE;
|
|
40
41
|
|
|
41
42
|
public:
|
|
42
43
|
NitroAvailablePurchasesAndroidOptions() = default;
|
|
43
|
-
explicit NitroAvailablePurchasesAndroidOptions(std::optional<NitroAvailablePurchasesAndroidType> type): type(type) {}
|
|
44
|
+
explicit NitroAvailablePurchasesAndroidOptions(std::optional<NitroAvailablePurchasesAndroidType> type, std::optional<bool> includeSuspended): type(type), includeSuspended(includeSuspended) {}
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
} // namespace margelo::nitro::iap
|
|
@@ -53,12 +54,14 @@ namespace margelo::nitro {
|
|
|
53
54
|
static inline margelo::nitro::iap::NitroAvailablePurchasesAndroidOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
55
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
56
|
return margelo::nitro::iap::NitroAvailablePurchasesAndroidOptions(
|
|
56
|
-
JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::fromJSI(runtime, obj.getProperty(runtime, "type"))
|
|
57
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::fromJSI(runtime, obj.getProperty(runtime, "type")),
|
|
58
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "includeSuspended"))
|
|
57
59
|
);
|
|
58
60
|
}
|
|
59
61
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroAvailablePurchasesAndroidOptions& arg) {
|
|
60
62
|
jsi::Object obj(runtime);
|
|
61
63
|
obj.setProperty(runtime, "type", JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::toJSI(runtime, arg.type));
|
|
64
|
+
obj.setProperty(runtime, "includeSuspended", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeSuspended));
|
|
62
65
|
return obj;
|
|
63
66
|
}
|
|
64
67
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -70,6 +73,7 @@ namespace margelo::nitro {
|
|
|
70
73
|
return false;
|
|
71
74
|
}
|
|
72
75
|
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroAvailablePurchasesAndroidType>>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
|
|
76
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "includeSuspended"))) return false;
|
|
73
77
|
return true;
|
|
74
78
|
}
|
|
75
79
|
};
|
|
@@ -37,11 +37,12 @@ namespace margelo::nitro::iap {
|
|
|
37
37
|
std::optional<bool> alsoPublishToEventListener SWIFT_PRIVATE;
|
|
38
38
|
std::optional<bool> onlyIncludeActiveItems SWIFT_PRIVATE;
|
|
39
39
|
std::optional<bool> alsoPublishToEventListenerIOS SWIFT_PRIVATE;
|
|
40
|
+
std::optional<bool> includeSuspendedAndroid SWIFT_PRIVATE;
|
|
40
41
|
std::optional<bool> onlyIncludeActiveItemsIOS SWIFT_PRIVATE;
|
|
41
42
|
|
|
42
43
|
public:
|
|
43
44
|
NitroAvailablePurchasesIosOptions() = default;
|
|
44
|
-
explicit NitroAvailablePurchasesIosOptions(std::optional<bool> alsoPublishToEventListener, std::optional<bool> onlyIncludeActiveItems, std::optional<bool> alsoPublishToEventListenerIOS, std::optional<bool> onlyIncludeActiveItemsIOS): alsoPublishToEventListener(alsoPublishToEventListener), onlyIncludeActiveItems(onlyIncludeActiveItems), alsoPublishToEventListenerIOS(alsoPublishToEventListenerIOS), onlyIncludeActiveItemsIOS(onlyIncludeActiveItemsIOS) {}
|
|
45
|
+
explicit NitroAvailablePurchasesIosOptions(std::optional<bool> alsoPublishToEventListener, std::optional<bool> onlyIncludeActiveItems, std::optional<bool> alsoPublishToEventListenerIOS, std::optional<bool> includeSuspendedAndroid, std::optional<bool> onlyIncludeActiveItemsIOS): alsoPublishToEventListener(alsoPublishToEventListener), onlyIncludeActiveItems(onlyIncludeActiveItems), alsoPublishToEventListenerIOS(alsoPublishToEventListenerIOS), includeSuspendedAndroid(includeSuspendedAndroid), onlyIncludeActiveItemsIOS(onlyIncludeActiveItemsIOS) {}
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
} // namespace margelo::nitro::iap
|
|
@@ -57,6 +58,7 @@ namespace margelo::nitro {
|
|
|
57
58
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "alsoPublishToEventListener")),
|
|
58
59
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "onlyIncludeActiveItems")),
|
|
59
60
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "alsoPublishToEventListenerIOS")),
|
|
61
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "includeSuspendedAndroid")),
|
|
60
62
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "onlyIncludeActiveItemsIOS"))
|
|
61
63
|
);
|
|
62
64
|
}
|
|
@@ -65,6 +67,7 @@ namespace margelo::nitro {
|
|
|
65
67
|
obj.setProperty(runtime, "alsoPublishToEventListener", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.alsoPublishToEventListener));
|
|
66
68
|
obj.setProperty(runtime, "onlyIncludeActiveItems", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.onlyIncludeActiveItems));
|
|
67
69
|
obj.setProperty(runtime, "alsoPublishToEventListenerIOS", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.alsoPublishToEventListenerIOS));
|
|
70
|
+
obj.setProperty(runtime, "includeSuspendedAndroid", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeSuspendedAndroid));
|
|
68
71
|
obj.setProperty(runtime, "onlyIncludeActiveItemsIOS", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.onlyIncludeActiveItemsIOS));
|
|
69
72
|
return obj;
|
|
70
73
|
}
|
|
@@ -79,6 +82,7 @@ namespace margelo::nitro {
|
|
|
79
82
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "alsoPublishToEventListener"))) return false;
|
|
80
83
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "onlyIncludeActiveItems"))) return false;
|
|
81
84
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "alsoPublishToEventListenerIOS"))) return false;
|
|
85
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "includeSuspendedAndroid"))) return false;
|
|
82
86
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "onlyIncludeActiveItemsIOS"))) return false;
|
|
83
87
|
return true;
|
|
84
88
|
}
|
|
@@ -76,10 +76,11 @@ namespace margelo::nitro::iap {
|
|
|
76
76
|
std::optional<std::string> freeTrialPeriodAndroid SWIFT_PRIVATE;
|
|
77
77
|
std::optional<std::string> subscriptionOfferDetailsAndroid SWIFT_PRIVATE;
|
|
78
78
|
std::optional<std::vector<NitroOneTimePurchaseOfferDetail>> oneTimePurchaseOfferDetailsAndroid SWIFT_PRIVATE;
|
|
79
|
+
std::optional<std::string> productStatusAndroid SWIFT_PRIVATE;
|
|
79
80
|
|
|
80
81
|
public:
|
|
81
82
|
NitroProduct() = default;
|
|
82
|
-
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> subscriptionOffers, std::optional<std::string> discountOffers, 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), subscriptionOffers(subscriptionOffers), discountOffers(discountOffers), nameAndroid(nameAndroid), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid), oneTimePurchaseOfferDetailsAndroid(oneTimePurchaseOfferDetailsAndroid) {}
|
|
83
|
+
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> subscriptionOffers, std::optional<std::string> discountOffers, 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, std::optional<std::string> productStatusAndroid): 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), subscriptionOffers(subscriptionOffers), discountOffers(discountOffers), nameAndroid(nameAndroid), originalPriceAndroid(originalPriceAndroid), originalPriceAmountMicrosAndroid(originalPriceAmountMicrosAndroid), introductoryPriceCyclesAndroid(introductoryPriceCyclesAndroid), introductoryPricePeriodAndroid(introductoryPricePeriodAndroid), introductoryPriceValueAndroid(introductoryPriceValueAndroid), subscriptionPeriodAndroid(subscriptionPeriodAndroid), freeTrialPeriodAndroid(freeTrialPeriodAndroid), subscriptionOfferDetailsAndroid(subscriptionOfferDetailsAndroid), oneTimePurchaseOfferDetailsAndroid(oneTimePurchaseOfferDetailsAndroid), productStatusAndroid(productStatusAndroid) {}
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
} // namespace margelo::nitro::iap
|
|
@@ -123,7 +124,8 @@ namespace margelo::nitro {
|
|
|
123
124
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionPeriodAndroid")),
|
|
124
125
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid")),
|
|
125
126
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid")),
|
|
126
|
-
JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::fromJSI(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid"))
|
|
127
|
+
JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::fromJSI(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid")),
|
|
128
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "productStatusAndroid"))
|
|
127
129
|
);
|
|
128
130
|
}
|
|
129
131
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroProduct& arg) {
|
|
@@ -160,6 +162,7 @@ namespace margelo::nitro {
|
|
|
160
162
|
obj.setProperty(runtime, "freeTrialPeriodAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.freeTrialPeriodAndroid));
|
|
161
163
|
obj.setProperty(runtime, "subscriptionOfferDetailsAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subscriptionOfferDetailsAndroid));
|
|
162
164
|
obj.setProperty(runtime, "oneTimePurchaseOfferDetailsAndroid", JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::toJSI(runtime, arg.oneTimePurchaseOfferDetailsAndroid));
|
|
165
|
+
obj.setProperty(runtime, "productStatusAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.productStatusAndroid));
|
|
163
166
|
return obj;
|
|
164
167
|
}
|
|
165
168
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -202,6 +205,7 @@ namespace margelo::nitro {
|
|
|
202
205
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "freeTrialPeriodAndroid"))) return false;
|
|
203
206
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionOfferDetailsAndroid"))) return false;
|
|
204
207
|
if (!JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail>>>::canConvert(runtime, obj.getProperty(runtime, "oneTimePurchaseOfferDetailsAndroid"))) return false;
|
|
208
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "productStatusAndroid"))) return false;
|
|
205
209
|
return true;
|
|
206
210
|
}
|
|
207
211
|
};
|
|
@@ -42,17 +42,18 @@ namespace margelo::nitro::iap {
|
|
|
42
42
|
struct NitroRequestPurchaseAndroid {
|
|
43
43
|
public:
|
|
44
44
|
std::vector<std::string> skus SWIFT_PRIVATE;
|
|
45
|
-
std::optional<std::string>
|
|
46
|
-
std::optional<std::string>
|
|
45
|
+
std::optional<std::string> obfuscatedAccountId SWIFT_PRIVATE;
|
|
46
|
+
std::optional<std::string> obfuscatedProfileId SWIFT_PRIVATE;
|
|
47
47
|
std::optional<bool> isOfferPersonalized SWIFT_PRIVATE;
|
|
48
|
+
std::optional<std::string> offerToken SWIFT_PRIVATE;
|
|
48
49
|
std::optional<std::vector<AndroidSubscriptionOfferInput>> subscriptionOffers SWIFT_PRIVATE;
|
|
49
|
-
std::optional<double>
|
|
50
|
-
std::optional<std::string>
|
|
50
|
+
std::optional<double> replacementMode SWIFT_PRIVATE;
|
|
51
|
+
std::optional<std::string> purchaseToken SWIFT_PRIVATE;
|
|
51
52
|
std::optional<SubscriptionProductReplacementParamsAndroid> subscriptionProductReplacementParams SWIFT_PRIVATE;
|
|
52
53
|
|
|
53
54
|
public:
|
|
54
55
|
NitroRequestPurchaseAndroid() = default;
|
|
55
|
-
explicit NitroRequestPurchaseAndroid(std::vector<std::string> skus, std::optional<std::string>
|
|
56
|
+
explicit NitroRequestPurchaseAndroid(std::vector<std::string> skus, std::optional<std::string> obfuscatedAccountId, std::optional<std::string> obfuscatedProfileId, std::optional<bool> isOfferPersonalized, std::optional<std::string> offerToken, std::optional<std::vector<AndroidSubscriptionOfferInput>> subscriptionOffers, std::optional<double> replacementMode, std::optional<std::string> purchaseToken, std::optional<SubscriptionProductReplacementParamsAndroid> subscriptionProductReplacementParams): skus(skus), obfuscatedAccountId(obfuscatedAccountId), obfuscatedProfileId(obfuscatedProfileId), isOfferPersonalized(isOfferPersonalized), offerToken(offerToken), subscriptionOffers(subscriptionOffers), replacementMode(replacementMode), purchaseToken(purchaseToken), subscriptionProductReplacementParams(subscriptionProductReplacementParams) {}
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
} // namespace margelo::nitro::iap
|
|
@@ -66,24 +67,26 @@ namespace margelo::nitro {
|
|
|
66
67
|
jsi::Object obj = arg.asObject(runtime);
|
|
67
68
|
return margelo::nitro::iap::NitroRequestPurchaseAndroid(
|
|
68
69
|
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "skus")),
|
|
69
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "
|
|
70
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "
|
|
70
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedAccountId")),
|
|
71
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedProfileId")),
|
|
71
72
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isOfferPersonalized")),
|
|
73
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "offerToken")),
|
|
72
74
|
JSIConverter<std::optional<std::vector<margelo::nitro::iap::AndroidSubscriptionOfferInput>>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOffers")),
|
|
73
|
-
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "
|
|
74
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "
|
|
75
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "replacementMode")),
|
|
76
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseToken")),
|
|
75
77
|
JSIConverter<std::optional<margelo::nitro::iap::SubscriptionProductReplacementParamsAndroid>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionProductReplacementParams"))
|
|
76
78
|
);
|
|
77
79
|
}
|
|
78
80
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroRequestPurchaseAndroid& arg) {
|
|
79
81
|
jsi::Object obj(runtime);
|
|
80
82
|
obj.setProperty(runtime, "skus", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.skus));
|
|
81
|
-
obj.setProperty(runtime, "
|
|
82
|
-
obj.setProperty(runtime, "
|
|
83
|
+
obj.setProperty(runtime, "obfuscatedAccountId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedAccountId));
|
|
84
|
+
obj.setProperty(runtime, "obfuscatedProfileId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedProfileId));
|
|
83
85
|
obj.setProperty(runtime, "isOfferPersonalized", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isOfferPersonalized));
|
|
86
|
+
obj.setProperty(runtime, "offerToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.offerToken));
|
|
84
87
|
obj.setProperty(runtime, "subscriptionOffers", JSIConverter<std::optional<std::vector<margelo::nitro::iap::AndroidSubscriptionOfferInput>>>::toJSI(runtime, arg.subscriptionOffers));
|
|
85
|
-
obj.setProperty(runtime, "
|
|
86
|
-
obj.setProperty(runtime, "
|
|
88
|
+
obj.setProperty(runtime, "replacementMode", JSIConverter<std::optional<double>>::toJSI(runtime, arg.replacementMode));
|
|
89
|
+
obj.setProperty(runtime, "purchaseToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseToken));
|
|
87
90
|
obj.setProperty(runtime, "subscriptionProductReplacementParams", JSIConverter<std::optional<margelo::nitro::iap::SubscriptionProductReplacementParamsAndroid>>::toJSI(runtime, arg.subscriptionProductReplacementParams));
|
|
88
91
|
return obj;
|
|
89
92
|
}
|
|
@@ -96,12 +99,13 @@ namespace margelo::nitro {
|
|
|
96
99
|
return false;
|
|
97
100
|
}
|
|
98
101
|
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "skus"))) return false;
|
|
99
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "
|
|
100
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "
|
|
102
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedAccountId"))) return false;
|
|
103
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedProfileId"))) return false;
|
|
101
104
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isOfferPersonalized"))) return false;
|
|
105
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "offerToken"))) return false;
|
|
102
106
|
if (!JSIConverter<std::optional<std::vector<margelo::nitro::iap::AndroidSubscriptionOfferInput>>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionOffers"))) return false;
|
|
103
|
-
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "
|
|
104
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "
|
|
107
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "replacementMode"))) return false;
|
|
108
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseToken"))) return false;
|
|
105
109
|
if (!JSIConverter<std::optional<margelo::nitro::iap::SubscriptionProductReplacementParamsAndroid>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionProductReplacementParams"))) return false;
|
|
106
110
|
return true;
|
|
107
111
|
}
|
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// Forward declaration of `PromotionalOfferJwsInputIOS` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { struct PromotionalOfferJwsInputIOS; }
|
|
28
|
+
// Forward declaration of `WinBackOfferInputIOS` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
|
|
27
30
|
|
|
28
31
|
#include <string>
|
|
29
32
|
#include <optional>
|
|
30
33
|
#include <unordered_map>
|
|
34
|
+
#include "PromotionalOfferJwsInputIOS.hpp"
|
|
35
|
+
#include "WinBackOfferInputIOS.hpp"
|
|
31
36
|
|
|
32
37
|
namespace margelo::nitro::iap {
|
|
33
38
|
|
|
@@ -42,10 +47,13 @@ namespace margelo::nitro::iap {
|
|
|
42
47
|
std::optional<double> quantity SWIFT_PRIVATE;
|
|
43
48
|
std::optional<std::unordered_map<std::string, std::string>> withOffer SWIFT_PRIVATE;
|
|
44
49
|
std::optional<std::string> advancedCommerceData SWIFT_PRIVATE;
|
|
50
|
+
std::optional<bool> introductoryOfferEligibility SWIFT_PRIVATE;
|
|
51
|
+
std::optional<PromotionalOfferJwsInputIOS> promotionalOfferJWS SWIFT_PRIVATE;
|
|
52
|
+
std::optional<WinBackOfferInputIOS> winBackOffer SWIFT_PRIVATE;
|
|
45
53
|
|
|
46
54
|
public:
|
|
47
55
|
NitroRequestPurchaseIos() = default;
|
|
48
|
-
explicit NitroRequestPurchaseIos(std::string sku, std::optional<bool> andDangerouslyFinishTransactionAutomatically, std::optional<std::string> appAccountToken, std::optional<double> quantity, std::optional<std::unordered_map<std::string, std::string>> withOffer, std::optional<std::string> advancedCommerceData): sku(sku), andDangerouslyFinishTransactionAutomatically(andDangerouslyFinishTransactionAutomatically), appAccountToken(appAccountToken), quantity(quantity), withOffer(withOffer), advancedCommerceData(advancedCommerceData) {}
|
|
56
|
+
explicit NitroRequestPurchaseIos(std::string sku, std::optional<bool> andDangerouslyFinishTransactionAutomatically, std::optional<std::string> appAccountToken, std::optional<double> quantity, std::optional<std::unordered_map<std::string, std::string>> withOffer, std::optional<std::string> advancedCommerceData, std::optional<bool> introductoryOfferEligibility, std::optional<PromotionalOfferJwsInputIOS> promotionalOfferJWS, std::optional<WinBackOfferInputIOS> winBackOffer): sku(sku), andDangerouslyFinishTransactionAutomatically(andDangerouslyFinishTransactionAutomatically), appAccountToken(appAccountToken), quantity(quantity), withOffer(withOffer), advancedCommerceData(advancedCommerceData), introductoryOfferEligibility(introductoryOfferEligibility), promotionalOfferJWS(promotionalOfferJWS), winBackOffer(winBackOffer) {}
|
|
49
57
|
};
|
|
50
58
|
|
|
51
59
|
} // namespace margelo::nitro::iap
|
|
@@ -63,7 +71,10 @@ namespace margelo::nitro {
|
|
|
63
71
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "appAccountToken")),
|
|
64
72
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
|
|
65
73
|
JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "withOffer")),
|
|
66
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "advancedCommerceData"))
|
|
74
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "advancedCommerceData")),
|
|
75
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "introductoryOfferEligibility")),
|
|
76
|
+
JSIConverter<std::optional<margelo::nitro::iap::PromotionalOfferJwsInputIOS>>::fromJSI(runtime, obj.getProperty(runtime, "promotionalOfferJWS")),
|
|
77
|
+
JSIConverter<std::optional<margelo::nitro::iap::WinBackOfferInputIOS>>::fromJSI(runtime, obj.getProperty(runtime, "winBackOffer"))
|
|
67
78
|
);
|
|
68
79
|
}
|
|
69
80
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroRequestPurchaseIos& arg) {
|
|
@@ -74,6 +85,9 @@ namespace margelo::nitro {
|
|
|
74
85
|
obj.setProperty(runtime, "quantity", JSIConverter<std::optional<double>>::toJSI(runtime, arg.quantity));
|
|
75
86
|
obj.setProperty(runtime, "withOffer", JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::toJSI(runtime, arg.withOffer));
|
|
76
87
|
obj.setProperty(runtime, "advancedCommerceData", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.advancedCommerceData));
|
|
88
|
+
obj.setProperty(runtime, "introductoryOfferEligibility", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.introductoryOfferEligibility));
|
|
89
|
+
obj.setProperty(runtime, "promotionalOfferJWS", JSIConverter<std::optional<margelo::nitro::iap::PromotionalOfferJwsInputIOS>>::toJSI(runtime, arg.promotionalOfferJWS));
|
|
90
|
+
obj.setProperty(runtime, "winBackOffer", JSIConverter<std::optional<margelo::nitro::iap::WinBackOfferInputIOS>>::toJSI(runtime, arg.winBackOffer));
|
|
77
91
|
return obj;
|
|
78
92
|
}
|
|
79
93
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -90,6 +104,9 @@ namespace margelo::nitro {
|
|
|
90
104
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
|
|
91
105
|
if (!JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::canConvert(runtime, obj.getProperty(runtime, "withOffer"))) return false;
|
|
92
106
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "advancedCommerceData"))) return false;
|
|
107
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "introductoryOfferEligibility"))) return false;
|
|
108
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::PromotionalOfferJwsInputIOS>>::canConvert(runtime, obj.getProperty(runtime, "promotionalOfferJWS"))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::WinBackOfferInputIOS>>::canConvert(runtime, obj.getProperty(runtime, "winBackOffer"))) return false;
|
|
93
110
|
return true;
|
|
94
111
|
}
|
|
95
112
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PromotionalOfferJwsInputIOS.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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 (PromotionalOfferJwsInputIOS).
|
|
34
|
+
*/
|
|
35
|
+
struct PromotionalOfferJwsInputIOS {
|
|
36
|
+
public:
|
|
37
|
+
std::string jws SWIFT_PRIVATE;
|
|
38
|
+
std::string offerId SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
PromotionalOfferJwsInputIOS() = default;
|
|
42
|
+
explicit PromotionalOfferJwsInputIOS(std::string jws, std::string offerId): jws(jws), offerId(offerId) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ PromotionalOfferJwsInputIOS <> JS PromotionalOfferJwsInputIOS (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::PromotionalOfferJwsInputIOS> final {
|
|
52
|
+
static inline margelo::nitro::iap::PromotionalOfferJwsInputIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::PromotionalOfferJwsInputIOS(
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "jws")),
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "offerId"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::PromotionalOfferJwsInputIOS& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "jws", JSIConverter<std::string>::toJSI(runtime, arg.jws));
|
|
62
|
+
obj.setProperty(runtime, "offerId", JSIConverter<std::string>::toJSI(runtime, arg.offerId));
|
|
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, "jws"))) return false;
|
|
74
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "offerId"))) return false;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WinBackOfferInputIOS.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 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 (WinBackOfferInputIOS).
|
|
34
|
+
*/
|
|
35
|
+
struct WinBackOfferInputIOS {
|
|
36
|
+
public:
|
|
37
|
+
std::string offerId SWIFT_PRIVATE;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
WinBackOfferInputIOS() = default;
|
|
41
|
+
explicit WinBackOfferInputIOS(std::string offerId): offerId(offerId) {}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::iap
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro {
|
|
47
|
+
|
|
48
|
+
// C++ WinBackOfferInputIOS <> JS WinBackOfferInputIOS (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<margelo::nitro::iap::WinBackOfferInputIOS> final {
|
|
51
|
+
static inline margelo::nitro::iap::WinBackOfferInputIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return margelo::nitro::iap::WinBackOfferInputIOS(
|
|
54
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "offerId"))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::WinBackOfferInputIOS& arg) {
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setProperty(runtime, "offerId", JSIConverter<std::string>::toJSI(runtime, arg.offerId));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
63
|
+
if (!value.isObject()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
jsi::Object obj = value.getObject(runtime);
|
|
67
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "offerId"))) return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED