react-native-iap 15.5.0 → 15.5.2
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 +19 -0
- package/ios/HybridRnIap.swift +16 -0
- package/lib/module/hooks/useIAP.js +6 -2
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js.map +1 -1
- package/lib/module/kit-api.js +27 -0
- package/lib/module/kit-api.js.map +1 -1
- package/lib/module/types.js +7 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/vega-adapter.js +10 -6
- package/lib/module/vega-adapter.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +1 -0
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/kit-api.d.ts +60 -0
- package/lib/typescript/src/kit-api.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +28 -12
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +36 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JIapkitClientPayloadFormat.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroIapkitProductClientPayload.hpp +71 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +7 -3
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +20 -1
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +5 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroIapkitProductClientPayload.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroIapkitProductClientPayload.hpp +74 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitResult.hpp +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapkitClientPayloadFormat.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroIapkitProductClientPayload.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +9 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +14 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroIapkitProductClientPayload.kt +62 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +50 -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/IapkitClientPayloadFormat.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroIapkitProductClientPayload.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +76 -2
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroIapkitProductClientPayload.swift +30 -0
- package/nitrogen/generated/shared/c++/IapkitClientPayloadFormat.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroIapkitProductClientPayload.hpp +97 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +6 -2
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +16 -1
- package/openiap-versions.json +3 -3
- package/package.json +5 -5
- package/src/hooks/useIAP.ts +6 -2
- package/src/index.kepler.ts +13 -0
- package/src/index.ts +13 -0
- package/src/kit-api.ts +107 -0
- package/src/specs/RnIap.nitro.ts +37 -12
- package/src/types.ts +38 -1
- package/src/vega-adapter.ts +14 -11
|
@@ -60,6 +60,8 @@ namespace margelo::nitro::iap { class HybridRnIapSpec; }
|
|
|
60
60
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
61
61
|
// Forward declaration of `IapStore` to properly resolve imports.
|
|
62
62
|
namespace margelo::nitro::iap { enum class IapStore; }
|
|
63
|
+
// Forward declaration of `IapkitClientPayloadFormat` to properly resolve imports.
|
|
64
|
+
namespace margelo::nitro::iap { enum class IapkitClientPayloadFormat; }
|
|
63
65
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
64
66
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
65
67
|
// Forward declaration of `InAppMessageCategoryAndroid` to properly resolve imports.
|
|
@@ -102,6 +104,8 @@ namespace margelo::nitro::iap { struct NitroFinishTransactionIosParams; }
|
|
|
102
104
|
namespace margelo::nitro::iap { struct NitroFinishTransactionParams; }
|
|
103
105
|
// Forward declaration of `NitroGetBillingChoiceInfoParamsAndroid` to properly resolve imports.
|
|
104
106
|
namespace margelo::nitro::iap { struct NitroGetBillingChoiceInfoParamsAndroid; }
|
|
107
|
+
// Forward declaration of `NitroIapkitProductClientPayload` to properly resolve imports.
|
|
108
|
+
namespace margelo::nitro::iap { struct NitroIapkitProductClientPayload; }
|
|
105
109
|
// Forward declaration of `NitroInAppMessageParamsAndroid` to properly resolve imports.
|
|
106
110
|
namespace margelo::nitro::iap { struct NitroInAppMessageParamsAndroid; }
|
|
107
111
|
// Forward declaration of `NitroInAppMessageResultAndroid` to properly resolve imports.
|
|
@@ -228,6 +232,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
|
|
|
228
232
|
#include "HybridRnIapSpec.hpp"
|
|
229
233
|
#include "IapPlatform.hpp"
|
|
230
234
|
#include "IapStore.hpp"
|
|
235
|
+
#include "IapkitClientPayloadFormat.hpp"
|
|
231
236
|
#include "IapkitPurchaseState.hpp"
|
|
232
237
|
#include "InAppMessageCategoryAndroid.hpp"
|
|
233
238
|
#include "InAppMessageResponseCodeAndroid.hpp"
|
|
@@ -249,6 +254,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
|
|
|
249
254
|
#include "NitroFinishTransactionIosParams.hpp"
|
|
250
255
|
#include "NitroFinishTransactionParams.hpp"
|
|
251
256
|
#include "NitroGetBillingChoiceInfoParamsAndroid.hpp"
|
|
257
|
+
#include "NitroIapkitProductClientPayload.hpp"
|
|
252
258
|
#include "NitroInAppMessageParamsAndroid.hpp"
|
|
253
259
|
#include "NitroInAppMessageResultAndroid.hpp"
|
|
254
260
|
#include "NitroLaunchExternalLinkParamsAndroid.hpp"
|
|
@@ -132,6 +132,10 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationHorizonOptions; }
|
|
|
132
132
|
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderResult; }
|
|
133
133
|
// Forward declaration of `NitroVerifyPurchaseWithIapkitResult` to properly resolve imports.
|
|
134
134
|
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitResult; }
|
|
135
|
+
// Forward declaration of `NitroIapkitProductClientPayload` to properly resolve imports.
|
|
136
|
+
namespace margelo::nitro::iap { struct NitroIapkitProductClientPayload; }
|
|
137
|
+
// Forward declaration of `IapkitClientPayloadFormat` to properly resolve imports.
|
|
138
|
+
namespace margelo::nitro::iap { enum class IapkitClientPayloadFormat; }
|
|
135
139
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
136
140
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
137
141
|
// Forward declaration of `NitroVerifyPurchaseWithProviderError` to properly resolve imports.
|
|
@@ -271,6 +275,8 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
|
|
|
271
275
|
#include "NitroReceiptValidationHorizonOptions.hpp"
|
|
272
276
|
#include "NitroVerifyPurchaseWithProviderResult.hpp"
|
|
273
277
|
#include "NitroVerifyPurchaseWithIapkitResult.hpp"
|
|
278
|
+
#include "NitroIapkitProductClientPayload.hpp"
|
|
279
|
+
#include "IapkitClientPayloadFormat.hpp"
|
|
274
280
|
#include "IapkitPurchaseState.hpp"
|
|
275
281
|
#include "NitroVerifyPurchaseWithProviderError.hpp"
|
|
276
282
|
#include "PurchaseVerificationProvider.hpp"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// IapkitClientPayloadFormat.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `IapkitClientPayloadFormat`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias IapkitClientPayloadFormat = margelo.nitro.iap.IapkitClientPayloadFormat
|
|
12
|
+
|
|
13
|
+
public extension IapkitClientPayloadFormat {
|
|
14
|
+
/**
|
|
15
|
+
* Get a IapkitClientPayloadFormat for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "toml":
|
|
21
|
+
self = .toml
|
|
22
|
+
case "json":
|
|
23
|
+
self = .json
|
|
24
|
+
case "text":
|
|
25
|
+
self = .text
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this IapkitClientPayloadFormat represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .toml:
|
|
37
|
+
return "toml"
|
|
38
|
+
case .json:
|
|
39
|
+
return "json"
|
|
40
|
+
case .text:
|
|
41
|
+
return "text"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroIapkitProductClientPayload.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroIapkitProductClientPayload`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroIapkitProductClientPayload = margelo.nitro.iap.NitroIapkitProductClientPayload
|
|
14
|
+
|
|
15
|
+
public extension NitroIapkitProductClientPayload {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroIapkitProductClientPayload`.
|
|
20
|
+
*/
|
|
21
|
+
init(body: String, format: IapkitClientPayloadFormat, updatedAt: Double, version: Double) {
|
|
22
|
+
self.init(std.string(body), format, updatedAt, version)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var body: String {
|
|
27
|
+
return String(self.__body)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var format: IapkitClientPayloadFormat {
|
|
32
|
+
return self.__format
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var updatedAt: Double {
|
|
37
|
+
return self.__updatedAt
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@inline(__always)
|
|
41
|
+
var version: Double {
|
|
42
|
+
return self.__version
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -18,7 +18,7 @@ public extension NitroVerifyPurchaseWithIapkitProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroVerifyPurchaseWithIapkitProps`.
|
|
20
20
|
*/
|
|
21
|
-
init(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?) {
|
|
21
|
+
init(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?, includeClientPayload: Variant_NullType_Bool?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
|
|
23
23
|
if let __unwrappedValue = apiKey {
|
|
24
24
|
return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
|
|
@@ -84,6 +84,19 @@ public extension NitroVerifyPurchaseWithIapkitProps {
|
|
|
84
84
|
} else {
|
|
85
85
|
return .init()
|
|
86
86
|
}
|
|
87
|
+
}(), { () -> bridge.std__optional_std__variant_nitro__NullType__bool__ in
|
|
88
|
+
if let __unwrappedValue = includeClientPayload {
|
|
89
|
+
return bridge.create_std__optional_std__variant_nitro__NullType__bool__({ () -> bridge.std__variant_nitro__NullType__bool_ in
|
|
90
|
+
switch __unwrappedValue {
|
|
91
|
+
case .first(let __value):
|
|
92
|
+
return bridge.create_std__variant_nitro__NullType__bool_(margelo.nitro.NullType.null)
|
|
93
|
+
case .second(let __value):
|
|
94
|
+
return bridge.create_std__variant_nitro__NullType__bool_(__value)
|
|
95
|
+
}
|
|
96
|
+
}().variant)
|
|
97
|
+
} else {
|
|
98
|
+
return .init()
|
|
99
|
+
}
|
|
87
100
|
}())
|
|
88
101
|
}
|
|
89
102
|
|
|
@@ -206,4 +219,28 @@ public extension NitroVerifyPurchaseWithIapkitProps {
|
|
|
206
219
|
}
|
|
207
220
|
}()
|
|
208
221
|
}
|
|
222
|
+
|
|
223
|
+
@inline(__always)
|
|
224
|
+
var includeClientPayload: Variant_NullType_Bool? {
|
|
225
|
+
return { () -> Variant_NullType_Bool? in
|
|
226
|
+
if bridge.has_value_std__optional_std__variant_nitro__NullType__bool__(self.__includeClientPayload) {
|
|
227
|
+
let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__bool__(self.__includeClientPayload)
|
|
228
|
+
return { () -> Variant_NullType_Bool in
|
|
229
|
+
let __variant = bridge.std__variant_nitro__NullType__bool_(__unwrapped)
|
|
230
|
+
switch __variant.index() {
|
|
231
|
+
case 0:
|
|
232
|
+
let __actual = __variant.get_0()
|
|
233
|
+
return .first(NullType.null)
|
|
234
|
+
case 1:
|
|
235
|
+
let __actual = __variant.get_1()
|
|
236
|
+
return .second(__actual)
|
|
237
|
+
default:
|
|
238
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
239
|
+
}
|
|
240
|
+
}()
|
|
241
|
+
} else {
|
|
242
|
+
return nil
|
|
243
|
+
}
|
|
244
|
+
}()
|
|
245
|
+
}
|
|
209
246
|
}
|
|
@@ -18,15 +18,89 @@ public extension NitroVerifyPurchaseWithIapkitResult {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroVerifyPurchaseWithIapkitResult`.
|
|
20
20
|
*/
|
|
21
|
-
init(isValid: Bool, state: IapkitPurchaseState, store: IapStore) {
|
|
22
|
-
self.init(
|
|
21
|
+
init(clientPayload: Variant_NullType_NitroIapkitProductClientPayload?, isValid: Bool, productId: Variant_NullType_String?, state: IapkitPurchaseState, store: IapStore) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__ in
|
|
23
|
+
if let __unwrappedValue = clientPayload {
|
|
24
|
+
return bridge.create_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__({ () -> bridge.std__variant_nitro__NullType__NitroIapkitProductClientPayload_ in
|
|
25
|
+
switch __unwrappedValue {
|
|
26
|
+
case .first(let __value):
|
|
27
|
+
return bridge.create_std__variant_nitro__NullType__NitroIapkitProductClientPayload_(margelo.nitro.NullType.null)
|
|
28
|
+
case .second(let __value):
|
|
29
|
+
return bridge.create_std__variant_nitro__NullType__NitroIapkitProductClientPayload_(__value)
|
|
30
|
+
}
|
|
31
|
+
}().variant)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}(), isValid, { () -> bridge.std__optional_std__variant_nitro__NullType__std__string__ in
|
|
36
|
+
if let __unwrappedValue = productId {
|
|
37
|
+
return bridge.create_std__optional_std__variant_nitro__NullType__std__string__({ () -> bridge.std__variant_nitro__NullType__std__string_ in
|
|
38
|
+
switch __unwrappedValue {
|
|
39
|
+
case .first(let __value):
|
|
40
|
+
return bridge.create_std__variant_nitro__NullType__std__string_(margelo.nitro.NullType.null)
|
|
41
|
+
case .second(let __value):
|
|
42
|
+
return bridge.create_std__variant_nitro__NullType__std__string_(std.string(__value))
|
|
43
|
+
}
|
|
44
|
+
}().variant)
|
|
45
|
+
} else {
|
|
46
|
+
return .init()
|
|
47
|
+
}
|
|
48
|
+
}(), state, store)
|
|
23
49
|
}
|
|
24
50
|
|
|
51
|
+
@inline(__always)
|
|
52
|
+
var clientPayload: Variant_NullType_NitroIapkitProductClientPayload? {
|
|
53
|
+
return { () -> Variant_NullType_NitroIapkitProductClientPayload? in
|
|
54
|
+
if bridge.has_value_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__(self.__clientPayload) {
|
|
55
|
+
let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__(self.__clientPayload)
|
|
56
|
+
return { () -> Variant_NullType_NitroIapkitProductClientPayload in
|
|
57
|
+
let __variant = bridge.std__variant_nitro__NullType__NitroIapkitProductClientPayload_(__unwrapped)
|
|
58
|
+
switch __variant.index() {
|
|
59
|
+
case 0:
|
|
60
|
+
let __actual = __variant.get_0()
|
|
61
|
+
return .first(NullType.null)
|
|
62
|
+
case 1:
|
|
63
|
+
let __actual = __variant.get_1()
|
|
64
|
+
return .second(__actual)
|
|
65
|
+
default:
|
|
66
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
67
|
+
}
|
|
68
|
+
}()
|
|
69
|
+
} else {
|
|
70
|
+
return nil
|
|
71
|
+
}
|
|
72
|
+
}()
|
|
73
|
+
}
|
|
74
|
+
|
|
25
75
|
@inline(__always)
|
|
26
76
|
var isValid: Bool {
|
|
27
77
|
return self.__isValid
|
|
28
78
|
}
|
|
29
79
|
|
|
80
|
+
@inline(__always)
|
|
81
|
+
var productId: Variant_NullType_String? {
|
|
82
|
+
return { () -> Variant_NullType_String? in
|
|
83
|
+
if bridge.has_value_std__optional_std__variant_nitro__NullType__std__string__(self.__productId) {
|
|
84
|
+
let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__std__string__(self.__productId)
|
|
85
|
+
return { () -> Variant_NullType_String in
|
|
86
|
+
let __variant = bridge.std__variant_nitro__NullType__std__string_(__unwrapped)
|
|
87
|
+
switch __variant.index() {
|
|
88
|
+
case 0:
|
|
89
|
+
let __actual = __variant.get_0()
|
|
90
|
+
return .first(NullType.null)
|
|
91
|
+
case 1:
|
|
92
|
+
let __actual = __variant.get_1()
|
|
93
|
+
return .second(String(__actual))
|
|
94
|
+
default:
|
|
95
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
96
|
+
}
|
|
97
|
+
}()
|
|
98
|
+
} else {
|
|
99
|
+
return nil
|
|
100
|
+
}
|
|
101
|
+
}()
|
|
102
|
+
}
|
|
103
|
+
|
|
30
104
|
@inline(__always)
|
|
31
105
|
var state: IapkitPurchaseState {
|
|
32
106
|
return self.__state
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_NitroIapkitProductClientPayload.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Variant_NullType_NitroIapkitProductClientPayload {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(NitroIapkitProductClientPayload)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension Variant_NullType_NitroIapkitProductClientPayload {
|
|
21
|
+
func asType<T>(_ type: T.Type = T.self) -> T? {
|
|
22
|
+
switch self {
|
|
23
|
+
case .first(let value): return value as? T
|
|
24
|
+
case .second(let value): return value as? T
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
func isType<T>(_ type: T.Type = T.self) -> Bool {
|
|
28
|
+
return self.asType(type) != nil
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// IapkitClientPayloadFormat.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (IapkitClientPayloadFormat).
|
|
30
|
+
*/
|
|
31
|
+
enum class IapkitClientPayloadFormat {
|
|
32
|
+
TOML SWIFT_NAME(toml) = 0,
|
|
33
|
+
JSON SWIFT_NAME(json) = 1,
|
|
34
|
+
TEXT SWIFT_NAME(text) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::iap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ IapkitClientPayloadFormat <> JS IapkitClientPayloadFormat (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::iap::IapkitClientPayloadFormat> final {
|
|
44
|
+
static inline margelo::nitro::iap::IapkitClientPayloadFormat fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("toml"): return margelo::nitro::iap::IapkitClientPayloadFormat::TOML;
|
|
48
|
+
case hashString("json"): return margelo::nitro::iap::IapkitClientPayloadFormat::JSON;
|
|
49
|
+
case hashString("text"): return margelo::nitro::iap::IapkitClientPayloadFormat::TEXT;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum IapkitClientPayloadFormat - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::IapkitClientPayloadFormat arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::iap::IapkitClientPayloadFormat::TOML: return JSIConverter<std::string>::toJSI(runtime, "toml");
|
|
57
|
+
case margelo::nitro::iap::IapkitClientPayloadFormat::JSON: return JSIConverter<std::string>::toJSI(runtime, "json");
|
|
58
|
+
case margelo::nitro::iap::IapkitClientPayloadFormat::TEXT: return JSIConverter<std::string>::toJSI(runtime, "text");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert IapkitClientPayloadFormat to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("toml"):
|
|
71
|
+
case hashString("json"):
|
|
72
|
+
case hashString("text"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroIapkitProductClientPayload.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `IapkitClientPayloadFormat` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::iap { enum class IapkitClientPayloadFormat; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include "IapkitClientPayloadFormat.hpp"
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::iap {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (NitroIapkitProductClientPayload).
|
|
41
|
+
*/
|
|
42
|
+
struct NitroIapkitProductClientPayload final {
|
|
43
|
+
public:
|
|
44
|
+
std::string body SWIFT_PRIVATE;
|
|
45
|
+
IapkitClientPayloadFormat format SWIFT_PRIVATE;
|
|
46
|
+
double updatedAt SWIFT_PRIVATE;
|
|
47
|
+
double version SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
NitroIapkitProductClientPayload() = default;
|
|
51
|
+
explicit NitroIapkitProductClientPayload(std::string body, IapkitClientPayloadFormat format, double updatedAt, double version): body(body), format(format), updatedAt(updatedAt), version(version) {}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
friend bool operator==(const NitroIapkitProductClientPayload& lhs, const NitroIapkitProductClientPayload& rhs) = default;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::iap
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ NitroIapkitProductClientPayload <> JS NitroIapkitProductClientPayload (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::iap::NitroIapkitProductClientPayload> final {
|
|
64
|
+
static inline margelo::nitro::iap::NitroIapkitProductClientPayload fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::iap::NitroIapkitProductClientPayload(
|
|
67
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body"))),
|
|
68
|
+
JSIConverter<margelo::nitro::iap::IapkitClientPayloadFormat>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "format"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "updatedAt"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "version")))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroIapkitProductClientPayload& arg) {
|
|
74
|
+
jsi::Object obj(runtime);
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "body"), JSIConverter<std::string>::toJSI(runtime, arg.body));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "format"), JSIConverter<margelo::nitro::iap::IapkitClientPayloadFormat>::toJSI(runtime, arg.format));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "updatedAt"), JSIConverter<double>::toJSI(runtime, arg.updatedAt));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "version"), JSIConverter<double>::toJSI(runtime, arg.version));
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
82
|
+
if (!value.isObject()) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
jsi::Object obj = value.getObject(runtime);
|
|
86
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body")))) return false;
|
|
90
|
+
if (!JSIConverter<margelo::nitro::iap::IapkitClientPayloadFormat>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "format")))) return false;
|
|
91
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "updatedAt")))) return false;
|
|
92
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "version")))) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro
|
|
@@ -55,10 +55,11 @@ namespace margelo::nitro::iap {
|
|
|
55
55
|
std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple SWIFT_PRIVATE;
|
|
56
56
|
std::optional<std::variant<nitro::NullType, std::string>> baseUrl SWIFT_PRIVATE;
|
|
57
57
|
std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google SWIFT_PRIVATE;
|
|
58
|
+
std::optional<std::variant<nitro::NullType, bool>> includeClientPayload SWIFT_PRIVATE;
|
|
58
59
|
|
|
59
60
|
public:
|
|
60
61
|
NitroVerifyPurchaseWithIapkitProps() = default;
|
|
61
|
-
explicit NitroVerifyPurchaseWithIapkitProps(std::optional<std::variant<nitro::NullType, std::string>> apiKey, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>> amazon, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple, std::optional<std::variant<nitro::NullType, std::string>> baseUrl, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google): apiKey(apiKey), amazon(amazon), apple(apple), baseUrl(baseUrl), google(google) {}
|
|
62
|
+
explicit NitroVerifyPurchaseWithIapkitProps(std::optional<std::variant<nitro::NullType, std::string>> apiKey, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAmazonProps>> amazon, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitAppleProps>> apple, std::optional<std::variant<nitro::NullType, std::string>> baseUrl, std::optional<std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitGoogleProps>> google, std::optional<std::variant<nitro::NullType, bool>> includeClientPayload): apiKey(apiKey), amazon(amazon), apple(apple), baseUrl(baseUrl), google(google), includeClientPayload(includeClientPayload) {}
|
|
62
63
|
|
|
63
64
|
public:
|
|
64
65
|
friend bool operator==(const NitroVerifyPurchaseWithIapkitProps& lhs, const NitroVerifyPurchaseWithIapkitProps& rhs) = default;
|
|
@@ -78,7 +79,8 @@ namespace margelo::nitro {
|
|
|
78
79
|
JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAmazonProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amazon"))),
|
|
79
80
|
JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple"))),
|
|
80
81
|
JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "baseUrl"))),
|
|
81
|
-
JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))
|
|
82
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google"))),
|
|
83
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeClientPayload")))
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitProps& arg) {
|
|
@@ -88,6 +90,7 @@ namespace margelo::nitro {
|
|
|
88
90
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "apple"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::toJSI(runtime, arg.apple));
|
|
89
91
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "baseUrl"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.baseUrl));
|
|
90
92
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "google"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::toJSI(runtime, arg.google));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeClientPayload"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.includeClientPayload));
|
|
91
94
|
return obj;
|
|
92
95
|
}
|
|
93
96
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -103,6 +106,7 @@ namespace margelo::nitro {
|
|
|
103
106
|
if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitAppleProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apple")))) return false;
|
|
104
107
|
if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "baseUrl")))) return false;
|
|
105
108
|
if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroVerifyPurchaseWithIapkitGoogleProps>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "google")))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeClientPayload")))) return false;
|
|
106
110
|
return true;
|
|
107
111
|
}
|
|
108
112
|
};
|
|
@@ -28,11 +28,18 @@
|
|
|
28
28
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
29
|
#endif
|
|
30
30
|
|
|
31
|
+
// Forward declaration of `NitroIapkitProductClientPayload` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::iap { struct NitroIapkitProductClientPayload; }
|
|
31
33
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
32
34
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
33
35
|
// Forward declaration of `IapStore` to properly resolve imports.
|
|
34
36
|
namespace margelo::nitro::iap { enum class IapStore; }
|
|
35
37
|
|
|
38
|
+
#include <NitroModules/Null.hpp>
|
|
39
|
+
#include "NitroIapkitProductClientPayload.hpp"
|
|
40
|
+
#include <variant>
|
|
41
|
+
#include <optional>
|
|
42
|
+
#include <string>
|
|
36
43
|
#include "IapkitPurchaseState.hpp"
|
|
37
44
|
#include "IapStore.hpp"
|
|
38
45
|
|
|
@@ -43,13 +50,15 @@ namespace margelo::nitro::iap {
|
|
|
43
50
|
*/
|
|
44
51
|
struct NitroVerifyPurchaseWithIapkitResult final {
|
|
45
52
|
public:
|
|
53
|
+
std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>> clientPayload SWIFT_PRIVATE;
|
|
46
54
|
bool isValid SWIFT_PRIVATE;
|
|
55
|
+
std::optional<std::variant<nitro::NullType, std::string>> productId SWIFT_PRIVATE;
|
|
47
56
|
IapkitPurchaseState state SWIFT_PRIVATE;
|
|
48
57
|
IapStore store SWIFT_PRIVATE;
|
|
49
58
|
|
|
50
59
|
public:
|
|
51
60
|
NitroVerifyPurchaseWithIapkitResult() = default;
|
|
52
|
-
explicit NitroVerifyPurchaseWithIapkitResult(bool isValid, IapkitPurchaseState state, IapStore store): isValid(isValid), state(state), store(store) {}
|
|
61
|
+
explicit NitroVerifyPurchaseWithIapkitResult(std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>> clientPayload, bool isValid, std::optional<std::variant<nitro::NullType, std::string>> productId, IapkitPurchaseState state, IapStore store): clientPayload(clientPayload), isValid(isValid), productId(productId), state(state), store(store) {}
|
|
53
62
|
|
|
54
63
|
public:
|
|
55
64
|
friend bool operator==(const NitroVerifyPurchaseWithIapkitResult& lhs, const NitroVerifyPurchaseWithIapkitResult& rhs) = default;
|
|
@@ -65,14 +74,18 @@ namespace margelo::nitro {
|
|
|
65
74
|
static inline margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
66
75
|
jsi::Object obj = arg.asObject(runtime);
|
|
67
76
|
return margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult(
|
|
77
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroIapkitProductClientPayload>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "clientPayload"))),
|
|
68
78
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isValid"))),
|
|
79
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "productId"))),
|
|
69
80
|
JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state"))),
|
|
70
81
|
JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "store")))
|
|
71
82
|
);
|
|
72
83
|
}
|
|
73
84
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroVerifyPurchaseWithIapkitResult& arg) {
|
|
74
85
|
jsi::Object obj(runtime);
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "clientPayload"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroIapkitProductClientPayload>>>::toJSI(runtime, arg.clientPayload));
|
|
75
87
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isValid"), JSIConverter<bool>::toJSI(runtime, arg.isValid));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "productId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.productId));
|
|
76
89
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "state"), JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::toJSI(runtime, arg.state));
|
|
77
90
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "store"), JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
|
|
78
91
|
return obj;
|
|
@@ -85,7 +98,9 @@ namespace margelo::nitro {
|
|
|
85
98
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
86
99
|
return false;
|
|
87
100
|
}
|
|
101
|
+
if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroIapkitProductClientPayload>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "clientPayload")))) return false;
|
|
88
102
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isValid")))) return false;
|
|
103
|
+
if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "productId")))) return false;
|
|
89
104
|
if (!JSIConverter<margelo::nitro::iap::IapkitPurchaseState>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state")))) return false;
|
|
90
105
|
if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "store")))) return false;
|
|
91
106
|
return true;
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "15.5.
|
|
3
|
+
"version": "15.5.2",
|
|
4
4
|
"description": "React Native In-App Purchases module for iOS and Android using Nitro",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"husky": "^8.0.3",
|
|
106
106
|
"jest": "^30.1.1",
|
|
107
107
|
"lint-staged": "^15.2.0",
|
|
108
|
-
"nitrogen": "^0.
|
|
108
|
+
"nitrogen": "^0.36.1",
|
|
109
109
|
"prettier": "^3.3.3",
|
|
110
110
|
"react": "19.1.0",
|
|
111
111
|
"react-native": "0.81.1",
|
|
112
112
|
"react-native-builder-bob": "^0.38.4",
|
|
113
|
-
"react-native-nitro-modules": "^0.
|
|
113
|
+
"react-native-nitro-modules": "^0.36.1",
|
|
114
114
|
"react-test-renderer": "^19.1.1",
|
|
115
115
|
"typescript": "^5.9.2"
|
|
116
116
|
},
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@amazon-devices/package-manager-lib": "~1.0.1767254401",
|
|
120
120
|
"react": "*",
|
|
121
121
|
"react-native": "*",
|
|
122
|
-
"react-native-nitro-modules": "^0.
|
|
122
|
+
"react-native-nitro-modules": "^0.36.1"
|
|
123
123
|
},
|
|
124
124
|
"peerDependenciesMeta": {
|
|
125
125
|
"@amazon-devices/keplerscript-appstore-iap-lib": {
|
|
@@ -176,6 +176,6 @@
|
|
|
176
176
|
},
|
|
177
177
|
"packageManager": "yarn@3.6.1",
|
|
178
178
|
"resolutions": {
|
|
179
|
-
"nitrogen@^0.
|
|
179
|
+
"nitrogen@^0.36.1": "patch:nitrogen@npm%3A0.36.1#./.yarn/patches/nitrogen-npm-0.36.1-abe3b64156.patch"
|
|
180
180
|
}
|
|
181
181
|
}
|