@thealteroffice/react-native-adgeist 0.0.12 → 0.0.14

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.
@@ -0,0 +1,63 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.facebook.fbreact.specs;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.bridge.ReadableMap;
21
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
22
+ import javax.annotation.Nonnull;
23
+
24
+ public abstract class NativeAdgeistSpec extends ReactContextBaseJavaModule implements TurboModule {
25
+ public static final String NAME = "Adgeist";
26
+
27
+ public NativeAdgeistSpec(ReactApplicationContext reactContext) {
28
+ super(reactContext);
29
+ }
30
+
31
+ @Override
32
+ public @Nonnull String getName() {
33
+ return NAME;
34
+ }
35
+
36
+ @ReactMethod
37
+ @DoNotStrip
38
+ public abstract void initializeSdk(String customDomain, Promise promise);
39
+
40
+ @ReactMethod
41
+ @DoNotStrip
42
+ public abstract void fetchCreative(String apiKey, String origin, String adSpaceId, String publisherId, boolean isTestEnvironment, Promise promise);
43
+
44
+ @ReactMethod
45
+ @DoNotStrip
46
+ public abstract void sendCreativeAnalytic(String campaignId, String adSpaceId, String publisherId, String eventType, String origin, String apiKey, String bidId, boolean isTestEnvironment, Promise promise);
47
+
48
+ @ReactMethod
49
+ @DoNotStrip
50
+ public abstract void setUserDetails(ReadableMap user);
51
+
52
+ @ReactMethod
53
+ @DoNotStrip
54
+ public abstract void logEvent(ReadableMap event);
55
+
56
+ @ReactMethod
57
+ @DoNotStrip
58
+ public abstract void getConsentStatus(Promise promise);
59
+
60
+ @ReactMethod
61
+ @DoNotStrip
62
+ public abstract void updateConsentStatus(boolean consent);
63
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNAdgeistSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNAdgeistSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNAdgeistSpec PUBLIC . react/renderer/components/RNAdgeistSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNAdgeistSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNAdgeistSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,68 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNAdgeistSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_initializeSdk(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "initializeSdk", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_fetchCreative(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "fetchCreative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "sendCreativeAnalytic", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_setUserDetails(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "setUserDetails", "(Lcom/facebook/react/bridge/ReadableMap;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_logEvent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "logEvent", "(Lcom/facebook/react/bridge/ReadableMap;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_getConsentStatus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getConsentStatus", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_updateConsentStatus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "updateConsentStatus", "(Z)V", args, count, cachedMethodId);
48
+ }
49
+
50
+ NativeAdgeistSpecJSI::NativeAdgeistSpecJSI(const JavaTurboModule::InitParams &params)
51
+ : JavaTurboModule(params) {
52
+ methodMap_["initializeSdk"] = MethodMetadata {1, __hostFunction_NativeAdgeistSpecJSI_initializeSdk};
53
+ methodMap_["fetchCreative"] = MethodMetadata {5, __hostFunction_NativeAdgeistSpecJSI_fetchCreative};
54
+ methodMap_["sendCreativeAnalytic"] = MethodMetadata {8, __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic};
55
+ methodMap_["setUserDetails"] = MethodMetadata {1, __hostFunction_NativeAdgeistSpecJSI_setUserDetails};
56
+ methodMap_["logEvent"] = MethodMetadata {1, __hostFunction_NativeAdgeistSpecJSI_logEvent};
57
+ methodMap_["getConsentStatus"] = MethodMetadata {0, __hostFunction_NativeAdgeistSpecJSI_getConsentStatus};
58
+ methodMap_["updateConsentStatus"] = MethodMetadata {1, __hostFunction_NativeAdgeistSpecJSI_updateConsentStatus};
59
+ }
60
+
61
+ std::shared_ptr<TurboModule> RNAdgeistSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
62
+ if (moduleName == "Adgeist") {
63
+ return std::make_shared<NativeAdgeistSpecJSI>(params);
64
+ }
65
+ return nullptr;
66
+ }
67
+
68
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeAdgeist'
21
+ */
22
+ class JSI_EXPORT NativeAdgeistSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeAdgeistSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNAdgeistSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,82 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNAdgeistSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_initializeSdk(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->initializeSdk(
16
+ rt,
17
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
18
+ );
19
+ }
20
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->fetchCreative(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
24
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
25
+ count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
26
+ count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
27
+ count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asBool()
28
+ );
29
+ }
30
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
31
+ return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->sendCreativeAnalytic(
32
+ rt,
33
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
34
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
35
+ count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
36
+ count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
37
+ count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
38
+ count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asString(rt),
39
+ count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asString(rt),
40
+ count <= 7 ? throw jsi::JSError(rt, "Expected argument in position 7 to be passed") : args[7].asBool()
41
+ );
42
+ }
43
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_setUserDetails(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
44
+ static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->setUserDetails(
45
+ rt,
46
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
47
+ );
48
+ return jsi::Value::undefined();
49
+ }
50
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_logEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
51
+ static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->logEvent(
52
+ rt,
53
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
54
+ );
55
+ return jsi::Value::undefined();
56
+ }
57
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_getConsentStatus(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
58
+ return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->getConsentStatus(
59
+ rt
60
+ );
61
+ }
62
+ static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_updateConsentStatus(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
63
+ static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->updateConsentStatus(
64
+ rt,
65
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
66
+ );
67
+ return jsi::Value::undefined();
68
+ }
69
+
70
+ NativeAdgeistCxxSpecJSI::NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
71
+ : TurboModule("Adgeist", jsInvoker) {
72
+ methodMap_["initializeSdk"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_initializeSdk};
73
+ methodMap_["fetchCreative"] = MethodMetadata {5, __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative};
74
+ methodMap_["sendCreativeAnalytic"] = MethodMetadata {8, __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic};
75
+ methodMap_["setUserDetails"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_setUserDetails};
76
+ methodMap_["logEvent"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_logEvent};
77
+ methodMap_["getConsentStatus"] = MethodMetadata {0, __hostFunction_NativeAdgeistCxxSpecJSI_getConsentStatus};
78
+ methodMap_["updateConsentStatus"] = MethodMetadata {1, __hostFunction_NativeAdgeistCxxSpecJSI_updateConsentStatus};
79
+ }
80
+
81
+
82
+ } // namespace facebook::react
@@ -0,0 +1,242 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ #pragma mark - NativeAdgeistEvent
20
+
21
+ template <typename P0, typename P1>
22
+ struct NativeAdgeistEvent {
23
+ P0 eventType;
24
+ P1 eventProperties;
25
+ bool operator==(const NativeAdgeistEvent &other) const {
26
+ return eventType == other.eventType && eventProperties == other.eventProperties;
27
+ }
28
+ };
29
+
30
+ template <typename T>
31
+ struct NativeAdgeistEventBridging {
32
+ static T types;
33
+
34
+ static T fromJs(
35
+ jsi::Runtime &rt,
36
+ const jsi::Object &value,
37
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
38
+ T result{
39
+ bridging::fromJs<decltype(types.eventType)>(rt, value.getProperty(rt, "eventType"), jsInvoker),
40
+ bridging::fromJs<decltype(types.eventProperties)>(rt, value.getProperty(rt, "eventProperties"), jsInvoker)};
41
+ return result;
42
+ }
43
+
44
+ #ifdef DEBUG
45
+ static jsi::String eventTypeToJs(jsi::Runtime &rt, decltype(types.eventType) value) {
46
+ return bridging::toJs(rt, value);
47
+ }
48
+
49
+ static jsi::Object eventPropertiesToJs(jsi::Runtime &rt, decltype(types.eventProperties) value) {
50
+ return bridging::toJs(rt, value);
51
+ }
52
+ #endif
53
+
54
+ static jsi::Object toJs(
55
+ jsi::Runtime &rt,
56
+ const T &value,
57
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
58
+ auto result = facebook::jsi::Object(rt);
59
+ result.setProperty(rt, "eventType", bridging::toJs(rt, value.eventType, jsInvoker));
60
+ result.setProperty(rt, "eventProperties", bridging::toJs(rt, value.eventProperties, jsInvoker));
61
+ return result;
62
+ }
63
+ };
64
+
65
+
66
+
67
+ #pragma mark - NativeAdgeistUserDetails
68
+
69
+ template <typename P0, typename P1, typename P2, typename P3>
70
+ struct NativeAdgeistUserDetails {
71
+ P0 userId;
72
+ P1 userName;
73
+ P2 email;
74
+ P3 phone;
75
+ bool operator==(const NativeAdgeistUserDetails &other) const {
76
+ return userId == other.userId && userName == other.userName && email == other.email && phone == other.phone;
77
+ }
78
+ };
79
+
80
+ template <typename T>
81
+ struct NativeAdgeistUserDetailsBridging {
82
+ static T types;
83
+
84
+ static T fromJs(
85
+ jsi::Runtime &rt,
86
+ const jsi::Object &value,
87
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
88
+ T result{
89
+ bridging::fromJs<decltype(types.userId)>(rt, value.getProperty(rt, "userId"), jsInvoker),
90
+ bridging::fromJs<decltype(types.userName)>(rt, value.getProperty(rt, "userName"), jsInvoker),
91
+ bridging::fromJs<decltype(types.email)>(rt, value.getProperty(rt, "email"), jsInvoker),
92
+ bridging::fromJs<decltype(types.phone)>(rt, value.getProperty(rt, "phone"), jsInvoker)};
93
+ return result;
94
+ }
95
+
96
+ #ifdef DEBUG
97
+ static jsi::String userIdToJs(jsi::Runtime &rt, decltype(types.userId) value) {
98
+ return bridging::toJs(rt, value);
99
+ }
100
+
101
+ static jsi::String userNameToJs(jsi::Runtime &rt, decltype(types.userName) value) {
102
+ return bridging::toJs(rt, value);
103
+ }
104
+
105
+ static jsi::String emailToJs(jsi::Runtime &rt, decltype(types.email) value) {
106
+ return bridging::toJs(rt, value);
107
+ }
108
+
109
+ static jsi::String phoneToJs(jsi::Runtime &rt, decltype(types.phone) value) {
110
+ return bridging::toJs(rt, value);
111
+ }
112
+ #endif
113
+
114
+ static jsi::Object toJs(
115
+ jsi::Runtime &rt,
116
+ const T &value,
117
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
118
+ auto result = facebook::jsi::Object(rt);
119
+ if (value.userId) {
120
+ result.setProperty(rt, "userId", bridging::toJs(rt, value.userId.value(), jsInvoker));
121
+ }
122
+ if (value.userName) {
123
+ result.setProperty(rt, "userName", bridging::toJs(rt, value.userName.value(), jsInvoker));
124
+ }
125
+ if (value.email) {
126
+ result.setProperty(rt, "email", bridging::toJs(rt, value.email.value(), jsInvoker));
127
+ }
128
+ if (value.phone) {
129
+ result.setProperty(rt, "phone", bridging::toJs(rt, value.phone.value(), jsInvoker));
130
+ }
131
+ return result;
132
+ }
133
+ };
134
+
135
+ class JSI_EXPORT NativeAdgeistCxxSpecJSI : public TurboModule {
136
+ protected:
137
+ NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
138
+
139
+ public:
140
+ virtual jsi::Value initializeSdk(jsi::Runtime &rt, jsi::String customDomain) = 0;
141
+ virtual jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String apiKey, jsi::String origin, jsi::String adSpaceId, jsi::String publisherId, bool isTestEnvironment) = 0;
142
+ virtual jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType, jsi::String origin, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment) = 0;
143
+ virtual void setUserDetails(jsi::Runtime &rt, jsi::Object user) = 0;
144
+ virtual void logEvent(jsi::Runtime &rt, jsi::Object event) = 0;
145
+ virtual jsi::Value getConsentStatus(jsi::Runtime &rt) = 0;
146
+ virtual void updateConsentStatus(jsi::Runtime &rt, bool consent) = 0;
147
+
148
+ };
149
+
150
+ template <typename T>
151
+ class JSI_EXPORT NativeAdgeistCxxSpec : public TurboModule {
152
+ public:
153
+ jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
154
+ return delegate_.create(rt, propName);
155
+ }
156
+
157
+ std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
158
+ return delegate_.getPropertyNames(runtime);
159
+ }
160
+
161
+ static constexpr std::string_view kModuleName = "Adgeist";
162
+
163
+ protected:
164
+ NativeAdgeistCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
165
+ : TurboModule(std::string{NativeAdgeistCxxSpec::kModuleName}, jsInvoker),
166
+ delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
167
+
168
+
169
+ private:
170
+ class Delegate : public NativeAdgeistCxxSpecJSI {
171
+ public:
172
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
173
+ NativeAdgeistCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
174
+
175
+ }
176
+
177
+ jsi::Value initializeSdk(jsi::Runtime &rt, jsi::String customDomain) override {
178
+ static_assert(
179
+ bridging::getParameterCount(&T::initializeSdk) == 2,
180
+ "Expected initializeSdk(...) to have 2 parameters");
181
+
182
+ return bridging::callFromJs<jsi::Value>(
183
+ rt, &T::initializeSdk, jsInvoker_, instance_, std::move(customDomain));
184
+ }
185
+ jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String apiKey, jsi::String origin, jsi::String adSpaceId, jsi::String publisherId, bool isTestEnvironment) override {
186
+ static_assert(
187
+ bridging::getParameterCount(&T::fetchCreative) == 6,
188
+ "Expected fetchCreative(...) to have 6 parameters");
189
+
190
+ return bridging::callFromJs<jsi::Value>(
191
+ rt, &T::fetchCreative, jsInvoker_, instance_, std::move(apiKey), std::move(origin), std::move(adSpaceId), std::move(publisherId), std::move(isTestEnvironment));
192
+ }
193
+ jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType, jsi::String origin, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment) override {
194
+ static_assert(
195
+ bridging::getParameterCount(&T::sendCreativeAnalytic) == 9,
196
+ "Expected sendCreativeAnalytic(...) to have 9 parameters");
197
+
198
+ return bridging::callFromJs<jsi::Value>(
199
+ rt, &T::sendCreativeAnalytic, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(publisherId), std::move(eventType), std::move(origin), std::move(apiKey), std::move(bidId), std::move(isTestEnvironment));
200
+ }
201
+ void setUserDetails(jsi::Runtime &rt, jsi::Object user) override {
202
+ static_assert(
203
+ bridging::getParameterCount(&T::setUserDetails) == 2,
204
+ "Expected setUserDetails(...) to have 2 parameters");
205
+
206
+ return bridging::callFromJs<void>(
207
+ rt, &T::setUserDetails, jsInvoker_, instance_, std::move(user));
208
+ }
209
+ void logEvent(jsi::Runtime &rt, jsi::Object event) override {
210
+ static_assert(
211
+ bridging::getParameterCount(&T::logEvent) == 2,
212
+ "Expected logEvent(...) to have 2 parameters");
213
+
214
+ return bridging::callFromJs<void>(
215
+ rt, &T::logEvent, jsInvoker_, instance_, std::move(event));
216
+ }
217
+ jsi::Value getConsentStatus(jsi::Runtime &rt) override {
218
+ static_assert(
219
+ bridging::getParameterCount(&T::getConsentStatus) == 1,
220
+ "Expected getConsentStatus(...) to have 1 parameters");
221
+
222
+ return bridging::callFromJs<jsi::Value>(
223
+ rt, &T::getConsentStatus, jsInvoker_, instance_);
224
+ }
225
+ void updateConsentStatus(jsi::Runtime &rt, bool consent) override {
226
+ static_assert(
227
+ bridging::getParameterCount(&T::updateConsentStatus) == 2,
228
+ "Expected updateConsentStatus(...) to have 2 parameters");
229
+
230
+ return bridging::callFromJs<void>(
231
+ rt, &T::updateConsentStatus, jsInvoker_, instance_, std::move(consent));
232
+ }
233
+
234
+ private:
235
+ friend class NativeAdgeistCxxSpec;
236
+ T *instance_;
237
+ };
238
+
239
+ Delegate delegate_;
240
+ };
241
+
242
+ } // namespace facebook::react
package/ios/Adgeist.mm CHANGED
@@ -74,12 +74,18 @@ RCT_EXPORT_METHOD(setUserDetails:(NSObject *)userDetails) {
74
74
  [adgeist setUserDetails:userDetails];
75
75
  }
76
76
 
77
+ RCT_EXPORT_METHOD(getConsentStatus:(RCTPromiseResolveBlock)resolve
78
+ reject:(RCTPromiseRejectBlock)reject) {
79
+ [adgeist getConsentStatusWithResolver:resolve
80
+ rejecter:reject];
81
+ }
82
+
77
83
  RCT_EXPORT_METHOD(updateConsentStatus:(BOOL)consent) {
78
84
  [adgeist updateConsentStatus:consent];
79
85
  }
80
86
 
81
- RCT_EXPORT_METHOD(logEvent:(NSObject *)eventDict) {
82
- [adgeist logEvent:eventDict];
87
+ RCT_EXPORT_METHOD(logEvent:(NSDictionary *)eventDict) {
88
+ [adgeist logEventWithEventDict:eventDict];
83
89
  }
84
90
 
85
91
  // TurboModule support for the new architecture
@@ -97,7 +97,11 @@ import React
97
97
  }
98
98
 
99
99
  @objc public func setUserDetails(_ userDetailsDict: [String: Any]) {
100
- let userDetails = UserDetails(
100
+ let filtered = userDetailsDict.compactMapValues { value -> Any? in
101
+ (value is NSNull) ? nil : value
102
+ }
103
+
104
+ let userDetails = UserDetails(
101
105
  userId: userDetailsDict["userId"] as? String,
102
106
  userName: userDetailsDict["userName"] as? String,
103
107
  email: userDetailsDict["email"] as? String,
@@ -106,19 +110,35 @@ import React
106
110
  adgeistInstance?.setUserDetails(userDetails)
107
111
  }
108
112
 
113
+
114
+ @objc public func getConsentStatus(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
115
+ guard let adgeistInstance = adgeistInstance else {
116
+ rejecter("SDK_NOT_INITIALIZED", "SDK not initialized. Call initializeSdk() first.", nil)
117
+ return
118
+ }
119
+ let status = adgeistInstance.getConsentStatus()
120
+ resolver(status)
121
+ }
122
+
109
123
  @objc public func updateConsentStatus(_ consent: Bool) {
110
124
  adgeistInstance?.updateConsentStatus(consent)
111
125
  }
112
126
 
113
127
 
114
- @objc public func logEvent(_ eventDict: NSDictionary) {
115
- print("Event must have a non-empty eventType")
116
- guard let eventType = eventDict["eventType"] as? String, !eventType.isEmpty else {
128
+ @objc public func logEvent(eventDict: [String: Any]) {
129
+ let filtered = eventDict.compactMapValues { value -> Any? in
130
+ (value is NSNull) ? nil : value
131
+ }
132
+
133
+ guard let eventType = filtered["eventType"] as? String, !eventType.isEmpty else {
117
134
  print("Event must have a non-empty eventType")
118
135
  return
119
136
  }
120
137
 
121
- let eventProps = eventDict["eventProperties"] as? [String: Any] ?? [:]
138
+ let eventProps = (filtered["eventProperties"] as? [String: Any])?.compactMapValues { value -> Any? in
139
+ (value is NSNull) ? nil : value
140
+ } ?? [:]
141
+
122
142
  let event = Event(eventType: eventType, eventProperties: eventProps)
123
143
  adgeistInstance?.logEvent(event)
124
144
  }