react-native-iap 14.5.1-rc.1 → 14.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +126 -0
- package/ios/HybridRnIap.swift +24 -0
- package/lib/module/index.js +166 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +58 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/index.d.ts +124 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +71 -0
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +100 -1
- 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 +76 -0
- 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/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/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +95 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +48 -0
- 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/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/openiap-versions.json +2 -2
- package/package.json +1 -1
- package/src/index.ts +218 -0
- package/src/specs/RnIap.nitro.ts +101 -0
- package/src/types.ts +110 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroBillingProgramAvailabilityResultAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
|
+
|
|
29
|
+
#include "BillingProgramAndroid.hpp"
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::iap {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A struct which can be represented as a JavaScript object (NitroBillingProgramAvailabilityResultAndroid).
|
|
35
|
+
*/
|
|
36
|
+
struct NitroBillingProgramAvailabilityResultAndroid {
|
|
37
|
+
public:
|
|
38
|
+
BillingProgramAndroid billingProgram SWIFT_PRIVATE;
|
|
39
|
+
bool isAvailable SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
NitroBillingProgramAvailabilityResultAndroid() = default;
|
|
43
|
+
explicit NitroBillingProgramAvailabilityResultAndroid(BillingProgramAndroid billingProgram, bool isAvailable): billingProgram(billingProgram), isAvailable(isAvailable) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::iap
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ NitroBillingProgramAvailabilityResultAndroid <> JS NitroBillingProgramAvailabilityResultAndroid (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid> final {
|
|
53
|
+
static inline margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid(
|
|
56
|
+
JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, "billingProgram")),
|
|
57
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isAvailable"))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroBillingProgramAvailabilityResultAndroid& arg) {
|
|
61
|
+
jsi::Object obj(runtime);
|
|
62
|
+
obj.setProperty(runtime, "billingProgram", JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
|
|
63
|
+
obj.setProperty(runtime, "isAvailable", JSIConverter<bool>::toJSI(runtime, arg.isAvailable));
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
67
|
+
if (!value.isObject()) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
jsi::Object obj = value.getObject(runtime);
|
|
71
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (!JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, "billingProgram"))) return false;
|
|
75
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isAvailable"))) return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroBillingProgramReportingDetailsAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
|
+
|
|
29
|
+
#include "BillingProgramAndroid.hpp"
|
|
30
|
+
#include <string>
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::iap {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A struct which can be represented as a JavaScript object (NitroBillingProgramReportingDetailsAndroid).
|
|
36
|
+
*/
|
|
37
|
+
struct NitroBillingProgramReportingDetailsAndroid {
|
|
38
|
+
public:
|
|
39
|
+
BillingProgramAndroid billingProgram SWIFT_PRIVATE;
|
|
40
|
+
std::string externalTransactionToken SWIFT_PRIVATE;
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
NitroBillingProgramReportingDetailsAndroid() = default;
|
|
44
|
+
explicit NitroBillingProgramReportingDetailsAndroid(BillingProgramAndroid billingProgram, std::string externalTransactionToken): billingProgram(billingProgram), externalTransactionToken(externalTransactionToken) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace margelo::nitro::iap
|
|
48
|
+
|
|
49
|
+
namespace margelo::nitro {
|
|
50
|
+
|
|
51
|
+
// C++ NitroBillingProgramReportingDetailsAndroid <> JS NitroBillingProgramReportingDetailsAndroid (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid> final {
|
|
54
|
+
static inline margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid(
|
|
57
|
+
JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, "billingProgram")),
|
|
58
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "externalTransactionToken"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroBillingProgramReportingDetailsAndroid& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "billingProgram", JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
|
|
64
|
+
obj.setProperty(runtime, "externalTransactionToken", JSIConverter<std::string>::toJSI(runtime, arg.externalTransactionToken));
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isObject()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
jsi::Object obj = value.getObject(runtime);
|
|
72
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, "billingProgram"))) return false;
|
|
76
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "externalTransactionToken"))) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLaunchExternalLinkParamsAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BillingProgramAndroid` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
|
|
28
|
+
// Forward declaration of `ExternalLinkLaunchModeAndroid` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::iap { enum class ExternalLinkLaunchModeAndroid; }
|
|
30
|
+
// Forward declaration of `ExternalLinkTypeAndroid` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::iap { enum class ExternalLinkTypeAndroid; }
|
|
32
|
+
|
|
33
|
+
#include "BillingProgramAndroid.hpp"
|
|
34
|
+
#include "ExternalLinkLaunchModeAndroid.hpp"
|
|
35
|
+
#include "ExternalLinkTypeAndroid.hpp"
|
|
36
|
+
#include <string>
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::iap {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A struct which can be represented as a JavaScript object (NitroLaunchExternalLinkParamsAndroid).
|
|
42
|
+
*/
|
|
43
|
+
struct NitroLaunchExternalLinkParamsAndroid {
|
|
44
|
+
public:
|
|
45
|
+
BillingProgramAndroid billingProgram SWIFT_PRIVATE;
|
|
46
|
+
ExternalLinkLaunchModeAndroid launchMode SWIFT_PRIVATE;
|
|
47
|
+
ExternalLinkTypeAndroid linkType SWIFT_PRIVATE;
|
|
48
|
+
std::string linkUri SWIFT_PRIVATE;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
NitroLaunchExternalLinkParamsAndroid() = default;
|
|
52
|
+
explicit NitroLaunchExternalLinkParamsAndroid(BillingProgramAndroid billingProgram, ExternalLinkLaunchModeAndroid launchMode, ExternalLinkTypeAndroid linkType, std::string linkUri): billingProgram(billingProgram), launchMode(launchMode), linkType(linkType), linkUri(linkUri) {}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::iap
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ NitroLaunchExternalLinkParamsAndroid <> JS NitroLaunchExternalLinkParamsAndroid (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid> final {
|
|
62
|
+
static inline margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid(
|
|
65
|
+
JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, "billingProgram")),
|
|
66
|
+
JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::fromJSI(runtime, obj.getProperty(runtime, "launchMode")),
|
|
67
|
+
JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::fromJSI(runtime, obj.getProperty(runtime, "linkType")),
|
|
68
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkUri"))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, "billingProgram", JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
|
|
74
|
+
obj.setProperty(runtime, "launchMode", JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::toJSI(runtime, arg.launchMode));
|
|
75
|
+
obj.setProperty(runtime, "linkType", JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::toJSI(runtime, arg.linkType));
|
|
76
|
+
obj.setProperty(runtime, "linkUri", JSIConverter<std::string>::toJSI(runtime, arg.linkUri));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (!JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, "billingProgram"))) return false;
|
|
88
|
+
if (!JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::canConvert(runtime, obj.getProperty(runtime, "launchMode"))) return false;
|
|
89
|
+
if (!JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::canConvert(runtime, obj.getProperty(runtime, "linkType"))) return false;
|
|
90
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkUri"))) return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace margelo::nitro
|
package/openiap-versions.json
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2153,6 +2153,224 @@ export const createAlternativeBillingTokenAndroid: MutationField<
|
|
|
2153
2153
|
}
|
|
2154
2154
|
};
|
|
2155
2155
|
|
|
2156
|
+
// ------------------------------
|
|
2157
|
+
// Billing Programs API (Android 8.2.0+)
|
|
2158
|
+
// ------------------------------
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* Billing program type for external content links and external offers.
|
|
2162
|
+
* @platform Android
|
|
2163
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2164
|
+
*/
|
|
2165
|
+
export type BillingProgramAndroid =
|
|
2166
|
+
| 'unspecified'
|
|
2167
|
+
| 'external-content-link'
|
|
2168
|
+
| 'external-offer';
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* Launch mode for external link flow.
|
|
2172
|
+
* @platform Android
|
|
2173
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2174
|
+
*/
|
|
2175
|
+
export type ExternalLinkLaunchModeAndroid =
|
|
2176
|
+
| 'unspecified'
|
|
2177
|
+
| 'launch-in-external-browser-or-app'
|
|
2178
|
+
| 'caller-will-launch-link';
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* Link type for external link flow.
|
|
2182
|
+
* @platform Android
|
|
2183
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2184
|
+
*/
|
|
2185
|
+
export type ExternalLinkTypeAndroid =
|
|
2186
|
+
| 'unspecified'
|
|
2187
|
+
| 'link-to-digital-content-offer'
|
|
2188
|
+
| 'link-to-app-download';
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* Parameters for launching an external link (Android 8.2.0+).
|
|
2192
|
+
*/
|
|
2193
|
+
export interface LaunchExternalLinkParamsAndroid {
|
|
2194
|
+
/** The billing program (external-content-link or external-offer) */
|
|
2195
|
+
billingProgram: BillingProgramAndroid;
|
|
2196
|
+
/** The external link launch mode */
|
|
2197
|
+
launchMode: ExternalLinkLaunchModeAndroid;
|
|
2198
|
+
/** The type of the external link */
|
|
2199
|
+
linkType: ExternalLinkTypeAndroid;
|
|
2200
|
+
/** The URI where the content will be accessed from */
|
|
2201
|
+
linkUri: string;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* Result of checking billing program availability (Android 8.2.0+).
|
|
2206
|
+
*/
|
|
2207
|
+
export interface BillingProgramAvailabilityResultAndroid {
|
|
2208
|
+
/** The billing program that was checked */
|
|
2209
|
+
billingProgram: BillingProgramAndroid;
|
|
2210
|
+
/** Whether the billing program is available for the user */
|
|
2211
|
+
isAvailable: boolean;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Reporting details for external transactions (Android 8.2.0+).
|
|
2216
|
+
*/
|
|
2217
|
+
export interface BillingProgramReportingDetailsAndroid {
|
|
2218
|
+
/** The billing program that the reporting details are associated with */
|
|
2219
|
+
billingProgram: BillingProgramAndroid;
|
|
2220
|
+
/** External transaction token used to report transactions to Google */
|
|
2221
|
+
externalTransactionToken: string;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Enable a billing program before initConnection (Android only).
|
|
2226
|
+
* Must be called BEFORE initConnection() to configure the BillingClient.
|
|
2227
|
+
*
|
|
2228
|
+
* @param program - The billing program to enable (external-content-link or external-offer)
|
|
2229
|
+
* @platform Android
|
|
2230
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2231
|
+
*
|
|
2232
|
+
* @example
|
|
2233
|
+
* ```typescript
|
|
2234
|
+
* // Enable external offers before connecting
|
|
2235
|
+
* enableBillingProgramAndroid('external-offer');
|
|
2236
|
+
* await initConnection();
|
|
2237
|
+
* ```
|
|
2238
|
+
*/
|
|
2239
|
+
export const enableBillingProgramAndroid = (
|
|
2240
|
+
program: BillingProgramAndroid,
|
|
2241
|
+
): void => {
|
|
2242
|
+
if (Platform.OS !== 'android') {
|
|
2243
|
+
RnIapConsole.warn(
|
|
2244
|
+
'enableBillingProgramAndroid is only supported on Android',
|
|
2245
|
+
);
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
try {
|
|
2249
|
+
IAP.instance.enableBillingProgramAndroid(program as any);
|
|
2250
|
+
} catch (error) {
|
|
2251
|
+
RnIapConsole.error('Failed to enable billing program:', error);
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Check if a billing program is available for this user/device (Android only).
|
|
2257
|
+
*
|
|
2258
|
+
* @param program - The billing program to check
|
|
2259
|
+
* @returns Promise with availability result
|
|
2260
|
+
* @platform Android
|
|
2261
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2262
|
+
*
|
|
2263
|
+
* @example
|
|
2264
|
+
* ```typescript
|
|
2265
|
+
* const result = await isBillingProgramAvailableAndroid('external-offer');
|
|
2266
|
+
* if (result.isAvailable) {
|
|
2267
|
+
* // External offers are available for this user
|
|
2268
|
+
* }
|
|
2269
|
+
* ```
|
|
2270
|
+
*/
|
|
2271
|
+
export const isBillingProgramAvailableAndroid = async (
|
|
2272
|
+
program: BillingProgramAndroid,
|
|
2273
|
+
): Promise<BillingProgramAvailabilityResultAndroid> => {
|
|
2274
|
+
if (Platform.OS !== 'android') {
|
|
2275
|
+
throw new Error('Billing Programs API is only supported on Android');
|
|
2276
|
+
}
|
|
2277
|
+
try {
|
|
2278
|
+
const result = await IAP.instance.isBillingProgramAvailableAndroid(
|
|
2279
|
+
program as any,
|
|
2280
|
+
);
|
|
2281
|
+
return {
|
|
2282
|
+
billingProgram: result.billingProgram as unknown as BillingProgramAndroid,
|
|
2283
|
+
isAvailable: result.isAvailable,
|
|
2284
|
+
};
|
|
2285
|
+
} catch (error) {
|
|
2286
|
+
RnIapConsole.error('Failed to check billing program availability:', error);
|
|
2287
|
+
throw error;
|
|
2288
|
+
}
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2291
|
+
/**
|
|
2292
|
+
* Create billing program reporting details for external transactions (Android only).
|
|
2293
|
+
* Used to get the external transaction token needed for reporting to Google.
|
|
2294
|
+
*
|
|
2295
|
+
* @param program - The billing program to create reporting details for
|
|
2296
|
+
* @returns Promise with reporting details including external transaction token
|
|
2297
|
+
* @platform Android
|
|
2298
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2299
|
+
*
|
|
2300
|
+
* @example
|
|
2301
|
+
* ```typescript
|
|
2302
|
+
* const details = await createBillingProgramReportingDetailsAndroid('external-offer');
|
|
2303
|
+
* // Use details.externalTransactionToken to report the transaction
|
|
2304
|
+
* await fetch('/api/report-external-transaction', {
|
|
2305
|
+
* method: 'POST',
|
|
2306
|
+
* body: JSON.stringify({ token: details.externalTransactionToken })
|
|
2307
|
+
* });
|
|
2308
|
+
* ```
|
|
2309
|
+
*/
|
|
2310
|
+
export const createBillingProgramReportingDetailsAndroid = async (
|
|
2311
|
+
program: BillingProgramAndroid,
|
|
2312
|
+
): Promise<BillingProgramReportingDetailsAndroid> => {
|
|
2313
|
+
if (Platform.OS !== 'android') {
|
|
2314
|
+
throw new Error('Billing Programs API is only supported on Android');
|
|
2315
|
+
}
|
|
2316
|
+
try {
|
|
2317
|
+
const result =
|
|
2318
|
+
await IAP.instance.createBillingProgramReportingDetailsAndroid(
|
|
2319
|
+
program as any,
|
|
2320
|
+
);
|
|
2321
|
+
return {
|
|
2322
|
+
billingProgram: result.billingProgram as unknown as BillingProgramAndroid,
|
|
2323
|
+
externalTransactionToken: result.externalTransactionToken,
|
|
2324
|
+
};
|
|
2325
|
+
} catch (error) {
|
|
2326
|
+
RnIapConsole.error(
|
|
2327
|
+
'Failed to create billing program reporting details:',
|
|
2328
|
+
error,
|
|
2329
|
+
);
|
|
2330
|
+
throw error;
|
|
2331
|
+
}
|
|
2332
|
+
};
|
|
2333
|
+
|
|
2334
|
+
/**
|
|
2335
|
+
* Launch external link for external offers or app download (Android only).
|
|
2336
|
+
*
|
|
2337
|
+
* @param params - Parameters for launching the external link
|
|
2338
|
+
* @returns Promise<boolean> - true if user accepted, false otherwise
|
|
2339
|
+
* @platform Android
|
|
2340
|
+
* @since Google Play Billing Library 8.2.0+
|
|
2341
|
+
*
|
|
2342
|
+
* @example
|
|
2343
|
+
* ```typescript
|
|
2344
|
+
* const success = await launchExternalLinkAndroid({
|
|
2345
|
+
* billingProgram: 'external-offer',
|
|
2346
|
+
* launchMode: 'launch-in-external-browser-or-app',
|
|
2347
|
+
* linkType: 'link-to-digital-content-offer',
|
|
2348
|
+
* linkUri: 'https://your-website.com/purchase'
|
|
2349
|
+
* });
|
|
2350
|
+
* if (success) {
|
|
2351
|
+
* console.log('User accepted external link');
|
|
2352
|
+
* }
|
|
2353
|
+
* ```
|
|
2354
|
+
*/
|
|
2355
|
+
export const launchExternalLinkAndroid = async (
|
|
2356
|
+
params: LaunchExternalLinkParamsAndroid,
|
|
2357
|
+
): Promise<boolean> => {
|
|
2358
|
+
if (Platform.OS !== 'android') {
|
|
2359
|
+
throw new Error('Billing Programs API is only supported on Android');
|
|
2360
|
+
}
|
|
2361
|
+
try {
|
|
2362
|
+
return await IAP.instance.launchExternalLinkAndroid({
|
|
2363
|
+
billingProgram: params.billingProgram as any,
|
|
2364
|
+
launchMode: params.launchMode as any,
|
|
2365
|
+
linkType: params.linkType as any,
|
|
2366
|
+
linkUri: params.linkUri,
|
|
2367
|
+
});
|
|
2368
|
+
} catch (error) {
|
|
2369
|
+
RnIapConsole.error('Failed to launch external link:', error);
|
|
2370
|
+
throw error;
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2156
2374
|
// ------------------------------
|
|
2157
2375
|
// iOS External Purchase
|
|
2158
2376
|
// ------------------------------
|
package/src/specs/RnIap.nitro.ts
CHANGED
|
@@ -44,6 +44,22 @@ export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
|
44
44
|
// Note: Nitro requires at least 2 values for union types
|
|
45
45
|
export type PurchaseVerificationProvider = 'iapkit' | 'none';
|
|
46
46
|
|
|
47
|
+
// Billing Programs API types (Android 8.2.0+)
|
|
48
|
+
export type BillingProgramAndroid =
|
|
49
|
+
| 'unspecified'
|
|
50
|
+
| 'external-content-link'
|
|
51
|
+
| 'external-offer';
|
|
52
|
+
|
|
53
|
+
export type ExternalLinkLaunchModeAndroid =
|
|
54
|
+
| 'unspecified'
|
|
55
|
+
| 'launch-in-external-browser-or-app'
|
|
56
|
+
| 'caller-will-launch-link';
|
|
57
|
+
|
|
58
|
+
export type ExternalLinkTypeAndroid =
|
|
59
|
+
| 'unspecified'
|
|
60
|
+
| 'link-to-digital-content-offer'
|
|
61
|
+
| 'link-to-app-download';
|
|
62
|
+
|
|
47
63
|
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
48
64
|
// ║ PARAMS ║
|
|
49
65
|
// ╚══════════════════════════════════════════════════════════════════════════╝
|
|
@@ -147,6 +163,20 @@ export interface NitroDeepLinkOptionsAndroid {
|
|
|
147
163
|
packageNameAndroid?: DeepLinkOptions['packageNameAndroid'];
|
|
148
164
|
}
|
|
149
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Parameters for launching an external link (Android 8.2.0+)
|
|
168
|
+
*/
|
|
169
|
+
export interface NitroLaunchExternalLinkParamsAndroid {
|
|
170
|
+
/** The billing program (external-content-link or external-offer) */
|
|
171
|
+
billingProgram: BillingProgramAndroid;
|
|
172
|
+
/** The external link launch mode */
|
|
173
|
+
launchMode: ExternalLinkLaunchModeAndroid;
|
|
174
|
+
/** The type of the external link */
|
|
175
|
+
linkType: ExternalLinkTypeAndroid;
|
|
176
|
+
/** The URI where the content will be accessed from */
|
|
177
|
+
linkUri: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
150
180
|
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
151
181
|
// ║ TYPES ║
|
|
152
182
|
// ╚══════════════════════════════════════════════════════════════════════════╝
|
|
@@ -251,6 +281,26 @@ export interface NitroVerifyPurchaseWithProviderResult {
|
|
|
251
281
|
provider: PurchaseVerificationProvider;
|
|
252
282
|
}
|
|
253
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Result of checking billing program availability (Android 8.2.0+)
|
|
286
|
+
*/
|
|
287
|
+
export interface NitroBillingProgramAvailabilityResultAndroid {
|
|
288
|
+
/** The billing program that was checked */
|
|
289
|
+
billingProgram: BillingProgramAndroid;
|
|
290
|
+
/** Whether the billing program is available for the user */
|
|
291
|
+
isAvailable: boolean;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Reporting details for external transactions (Android 8.2.0+)
|
|
296
|
+
*/
|
|
297
|
+
export interface NitroBillingProgramReportingDetailsAndroid {
|
|
298
|
+
/** The billing program that the reporting details are associated with */
|
|
299
|
+
billingProgram: BillingProgramAndroid;
|
|
300
|
+
/** External transaction token used to report transactions to Google */
|
|
301
|
+
externalTransactionToken: string;
|
|
302
|
+
}
|
|
303
|
+
|
|
254
304
|
/**
|
|
255
305
|
* Discount amount details for one-time purchase offers (Android)
|
|
256
306
|
*/
|
|
@@ -870,6 +920,57 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
|
870
920
|
listener: (details: UserChoiceBillingDetails) => void,
|
|
871
921
|
): void;
|
|
872
922
|
|
|
923
|
+
// ╔════════════════════════════════════════════════════════════════════════╗
|
|
924
|
+
// ║ BILLING PROGRAMS API (Android 8.2.0+) ║
|
|
925
|
+
// ╚════════════════════════════════════════════════════════════════════════╝
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Enable a billing program before initConnection (Android only).
|
|
929
|
+
* Must be called BEFORE initConnection() to configure the BillingClient.
|
|
930
|
+
*
|
|
931
|
+
* @param program - The billing program to enable
|
|
932
|
+
* @platform Android
|
|
933
|
+
* @since Billing Library 8.2.0+
|
|
934
|
+
*/
|
|
935
|
+
enableBillingProgramAndroid(program: BillingProgramAndroid): void;
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Check if a billing program is available for this user/device (Android only).
|
|
939
|
+
*
|
|
940
|
+
* @param program - The billing program to check
|
|
941
|
+
* @returns Promise with availability result
|
|
942
|
+
* @platform Android
|
|
943
|
+
* @since Billing Library 8.2.0+
|
|
944
|
+
*/
|
|
945
|
+
isBillingProgramAvailableAndroid(
|
|
946
|
+
program: BillingProgramAndroid,
|
|
947
|
+
): Promise<NitroBillingProgramAvailabilityResultAndroid>;
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Create billing program reporting details for external transactions (Android only).
|
|
951
|
+
* Used to get the external transaction token needed for reporting to Google.
|
|
952
|
+
*
|
|
953
|
+
* @param program - The billing program to create reporting details for
|
|
954
|
+
* @returns Promise with reporting details including external transaction token
|
|
955
|
+
* @platform Android
|
|
956
|
+
* @since Billing Library 8.2.0+
|
|
957
|
+
*/
|
|
958
|
+
createBillingProgramReportingDetailsAndroid(
|
|
959
|
+
program: BillingProgramAndroid,
|
|
960
|
+
): Promise<NitroBillingProgramReportingDetailsAndroid>;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Launch external link for external offers or app download (Android only).
|
|
964
|
+
*
|
|
965
|
+
* @param params - Parameters for launching the external link
|
|
966
|
+
* @returns Promise<boolean> - true if user accepted, false otherwise
|
|
967
|
+
* @platform Android
|
|
968
|
+
* @since Billing Library 8.2.0+
|
|
969
|
+
*/
|
|
970
|
+
launchExternalLinkAndroid(
|
|
971
|
+
params: NitroLaunchExternalLinkParamsAndroid,
|
|
972
|
+
): Promise<boolean>;
|
|
973
|
+
|
|
873
974
|
// ╔════════════════════════════════════════════════════════════════════════╗
|
|
874
975
|
// ║ EXTERNAL PURCHASE LINKS (iOS 16.0+) ║
|
|
875
976
|
// ╚════════════════════════════════════════════════════════════════════════╝
|