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