mixpanel-react-native 2.4.0 → 2.4.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 +0 -11
- package/__tests__/index.test.js +181 -61
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +1 -1
- package/android/bin/build.gradle +8 -1
- package/index.js +896 -833
- package/package.json +56 -56
- package/release.py +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
#
|
|
2
2
|
|
|
3
|
-
## [v2.4.0](https://github.com/mixpanel/mixpanel-react-native/tree/v2.4.0) (2023-12-02)
|
|
4
|
-
|
|
5
|
-
### Enhancements
|
|
6
|
-
|
|
7
|
-
- add api: setFlushBatchSize [\#219](https://github.com/mixpanel/mixpanel-react-native/pull/219)
|
|
8
|
-
- RN 73 support for Android with AGP 8 required [\#215](https://github.com/mixpanel/mixpanel-react-native/pull/215)
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
|
|
12
3
|
## [v2.3.1](https://github.com/mixpanel/mixpanel-react-native/tree/v2.3.1) (2023-06-20)
|
|
13
4
|
|
|
14
5
|
### Fixes
|
|
@@ -342,8 +333,6 @@ Report issues or give us any feedback is appreciated!
|
|
|
342
333
|
|
|
343
334
|
|
|
344
335
|
|
|
345
|
-
|
|
346
|
-
|
|
347
336
|
|
|
348
337
|
|
|
349
338
|
|
package/__tests__/index.test.js
CHANGED
|
@@ -2,111 +2,184 @@
|
|
|
2
2
|
* @format
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { NativeModules } from 'react-native';
|
|
5
|
+
import {Mixpanel} from "mixpanel-react-native";
|
|
8
6
|
|
|
7
|
+
import {NativeModules} from "react-native";
|
|
9
8
|
|
|
10
9
|
test(`it calls MixpanelReactNative initialize`, async () => {
|
|
11
10
|
const mixpanel = await Mixpanel.init("token", true);
|
|
12
|
-
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith(
|
|
11
|
+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith(
|
|
12
|
+
"token",
|
|
13
|
+
true,
|
|
14
|
+
false,
|
|
15
|
+
{$lib_version: expect.any(String), mp_lib: "react-native"},
|
|
16
|
+
"https://api.mixpanel.com"
|
|
17
|
+
);
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
test(`it calls MixpanelReactNative initialize with optOut and superProperties`, async () => {
|
|
16
21
|
const mixpanel = new Mixpanel("token", true);
|
|
17
|
-
mixpanel.init(true, {
|
|
18
|
-
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith(
|
|
22
|
+
mixpanel.init(true, {super: "property"});
|
|
23
|
+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith(
|
|
24
|
+
"token",
|
|
25
|
+
true,
|
|
26
|
+
true,
|
|
27
|
+
{
|
|
28
|
+
$lib_version: expect.any(String),
|
|
29
|
+
mp_lib: "react-native",
|
|
30
|
+
super: "property",
|
|
31
|
+
},
|
|
32
|
+
"https://api.mixpanel.com"
|
|
33
|
+
);
|
|
19
34
|
});
|
|
20
35
|
|
|
21
36
|
test(`it calls MixpanelReactNative setServerURL`, async () => {
|
|
22
37
|
const mixpanel = await Mixpanel.init("token", true);
|
|
23
38
|
mixpanel.setServerURL("https://api-eu.mixpanel.com");
|
|
24
|
-
expect(NativeModules.MixpanelReactNative.setServerURL).toBeCalledWith(
|
|
39
|
+
expect(NativeModules.MixpanelReactNative.setServerURL).toBeCalledWith(
|
|
40
|
+
"token",
|
|
41
|
+
"https://api-eu.mixpanel.com"
|
|
42
|
+
);
|
|
25
43
|
});
|
|
26
44
|
|
|
27
45
|
test(`it calls MixpanelReactNative setLoggingEnabled`, async () => {
|
|
28
46
|
const mixpanel = await Mixpanel.init("token", true);
|
|
29
47
|
mixpanel.setLoggingEnabled(true);
|
|
30
|
-
expect(NativeModules.MixpanelReactNative.setLoggingEnabled).toBeCalledWith(
|
|
48
|
+
expect(NativeModules.MixpanelReactNative.setLoggingEnabled).toBeCalledWith(
|
|
49
|
+
"token",
|
|
50
|
+
true
|
|
51
|
+
);
|
|
31
52
|
});
|
|
32
53
|
|
|
33
54
|
test(`it calls MixpanelReactNative setUseIpAddressForGeolocation`, async () => {
|
|
34
55
|
const mixpanel = await Mixpanel.init("token", true);
|
|
35
56
|
mixpanel.setUseIpAddressForGeolocation(true);
|
|
36
|
-
expect(
|
|
57
|
+
expect(
|
|
58
|
+
NativeModules.MixpanelReactNative.setUseIpAddressForGeolocation
|
|
59
|
+
).toBeCalledWith("token", true);
|
|
37
60
|
});
|
|
38
61
|
|
|
39
62
|
test(`it calls MixpanelReactNative setFlushBatchSize`, async () => {
|
|
40
63
|
const mixpanel = await Mixpanel.init("token", true);
|
|
41
64
|
mixpanel.setFlushBatchSize(20);
|
|
42
|
-
expect(NativeModules.MixpanelReactNative.setFlushBatchSize).toBeCalledWith(
|
|
65
|
+
expect(NativeModules.MixpanelReactNative.setFlushBatchSize).toBeCalledWith(
|
|
66
|
+
"token",
|
|
67
|
+
20
|
|
68
|
+
);
|
|
43
69
|
});
|
|
44
70
|
|
|
45
71
|
test(`it calls MixpanelReactNative hasOptedOutTracking`, async () => {
|
|
46
72
|
const mixpanel = await Mixpanel.init("token", true);
|
|
47
73
|
mixpanel.hasOptedOutTracking();
|
|
48
|
-
expect(NativeModules.MixpanelReactNative.hasOptedOutTracking).toBeCalledWith(
|
|
74
|
+
expect(NativeModules.MixpanelReactNative.hasOptedOutTracking).toBeCalledWith(
|
|
75
|
+
"token"
|
|
76
|
+
);
|
|
49
77
|
});
|
|
50
78
|
|
|
51
|
-
|
|
52
79
|
test(`it calls MixpanelReactNative optInTracking`, async () => {
|
|
53
80
|
const mixpanel = await Mixpanel.init("token", true);
|
|
54
81
|
mixpanel.optInTracking();
|
|
55
|
-
expect(NativeModules.MixpanelReactNative.optInTracking).toBeCalledWith(
|
|
82
|
+
expect(NativeModules.MixpanelReactNative.optInTracking).toBeCalledWith(
|
|
83
|
+
"token"
|
|
84
|
+
);
|
|
56
85
|
});
|
|
57
86
|
|
|
58
87
|
test(`it calls MixpanelReactNative optOutTracking`, async () => {
|
|
59
88
|
const mixpanel = await Mixpanel.init("token", true);
|
|
60
89
|
mixpanel.optOutTracking();
|
|
61
|
-
expect(NativeModules.MixpanelReactNative.optOutTracking).toBeCalledWith(
|
|
90
|
+
expect(NativeModules.MixpanelReactNative.optOutTracking).toBeCalledWith(
|
|
91
|
+
"token"
|
|
92
|
+
);
|
|
62
93
|
});
|
|
63
94
|
|
|
64
95
|
test(`it calls MixpanelReactNative identify`, async () => {
|
|
65
96
|
const mixpanel = await Mixpanel.init("token", true);
|
|
66
97
|
mixpanel.identify("distinct_id");
|
|
67
|
-
expect(NativeModules.MixpanelReactNative.identify).toBeCalledWith(
|
|
98
|
+
expect(NativeModules.MixpanelReactNative.identify).toBeCalledWith(
|
|
99
|
+
"token",
|
|
100
|
+
"distinct_id"
|
|
101
|
+
);
|
|
68
102
|
});
|
|
69
103
|
|
|
70
104
|
test(`it calls MixpanelReactNative alias`, async () => {
|
|
71
105
|
const mixpanel = await Mixpanel.init("token", true);
|
|
72
106
|
mixpanel.alias("alias", "distinct_id");
|
|
73
|
-
expect(NativeModules.MixpanelReactNative.alias).toBeCalledWith(
|
|
107
|
+
expect(NativeModules.MixpanelReactNative.alias).toBeCalledWith(
|
|
108
|
+
"token",
|
|
109
|
+
"alias",
|
|
110
|
+
"distinct_id"
|
|
111
|
+
);
|
|
74
112
|
});
|
|
75
113
|
|
|
76
114
|
test(`it calls MixpanelReactNative track`, async () => {
|
|
77
115
|
const mixpanel = await Mixpanel.init("token", true);
|
|
78
|
-
mixpanel.track("event name",
|
|
79
|
-
|
|
116
|
+
mixpanel.track("event name", {
|
|
117
|
+
"Cool Property": "Property Value",
|
|
118
|
+
});
|
|
119
|
+
expect(NativeModules.MixpanelReactNative.track).toBeCalledWith(
|
|
120
|
+
"token",
|
|
121
|
+
"event name",
|
|
122
|
+
{
|
|
123
|
+
"Cool Property": "Property Value",
|
|
124
|
+
$lib_version: expect.any(String),
|
|
125
|
+
mp_lib: "react-native",
|
|
126
|
+
}
|
|
127
|
+
);
|
|
80
128
|
});
|
|
81
129
|
|
|
82
130
|
test(`it calls MixpanelReactNative trackWithGroups`, async () => {
|
|
83
131
|
const mixpanel = await Mixpanel.init("token", true);
|
|
84
|
-
mixpanel.trackWithGroups(
|
|
85
|
-
|
|
132
|
+
mixpanel.trackWithGroups(
|
|
133
|
+
"tracked with groups",
|
|
134
|
+
{a: 1, b: 2.3},
|
|
135
|
+
{company_id: "Mixpanel"}
|
|
136
|
+
);
|
|
137
|
+
expect(NativeModules.MixpanelReactNative.trackWithGroups).toBeCalledWith(
|
|
138
|
+
"token",
|
|
139
|
+
"tracked with groups",
|
|
140
|
+
{a: 1, b: 2.3, $lib_version: expect.any(String), mp_lib: "react-native"},
|
|
141
|
+
{company_id: "Mixpanel"}
|
|
142
|
+
);
|
|
86
143
|
});
|
|
87
144
|
|
|
88
145
|
test(`it calls MixpanelReactNative setGroup`, async () => {
|
|
89
146
|
const mixpanel = await Mixpanel.init("token", true);
|
|
90
147
|
mixpanel.setGroup("company_id", 12345);
|
|
91
|
-
expect(NativeModules.MixpanelReactNative.setGroup).toBeCalledWith(
|
|
148
|
+
expect(NativeModules.MixpanelReactNative.setGroup).toBeCalledWith(
|
|
149
|
+
"token",
|
|
150
|
+
"company_id",
|
|
151
|
+
12345
|
|
152
|
+
);
|
|
92
153
|
});
|
|
93
154
|
|
|
94
155
|
test(`it calls MixpanelReactNative addGroup`, async () => {
|
|
95
156
|
const mixpanel = await Mixpanel.init("token", true);
|
|
96
157
|
mixpanel.addGroup("company_id", 12345);
|
|
97
|
-
expect(NativeModules.MixpanelReactNative.addGroup).toBeCalledWith(
|
|
158
|
+
expect(NativeModules.MixpanelReactNative.addGroup).toBeCalledWith(
|
|
159
|
+
"token",
|
|
160
|
+
"company_id",
|
|
161
|
+
12345
|
|
162
|
+
);
|
|
98
163
|
});
|
|
99
164
|
|
|
100
165
|
test(`it calls MixpanelReactNative removeGroup`, async () => {
|
|
101
166
|
const mixpanel = await Mixpanel.init("token", true);
|
|
102
167
|
mixpanel.removeGroup("company_id", 12345);
|
|
103
|
-
expect(NativeModules.MixpanelReactNative.removeGroup).toBeCalledWith(
|
|
168
|
+
expect(NativeModules.MixpanelReactNative.removeGroup).toBeCalledWith(
|
|
169
|
+
"token",
|
|
170
|
+
"company_id",
|
|
171
|
+
12345
|
|
172
|
+
);
|
|
104
173
|
});
|
|
105
174
|
|
|
106
175
|
test(`it calls MixpanelReactNative deleteGroup`, async () => {
|
|
107
176
|
const mixpanel = await Mixpanel.init("token", true);
|
|
108
177
|
mixpanel.deleteGroup("company_id", 12345);
|
|
109
|
-
expect(NativeModules.MixpanelReactNative.deleteGroup).toBeCalledWith(
|
|
178
|
+
expect(NativeModules.MixpanelReactNative.deleteGroup).toBeCalledWith(
|
|
179
|
+
"token",
|
|
180
|
+
"company_id",
|
|
181
|
+
12345
|
|
182
|
+
);
|
|
110
183
|
});
|
|
111
184
|
|
|
112
185
|
test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
|
|
@@ -115,7 +188,9 @@ test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
|
|
|
115
188
|
"super property": "super property value",
|
|
116
189
|
"super property1": "super property value1",
|
|
117
190
|
});
|
|
118
|
-
expect(
|
|
191
|
+
expect(
|
|
192
|
+
NativeModules.MixpanelReactNative.registerSuperProperties
|
|
193
|
+
).toBeCalledWith("token", {
|
|
119
194
|
"super property": "super property value",
|
|
120
195
|
"super property1": "super property value1",
|
|
121
196
|
});
|
|
@@ -127,7 +202,9 @@ test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
|
|
|
127
202
|
"super property": "super property value",
|
|
128
203
|
"super property1": "super property value1",
|
|
129
204
|
});
|
|
130
|
-
expect(
|
|
205
|
+
expect(
|
|
206
|
+
NativeModules.MixpanelReactNative.registerSuperProperties
|
|
207
|
+
).toBeCalledWith("token", {
|
|
131
208
|
"super property": "super property value",
|
|
132
209
|
"super property1": "super property value1",
|
|
133
210
|
});
|
|
@@ -136,31 +213,43 @@ test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
|
|
|
136
213
|
test(`it calls MixpanelReactNative unregisterSuperProperty`, async () => {
|
|
137
214
|
const mixpanel = await Mixpanel.init("token", true);
|
|
138
215
|
mixpanel.unregisterSuperProperty("super property");
|
|
139
|
-
expect(
|
|
216
|
+
expect(
|
|
217
|
+
NativeModules.MixpanelReactNative.unregisterSuperProperty
|
|
218
|
+
).toBeCalledWith("token", "super property");
|
|
140
219
|
});
|
|
141
220
|
|
|
142
221
|
test(`it calls MixpanelReactNative getSuperProperties`, async () => {
|
|
143
222
|
const mixpanel = await Mixpanel.init("token", true);
|
|
144
223
|
mixpanel.getSuperProperties();
|
|
145
|
-
expect(NativeModules.MixpanelReactNative.getSuperProperties).toBeCalledWith(
|
|
224
|
+
expect(NativeModules.MixpanelReactNative.getSuperProperties).toBeCalledWith(
|
|
225
|
+
"token"
|
|
226
|
+
);
|
|
146
227
|
});
|
|
147
228
|
|
|
148
229
|
test(`it calls MixpanelReactNative clearSuperProperties`, async () => {
|
|
149
230
|
const mixpanel = await Mixpanel.init("token", true);
|
|
150
231
|
mixpanel.clearSuperProperties();
|
|
151
|
-
expect(NativeModules.MixpanelReactNative.clearSuperProperties).toBeCalledWith(
|
|
232
|
+
expect(NativeModules.MixpanelReactNative.clearSuperProperties).toBeCalledWith(
|
|
233
|
+
"token"
|
|
234
|
+
);
|
|
152
235
|
});
|
|
153
236
|
|
|
154
237
|
test(`it calls MixpanelReactNative timeEvent`, async () => {
|
|
155
238
|
const mixpanel = await Mixpanel.init("token", true);
|
|
156
239
|
mixpanel.timeEvent("Timed Event");
|
|
157
|
-
expect(NativeModules.MixpanelReactNative.timeEvent).toBeCalledWith(
|
|
240
|
+
expect(NativeModules.MixpanelReactNative.timeEvent).toBeCalledWith(
|
|
241
|
+
"token",
|
|
242
|
+
"Timed Event"
|
|
243
|
+
);
|
|
158
244
|
});
|
|
159
245
|
|
|
160
246
|
test(`it calls MixpanelReactNative eventElapsedTime`, async () => {
|
|
161
247
|
const mixpanel = await Mixpanel.init("token", true);
|
|
162
248
|
mixpanel.eventElapsedTime("Timed Event");
|
|
163
|
-
expect(NativeModules.MixpanelReactNative.eventElapsedTime).toBeCalledWith(
|
|
249
|
+
expect(NativeModules.MixpanelReactNative.eventElapsedTime).toBeCalledWith(
|
|
250
|
+
"token",
|
|
251
|
+
"Timed Event"
|
|
252
|
+
);
|
|
164
253
|
});
|
|
165
254
|
|
|
166
255
|
test(`it calls MixpanelReactNative reset`, async () => {
|
|
@@ -172,74 +261,86 @@ test(`it calls MixpanelReactNative reset`, async () => {
|
|
|
172
261
|
test(`it calls MixpanelReactNative getDistinctId`, async () => {
|
|
173
262
|
const mixpanel = await Mixpanel.init("token", true);
|
|
174
263
|
mixpanel.getDistinctId();
|
|
175
|
-
expect(NativeModules.MixpanelReactNative.getDistinctId).toBeCalledWith(
|
|
264
|
+
expect(NativeModules.MixpanelReactNative.getDistinctId).toBeCalledWith(
|
|
265
|
+
"token"
|
|
266
|
+
);
|
|
176
267
|
});
|
|
177
268
|
|
|
178
269
|
test(`it calls MixpanelReactNative profile set`, async () => {
|
|
179
270
|
const mixpanel = await Mixpanel.init("token", true);
|
|
180
271
|
mixpanel.getPeople().set({
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
272
|
+
a: 1,
|
|
273
|
+
b: 2.3,
|
|
274
|
+
c: ["4", 5],
|
|
184
275
|
});
|
|
185
276
|
expect(NativeModules.MixpanelReactNative.set).toBeCalledWith("token", {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
277
|
+
a: 1,
|
|
278
|
+
b: 2.3,
|
|
279
|
+
c: ["4", 5],
|
|
189
280
|
});
|
|
190
281
|
// set one property
|
|
191
282
|
mixpanel.getPeople().set("a", 1);
|
|
192
|
-
expect(NativeModules.MixpanelReactNative.set).toBeCalledWith("token", {
|
|
283
|
+
expect(NativeModules.MixpanelReactNative.set).toBeCalledWith("token", {a: 1});
|
|
193
284
|
});
|
|
194
285
|
|
|
195
286
|
test(`it calls MixpanelReactNative profile setOnce`, async () => {
|
|
196
287
|
const mixpanel = await Mixpanel.init("token", true);
|
|
197
288
|
mixpanel.getPeople().setOnce({
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
289
|
+
a: 1,
|
|
290
|
+
b: 2.3,
|
|
291
|
+
c: ["4", 5],
|
|
201
292
|
});
|
|
202
293
|
expect(NativeModules.MixpanelReactNative.setOnce).toBeCalledWith("token", {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
294
|
+
a: 1,
|
|
295
|
+
b: 2.3,
|
|
296
|
+
c: ["4", 5],
|
|
206
297
|
});
|
|
207
298
|
// set one property
|
|
208
299
|
mixpanel.getPeople().setOnce("a", 1);
|
|
209
|
-
expect(NativeModules.MixpanelReactNative.setOnce).toBeCalledWith("token", {
|
|
300
|
+
expect(NativeModules.MixpanelReactNative.setOnce).toBeCalledWith("token", {
|
|
301
|
+
a: 1,
|
|
302
|
+
});
|
|
210
303
|
});
|
|
211
304
|
|
|
212
305
|
test(`it calls MixpanelReactNative profile increment`, async () => {
|
|
213
306
|
const mixpanel = await Mixpanel.init("token", true);
|
|
214
307
|
mixpanel.getPeople().increment({
|
|
215
|
-
|
|
216
|
-
|
|
308
|
+
a: 1,
|
|
309
|
+
b: 2.3,
|
|
217
310
|
});
|
|
218
311
|
expect(NativeModules.MixpanelReactNative.increment).toBeCalledWith("token", {
|
|
219
|
-
|
|
220
|
-
|
|
312
|
+
a: 1,
|
|
313
|
+
b: 2.3,
|
|
221
314
|
});
|
|
222
315
|
// set one property
|
|
223
316
|
mixpanel.getPeople().increment("a", 1);
|
|
224
|
-
expect(NativeModules.MixpanelReactNative.increment).toBeCalledWith("token", {
|
|
317
|
+
expect(NativeModules.MixpanelReactNative.increment).toBeCalledWith("token", {
|
|
318
|
+
a: 1,
|
|
319
|
+
});
|
|
225
320
|
});
|
|
226
321
|
|
|
227
322
|
test(`it calls MixpanelReactNative profile append`, async () => {
|
|
228
323
|
const mixpanel = await Mixpanel.init("token", true);
|
|
229
324
|
mixpanel.getPeople().append("a", "1");
|
|
230
|
-
expect(NativeModules.MixpanelReactNative.append).toBeCalledWith("token", {
|
|
325
|
+
expect(NativeModules.MixpanelReactNative.append).toBeCalledWith("token", {
|
|
326
|
+
a: "1",
|
|
327
|
+
});
|
|
231
328
|
});
|
|
232
329
|
|
|
233
330
|
test(`it calls MixpanelReactNative profile union`, async () => {
|
|
234
331
|
const mixpanel = await Mixpanel.init("token", true);
|
|
235
332
|
mixpanel.getPeople().union("a1", "1");
|
|
236
|
-
expect(NativeModules.MixpanelReactNative.union).toBeCalledWith("token", {
|
|
333
|
+
expect(NativeModules.MixpanelReactNative.union).toBeCalledWith("token", {
|
|
334
|
+
a1: ["1"],
|
|
335
|
+
});
|
|
237
336
|
});
|
|
238
337
|
|
|
239
338
|
test(`it calls MixpanelReactNative profile remove`, async () => {
|
|
240
339
|
const mixpanel = await Mixpanel.init("token", true);
|
|
241
340
|
mixpanel.getPeople().remove("a", "1");
|
|
242
|
-
expect(NativeModules.MixpanelReactNative.remove).toBeCalledWith("token", {
|
|
341
|
+
expect(NativeModules.MixpanelReactNative.remove).toBeCalledWith("token", {
|
|
342
|
+
a: "1",
|
|
343
|
+
});
|
|
243
344
|
});
|
|
244
345
|
|
|
245
346
|
test(`it calls MixpanelReactNative profile unset`, async () => {
|
|
@@ -251,13 +352,19 @@ test(`it calls MixpanelReactNative profile unset`, async () => {
|
|
|
251
352
|
test(`it calls MixpanelReactNative profile trackCharge`, async () => {
|
|
252
353
|
const mixpanel = await Mixpanel.init("token", true);
|
|
253
354
|
mixpanel.getPeople().trackCharge(22.8);
|
|
254
|
-
expect(NativeModules.MixpanelReactNative.trackCharge).toBeCalledWith(
|
|
355
|
+
expect(NativeModules.MixpanelReactNative.trackCharge).toBeCalledWith(
|
|
356
|
+
"token",
|
|
357
|
+
22.8,
|
|
358
|
+
{}
|
|
359
|
+
);
|
|
255
360
|
});
|
|
256
361
|
|
|
257
362
|
test(`it calls MixpanelReactNative profile clearCharges`, async () => {
|
|
258
363
|
const mixpanel = await Mixpanel.init("token", true);
|
|
259
364
|
mixpanel.getPeople().clearCharges();
|
|
260
|
-
expect(NativeModules.MixpanelReactNative.clearCharges).toBeCalledWith(
|
|
365
|
+
expect(NativeModules.MixpanelReactNative.clearCharges).toBeCalledWith(
|
|
366
|
+
"token"
|
|
367
|
+
);
|
|
261
368
|
});
|
|
262
369
|
|
|
263
370
|
test(`it calls MixpanelReactNative profile deleteUser`, async () => {
|
|
@@ -269,29 +376,42 @@ test(`it calls MixpanelReactNative profile deleteUser`, async () => {
|
|
|
269
376
|
test(`it calls MixpanelReactNative group set properties`, async () => {
|
|
270
377
|
const mixpanel = await Mixpanel.init("token", true);
|
|
271
378
|
mixpanel.getGroup("company_id", 12345).set("prop_key", "prop_value");
|
|
272
|
-
expect(
|
|
379
|
+
expect(
|
|
380
|
+
NativeModules.MixpanelReactNative.groupSetProperties
|
|
381
|
+
).toBeCalledWith("token", "company_id", 12345, {prop_key: "prop_value"});
|
|
273
382
|
});
|
|
274
383
|
|
|
275
384
|
test(`it calls MixpanelReactNative group set property once`, async () => {
|
|
276
385
|
const mixpanel = await Mixpanel.init("token", true);
|
|
277
386
|
mixpanel.getGroup("company_id", 12345).setOnce("prop_key", "prop_value");
|
|
278
|
-
expect(
|
|
387
|
+
expect(
|
|
388
|
+
NativeModules.MixpanelReactNative.groupSetPropertyOnce
|
|
389
|
+
).toBeCalledWith("token", "company_id", 12345, {prop_key: "prop_value"});
|
|
279
390
|
});
|
|
280
391
|
|
|
281
392
|
test(`it calls MixpanelReactNative group unset property`, async () => {
|
|
282
393
|
const mixpanel = await Mixpanel.init("token", true);
|
|
283
394
|
mixpanel.getGroup("company_id", 12345).unset("prop_key");
|
|
284
|
-
expect(NativeModules.MixpanelReactNative.groupUnsetProperty).toBeCalledWith(
|
|
395
|
+
expect(NativeModules.MixpanelReactNative.groupUnsetProperty).toBeCalledWith(
|
|
396
|
+
"token",
|
|
397
|
+
"company_id",
|
|
398
|
+
12345,
|
|
399
|
+
"prop_key"
|
|
400
|
+
);
|
|
285
401
|
});
|
|
286
402
|
|
|
287
403
|
test(`it calls MixpanelReactNative group remove property`, async () => {
|
|
288
404
|
const mixpanel = await Mixpanel.init("token", true);
|
|
289
405
|
mixpanel.getGroup("company_id", 12345).remove("prop_key", "334");
|
|
290
|
-
expect(
|
|
406
|
+
expect(
|
|
407
|
+
NativeModules.MixpanelReactNative.groupRemovePropertyValue
|
|
408
|
+
).toBeCalledWith("token", "company_id", 12345, "prop_key", "334");
|
|
291
409
|
});
|
|
292
410
|
|
|
293
411
|
test(`it calls MixpanelReactNative group union property`, async () => {
|
|
294
412
|
const mixpanel = await Mixpanel.init("token", true);
|
|
295
413
|
mixpanel.getGroup("company_id", 12345).union("prop_key", "334");
|
|
296
|
-
expect(
|
|
414
|
+
expect(
|
|
415
|
+
NativeModules.MixpanelReactNative.groupRemovePropertyValue
|
|
416
|
+
).toBeCalledWith("token", "company_id", 12345, "prop_key", "334");
|
|
297
417
|
});
|
|
@@ -5,7 +5,7 @@ connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
|
|
5
5
|
connection.project.dir=
|
|
6
6
|
eclipse.preferences.version=1
|
|
7
7
|
gradle.user.home=
|
|
8
|
-
java.home=/
|
|
8
|
+
java.home=/Users/zihejia/.kepler/kntools/asdf/installs/java-corretto/11.0.20.8.1
|
|
9
9
|
jvm.arguments=
|
|
10
10
|
offline.mode=false
|
|
11
11
|
override.workspace.settings=true
|
package/android/bin/build.gradle
CHANGED
|
@@ -13,6 +13,13 @@ apply plugin: 'com.android.library'
|
|
|
13
13
|
android {
|
|
14
14
|
compileSdkVersion 33
|
|
15
15
|
buildToolsVersion "30.0.3"
|
|
16
|
+
|
|
17
|
+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
18
|
+
|
|
19
|
+
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
|
|
20
|
+
namespace "com.mixpanel.reactnative"
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
defaultConfig {
|
|
17
24
|
minSdkVersion 21
|
|
18
25
|
targetSdkVersion 33
|
|
@@ -34,5 +41,5 @@ repositories {
|
|
|
34
41
|
|
|
35
42
|
dependencies {
|
|
36
43
|
implementation 'com.facebook.react:react-native:+'
|
|
37
|
-
implementation 'com.mixpanel.android:mixpanel-android:7.3.
|
|
44
|
+
implementation 'com.mixpanel.android:mixpanel-android:7.3.2'
|
|
38
45
|
}
|