plotline-engage 1.0.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.
Files changed (41) hide show
  1. package/.gitattributes +1 -0
  2. package/README.md +12 -0
  3. package/android/build/.transforms/a955cbcc6504c298c9f5bfa3f2809639/results.bin +1 -0
  4. package/android/build/.transforms/a955cbcc6504c298c9f5bfa3f2809639/transformed/classes/classes.dex +0 -0
  5. package/android/build/generated/source/buildConfig/debug/com/reactnativeplotline/BuildConfig.java +10 -0
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +9 -0
  7. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
  8. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +4 -0
  9. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  10. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  11. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  12. package/android/build/intermediates/compile_symbol_list/debug/R.txt +2045 -0
  13. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  14. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  15. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  16. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -0
  17. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -0
  18. package/android/build/intermediates/javac/debug/classes/com/reactnativeplotline/BuildConfig.class +0 -0
  19. package/android/build/intermediates/javac/debug/classes/com/reactnativeplotline/RNPlotline$1.class +0 -0
  20. package/android/build/intermediates/javac/debug/classes/com/reactnativeplotline/RNPlotline.class +0 -0
  21. package/android/build/intermediates/javac/debug/classes/com/reactnativeplotline/RNPlotlinePackage.class +0 -0
  22. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
  23. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +11 -0
  24. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +9 -0
  25. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  26. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +18 -0
  27. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  28. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1538 -0
  29. package/android/build/outputs/logs/manifest-merger-debug-report.txt +25 -0
  30. package/android/build.gradle +44 -0
  31. package/android/src/main/AndroidManifest.xml +5 -0
  32. package/android/src/main/java/com/reactnativeplotline/RNPlotline.java +297 -0
  33. package/android/src/main/java/com/reactnativeplotline/RNPlotlinePackage.java +29 -0
  34. package/index.d.ts +11 -0
  35. package/index.js +43 -0
  36. package/ios/RNPlotline.h +11 -0
  37. package/ios/RNPlotline.m +64 -0
  38. package/ios/RNPlotline.xcodeproj/project.pbxproj +259 -0
  39. package/ios/RNPlotline.xcworkspace/contents.xcworkspacedata +9 -0
  40. package/package.json +23 -0
  41. package/plotline-insights.podspec +22 -0
@@ -0,0 +1,25 @@
1
+ -- Merging decision tree log ---
2
+ manifest
3
+ ADDED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml:2:1-4:12
4
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml:2:1-4:12
5
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml:2:1-4:12
6
+ package
7
+ ADDED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml:2:70-103
8
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
9
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
10
+ xmlns:android
11
+ ADDED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml:2:11-69
12
+ uses-sdk
13
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
14
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
15
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
16
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
17
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
18
+ android:targetSdkVersion
19
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
20
+ ADDED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
21
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
22
+ android:minSdkVersion
23
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
24
+ ADDED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
25
+ INJECTED from /Users/adarsh/Documents/Projects/plotline-react-native/DemoApp/node_modules/plotline-insights/android/src/main/AndroidManifest.xml
@@ -0,0 +1,44 @@
1
+
2
+ buildscript {
3
+ repositories {
4
+ jcenter()
5
+ }
6
+
7
+ dependencies {
8
+ classpath 'com.android.tools.build:gradle:1.3.1'
9
+ }
10
+ }
11
+
12
+ apply plugin: 'com.android.library'
13
+
14
+ android {
15
+ compileSdkVersion 23
16
+ buildToolsVersion "23.0.1"
17
+ compileOptions {
18
+ sourceCompatibility JavaVersion.VERSION_1_8
19
+ targetCompatibility JavaVersion.VERSION_1_8
20
+ }
21
+
22
+ defaultConfig {
23
+ minSdkVersion 16
24
+ targetSdkVersion 22
25
+ versionCode 1
26
+ versionName "1.0"
27
+ }
28
+ lintOptions {
29
+ abortOnError false
30
+ }
31
+ }
32
+
33
+ repositories {
34
+ mavenCentral()
35
+ maven {
36
+ url 'https://plotline-android-sdk.s3.amazonaws.com'
37
+ }
38
+ }
39
+
40
+ dependencies {
41
+ implementation 'com.facebook.react:react-native:+'
42
+ implementation 'com.gitlab.plotline:plotline-android-sdk:2.7.2'
43
+ }
44
+
@@ -0,0 +1,5 @@
1
+
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.reactnativeplotline">
3
+
4
+ </manifest>
5
+
@@ -0,0 +1,297 @@
1
+
2
+ package com.reactnativeplotline;
3
+
4
+ import android.app.Activity;
5
+ import android.graphics.RectF;
6
+ import android.view.View;
7
+ import android.view.ViewGroup;
8
+ import android.view.accessibility.AccessibilityNodeInfo;
9
+
10
+ import androidx.annotation.NonNull;
11
+
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
14
+ import com.facebook.react.bridge.ReactMethod;
15
+ import com.facebook.react.bridge.ReadableMap;
16
+ import com.facebook.react.bridge.ReadableMapKeySetIterator;
17
+ import com.facebook.react.bridge.ReadableType;
18
+ import com.facebook.react.uimanager.util.ReactFindViewUtil;
19
+
20
+ import org.json.JSONArray;
21
+ import org.json.JSONObject;
22
+ import org.json.JSONException;
23
+
24
+ import so.plotline.insights.FlowViews.PlotlineInternal;
25
+ import so.plotline.insights.FlowViews.PlotlineViewPositionCallback;
26
+ import so.plotline.insights.FlowViews.PlotlineViewPositionCompleteListener;
27
+ import so.plotline.insights.FlowViews.PlotlineScreenshotPositionsCompleteListener;
28
+ import so.plotline.insights.FlowViews.PlotlineViewsPresenceListener;
29
+ import so.plotline.insights.FlowViews.ElementSearchObject;
30
+
31
+ import so.plotline.insights.Models.ViewPosition;
32
+ import so.plotline.insights.Plotline;
33
+
34
+ import java.util.ArrayList;
35
+ import java.util.List;
36
+ import java.util.HashSet;
37
+ import java.util.Set;
38
+
39
+ public class RNPlotline extends ReactContextBaseJavaModule {
40
+
41
+ private final ReactApplicationContext reactContext;
42
+
43
+ public RNPlotline(ReactApplicationContext reactContext) {
44
+ super(reactContext);
45
+ this.reactContext = reactContext;
46
+ }
47
+
48
+ @Override
49
+ public String getName() {
50
+ return "RNPlotline";
51
+ }
52
+
53
+ public static JSONArray getAllElements(@NonNull Activity activity) {
54
+ Set<String> includedElements = new HashSet<>();
55
+ ViewGroup viewGroup = (ViewGroup) activity.findViewById(android.R.id.content);
56
+ JSONArray elements = new JSONArray();
57
+ for(int i=0; i < viewGroup.getChildCount(); i++) {
58
+ ArrayList<View> children = getAllChildren( viewGroup.getChildAt(i));
59
+ for(int j=0; j<children.size(); j++) {
60
+ View childElement = children.get(j);
61
+ String nativeId = getNativeId(childElement);
62
+ if (includedElements.contains(nativeId))
63
+ continue;
64
+
65
+ if (nativeId != null) {
66
+ includedElements.add(nativeId);
67
+ int[] location = new int[2];
68
+ childElement.getLocationInWindow(location);
69
+ JSONObject element = new JSONObject();
70
+ try {
71
+ element.put("clientElementId", nativeId);
72
+ JSONObject position = new JSONObject();
73
+ position.put("x", location[0]);
74
+ position.put("y", location[1]);
75
+ position.put("width", childElement.getWidth());
76
+ position.put("height", childElement.getHeight());
77
+ element.put("position", position);
78
+ elements.put(element);
79
+ } catch (JSONException e) {
80
+ e.printStackTrace();
81
+ }
82
+ }
83
+ }
84
+ }
85
+ return elements;
86
+ }
87
+
88
+ public static ArrayList<View> getAllChildren(View v) {
89
+ if (!(v instanceof ViewGroup)) {
90
+ ArrayList<View> viewArrayList = new ArrayList<>();
91
+ viewArrayList.add(v);
92
+ return viewArrayList;
93
+ }
94
+
95
+ ArrayList<View> result = new ArrayList<>();
96
+
97
+ ViewGroup viewGroup = (ViewGroup) v;
98
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
99
+
100
+ View child = viewGroup.getChildAt(i);
101
+
102
+ ArrayList<View> viewArrayList = new ArrayList<>();
103
+ viewArrayList.add(v);
104
+ viewArrayList.addAll(getAllChildren(child));
105
+
106
+ result.addAll(viewArrayList);
107
+ }
108
+ return result;
109
+ }
110
+
111
+ public static RectF calculeRectOnScreen(View view) {
112
+ int[] location = new int[2];
113
+ view.getLocationOnScreen(location);
114
+ return new RectF(location[0], location[1], location[0] + view.getMeasuredWidth(), location[1] + view.getMeasuredHeight());
115
+ }
116
+
117
+ public static RectF calculeRectInWindow(View view) {
118
+ int[] location = new int[2];
119
+ view.getLocationInWindow(location);
120
+ return new RectF(location[0], location[1], location[0] + view.getMeasuredWidth(), location[1] + view.getMeasuredHeight());
121
+ }
122
+
123
+ private static String getNativeId(View view) {
124
+ Object tag = view.getTag(R.id.view_tag_native_id);
125
+ return tag instanceof String ? (String) tag : null;
126
+ }
127
+
128
+ @ReactMethod
129
+ public void init(String apiKey, String userId, String endpoint) {
130
+ final Activity activity = getCurrentActivity();
131
+ Plotline.init(activity, apiKey, userId, endpoint);
132
+ Plotline.setFramework("REACT_NATIVE");
133
+ PlotlineInternal.setPositionCallback(new PlotlineViewPositionCallback() {
134
+ @Override
135
+ public void getAllElements(Activity activity, PlotlineScreenshotPositionsCompleteListener plotlineScreenshotPositionsCompleteListener) {
136
+ plotlineScreenshotPositionsCompleteListener.onPositionsReady(RNPlotline.getAllElements(activity));
137
+ }
138
+
139
+ @Override
140
+ public void getViewPosition(Activity activity, String fragmentId, String nativeId, PlotlineViewPositionCompleteListener plotlineViewPositionCompleteListener) {
141
+ final Activity activityInternal = getCurrentActivity();
142
+ View view = ReactFindViewUtil.findView(activityInternal.getWindow().getDecorView().getRootView(), nativeId);
143
+
144
+ if (view == null) {
145
+ plotlineViewPositionCompleteListener.onViewReady(null);
146
+ return;
147
+ }
148
+
149
+ view.post(() -> {
150
+ boolean isVisible = false;
151
+ try {
152
+ AccessibilityNodeInfo nodeInfo = AccessibilityNodeInfo.obtain();
153
+ view.onInitializeAccessibilityNodeInfo(nodeInfo);
154
+ isVisible = nodeInfo.isVisibleToUser();
155
+ nodeInfo.recycle();
156
+ } catch (Exception e) {
157
+ e.printStackTrace();
158
+ }
159
+
160
+ if (isVisible) {
161
+ ViewPosition viewPosition = new ViewPosition(calculeRectOnScreen(view), calculeRectInWindow(view));
162
+ plotlineViewPositionCompleteListener.onViewReady(viewPosition);
163
+ } else {
164
+ plotlineViewPositionCompleteListener.onViewReady(null);
165
+ }
166
+ });
167
+ }
168
+
169
+ public boolean isViewPresent(Activity activity, String fragmentId, String nativeId) {
170
+ final Activity activityInternal = getCurrentActivity();
171
+ View view = ReactFindViewUtil.findView(activityInternal.getWindow().getDecorView().getRootView(), nativeId);
172
+
173
+ if (view == null)
174
+ return false;
175
+
176
+ try {
177
+ AccessibilityNodeInfo nodeInfo = AccessibilityNodeInfo.obtain();
178
+ view.onInitializeAccessibilityNodeInfo(nodeInfo);
179
+ boolean isVisible = nodeInfo.isVisibleToUser();
180
+ nodeInfo.recycle();
181
+ return (view.getWidth() != 0 && view.getHeight() != 0 && isVisible);
182
+ } catch (Exception e) {
183
+ e.printStackTrace();
184
+ }
185
+ return false;
186
+ }
187
+
188
+ @Override
189
+ public void areViewsPresent(Activity activity, List<ElementSearchObject> elementSearchObjects, PlotlineViewsPresenceListener plotlineViewsPresenceListener) {
190
+ List<ElementSearchObject> presentElements = new ArrayList<>();
191
+ if (elementSearchObjects.size() == 0) {
192
+ plotlineViewsPresenceListener.onViewsPresent(presentElements);
193
+ return;
194
+ }
195
+
196
+ for(ElementSearchObject elementSearchObject: elementSearchObjects) {
197
+ if (isViewPresent(activity, elementSearchObject.clientFragmentId, elementSearchObject.clientElementId)) {
198
+ presentElements.add(elementSearchObject);
199
+ }
200
+ }
201
+ plotlineViewsPresenceListener.onViewsPresent(presentElements);
202
+ }
203
+
204
+
205
+ @Override
206
+ public View getView(Activity activity, String fragmentId, String nativeId) {
207
+ final Activity activityInternal = getCurrentActivity();
208
+ View view = ReactFindViewUtil.findView(activityInternal.getWindow().getDecorView().getRootView(), nativeId);
209
+ return view;
210
+ }
211
+ });
212
+ }
213
+
214
+ @ReactMethod
215
+ public void track(String eventName) {
216
+ final Activity activity = getCurrentActivity();
217
+ Plotline.track(eventName, activity);
218
+ }
219
+
220
+ @ReactMethod
221
+ public void track(String eventName, ReadableMap object){
222
+ final Activity activity = getCurrentActivity();
223
+ JSONObject properties = new JSONObject();
224
+ if (object != null) {
225
+ ReadableMapKeySetIterator iterator = object.keySetIterator();
226
+ while (iterator.hasNextKey()) {
227
+ String key = iterator.nextKey();
228
+ ReadableType type = object.getType(key);
229
+ if (type == ReadableType.String) {
230
+ try {
231
+ properties.put((String) key, (String) object.getString(key));
232
+ } catch (JSONException e) {
233
+ e.printStackTrace();
234
+ }
235
+ }
236
+ }
237
+ }
238
+ Plotline.track(eventName, properties, activity);
239
+ }
240
+
241
+ @ReactMethod
242
+ public void identify(ReadableMap object) {
243
+ JSONObject jsonObject = new JSONObject();
244
+ if (object != null) {
245
+ ReadableMapKeySetIterator iterator = object.keySetIterator();
246
+ while (iterator.hasNextKey()) {
247
+ String key = iterator.nextKey();
248
+ ReadableType type = object.getType(key);
249
+ if (type == ReadableType.String) {
250
+ try {
251
+ jsonObject.put((String) key, (String) object.getString(key));
252
+ } catch (JSONException e) {
253
+ e.printStackTrace();
254
+ }
255
+ }
256
+ }
257
+ }
258
+ Plotline.identify(jsonObject);
259
+ }
260
+
261
+ @ReactMethod
262
+ public void showMockStudy() {
263
+ final Activity activity = getCurrentActivity();
264
+ Plotline.showMockStudy(activity);
265
+ }
266
+
267
+ @ReactMethod
268
+ public void setLocale(String locale) {
269
+ Plotline.setLocale(locale);
270
+ }
271
+
272
+ @ReactMethod
273
+ public void setColor(ReadableMap colors) {
274
+ JSONObject jsonObject = new JSONObject();
275
+ if (colors != null) {
276
+ ReadableMapKeySetIterator iterator = colors.keySetIterator();
277
+ while (iterator.hasNextKey()) {
278
+ String key = iterator.nextKey();
279
+ ReadableType type = colors.getType(key);
280
+ if (type == ReadableType.String) {
281
+ try {
282
+ jsonObject.put((String) key, (String) colors.getString(key));
283
+ } catch (JSONException e) {
284
+ e.printStackTrace();
285
+ }
286
+ }
287
+ }
288
+ }
289
+ Plotline.setColor(jsonObject);
290
+ }
291
+
292
+ @ReactMethod
293
+ public void trackPage(String pageId) {
294
+ final Activity activity = getCurrentActivity();
295
+ Plotline.trackPage(pageId, activity);
296
+ }
297
+ }
@@ -0,0 +1,29 @@
1
+
2
+ package com.reactnativeplotline;
3
+
4
+ import java.util.Arrays;
5
+ import java.util.Collections;
6
+ import java.util.List;
7
+
8
+ import com.facebook.react.ReactPackage;
9
+ import com.facebook.react.bridge.NativeModule;
10
+ import com.facebook.react.bridge.ReactApplicationContext;
11
+ import com.facebook.react.uimanager.ViewManager;
12
+ import com.facebook.react.bridge.JavaScriptModule;
13
+
14
+ public class RNPlotlinePackage implements ReactPackage {
15
+ @Override
16
+ public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
17
+ return Arrays.<NativeModule>asList(new RNPlotline(reactContext));
18
+ }
19
+
20
+ // Deprecated from RN 0.47
21
+ public List<Class<? extends JavaScriptModule>> createJSModules() {
22
+ return Collections.emptyList();
23
+ }
24
+
25
+ @Override
26
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
27
+ return Collections.emptyList();
28
+ }
29
+ }
package/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ declare class plotline {
2
+ track(eventName: string, properties: {[key: string]: string}): void;
3
+ init(apiKey: string, refId: string, endpoint?: string): void;
4
+ identify(attributes: {[key: string]: string}): void;
5
+ setLocale(locale: string): void;
6
+ showMockStudy(): void;
7
+ setColor(colors: {[key: string]: string}): void;
8
+ trackPage(pageId: string): void;
9
+ }
10
+ declare const Plotline: plotline;
11
+ export default Plotline;
package/index.js ADDED
@@ -0,0 +1,43 @@
1
+
2
+ import { NativeModules, Platform } from 'react-native';
3
+
4
+ const { RNPlotline } = NativeModules;
5
+
6
+ class plotline {
7
+ track (eventName, properties) {
8
+ if (properties)
9
+ RNPlotline.track(eventName, properties);
10
+ else
11
+ RNPlotline.track(eventName, null);
12
+ }
13
+
14
+ init (apiKey, refId, endpoint = null) {
15
+ console.log("[Plotline] init called");
16
+ RNPlotline.init(apiKey, refId, endpoint);
17
+ }
18
+
19
+ identify (obj) {
20
+ RNPlotline.identify(obj);
21
+ }
22
+
23
+ setLocale (locale) {
24
+ RNPlotline.setLocale(locale);
25
+ }
26
+
27
+ showMockStudy () {
28
+ RNPlotline.showMockStudy();
29
+ }
30
+
31
+ setColor (colors) {
32
+ RNPlotline.setColor(colors);
33
+ }
34
+
35
+ trackPage (pageId) {
36
+ console.log("[Plotline] track called");
37
+ RNPlotline.trackPage(pageId);
38
+ }
39
+ }
40
+
41
+ const Plotline = new plotline();
42
+
43
+ export default Plotline;
@@ -0,0 +1,11 @@
1
+
2
+ #if __has_include("RCTBridgeModule.h")
3
+ #import "RCTBridgeModule.h"
4
+ #else
5
+ #import <React/RCTBridgeModule.h>
6
+ #endif
7
+
8
+ @interface RNPlotline : NSObject <RCTBridgeModule>
9
+
10
+ @end
11
+
@@ -0,0 +1,64 @@
1
+
2
+ #import "RNPlotline.h"
3
+ #import <Plotline/Plotline-Swift.h>
4
+
5
+ @implementation RNPlotline
6
+
7
+ RCT_EXPORT_METHOD(init:(NSString *)apiKey userId:(NSString *)userId endpoint:(NSString *)endpoint)
8
+ {
9
+ printf("Plotline Init Called");
10
+ [Plotline debugWithShouldDebug:true];
11
+ if (endpoint != nil) {
12
+ [Plotline initializeWithApiKey:apiKey userId:userId endpoint:endpoint];
13
+ } else {
14
+ [Plotline initializeWithApiKey:apiKey userId:userId];
15
+ }
16
+ [Plotline setPlotlineFrameworkWithFramework:@"REACT_NATIVE"];
17
+ // [Plotline trackPageWithPageName:@"MainActivity"];
18
+ }
19
+
20
+ RCT_EXPORT_METHOD(track:(NSString *)eventName properties: (NSDictionary *) properties)
21
+ {
22
+ if(properties != nil) {
23
+ [Plotline trackWithEventName:eventName properties:properties];
24
+ } else {
25
+ [Plotline trackWithEventName:eventName];
26
+ }
27
+ }
28
+
29
+ RCT_EXPORT_METHOD(setLocale:(NSString *)locale)
30
+ {
31
+ [Plotline setLocaleWithLocale:locale];
32
+ }
33
+
34
+ RCT_EXPORT_METHOD(identify:(NSDictionary *)attribute)
35
+ {
36
+ [Plotline identifyWithAttributes:attribute];
37
+ }
38
+
39
+ RCT_EXPORT_METHOD(showMockStudy)
40
+ {
41
+ [Plotline showMockStudy];
42
+ [Plotline initAlong];
43
+ }
44
+
45
+ RCT_EXPORT_METHOD(setColor:(NSDictionary *)colors)
46
+ {
47
+ [Plotline setColorWithColors:colors];
48
+ }
49
+
50
+ RCT_EXPORT_METHOD(debug)
51
+ {
52
+ [Plotline debugWithShouldDebug:true];
53
+ }
54
+
55
+ RCT_EXPORT_METHOD(trackPage:(NSString *)pageName)
56
+ {
57
+ printf("Plotline Track Page Called");
58
+ [Plotline trackPageWithPageName:pageName];
59
+ }
60
+
61
+ RCT_EXPORT_MODULE();
62
+
63
+ @end
64
+