@onramper/onramper-react-native 1.2.2 → 1.3.0
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/CHANGELOG.md +214 -0
- package/README.md +46 -4
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios.swiftinterface +107 -4
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/DWARF/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/OnramperSDK.yml +3560 -2684
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +107 -4
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +107 -4
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/DWARF/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/OnramperSDK.yml +3560 -2684
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/OnramperSDK.yml +3523 -2651
- package/ios/HybridOnramperCheckoutButton.swift +77 -3
- package/ios/HybridOnramperNitro.swift +140 -78
- package/ios/OnramperSDKBridge.swift +19 -2
- package/ios/PreparedIntentRegistry.swift +124 -6
- package/ios/SDKLogRelay.swift +41 -0
- package/lib/commonjs/CheckoutButton.js +34 -0
- package/lib/commonjs/CheckoutButton.js.map +1 -0
- package/lib/commonjs/OnramperClient.js +69 -12
- package/lib/commonjs/OnramperClient.js.map +1 -1
- package/lib/commonjs/errors.js +19 -5
- package/lib/commonjs/errors.js.map +1 -1
- package/lib/commonjs/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/lib/module/CheckoutButton.js +30 -0
- package/lib/module/CheckoutButton.js.map +1 -0
- package/lib/module/OnramperClient.js +69 -12
- package/lib/module/OnramperClient.js.map +1 -1
- package/lib/module/errors.js +19 -5
- package/lib/module/errors.js.map +1 -1
- package/lib/module/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/lib/typescript/commonjs/src/CheckoutButton.d.ts +20 -0
- package/lib/typescript/commonjs/src/CheckoutButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/OnramperClient.d.ts +5 -1
- package/lib/typescript/commonjs/src/OnramperClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/errors.d.ts +6 -1
- package/lib/typescript/commonjs/src/errors.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/events.d.ts +10 -0
- package/lib/typescript/commonjs/src/events.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/OnramperCheckoutButton.nitro.d.ts +6 -0
- package/lib/typescript/commonjs/src/specs/OnramperCheckoutButton.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/OnramperNitro.nitro.d.ts +3 -0
- package/lib/typescript/commonjs/src/specs/OnramperNitro.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types.d.ts +32 -3
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
- package/lib/typescript/module/src/CheckoutButton.d.ts +20 -0
- package/lib/typescript/module/src/CheckoutButton.d.ts.map +1 -0
- package/lib/typescript/module/src/OnramperClient.d.ts +5 -1
- package/lib/typescript/module/src/OnramperClient.d.ts.map +1 -1
- package/lib/typescript/module/src/errors.d.ts +6 -1
- package/lib/typescript/module/src/errors.d.ts.map +1 -1
- package/lib/typescript/module/src/events.d.ts +10 -0
- package/lib/typescript/module/src/events.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/OnramperCheckoutButton.nitro.d.ts +6 -0
- package/lib/typescript/module/src/specs/OnramperCheckoutButton.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/OnramperNitro.nitro.d.ts +3 -0
- package/lib/typescript/module/src/specs/OnramperNitro.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/types.d.ts +32 -3
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.cpp +11 -3
- package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.hpp +44 -7
- package/nitrogen/generated/ios/c++/HybridOnramperCheckoutButtonSpecSwift.hpp +9 -0
- package/nitrogen/generated/ios/c++/HybridOnramperNitroSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/c++/views/HybridOnramperCheckoutButtonComponent.mm +5 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +5 -5
- package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec_cxx.swift +32 -0
- package/nitrogen/generated/ios/swift/HybridOnramperNitroSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOnramperNitroSpec_cxx.swift +27 -11
- package/nitrogen/generated/ios/swift/OnramperNitroConfig.swift +16 -6
- package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/HybridOnramperNitroSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridOnramperNitroSpec.hpp +1 -0
- package/nitrogen/generated/shared/c++/OnramperNitroConfig.hpp +10 -2
- package/nitrogen/generated/shared/c++/views/HybridOnramperCheckoutButtonComponent.cpp +11 -0
- package/nitrogen/generated/shared/c++/views/HybridOnramperCheckoutButtonComponent.hpp +3 -2
- package/nitrogen/generated/shared/json/OnramperCheckoutButtonConfig.json +1 -0
- package/package.json +5 -2
- package/src/CheckoutButton.ts +28 -0
- package/src/OnramperClient.ts +69 -9
- package/src/errors.ts +29 -6
- package/src/events.ts +5 -0
- package/src/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/src/index.ts +3 -0
- package/src/specs/OnramperCheckoutButton.nitro.ts +6 -0
- package/src/specs/OnramperNitro.nitro.ts +3 -0
- package/src/types.ts +36 -3
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { OnramperErrorPayload } from './errors.js';
|
|
2
2
|
export type OnramperEnvironment = 'development' | 'production';
|
|
3
3
|
export type OnramperLogLevel = 'off' | 'error' | 'info' | 'debug';
|
|
4
|
+
/** A sanitized native SDK diagnostic. Timestamp is Unix milliseconds. */
|
|
5
|
+
export interface OnramperLogRecord {
|
|
6
|
+
timestamp: number;
|
|
7
|
+
level: OnramperLogLevel;
|
|
8
|
+
category: string;
|
|
9
|
+
event: string;
|
|
10
|
+
context: Record<string, string>;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
4
13
|
export type OnramperTheme = 'system' | 'light' | 'dark';
|
|
5
14
|
export type TransactionType = 'buy' | 'sell';
|
|
6
15
|
export interface SessionCredentials {
|
|
@@ -13,12 +22,16 @@ export interface OnramperConfiguration {
|
|
|
13
22
|
environment: OnramperEnvironment;
|
|
14
23
|
theme?: OnramperTheme;
|
|
15
24
|
logLevel?: OnramperLogLevel;
|
|
25
|
+
/** Receives native records in JS; system Console output is preserved. Off unless logLevel enables it. */
|
|
26
|
+
logHandler?: (record: OnramperLogRecord) => void;
|
|
27
|
+
/** Opt-in provider-event telemetry to the BFF. Defaults to false. */
|
|
28
|
+
isEventLoggingEnabled?: boolean;
|
|
29
|
+
/** Emit provider events at info even when logLevel is lower. Defaults to false. */
|
|
30
|
+
isEventConsoleLoggingEnabled?: boolean;
|
|
16
31
|
/**
|
|
17
32
|
* Called by the SDK when the session token expires and needs to be re-issued.
|
|
18
33
|
*
|
|
19
|
-
* May be synchronous or async
|
|
20
|
-
* round-trip (`onSessionExpired` → `provideSessionCredentials`) so Promises
|
|
21
|
-
* are awaited normally. Throw or reject to signal that no fresh credentials
|
|
34
|
+
* May be synchronous or async; the Nitro bridge awaits the callback directly. Throw or reject to signal that no fresh credentials
|
|
22
35
|
* are available; the SDK will surface `userTokenRefreshFailed`.
|
|
23
36
|
*/
|
|
24
37
|
onSessionExpired: () => SessionCredentials | Promise<SessionCredentials>;
|
|
@@ -48,6 +61,17 @@ export interface QuoteResponse {
|
|
|
48
61
|
networkFee: number;
|
|
49
62
|
transactionFee: number;
|
|
50
63
|
recommendations?: string[];
|
|
64
|
+
providerContext?: Record<string, ProviderJSONValue>;
|
|
65
|
+
}
|
|
66
|
+
/** JSON values used in provider-specific quote metadata (including booleans and limits). */
|
|
67
|
+
export type ProviderJSONValue = string | number | boolean | null | ProviderJSONValue[] | {
|
|
68
|
+
[key: string]: ProviderJSONValue;
|
|
69
|
+
};
|
|
70
|
+
export interface PaymentDisclosure {
|
|
71
|
+
code: string;
|
|
72
|
+
version: string;
|
|
73
|
+
contentMarkdown: string;
|
|
74
|
+
contentHtml: string;
|
|
51
75
|
}
|
|
52
76
|
export interface OnramperUserPrefill {
|
|
53
77
|
email?: string;
|
|
@@ -67,6 +91,9 @@ export interface HeadlessCheckoutData {
|
|
|
67
91
|
checkoutPaymentType: CheckoutPaymentType;
|
|
68
92
|
url: string;
|
|
69
93
|
renderType: RenderType;
|
|
94
|
+
providerBootstrap?: {
|
|
95
|
+
framesBaseUrl?: string;
|
|
96
|
+
};
|
|
70
97
|
}
|
|
71
98
|
export interface CheckoutFinalizeResponse {
|
|
72
99
|
headlessCheckoutId: string;
|
|
@@ -131,6 +158,8 @@ export type OnramperState = {
|
|
|
131
158
|
url: string;
|
|
132
159
|
renderType: RenderType;
|
|
133
160
|
paymentType: CheckoutPaymentType;
|
|
161
|
+
} | {
|
|
162
|
+
kind: 'paymentPending';
|
|
134
163
|
} | {
|
|
135
164
|
kind: 'completed';
|
|
136
165
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAU,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,YAAY,CAAC;AAC/D,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAA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AAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,GAC5F;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAEpD,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
namespace margelo::nitro::onramper::bridge::swift {
|
|
17
17
|
|
|
18
|
+
// pragma MARK: std::function<void(double /* height */)>
|
|
19
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
|
+
auto swiftClosure = OnramperReactNative::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
21
|
+
return [swiftClosure = std::move(swiftClosure)](double height) mutable -> void {
|
|
22
|
+
swiftClosure.call(height);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
// pragma MARK: std::shared_ptr<HybridOnramperCheckoutButtonSpec>
|
|
19
27
|
std::shared_ptr<HybridOnramperCheckoutButtonSpec> create_std__shared_ptr_HybridOnramperCheckoutButtonSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
20
28
|
OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx swiftPart = OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -55,11 +63,11 @@ namespace margelo::nitro::onramper::bridge::swift {
|
|
|
55
63
|
};
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
// pragma MARK: std::function<void(const std::string& /*
|
|
66
|
+
// pragma MARK: std::function<void(const std::string& /* recordJson */)>
|
|
59
67
|
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
60
68
|
auto swiftClosure = OnramperReactNative::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
61
|
-
return [swiftClosure = std::move(swiftClosure)](const std::string&
|
|
62
|
-
swiftClosure.call(
|
|
69
|
+
return [swiftClosure = std::move(swiftClosure)](const std::string& recordJson) mutable -> void {
|
|
70
|
+
swiftClosure.call(recordJson);
|
|
63
71
|
};
|
|
64
72
|
}
|
|
65
73
|
|
|
@@ -43,6 +43,43 @@ namespace OnramperReactNative { class HybridOnramperNitroSpec_cxx; }
|
|
|
43
43
|
*/
|
|
44
44
|
namespace margelo::nitro::onramper::bridge::swift {
|
|
45
45
|
|
|
46
|
+
// pragma MARK: std::function<void(double /* height */)>
|
|
47
|
+
/**
|
|
48
|
+
* Specialized version of `std::function<void(double)>`.
|
|
49
|
+
*/
|
|
50
|
+
using Func_void_double = std::function<void(double /* height */)>;
|
|
51
|
+
/**
|
|
52
|
+
* Wrapper class for a `std::function<void(double / * height * /)>`, this can be used from Swift.
|
|
53
|
+
*/
|
|
54
|
+
class Func_void_double_Wrapper final {
|
|
55
|
+
public:
|
|
56
|
+
explicit Func_void_double_Wrapper(std::function<void(double /* height */)>&& func): _function(std::make_unique<std::function<void(double /* height */)>>(std::move(func))) {}
|
|
57
|
+
inline void call(double height) const noexcept {
|
|
58
|
+
_function->operator()(height);
|
|
59
|
+
}
|
|
60
|
+
private:
|
|
61
|
+
std::unique_ptr<std::function<void(double /* height */)>> _function;
|
|
62
|
+
} SWIFT_NONCOPYABLE;
|
|
63
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
64
|
+
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
|
|
65
|
+
return Func_void_double_Wrapper(std::move(value));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// pragma MARK: std::optional<std::function<void(double /* height */)>>
|
|
69
|
+
/**
|
|
70
|
+
* Specialized version of `std::optional<std::function<void(double / * height * /)>>`.
|
|
71
|
+
*/
|
|
72
|
+
using std__optional_std__function_void_double____height______ = std::optional<std::function<void(double /* height */)>>;
|
|
73
|
+
inline std::optional<std::function<void(double /* height */)>> create_std__optional_std__function_void_double____height______(const std::function<void(double /* height */)>& value) noexcept {
|
|
74
|
+
return std::optional<std::function<void(double /* height */)>>(value);
|
|
75
|
+
}
|
|
76
|
+
inline bool has_value_std__optional_std__function_void_double____height______(const std::optional<std::function<void(double /* height */)>>& optional) noexcept {
|
|
77
|
+
return optional.has_value();
|
|
78
|
+
}
|
|
79
|
+
inline std::function<void(double /* height */)> get_std__optional_std__function_void_double____height______(const std::optional<std::function<void(double /* height */)>>& optional) noexcept {
|
|
80
|
+
return optional.value();
|
|
81
|
+
}
|
|
82
|
+
|
|
46
83
|
// pragma MARK: std::shared_ptr<HybridOnramperCheckoutButtonSpec>
|
|
47
84
|
/**
|
|
48
85
|
* Specialized version of `std::shared_ptr<HybridOnramperCheckoutButtonSpec>`.
|
|
@@ -145,22 +182,22 @@ namespace margelo::nitro::onramper::bridge::swift {
|
|
|
145
182
|
return Func_void_PreparedIntentResult_Wrapper(std::move(value));
|
|
146
183
|
}
|
|
147
184
|
|
|
148
|
-
// pragma MARK: std::function<void(const std::string& /*
|
|
185
|
+
// pragma MARK: std::function<void(const std::string& /* recordJson */)>
|
|
149
186
|
/**
|
|
150
187
|
* Specialized version of `std::function<void(const std::string&)>`.
|
|
151
188
|
*/
|
|
152
|
-
using Func_void_std__string = std::function<void(const std::string& /*
|
|
189
|
+
using Func_void_std__string = std::function<void(const std::string& /* recordJson */)>;
|
|
153
190
|
/**
|
|
154
|
-
* Wrapper class for a `std::function<void(const std::string& / *
|
|
191
|
+
* Wrapper class for a `std::function<void(const std::string& / * recordJson * /)>`, this can be used from Swift.
|
|
155
192
|
*/
|
|
156
193
|
class Func_void_std__string_Wrapper final {
|
|
157
194
|
public:
|
|
158
|
-
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /*
|
|
159
|
-
inline void call(std::string
|
|
160
|
-
_function->operator()(
|
|
195
|
+
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* recordJson */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* recordJson */)>>(std::move(func))) {}
|
|
196
|
+
inline void call(std::string recordJson) const noexcept {
|
|
197
|
+
_function->operator()(recordJson);
|
|
161
198
|
}
|
|
162
199
|
private:
|
|
163
|
-
std::unique_ptr<std::function<void(const std::string& /*
|
|
200
|
+
std::unique_ptr<std::function<void(const std::string& /* recordJson */)>> _function;
|
|
164
201
|
} SWIFT_NONCOPYABLE;
|
|
165
202
|
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
166
203
|
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
|
|
@@ -15,6 +15,8 @@ namespace OnramperReactNative { class HybridOnramperCheckoutButtonSpec_cxx; }
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
#include <string>
|
|
18
|
+
#include <functional>
|
|
19
|
+
#include <optional>
|
|
18
20
|
|
|
19
21
|
#include "OnramperReactNative-Swift-Cxx-Umbrella.hpp"
|
|
20
22
|
|
|
@@ -69,6 +71,13 @@ namespace margelo::nitro::onramper {
|
|
|
69
71
|
inline void setIntentHandle(const std::string& intentHandle) noexcept override {
|
|
70
72
|
_swiftPart.setIntentHandle(intentHandle);
|
|
71
73
|
}
|
|
74
|
+
inline std::optional<std::function<void(double /* height */)>> getOnContentHeightChange() noexcept override {
|
|
75
|
+
auto __result = _swiftPart.getOnContentHeightChange();
|
|
76
|
+
return __result;
|
|
77
|
+
}
|
|
78
|
+
inline void setOnContentHeightChange(const std::optional<std::function<void(double /* height */)>>& onContentHeightChange) noexcept override {
|
|
79
|
+
_swiftPart.setOnContentHeightChange(onContentHeightChange);
|
|
80
|
+
}
|
|
72
81
|
|
|
73
82
|
public:
|
|
74
83
|
// Methods
|
|
@@ -125,6 +125,12 @@ namespace margelo::nitro::onramper {
|
|
|
125
125
|
auto __value = std::move(__result.value());
|
|
126
126
|
return __value;
|
|
127
127
|
}
|
|
128
|
+
inline void setLogListener(const std::function<void(const std::string& /* recordJson */)>& onLog) override {
|
|
129
|
+
auto __result = _swiftPart.setLogListener(onLog);
|
|
130
|
+
if (__result.hasError()) [[unlikely]] {
|
|
131
|
+
std::rethrow_exception(__result.error());
|
|
132
|
+
}
|
|
133
|
+
}
|
|
128
134
|
inline void setStateListener(const std::function<void(const std::string& /* stateJson */)>& onState) override {
|
|
129
135
|
auto __result = _swiftPart.setStateListener(onState);
|
|
130
136
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -84,6 +84,11 @@ using namespace margelo::nitro::onramper::views;
|
|
|
84
84
|
swiftPart.setIntentHandle(newViewProps.intentHandle.value);
|
|
85
85
|
newViewProps.intentHandle.isDirty = false;
|
|
86
86
|
}
|
|
87
|
+
// onContentHeightChange: optional
|
|
88
|
+
if (newViewProps.onContentHeightChange.isDirty) {
|
|
89
|
+
swiftPart.setOnContentHeightChange(newViewProps.onContentHeightChange.value);
|
|
90
|
+
newViewProps.onContentHeightChange.isDirty = false;
|
|
91
|
+
}
|
|
87
92
|
|
|
88
93
|
swiftPart.afterUpdate();
|
|
89
94
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.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
|
+
* Wraps a Swift `(_ height: Double) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.onramper.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ height: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ height: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(height: Double) -> Void {
|
|
25
|
+
self.closure(height)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
|
|
44
|
+
return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wraps a Swift `(_
|
|
11
|
+
* Wraps a Swift `(_ recordJson: String) -> Void` as a class.
|
|
12
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
13
|
*/
|
|
14
14
|
public final class Func_void_std__string {
|
|
15
15
|
public typealias bridge = margelo.nitro.onramper.bridge.swift
|
|
16
16
|
|
|
17
|
-
private let closure: (_
|
|
17
|
+
private let closure: (_ recordJson: String) -> Void
|
|
18
18
|
|
|
19
|
-
public init(_ closure: @escaping (_
|
|
19
|
+
public init(_ closure: @escaping (_ recordJson: String) -> Void) {
|
|
20
20
|
self.closure = closure
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@inline(__always)
|
|
24
|
-
public func call(
|
|
25
|
-
self.closure(String(
|
|
24
|
+
public func call(recordJson: std.string) -> Void {
|
|
25
|
+
self.closure(String(recordJson))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -131,6 +131,38 @@ open class HybridOnramperCheckoutButtonSpec_cxx {
|
|
|
131
131
|
self.__implementation.intentHandle = String(newValue)
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
+
|
|
135
|
+
public final var onContentHeightChange: bridge.std__optional_std__function_void_double____height______ {
|
|
136
|
+
@inline(__always)
|
|
137
|
+
get {
|
|
138
|
+
return { () -> bridge.std__optional_std__function_void_double____height______ in
|
|
139
|
+
if let __unwrappedValue = self.__implementation.onContentHeightChange {
|
|
140
|
+
return bridge.create_std__optional_std__function_void_double____height______({ () -> bridge.Func_void_double in
|
|
141
|
+
let __closureWrapper = Func_void_double(__unwrappedValue)
|
|
142
|
+
return bridge.create_Func_void_double(__closureWrapper.toUnsafe())
|
|
143
|
+
}())
|
|
144
|
+
} else {
|
|
145
|
+
return .init()
|
|
146
|
+
}
|
|
147
|
+
}()
|
|
148
|
+
}
|
|
149
|
+
@inline(__always)
|
|
150
|
+
set {
|
|
151
|
+
self.__implementation.onContentHeightChange = { () -> ((_ height: Double) -> Void)? in
|
|
152
|
+
if bridge.has_value_std__optional_std__function_void_double____height______(newValue) {
|
|
153
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_double____height______(newValue)
|
|
154
|
+
return { () -> (Double) -> Void in
|
|
155
|
+
let __wrappedFunction = bridge.wrap_Func_void_double(__unwrapped)
|
|
156
|
+
return { (__height: Double) -> Void in
|
|
157
|
+
__wrappedFunction.call(__height)
|
|
158
|
+
}
|
|
159
|
+
}()
|
|
160
|
+
} else {
|
|
161
|
+
return nil
|
|
162
|
+
}
|
|
163
|
+
}()
|
|
164
|
+
}
|
|
165
|
+
}
|
|
134
166
|
|
|
135
167
|
// Methods
|
|
136
168
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
@@ -19,6 +19,7 @@ public protocol HybridOnramperNitroSpec_protocol: HybridObject {
|
|
|
19
19
|
func signOut() throws -> Promise<Void>
|
|
20
20
|
func getCheckoutRequirements(requestJson: String, prefillJson: String, styleJson: String) throws -> Promise<PreparedIntentResult>
|
|
21
21
|
func cancelPreparedIntent(intentHandle: String) throws -> Promise<Void>
|
|
22
|
+
func setLogListener(onLog: @escaping (_ recordJson: String) -> Void) throws -> Void
|
|
22
23
|
func setStateListener(onState: @escaping (_ stateJson: String) -> Void) throws -> Void
|
|
23
24
|
func setEventListener(onEvent: @escaping (_ eventJson: String) -> Void) throws -> Void
|
|
24
25
|
func setTransactionIdListener(onTransactionId: @escaping (_ transactionId: String?) -> Void) throws -> Void
|
|
@@ -84,7 +84,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
@@ -121,7 +121,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// Properties
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
|
|
126
126
|
// Methods
|
|
127
127
|
@inline(__always)
|
|
@@ -142,7 +142,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
142
142
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
@inline(__always)
|
|
147
147
|
public final func initialize(sessionId: std.string, sessionToken: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
148
148
|
do {
|
|
@@ -161,7 +161,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
161
161
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
@inline(__always)
|
|
166
166
|
public final func reset() -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
167
167
|
do {
|
|
@@ -180,7 +180,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
180
180
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
|
|
184
184
|
@inline(__always)
|
|
185
185
|
public final func signOut() -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
186
186
|
do {
|
|
@@ -199,7 +199,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
199
199
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
@inline(__always)
|
|
204
204
|
public final func getCheckoutRequirements(requestJson: std.string, prefillJson: std.string, styleJson: std.string) -> bridge.Result_std__shared_ptr_Promise_PreparedIntentResult___ {
|
|
205
205
|
do {
|
|
@@ -218,7 +218,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
218
218
|
return bridge.create_Result_std__shared_ptr_Promise_PreparedIntentResult___(__exceptionPtr)
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
|
|
222
222
|
@inline(__always)
|
|
223
223
|
public final func cancelPreparedIntent(intentHandle: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
224
224
|
do {
|
|
@@ -237,7 +237,23 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
237
237
|
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
|
|
241
|
+
@inline(__always)
|
|
242
|
+
public final func setLogListener(onLog: bridge.Func_void_std__string) -> bridge.Result_void_ {
|
|
243
|
+
do {
|
|
244
|
+
try self.__implementation.setLogListener(onLog: { () -> (String) -> Void in
|
|
245
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string(onLog)
|
|
246
|
+
return { (__recordJson: String) -> Void in
|
|
247
|
+
__wrappedFunction.call(std.string(__recordJson))
|
|
248
|
+
}
|
|
249
|
+
}())
|
|
250
|
+
return bridge.create_Result_void_()
|
|
251
|
+
} catch (let __error) {
|
|
252
|
+
let __exceptionPtr = __error.toCpp()
|
|
253
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
241
257
|
@inline(__always)
|
|
242
258
|
public final func setStateListener(onState: bridge.Func_void_std__string) -> bridge.Result_void_ {
|
|
243
259
|
do {
|
|
@@ -253,7 +269,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
253
269
|
return bridge.create_Result_void_(__exceptionPtr)
|
|
254
270
|
}
|
|
255
271
|
}
|
|
256
|
-
|
|
272
|
+
|
|
257
273
|
@inline(__always)
|
|
258
274
|
public final func setEventListener(onEvent: bridge.Func_void_std__string) -> bridge.Result_void_ {
|
|
259
275
|
do {
|
|
@@ -269,7 +285,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
269
285
|
return bridge.create_Result_void_(__exceptionPtr)
|
|
270
286
|
}
|
|
271
287
|
}
|
|
272
|
-
|
|
288
|
+
|
|
273
289
|
@inline(__always)
|
|
274
290
|
public final func setTransactionIdListener(onTransactionId: bridge.Func_void_std__optional_std__string_) -> bridge.Result_void_ {
|
|
275
291
|
do {
|
|
@@ -291,7 +307,7 @@ open class HybridOnramperNitroSpec_cxx {
|
|
|
291
307
|
return bridge.create_Result_void_(__exceptionPtr)
|
|
292
308
|
}
|
|
293
309
|
}
|
|
294
|
-
|
|
310
|
+
|
|
295
311
|
@inline(__always)
|
|
296
312
|
public final func setSessionExpirationHandler(handler: bridge.Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____) -> bridge.Result_void_ {
|
|
297
313
|
do {
|
|
@@ -18,32 +18,42 @@ public extension OnramperNitroConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `OnramperNitroConfig`.
|
|
20
20
|
*/
|
|
21
|
-
init(apiKey: String, clientId: String, environment: String, theme: String, logLevel: String) {
|
|
22
|
-
self.init(std.string(apiKey), std.string(clientId), std.string(environment), std.string(theme), std.string(logLevel))
|
|
21
|
+
init(apiKey: String, clientId: String, environment: String, theme: String, logLevel: String, isEventLoggingEnabled: Bool, isEventConsoleLoggingEnabled: Bool) {
|
|
22
|
+
self.init(std.string(apiKey), std.string(clientId), std.string(environment), std.string(theme), std.string(logLevel), isEventLoggingEnabled, isEventConsoleLoggingEnabled)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@inline(__always)
|
|
26
26
|
var apiKey: String {
|
|
27
27
|
return String(self.__apiKey)
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
@inline(__always)
|
|
31
31
|
var clientId: String {
|
|
32
32
|
return String(self.__clientId)
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
@inline(__always)
|
|
36
36
|
var environment: String {
|
|
37
37
|
return String(self.__environment)
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
@inline(__always)
|
|
41
41
|
var theme: String {
|
|
42
42
|
return String(self.__theme)
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
@inline(__always)
|
|
46
46
|
var logLevel: String {
|
|
47
47
|
return String(self.__logLevel)
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
@inline(__always)
|
|
51
|
+
var isEventLoggingEnabled: Bool {
|
|
52
|
+
return self.__isEventLoggingEnabled
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@inline(__always)
|
|
56
|
+
var isEventConsoleLoggingEnabled: Bool {
|
|
57
|
+
return self.__isEventConsoleLoggingEnabled
|
|
58
|
+
}
|
|
49
59
|
}
|
|
@@ -16,6 +16,8 @@ namespace margelo::nitro::onramper {
|
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
17
|
prototype.registerHybridGetter("intentHandle", &HybridOnramperCheckoutButtonSpec::getIntentHandle);
|
|
18
18
|
prototype.registerHybridSetter("intentHandle", &HybridOnramperCheckoutButtonSpec::setIntentHandle);
|
|
19
|
+
prototype.registerHybridGetter("onContentHeightChange", &HybridOnramperCheckoutButtonSpec::getOnContentHeightChange);
|
|
20
|
+
prototype.registerHybridSetter("onContentHeightChange", &HybridOnramperCheckoutButtonSpec::setOnContentHeightChange);
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
#include <string>
|
|
19
|
+
#include <functional>
|
|
20
|
+
#include <optional>
|
|
19
21
|
|
|
20
22
|
namespace margelo::nitro::onramper {
|
|
21
23
|
|
|
@@ -46,6 +48,8 @@ namespace margelo::nitro::onramper {
|
|
|
46
48
|
// Properties
|
|
47
49
|
virtual std::string getIntentHandle() = 0;
|
|
48
50
|
virtual void setIntentHandle(const std::string& intentHandle) = 0;
|
|
51
|
+
virtual std::optional<std::function<void(double /* height */)>> getOnContentHeightChange() = 0;
|
|
52
|
+
virtual void setOnContentHeightChange(const std::optional<std::function<void(double /* height */)>>& onContentHeightChange) = 0;
|
|
49
53
|
|
|
50
54
|
public:
|
|
51
55
|
// Methods
|
|
@@ -20,6 +20,7 @@ namespace margelo::nitro::onramper {
|
|
|
20
20
|
prototype.registerHybridMethod("signOut", &HybridOnramperNitroSpec::signOut);
|
|
21
21
|
prototype.registerHybridMethod("getCheckoutRequirements", &HybridOnramperNitroSpec::getCheckoutRequirements);
|
|
22
22
|
prototype.registerHybridMethod("cancelPreparedIntent", &HybridOnramperNitroSpec::cancelPreparedIntent);
|
|
23
|
+
prototype.registerHybridMethod("setLogListener", &HybridOnramperNitroSpec::setLogListener);
|
|
23
24
|
prototype.registerHybridMethod("setStateListener", &HybridOnramperNitroSpec::setStateListener);
|
|
24
25
|
prototype.registerHybridMethod("setEventListener", &HybridOnramperNitroSpec::setEventListener);
|
|
25
26
|
prototype.registerHybridMethod("setTransactionIdListener", &HybridOnramperNitroSpec::setTransactionIdListener);
|
|
@@ -65,6 +65,7 @@ namespace margelo::nitro::onramper {
|
|
|
65
65
|
virtual std::shared_ptr<Promise<void>> signOut() = 0;
|
|
66
66
|
virtual std::shared_ptr<Promise<PreparedIntentResult>> getCheckoutRequirements(const std::string& requestJson, const std::string& prefillJson, const std::string& styleJson) = 0;
|
|
67
67
|
virtual std::shared_ptr<Promise<void>> cancelPreparedIntent(const std::string& intentHandle) = 0;
|
|
68
|
+
virtual void setLogListener(const std::function<void(const std::string& /* recordJson */)>& onLog) = 0;
|
|
68
69
|
virtual void setStateListener(const std::function<void(const std::string& /* stateJson */)>& onState) = 0;
|
|
69
70
|
virtual void setEventListener(const std::function<void(const std::string& /* eventJson */)>& onEvent) = 0;
|
|
70
71
|
virtual void setTransactionIdListener(const std::function<void(const std::optional<std::string>& /* transactionId */)>& onTransactionId) = 0;
|
|
@@ -44,10 +44,12 @@ namespace margelo::nitro::onramper {
|
|
|
44
44
|
std::string environment SWIFT_PRIVATE;
|
|
45
45
|
std::string theme SWIFT_PRIVATE;
|
|
46
46
|
std::string logLevel SWIFT_PRIVATE;
|
|
47
|
+
bool isEventLoggingEnabled SWIFT_PRIVATE;
|
|
48
|
+
bool isEventConsoleLoggingEnabled SWIFT_PRIVATE;
|
|
47
49
|
|
|
48
50
|
public:
|
|
49
51
|
OnramperNitroConfig() = default;
|
|
50
|
-
explicit OnramperNitroConfig(std::string apiKey, std::string clientId, std::string environment, std::string theme, std::string logLevel): apiKey(apiKey), clientId(clientId), environment(environment), theme(theme), logLevel(logLevel) {}
|
|
52
|
+
explicit OnramperNitroConfig(std::string apiKey, std::string clientId, std::string environment, std::string theme, std::string logLevel, bool isEventLoggingEnabled, bool isEventConsoleLoggingEnabled): apiKey(apiKey), clientId(clientId), environment(environment), theme(theme), logLevel(logLevel), isEventLoggingEnabled(isEventLoggingEnabled), isEventConsoleLoggingEnabled(isEventConsoleLoggingEnabled) {}
|
|
51
53
|
|
|
52
54
|
public:
|
|
53
55
|
friend bool operator==(const OnramperNitroConfig& lhs, const OnramperNitroConfig& rhs) = default;
|
|
@@ -67,7 +69,9 @@ namespace margelo::nitro {
|
|
|
67
69
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "clientId"))),
|
|
68
70
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "environment"))),
|
|
69
71
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "theme"))),
|
|
70
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel")))
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel"))),
|
|
73
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isEventLoggingEnabled"))),
|
|
74
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isEventConsoleLoggingEnabled")))
|
|
71
75
|
);
|
|
72
76
|
}
|
|
73
77
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::onramper::OnramperNitroConfig& arg) {
|
|
@@ -77,6 +81,8 @@ namespace margelo::nitro {
|
|
|
77
81
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "environment"), JSIConverter<std::string>::toJSI(runtime, arg.environment));
|
|
78
82
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "theme"), JSIConverter<std::string>::toJSI(runtime, arg.theme));
|
|
79
83
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "logLevel"), JSIConverter<std::string>::toJSI(runtime, arg.logLevel));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isEventLoggingEnabled"), JSIConverter<bool>::toJSI(runtime, arg.isEventLoggingEnabled));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isEventConsoleLoggingEnabled"), JSIConverter<bool>::toJSI(runtime, arg.isEventConsoleLoggingEnabled));
|
|
80
86
|
return obj;
|
|
81
87
|
}
|
|
82
88
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -92,6 +98,8 @@ namespace margelo::nitro {
|
|
|
92
98
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "environment")))) return false;
|
|
93
99
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "theme")))) return false;
|
|
94
100
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel")))) return false;
|
|
101
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isEventLoggingEnabled")))) return false;
|
|
102
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isEventConsoleLoggingEnabled")))) return false;
|
|
95
103
|
return true;
|
|
96
104
|
}
|
|
97
105
|
};
|