plotline-engage 4.0.9 → 4.1.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.
@@ -39,6 +39,6 @@ repositories {
39
39
 
40
40
  dependencies {
41
41
  implementation 'com.facebook.react:react-native:+'
42
- implementation 'com.gitlab.plotline:plotline-android-sdk:3.1.8'
42
+ implementation 'com.gitlab.plotline:plotline-android-sdk:3.2.8'
43
43
  }
44
44
 
package/index.js CHANGED
@@ -4,6 +4,28 @@ import { ScrollView as RNScrollView, FlatList as RNFlatList} from 'react-native'
4
4
  import React from 'react';
5
5
  const { RNPlotline } = NativeModules;
6
6
 
7
+ function convertToStringValues(obj) {
8
+ const convertedObj = {};
9
+
10
+ for (let key in obj) {
11
+ if (obj.hasOwnProperty(key)) {
12
+ const value = obj[key];
13
+
14
+ if (typeof value === 'number') {
15
+ convertedObj[key] = String(value);
16
+ }
17
+ else if (typeof value === 'boolean') {
18
+ convertedObj[key] = value ? "true" : "false";
19
+ }
20
+ else if (typeof value === 'string') {
21
+ convertedObj[key] = value;
22
+ }
23
+ }
24
+ }
25
+
26
+ return convertedObj;
27
+ }
28
+
7
29
  class plotline {
8
30
  constructor() {
9
31
  this.throttledNotifyScroll = this.throttle(this.handleScroll, 250);
@@ -43,7 +65,7 @@ class plotline {
43
65
 
44
66
  track (eventName, properties) {
45
67
  if (properties)
46
- RNPlotline.track(eventName, properties);
68
+ RNPlotline.track(eventName, convertToStringValues(properties));
47
69
  else
48
70
  RNPlotline.track(eventName, null);
49
71
  }
@@ -53,7 +75,7 @@ class plotline {
53
75
  }
54
76
 
55
77
  identify (obj) {
56
- RNPlotline.identify(obj);
78
+ RNPlotline.identify(convertToStringValues(obj));
57
79
  }
58
80
 
59
81
  setLocale (locale) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plotline-engage",
3
- "version": "4.0.9",
3
+ "version": "4.1.1",
4
4
  "description": "React Native plugin for Plotline",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"