mixpanel-react-native 1.4.2 → 2.0.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/CHANGELOG.md +33 -0
- package/{LICENSE → LICENSE.md} +1 -12
- package/MixpanelReactNative.podspec +1 -1
- package/README.md +6 -3
- package/Samples/ContextAPIMixpanel/Analytics.js +2 -1
- package/Samples/MixpanelDemo/Analytics.js +2 -2
- package/Samples/MixpanelDemo/app.json +2 -1
- package/Samples/SimpleMixpanel/App.js +2 -1
- package/__tests__/index.test.js +42 -42
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/mixpanel/reactnative/MixpanelReactNativeModule.java +84 -84
- package/docs/Mixpanel.html +60 -37
- package/docs/MixpanelGroup.html +7 -7
- package/docs/People.html +12 -12
- package/docs/index.html +7 -4
- package/docs/index.js.html +13 -8
- package/index.d.ts +2 -2
- package/index.js +12 -7
- package/ios/MixpanelReactNative.m +1 -1
- package/ios/MixpanelReactNative.swift +3 -6
- package/package.json +1 -1
|
@@ -33,16 +33,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
@ReactMethod
|
|
36
|
-
public void initialize(String token, boolean optOutTrackingDefault, ReadableMap metadata, Promise promise) throws JSONException {
|
|
36
|
+
public void initialize(String token, boolean trackAutomaticEvents, boolean optOutTrackingDefault, ReadableMap metadata, Promise promise) throws JSONException {
|
|
37
37
|
JSONObject mixpanelProperties = ReactNativeHelper.reactToJSON(metadata);
|
|
38
38
|
AutomaticProperties.setAutomaticProperties(mixpanelProperties);
|
|
39
|
-
MixpanelAPI.getInstance(this.mReactContext, token, optOutTrackingDefault, mixpanelProperties);
|
|
39
|
+
MixpanelAPI.getInstance(this.mReactContext, token, optOutTrackingDefault, mixpanelProperties, null, trackAutomaticEvents);
|
|
40
40
|
promise.resolve(null);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@ReactMethod
|
|
44
|
-
public void setServerURL(final String token, final String serverURL, Promise promise) throws JSONException {
|
|
45
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
44
|
+
public void setServerURL(final String token, final boolean trackAutomaticEvents, final String serverURL, Promise promise) throws JSONException {
|
|
45
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
46
46
|
synchronized (instance) {
|
|
47
47
|
instance.setServerURL(serverURL);
|
|
48
48
|
promise.resolve(null);
|
|
@@ -50,8 +50,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@ReactMethod
|
|
53
|
-
public void setUseIpAddressForGeolocation(final String token, boolean useIpAddressForGeolocation, Promise promise) throws JSONException {
|
|
54
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
53
|
+
public void setUseIpAddressForGeolocation(final String token, final boolean trackAutomaticEvents, boolean useIpAddressForGeolocation, Promise promise) throws JSONException {
|
|
54
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
55
55
|
synchronized (instance) {
|
|
56
56
|
instance.setUseIpAddressForGeolocation(useIpAddressForGeolocation);
|
|
57
57
|
promise.resolve(null);
|
|
@@ -59,8 +59,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
@ReactMethod
|
|
62
|
-
public void setLoggingEnabled(final String token, boolean enableLogging, Promise promise) throws JSONException {
|
|
63
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
62
|
+
public void setLoggingEnabled(final String token, final boolean trackAutomaticEvents, boolean enableLogging, Promise promise) throws JSONException {
|
|
63
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
64
64
|
synchronized (instance) {
|
|
65
65
|
instance.setEnableLogging(enableLogging);
|
|
66
66
|
promise.resolve(null);
|
|
@@ -68,16 +68,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
@ReactMethod
|
|
71
|
-
public void hasOptedOutTracking(final String token, Promise promise) {
|
|
72
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
71
|
+
public void hasOptedOutTracking(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
72
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
73
73
|
synchronized (instance) {
|
|
74
74
|
promise.resolve(instance.hasOptedOutTracking());
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
@ReactMethod
|
|
79
|
-
public void optInTracking(final String token, Promise promise) throws JSONException {
|
|
80
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
79
|
+
public void optInTracking(final String token, final boolean trackAutomaticEvents, Promise promise) throws JSONException {
|
|
80
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
81
81
|
synchronized (instance) {
|
|
82
82
|
instance.optInTracking();
|
|
83
83
|
promise.resolve(null);
|
|
@@ -85,8 +85,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@ReactMethod
|
|
88
|
-
public void optOutTracking(final String token, Promise promise) {
|
|
89
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
88
|
+
public void optOutTracking(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
89
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
90
90
|
synchronized (instance) {
|
|
91
91
|
instance.optOutTracking();
|
|
92
92
|
promise.resolve(null);
|
|
@@ -94,8 +94,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
@ReactMethod
|
|
97
|
-
public void identify(final String token, final String distinctId, Promise promise) {
|
|
98
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
97
|
+
public void identify(final String token, final boolean trackAutomaticEvents, final String distinctId, Promise promise) {
|
|
98
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
99
99
|
synchronized (instance) {
|
|
100
100
|
instance.identify(distinctId);
|
|
101
101
|
promise.resolve(null);
|
|
@@ -103,24 +103,24 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
@ReactMethod
|
|
106
|
-
public void getDistinctId(final String token, Promise promise) {
|
|
107
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
106
|
+
public void getDistinctId(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
107
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
108
108
|
synchronized (instance) {
|
|
109
109
|
promise.resolve(instance.getDistinctId());
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
@ReactMethod
|
|
114
|
-
public void getDeviceId(final String token, Promise promise) {
|
|
115
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
114
|
+
public void getDeviceId(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
115
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
116
116
|
synchronized (instance) {
|
|
117
117
|
promise.resolve(instance.getAnonymousId());
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
@ReactMethod
|
|
122
|
-
public void track(final String token, final String eventName, ReadableMap properties, Promise promise) throws JSONException {
|
|
123
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
122
|
+
public void track(final String token, final boolean trackAutomaticEvents, final String eventName, ReadableMap properties, Promise promise) throws JSONException {
|
|
123
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
124
124
|
synchronized (instance) {
|
|
125
125
|
JSONObject eventProperties = ReactNativeHelper.reactToJSON(properties);
|
|
126
126
|
AutomaticProperties.appendLibraryProperties(eventProperties);
|
|
@@ -130,8 +130,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
@ReactMethod
|
|
133
|
-
public void registerSuperProperties(final String token, ReadableMap properties, Promise promise) throws JSONException {
|
|
134
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
133
|
+
public void registerSuperProperties(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
|
|
134
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
135
135
|
synchronized (instance) {
|
|
136
136
|
JSONObject superProperties = ReactNativeHelper.reactToJSON(properties);
|
|
137
137
|
instance.registerSuperProperties(superProperties);
|
|
@@ -140,8 +140,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
@ReactMethod
|
|
143
|
-
public void registerSuperPropertiesOnce(final String token, ReadableMap properties, Promise promise) throws JSONException {
|
|
144
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
143
|
+
public void registerSuperPropertiesOnce(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
|
|
144
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
145
145
|
synchronized (instance) {
|
|
146
146
|
JSONObject superProperties = ReactNativeHelper.reactToJSON(properties);
|
|
147
147
|
instance.registerSuperPropertiesOnce(superProperties);
|
|
@@ -150,8 +150,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
@ReactMethod
|
|
153
|
-
public void unregisterSuperProperty(final String token, String superPropertyName, Promise promise) {
|
|
154
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
153
|
+
public void unregisterSuperProperty(final String token, final boolean trackAutomaticEvents, String superPropertyName, Promise promise) {
|
|
154
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
155
155
|
synchronized (instance) {
|
|
156
156
|
instance.unregisterSuperProperty(superPropertyName);
|
|
157
157
|
promise.resolve(null);
|
|
@@ -159,8 +159,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
@ReactMethod
|
|
162
|
-
public void union(final String token, String name, ReadableArray value, Promise promise) throws JSONException {
|
|
163
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
162
|
+
public void union(final String token, final boolean trackAutomaticEvents, String name, ReadableArray value, Promise promise) throws JSONException {
|
|
163
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
164
164
|
synchronized (instance) {
|
|
165
165
|
JSONArray propertyValue = ReactNativeHelper.reactToJSON(value);
|
|
166
166
|
instance.getPeople().union(name, propertyValue);
|
|
@@ -169,16 +169,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
@ReactMethod
|
|
172
|
-
public void getSuperProperties(final String token, Promise promise) throws JSONException {
|
|
173
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
172
|
+
public void getSuperProperties(final String token, final boolean trackAutomaticEvents, Promise promise) throws JSONException {
|
|
173
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
174
174
|
synchronized (instance) {
|
|
175
175
|
promise.resolve(ReactNativeHelper.convertJsonToMap(instance.getSuperProperties()));
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
@ReactMethod
|
|
180
|
-
public void clearSuperProperties(final String token, Promise promise) {
|
|
181
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
180
|
+
public void clearSuperProperties(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
181
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
182
182
|
synchronized (instance) {
|
|
183
183
|
instance.clearSuperProperties();
|
|
184
184
|
promise.resolve(null);
|
|
@@ -186,8 +186,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
@ReactMethod
|
|
189
|
-
public void alias(final String token, String alias, String original, Promise promise) {
|
|
190
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
189
|
+
public void alias(final String token, final boolean trackAutomaticEvents, String alias, String original, Promise promise) {
|
|
190
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
191
191
|
synchronized (instance) {
|
|
192
192
|
instance.alias(alias, original);
|
|
193
193
|
promise.resolve(null);
|
|
@@ -195,8 +195,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
@ReactMethod
|
|
198
|
-
public void reset(final String token, Promise promise) {
|
|
199
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
198
|
+
public void reset(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
199
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
200
200
|
synchronized (instance) {
|
|
201
201
|
instance.reset();
|
|
202
202
|
promise.resolve(null);
|
|
@@ -204,8 +204,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
@ReactMethod
|
|
207
|
-
public void flush(final String token, Promise promise) {
|
|
208
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
207
|
+
public void flush(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
208
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
209
209
|
synchronized (instance) {
|
|
210
210
|
instance.flush();
|
|
211
211
|
promise.resolve(null);
|
|
@@ -213,8 +213,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
@ReactMethod
|
|
216
|
-
public void timeEvent(final String token, final String eventName, Promise promise) {
|
|
217
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
216
|
+
public void timeEvent(final String token, final boolean trackAutomaticEvents, final String eventName, Promise promise) {
|
|
217
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
218
218
|
synchronized (instance) {
|
|
219
219
|
instance.timeEvent(eventName);
|
|
220
220
|
promise.resolve(null);
|
|
@@ -222,16 +222,16 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
@ReactMethod
|
|
225
|
-
public void eventElapsedTime(final String token, final String eventName, Promise promise) {
|
|
226
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
225
|
+
public void eventElapsedTime(final String token, final boolean trackAutomaticEvents, final String eventName, Promise promise) {
|
|
226
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
227
227
|
synchronized (instance) {
|
|
228
228
|
promise.resolve(instance.eventElapsedTime(eventName));
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
@ReactMethod
|
|
233
|
-
public void set(final String token, ReadableMap properties, Promise promise) throws JSONException {
|
|
234
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
233
|
+
public void set(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
|
|
234
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
235
235
|
synchronized (instance) {
|
|
236
236
|
JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
|
|
237
237
|
AutomaticProperties.appendLibraryProperties(sendProperties);
|
|
@@ -241,8 +241,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
@ReactMethod
|
|
244
|
-
public void unset(final String token, String propertyName, Promise promise) {
|
|
245
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
244
|
+
public void unset(final String token, final boolean trackAutomaticEvents, String propertyName, Promise promise) {
|
|
245
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
246
246
|
synchronized (instance) {
|
|
247
247
|
instance.getPeople().unset(propertyName);
|
|
248
248
|
promise.resolve(null);
|
|
@@ -250,8 +250,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
@ReactMethod
|
|
253
|
-
public void setOnce(final String token, ReadableMap properties, Promise promise) throws JSONException {
|
|
254
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
253
|
+
public void setOnce(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) throws JSONException {
|
|
254
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
255
255
|
synchronized (instance) {
|
|
256
256
|
JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
|
|
257
257
|
AutomaticProperties.appendLibraryProperties(sendProperties);
|
|
@@ -261,8 +261,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
@ReactMethod
|
|
264
|
-
public void trackCharge(final String token, double charge, ReadableMap properties, Promise promise) throws JSONException {
|
|
265
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
264
|
+
public void trackCharge(final String token, final boolean trackAutomaticEvents, double charge, ReadableMap properties, Promise promise) throws JSONException {
|
|
265
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
266
266
|
synchronized (instance) {
|
|
267
267
|
JSONObject transactionValue = ReactNativeHelper.reactToJSON(properties);
|
|
268
268
|
instance.getPeople().trackCharge(charge, transactionValue);
|
|
@@ -271,8 +271,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
@ReactMethod
|
|
274
|
-
public void clearCharges(final String token, Promise promise) {
|
|
275
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
274
|
+
public void clearCharges(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
275
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
276
276
|
synchronized (instance) {
|
|
277
277
|
instance.getPeople().clearCharges();
|
|
278
278
|
promise.resolve(null);
|
|
@@ -280,9 +280,9 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
@ReactMethod
|
|
283
|
-
public void increment(final String token, ReadableMap properties, Promise promise) {
|
|
283
|
+
public void increment(final String token, final boolean trackAutomaticEvents, ReadableMap properties, Promise promise) {
|
|
284
284
|
Map incrementProperties = ReactNativeHelper.toMap(properties);
|
|
285
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
285
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
286
286
|
synchronized (instance) {
|
|
287
287
|
instance.getPeople().increment(incrementProperties);
|
|
288
288
|
promise.resolve(null);
|
|
@@ -290,8 +290,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
@ReactMethod
|
|
293
|
-
public void append(final String token, String name, Dynamic value, Promise promise) throws JSONException {
|
|
294
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
293
|
+
public void append(final String token, final boolean trackAutomaticEvents, String name, Dynamic value, Promise promise) throws JSONException {
|
|
294
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
295
295
|
synchronized (instance) {
|
|
296
296
|
instance.getPeople().append(name, ReactNativeHelper.dynamicToObject(value));
|
|
297
297
|
promise.resolve(null);
|
|
@@ -299,8 +299,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
@ReactMethod
|
|
302
|
-
public void deleteUser(final String token, Promise promise) {
|
|
303
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
302
|
+
public void deleteUser(final String token, final boolean trackAutomaticEvents, Promise promise) {
|
|
303
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
304
304
|
synchronized (instance) {
|
|
305
305
|
instance.getPeople().deleteUser();
|
|
306
306
|
promise.resolve(null);
|
|
@@ -308,8 +308,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
@ReactMethod
|
|
311
|
-
public void remove(final String token, String name, Dynamic value, Promise promise) throws JSONException {
|
|
312
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
311
|
+
public void remove(final String token, final boolean trackAutomaticEvents, String name, Dynamic value, Promise promise) throws JSONException {
|
|
312
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
313
313
|
synchronized (instance) {
|
|
314
314
|
instance.getPeople().remove(name, ReactNativeHelper.dynamicToObject(value));
|
|
315
315
|
promise.resolve(null);
|
|
@@ -317,8 +317,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
@ReactMethod
|
|
320
|
-
public void trackWithGroups(final String token, String eventName, ReadableMap properties, ReadableMap groups, Promise promise) {
|
|
321
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
320
|
+
public void trackWithGroups(final String token, final boolean trackAutomaticEvents, String eventName, ReadableMap properties, ReadableMap groups, Promise promise) {
|
|
321
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
322
322
|
synchronized (instance) {
|
|
323
323
|
Map eventProperties = ReactNativeHelper.toMap(properties);
|
|
324
324
|
Map eventGroups = ReactNativeHelper.toMap(groups);
|
|
@@ -329,8 +329,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
329
329
|
|
|
330
330
|
|
|
331
331
|
@ReactMethod
|
|
332
|
-
public void setGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
|
|
333
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
332
|
+
public void setGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
|
|
333
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
334
334
|
synchronized (instance) {
|
|
335
335
|
instance.setGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID));
|
|
336
336
|
promise.resolve(null);
|
|
@@ -338,8 +338,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
@ReactMethod
|
|
341
|
-
public void setGroups(final String token, String groupKey, ReadableArray groupIDs, Promise promise) throws JSONException {
|
|
342
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
341
|
+
public void setGroups(final String token, final boolean trackAutomaticEvents, String groupKey, ReadableArray groupIDs, Promise promise) throws JSONException {
|
|
342
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
343
343
|
synchronized (instance) {
|
|
344
344
|
instance.setGroup(groupKey, Arrays.asList(ReactNativeHelper.toArray(groupIDs)));
|
|
345
345
|
promise.resolve(null);
|
|
@@ -347,8 +347,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
@ReactMethod
|
|
350
|
-
public void addGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
|
|
351
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
350
|
+
public void addGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
|
|
351
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
352
352
|
synchronized (instance) {
|
|
353
353
|
instance.addGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID));
|
|
354
354
|
promise.resolve(null);
|
|
@@ -356,8 +356,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
@ReactMethod
|
|
359
|
-
public void removeGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
|
|
360
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
359
|
+
public void removeGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
|
|
360
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
361
361
|
synchronized (instance) {
|
|
362
362
|
instance.removeGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID));
|
|
363
363
|
promise.resolve(null);
|
|
@@ -365,8 +365,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
@ReactMethod
|
|
368
|
-
public void deleteGroup(final String token, String groupKey, Dynamic groupID, Promise promise) {
|
|
369
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
368
|
+
public void deleteGroup(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, Promise promise) {
|
|
369
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
370
370
|
synchronized (instance) {
|
|
371
371
|
instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).deleteGroup();
|
|
372
372
|
promise.resolve(null);
|
|
@@ -374,8 +374,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
@ReactMethod
|
|
377
|
-
public void groupSetProperties(final String token, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
|
|
378
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
377
|
+
public void groupSetProperties(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
|
|
378
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
379
379
|
synchronized (instance) {
|
|
380
380
|
JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
|
|
381
381
|
instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).set(sendProperties);
|
|
@@ -384,8 +384,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
@ReactMethod
|
|
387
|
-
public void groupSetPropertyOnce(final String token, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
|
|
388
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
387
|
+
public void groupSetPropertyOnce(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, ReadableMap properties, Promise promise) throws JSONException {
|
|
388
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
389
389
|
synchronized (instance) {
|
|
390
390
|
JSONObject sendProperties = ReactNativeHelper.reactToJSON(properties);
|
|
391
391
|
instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).setOnce(sendProperties);
|
|
@@ -394,8 +394,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
@ReactMethod
|
|
397
|
-
public void groupUnsetProperty(final String token, String groupKey, Dynamic groupID, String propertyName, Promise promise) throws JSONException {
|
|
398
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
397
|
+
public void groupUnsetProperty(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, String propertyName, Promise promise) throws JSONException {
|
|
398
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
399
399
|
synchronized (instance) {
|
|
400
400
|
instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).unset(propertyName);
|
|
401
401
|
promise.resolve(null);
|
|
@@ -403,8 +403,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
@ReactMethod
|
|
406
|
-
public void groupRemovePropertyValue(final String token, String groupKey, Dynamic groupID, String name, Dynamic value, Promise promise) throws JSONException {
|
|
407
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
406
|
+
public void groupRemovePropertyValue(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, String name, Dynamic value, Promise promise) throws JSONException {
|
|
407
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
408
408
|
synchronized (instance) {
|
|
409
409
|
instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).remove(name, ReactNativeHelper.dynamicToObject(value));
|
|
410
410
|
promise.resolve(null);
|
|
@@ -412,8 +412,8 @@ public class MixpanelReactNativeModule extends ReactContextBaseJavaModule {
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
@ReactMethod
|
|
415
|
-
public void groupUnionProperty(final String token, String groupKey, Dynamic groupID, String name, ReadableArray values, Promise promise) throws JSONException {
|
|
416
|
-
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token);
|
|
415
|
+
public void groupUnionProperty(final String token, final boolean trackAutomaticEvents, String groupKey, Dynamic groupID, String name, ReadableArray values, Promise promise) throws JSONException {
|
|
416
|
+
MixpanelAPI instance = MixpanelAPI.getInstance(this.mReactContext, token, trackAutomaticEvents);
|
|
417
417
|
synchronized (instance) {
|
|
418
418
|
JSONArray arrayValues = ReactNativeHelper.reactToJSON(values);
|
|
419
419
|
instance.getGroup(groupKey, ReactNativeHelper.dynamicToObject(groupID)).union(name, arrayValues);
|