react-native-iap 14.5.1-rc.1 → 14.6.0-rc.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/README.md +1 -0
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +198 -36
- package/ios/HybridRnIap.swift +32 -2
- package/lib/module/hooks/useIAP.js +1 -6
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +228 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +116 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/plugin/src/withIAP.d.ts +6 -0
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +5 -7
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +144 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +90 -8
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +194 -10
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JBillingProgramAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalLinkLaunchModeAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalLinkTypeAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +88 -4
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroBillingProgramAvailabilityResultAndroid.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroBillingProgramReportingDetailsAndroid.hpp +63 -0
- package/nitrogen/generated/android/c++/JNitroLaunchExternalLinkParamsAndroid.hpp +75 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationAppleOptions.hpp +57 -0
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationAndroidOptions.hpp → JNitroReceiptValidationGoogleOptions.hpp} +18 -14
- package/nitrogen/generated/android/c++/JNitroReceiptValidationHorizonOptions.hpp +65 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +19 -11
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalLinkLaunchModeAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalLinkTypeAndroid.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +16 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramAvailabilityResultAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramReportingDetailsAndroid.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLaunchExternalLinkParamsAndroid.kt +45 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationAppleOptions.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationAndroidOptions.kt → NitroReceiptValidationGoogleOptions.kt} +9 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationHorizonOptions.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationParams.kt +7 -4
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +141 -10
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +27 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +57 -3
- package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/ExternalLinkLaunchModeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/ExternalLinkTypeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroBillingProgramAvailabilityResultAndroid.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroBillingProgramReportingDetailsAndroid.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +68 -0
- package/nitrogen/generated/ios/swift/NitroBillingProgramAvailabilityResultAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroBillingProgramReportingDetailsAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroLaunchExternalLinkParamsAndroid.swift +68 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationAppleOptions.swift +35 -0
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationAndroidOptions.swift → NitroReceiptValidationGoogleOptions.swift} +21 -10
- package/nitrogen/generated/ios/swift/NitroReceiptValidationHorizonOptions.swift +57 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationParams.swift +46 -11
- package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalLinkLaunchModeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalLinkTypeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +16 -0
- package/nitrogen/generated/shared/c++/NitroBillingProgramAvailabilityResultAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroBillingProgramReportingDetailsAndroid.hpp +81 -0
- package/nitrogen/generated/shared/c++/NitroLaunchExternalLinkParamsAndroid.hpp +95 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationAppleOptions.hpp +75 -0
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationAndroidOptions.hpp → NitroReceiptValidationGoogleOptions.hpp} +18 -14
- package/nitrogen/generated/shared/c++/NitroReceiptValidationHorizonOptions.hpp +83 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +22 -13
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/build/withIAP.d.ts +6 -0
- package/plugin/build/withIAP.js +46 -2
- package/plugin/src/withIAP.ts +67 -2
- package/src/hooks/useIAP.ts +8 -23
- package/src/index.ts +297 -14
- package/src/specs/RnIap.nitro.ts +125 -10
- package/src/types.ts +207 -10
|
@@ -1075,6 +1075,74 @@ open class HybridRnIapSpec_cxx {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
|
|
1078
|
+
@inline(__always)
|
|
1079
|
+
public final func enableBillingProgramAndroid(program: Int32) -> bridge.Result_void_ {
|
|
1080
|
+
do {
|
|
1081
|
+
try self.__implementation.enableBillingProgramAndroid(program: margelo.nitro.iap.BillingProgramAndroid(rawValue: program)!)
|
|
1082
|
+
return bridge.create_Result_void_()
|
|
1083
|
+
} catch (let __error) {
|
|
1084
|
+
let __exceptionPtr = __error.toCpp()
|
|
1085
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
@inline(__always)
|
|
1090
|
+
public final func isBillingProgramAvailableAndroid(program: Int32) -> bridge.Result_std__shared_ptr_Promise_NitroBillingProgramAvailabilityResultAndroid___ {
|
|
1091
|
+
do {
|
|
1092
|
+
let __result = try self.__implementation.isBillingProgramAvailableAndroid(program: margelo.nitro.iap.BillingProgramAndroid(rawValue: program)!)
|
|
1093
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_NitroBillingProgramAvailabilityResultAndroid__ in
|
|
1094
|
+
let __promise = bridge.create_std__shared_ptr_Promise_NitroBillingProgramAvailabilityResultAndroid__()
|
|
1095
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_NitroBillingProgramAvailabilityResultAndroid__(__promise)
|
|
1096
|
+
__result
|
|
1097
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
1098
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
1099
|
+
return __promise
|
|
1100
|
+
}()
|
|
1101
|
+
return bridge.create_Result_std__shared_ptr_Promise_NitroBillingProgramAvailabilityResultAndroid___(__resultCpp)
|
|
1102
|
+
} catch (let __error) {
|
|
1103
|
+
let __exceptionPtr = __error.toCpp()
|
|
1104
|
+
return bridge.create_Result_std__shared_ptr_Promise_NitroBillingProgramAvailabilityResultAndroid___(__exceptionPtr)
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
@inline(__always)
|
|
1109
|
+
public final func createBillingProgramReportingDetailsAndroid(program: Int32) -> bridge.Result_std__shared_ptr_Promise_NitroBillingProgramReportingDetailsAndroid___ {
|
|
1110
|
+
do {
|
|
1111
|
+
let __result = try self.__implementation.createBillingProgramReportingDetailsAndroid(program: margelo.nitro.iap.BillingProgramAndroid(rawValue: program)!)
|
|
1112
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_NitroBillingProgramReportingDetailsAndroid__ in
|
|
1113
|
+
let __promise = bridge.create_std__shared_ptr_Promise_NitroBillingProgramReportingDetailsAndroid__()
|
|
1114
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_NitroBillingProgramReportingDetailsAndroid__(__promise)
|
|
1115
|
+
__result
|
|
1116
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
1117
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
1118
|
+
return __promise
|
|
1119
|
+
}()
|
|
1120
|
+
return bridge.create_Result_std__shared_ptr_Promise_NitroBillingProgramReportingDetailsAndroid___(__resultCpp)
|
|
1121
|
+
} catch (let __error) {
|
|
1122
|
+
let __exceptionPtr = __error.toCpp()
|
|
1123
|
+
return bridge.create_Result_std__shared_ptr_Promise_NitroBillingProgramReportingDetailsAndroid___(__exceptionPtr)
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
@inline(__always)
|
|
1128
|
+
public final func launchExternalLinkAndroid(params: NitroLaunchExternalLinkParamsAndroid) -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
1129
|
+
do {
|
|
1130
|
+
let __result = try self.__implementation.launchExternalLinkAndroid(params: params)
|
|
1131
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
1132
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
1133
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
1134
|
+
__result
|
|
1135
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
1136
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
1137
|
+
return __promise
|
|
1138
|
+
}()
|
|
1139
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
1140
|
+
} catch (let __error) {
|
|
1141
|
+
let __exceptionPtr = __error.toCpp()
|
|
1142
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1078
1146
|
@inline(__always)
|
|
1079
1147
|
public final func canPresentExternalPurchaseNoticeIOS() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
1080
1148
|
do {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroBillingProgramAvailabilityResultAndroid.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroBillingProgramAvailabilityResultAndroid`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroBillingProgramAvailabilityResultAndroid = margelo.nitro.iap.NitroBillingProgramAvailabilityResultAndroid
|
|
14
|
+
|
|
15
|
+
public extension NitroBillingProgramAvailabilityResultAndroid {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroBillingProgramAvailabilityResultAndroid`.
|
|
20
|
+
*/
|
|
21
|
+
init(billingProgram: BillingProgramAndroid, isAvailable: Bool) {
|
|
22
|
+
self.init(billingProgram, isAvailable)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var billingProgram: BillingProgramAndroid {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__billingProgram
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__billingProgram = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var isAvailable: Bool {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return self.__isAvailable
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__isAvailable = newValue
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroBillingProgramReportingDetailsAndroid.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroBillingProgramReportingDetailsAndroid`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroBillingProgramReportingDetailsAndroid = margelo.nitro.iap.NitroBillingProgramReportingDetailsAndroid
|
|
14
|
+
|
|
15
|
+
public extension NitroBillingProgramReportingDetailsAndroid {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroBillingProgramReportingDetailsAndroid`.
|
|
20
|
+
*/
|
|
21
|
+
init(billingProgram: BillingProgramAndroid, externalTransactionToken: String) {
|
|
22
|
+
self.init(billingProgram, std.string(externalTransactionToken))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var billingProgram: BillingProgramAndroid {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__billingProgram
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__billingProgram = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var externalTransactionToken: String {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return String(self.__externalTransactionToken)
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__externalTransactionToken = std.string(newValue)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLaunchExternalLinkParamsAndroid.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroLaunchExternalLinkParamsAndroid`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroLaunchExternalLinkParamsAndroid = margelo.nitro.iap.NitroLaunchExternalLinkParamsAndroid
|
|
14
|
+
|
|
15
|
+
public extension NitroLaunchExternalLinkParamsAndroid {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroLaunchExternalLinkParamsAndroid`.
|
|
20
|
+
*/
|
|
21
|
+
init(billingProgram: BillingProgramAndroid, launchMode: ExternalLinkLaunchModeAndroid, linkType: ExternalLinkTypeAndroid, linkUri: String) {
|
|
22
|
+
self.init(billingProgram, launchMode, linkType, std.string(linkUri))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var billingProgram: BillingProgramAndroid {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__billingProgram
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__billingProgram = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var launchMode: ExternalLinkLaunchModeAndroid {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return self.__launchMode
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__launchMode = newValue
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var linkType: ExternalLinkTypeAndroid {
|
|
48
|
+
@inline(__always)
|
|
49
|
+
get {
|
|
50
|
+
return self.__linkType
|
|
51
|
+
}
|
|
52
|
+
@inline(__always)
|
|
53
|
+
set {
|
|
54
|
+
self.__linkType = newValue
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var linkUri: String {
|
|
59
|
+
@inline(__always)
|
|
60
|
+
get {
|
|
61
|
+
return String(self.__linkUri)
|
|
62
|
+
}
|
|
63
|
+
@inline(__always)
|
|
64
|
+
set {
|
|
65
|
+
self.__linkUri = std.string(newValue)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroReceiptValidationAppleOptions.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroReceiptValidationAppleOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroReceiptValidationAppleOptions = margelo.nitro.iap.NitroReceiptValidationAppleOptions
|
|
14
|
+
|
|
15
|
+
public extension NitroReceiptValidationAppleOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroReceiptValidationAppleOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(sku: String) {
|
|
22
|
+
self.init(std.string(sku))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var sku: String {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return String(self.__sku)
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__sku = std.string(newValue)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// NitroReceiptValidationGoogleOptions.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Represents an instance of `
|
|
11
|
+
* Represents an instance of `NitroReceiptValidationGoogleOptions`, backed by a C++ struct.
|
|
12
12
|
*/
|
|
13
|
-
public typealias
|
|
13
|
+
public typealias NitroReceiptValidationGoogleOptions = margelo.nitro.iap.NitroReceiptValidationGoogleOptions
|
|
14
14
|
|
|
15
|
-
public extension
|
|
15
|
+
public extension NitroReceiptValidationGoogleOptions {
|
|
16
16
|
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Create a new instance of `
|
|
19
|
+
* Create a new instance of `NitroReceiptValidationGoogleOptions`.
|
|
20
20
|
*/
|
|
21
|
-
init(accessToken: String, isSub: Bool?, packageName: String,
|
|
21
|
+
init(accessToken: String, isSub: Bool?, packageName: String, purchaseToken: String, sku: String) {
|
|
22
22
|
self.init(std.string(accessToken), { () -> bridge.std__optional_bool_ in
|
|
23
23
|
if let __unwrappedValue = isSub {
|
|
24
24
|
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
25
25
|
} else {
|
|
26
26
|
return .init()
|
|
27
27
|
}
|
|
28
|
-
}(), std.string(packageName), std.string(
|
|
28
|
+
}(), std.string(packageName), std.string(purchaseToken), std.string(sku))
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var accessToken: String {
|
|
@@ -74,14 +74,25 @@ public extension NitroReceiptValidationAndroidOptions {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
var
|
|
77
|
+
var purchaseToken: String {
|
|
78
78
|
@inline(__always)
|
|
79
79
|
get {
|
|
80
|
-
return String(self.
|
|
80
|
+
return String(self.__purchaseToken)
|
|
81
81
|
}
|
|
82
82
|
@inline(__always)
|
|
83
83
|
set {
|
|
84
|
-
self.
|
|
84
|
+
self.__purchaseToken = std.string(newValue)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var sku: String {
|
|
89
|
+
@inline(__always)
|
|
90
|
+
get {
|
|
91
|
+
return String(self.__sku)
|
|
92
|
+
}
|
|
93
|
+
@inline(__always)
|
|
94
|
+
set {
|
|
95
|
+
self.__sku = std.string(newValue)
|
|
85
96
|
}
|
|
86
97
|
}
|
|
87
98
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroReceiptValidationHorizonOptions.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroReceiptValidationHorizonOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroReceiptValidationHorizonOptions = margelo.nitro.iap.NitroReceiptValidationHorizonOptions
|
|
14
|
+
|
|
15
|
+
public extension NitroReceiptValidationHorizonOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroReceiptValidationHorizonOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(accessToken: String, sku: String, userId: String) {
|
|
22
|
+
self.init(std.string(accessToken), std.string(sku), std.string(userId))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var accessToken: String {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return String(self.__accessToken)
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__accessToken = std.string(newValue)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var sku: String {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return String(self.__sku)
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__sku = std.string(newValue)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var userId: String {
|
|
48
|
+
@inline(__always)
|
|
49
|
+
get {
|
|
50
|
+
return String(self.__userId)
|
|
51
|
+
}
|
|
52
|
+
@inline(__always)
|
|
53
|
+
set {
|
|
54
|
+
self.__userId = std.string(newValue)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -18,37 +18,72 @@ public extension NitroReceiptValidationParams {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroReceiptValidationParams`.
|
|
20
20
|
*/
|
|
21
|
-
init(
|
|
22
|
-
self.init(
|
|
23
|
-
if let __unwrappedValue =
|
|
24
|
-
return bridge.
|
|
21
|
+
init(apple: NitroReceiptValidationAppleOptions?, google: NitroReceiptValidationGoogleOptions?, horizon: NitroReceiptValidationHorizonOptions?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_NitroReceiptValidationAppleOptions_ in
|
|
23
|
+
if let __unwrappedValue = apple {
|
|
24
|
+
return bridge.create_std__optional_NitroReceiptValidationAppleOptions_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_NitroReceiptValidationGoogleOptions_ in
|
|
29
|
+
if let __unwrappedValue = google {
|
|
30
|
+
return bridge.create_std__optional_NitroReceiptValidationGoogleOptions_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_NitroReceiptValidationHorizonOptions_ in
|
|
35
|
+
if let __unwrappedValue = horizon {
|
|
36
|
+
return bridge.create_std__optional_NitroReceiptValidationHorizonOptions_(__unwrappedValue)
|
|
25
37
|
} else {
|
|
26
38
|
return .init()
|
|
27
39
|
}
|
|
28
40
|
}())
|
|
29
41
|
}
|
|
30
42
|
|
|
31
|
-
var
|
|
43
|
+
var apple: NitroReceiptValidationAppleOptions? {
|
|
44
|
+
@inline(__always)
|
|
45
|
+
get {
|
|
46
|
+
return self.__apple.value
|
|
47
|
+
}
|
|
48
|
+
@inline(__always)
|
|
49
|
+
set {
|
|
50
|
+
self.__apple = { () -> bridge.std__optional_NitroReceiptValidationAppleOptions_ in
|
|
51
|
+
if let __unwrappedValue = newValue {
|
|
52
|
+
return bridge.create_std__optional_NitroReceiptValidationAppleOptions_(__unwrappedValue)
|
|
53
|
+
} else {
|
|
54
|
+
return .init()
|
|
55
|
+
}
|
|
56
|
+
}()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var google: NitroReceiptValidationGoogleOptions? {
|
|
32
61
|
@inline(__always)
|
|
33
62
|
get {
|
|
34
|
-
return
|
|
63
|
+
return self.__google.value
|
|
35
64
|
}
|
|
36
65
|
@inline(__always)
|
|
37
66
|
set {
|
|
38
|
-
self.
|
|
67
|
+
self.__google = { () -> bridge.std__optional_NitroReceiptValidationGoogleOptions_ in
|
|
68
|
+
if let __unwrappedValue = newValue {
|
|
69
|
+
return bridge.create_std__optional_NitroReceiptValidationGoogleOptions_(__unwrappedValue)
|
|
70
|
+
} else {
|
|
71
|
+
return .init()
|
|
72
|
+
}
|
|
73
|
+
}()
|
|
39
74
|
}
|
|
40
75
|
}
|
|
41
76
|
|
|
42
|
-
var
|
|
77
|
+
var horizon: NitroReceiptValidationHorizonOptions? {
|
|
43
78
|
@inline(__always)
|
|
44
79
|
get {
|
|
45
|
-
return self.
|
|
80
|
+
return self.__horizon.value
|
|
46
81
|
}
|
|
47
82
|
@inline(__always)
|
|
48
83
|
set {
|
|
49
|
-
self.
|
|
84
|
+
self.__horizon = { () -> bridge.std__optional_NitroReceiptValidationHorizonOptions_ in
|
|
50
85
|
if let __unwrappedValue = newValue {
|
|
51
|
-
return bridge.
|
|
86
|
+
return bridge.create_std__optional_NitroReceiptValidationHorizonOptions_(__unwrappedValue)
|
|
52
87
|
} else {
|
|
53
88
|
return .init()
|
|
54
89
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BillingProgramAndroid.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/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 (BillingProgramAndroid).
|
|
30
|
+
*/
|
|
31
|
+
enum class BillingProgramAndroid {
|
|
32
|
+
UNSPECIFIED SWIFT_NAME(unspecified) = 0,
|
|
33
|
+
EXTERNAL_CONTENT_LINK SWIFT_NAME(externalContentLink) = 1,
|
|
34
|
+
EXTERNAL_OFFER SWIFT_NAME(externalOffer) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::iap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ BillingProgramAndroid <> JS BillingProgramAndroid (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::iap::BillingProgramAndroid> final {
|
|
44
|
+
static inline margelo::nitro::iap::BillingProgramAndroid 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("unspecified"): return margelo::nitro::iap::BillingProgramAndroid::UNSPECIFIED;
|
|
48
|
+
case hashString("external-content-link"): return margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_CONTENT_LINK;
|
|
49
|
+
case hashString("external-offer"): return margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_OFFER;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BillingProgramAndroid - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::BillingProgramAndroid arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::iap::BillingProgramAndroid::UNSPECIFIED: return JSIConverter<std::string>::toJSI(runtime, "unspecified");
|
|
57
|
+
case margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_CONTENT_LINK: return JSIConverter<std::string>::toJSI(runtime, "external-content-link");
|
|
58
|
+
case margelo::nitro::iap::BillingProgramAndroid::EXTERNAL_OFFER: return JSIConverter<std::string>::toJSI(runtime, "external-offer");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert BillingProgramAndroid 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("unspecified"):
|
|
71
|
+
case hashString("external-content-link"):
|
|
72
|
+
case hashString("external-offer"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ExternalLinkLaunchModeAndroid.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/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 (ExternalLinkLaunchModeAndroid).
|
|
30
|
+
*/
|
|
31
|
+
enum class ExternalLinkLaunchModeAndroid {
|
|
32
|
+
UNSPECIFIED SWIFT_NAME(unspecified) = 0,
|
|
33
|
+
LAUNCH_IN_EXTERNAL_BROWSER_OR_APP SWIFT_NAME(launchInExternalBrowserOrApp) = 1,
|
|
34
|
+
CALLER_WILL_LAUNCH_LINK SWIFT_NAME(callerWillLaunchLink) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::iap
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ ExternalLinkLaunchModeAndroid <> JS ExternalLinkLaunchModeAndroid (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid> final {
|
|
44
|
+
static inline margelo::nitro::iap::ExternalLinkLaunchModeAndroid 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("unspecified"): return margelo::nitro::iap::ExternalLinkLaunchModeAndroid::UNSPECIFIED;
|
|
48
|
+
case hashString("launch-in-external-browser-or-app"): return margelo::nitro::iap::ExternalLinkLaunchModeAndroid::LAUNCH_IN_EXTERNAL_BROWSER_OR_APP;
|
|
49
|
+
case hashString("caller-will-launch-link"): return margelo::nitro::iap::ExternalLinkLaunchModeAndroid::CALLER_WILL_LAUNCH_LINK;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ExternalLinkLaunchModeAndroid - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::ExternalLinkLaunchModeAndroid arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::iap::ExternalLinkLaunchModeAndroid::UNSPECIFIED: return JSIConverter<std::string>::toJSI(runtime, "unspecified");
|
|
57
|
+
case margelo::nitro::iap::ExternalLinkLaunchModeAndroid::LAUNCH_IN_EXTERNAL_BROWSER_OR_APP: return JSIConverter<std::string>::toJSI(runtime, "launch-in-external-browser-or-app");
|
|
58
|
+
case margelo::nitro::iap::ExternalLinkLaunchModeAndroid::CALLER_WILL_LAUNCH_LINK: return JSIConverter<std::string>::toJSI(runtime, "caller-will-launch-link");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert ExternalLinkLaunchModeAndroid 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("unspecified"):
|
|
71
|
+
case hashString("launch-in-external-browser-or-app"):
|
|
72
|
+
case hashString("caller-will-launch-link"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|