mixpanel-react-native 2.3.1 → 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 +10 -0
- package/MixpanelReactNative.podspec +1 -1
- package/Samples/ContextAPIMixpanel/Analytics.js +0 -6
- package/__tests__/index.test.js +186 -60
- package/__tests__/jest_setup.js +1 -0
- package/android/bin/.gradle/5.5/executionHistory/executionHistory.lock +0 -0
- package/android/bin/.gradle/5.5/fileChanges/last-build.bin +0 -0
- package/android/bin/.gradle/5.5/fileHashes/fileHashes.bin +0 -0
- package/android/bin/.gradle/5.5/fileHashes/fileHashes.lock +0 -0
- package/android/bin/.gradle/5.5/gc.properties +0 -0
- package/android/bin/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/bin/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/bin/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/bin/.gradle/vcs-1/gc.properties +0 -0
- package/android/bin/.idea/caches/build_file_checksums.ser +0 -0
- package/android/bin/.idea/compiler.xml +6 -0
- package/android/bin/.idea/gradle.xml +21 -0
- package/android/bin/.idea/jarRepositories.xml +30 -0
- package/android/bin/.idea/libraries/Gradle__com_android_support_appcompat_v7_23_0_1_aar.xml +16 -0
- package/android/bin/.idea/libraries/Gradle__com_android_support_recyclerview_v7_23_0_1_aar.xml +13 -0
- package/android/bin/.idea/libraries/Gradle__com_android_support_support_annotations_23_0_1.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_android_support_support_v4_23_0_1_aar.xml +17 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_drawee_0_8_1_aar.xml +13 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_fbcore_0_8_1_aar.xml +13 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_fresco_0_8_1_aar.xml +13 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_0_8_1_aar.xml +13 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp_0_8_1_aar.xml +13 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_react_react_native_0_20_1_aar.xml +17 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_2_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_facebook_stetho_stetho_okhttp_1_2_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_2_3.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_mixpanel_android_mixpanel_android_6_0_0_beta1_aar.xml +16 -0
- package/android/bin/.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_parse_bolts_bolts_android_1_1_4.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_5_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_ws_2_5_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__com_squareup_okio_okio_1_6_0.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml +11 -0
- package/android/bin/.idea/libraries/Gradle__org_webkit_android_jsc_r174650_aar.xml +11 -0
- package/android/bin/.idea/misc.xml +9 -0
- package/android/bin/.idea/modules.xml +8 -0
- package/android/bin/.idea/vcs.xml +6 -0
- package/android/bin/.idea/workspace.xml +57 -0
- package/android/bin/.project +34 -0
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/bin/build.gradle +45 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/android/bin/gradlew +172 -0
- package/android/bin/gradlew.bat +84 -0
- package/android/bin/local.properties +8 -0
- package/android/bin/src/main/AndroidManifest.xml +2 -0
- package/android/build.gradle +8 -1
- package/android/src/main/java/com/mixpanel/reactnative/MixpanelReactNativeModule.java +15 -1
- package/docs/Mixpanel.html +164 -25
- package/docs/MixpanelGroup.html +7 -7
- package/docs/People.html +12 -12
- package/docs/index.html +1 -1
- package/docs/index.js.html +14 -1
- package/index.d.ts +1 -1
- package/index.js +896 -820
- package/ios/MixpanelReactNative.m +2 -0
- package/ios/MixpanelReactNative.swift +10 -0
- package/package.json +56 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
#
|
|
2
2
|
|
|
3
|
+
## [v2.3.1](https://github.com/mixpanel/mixpanel-react-native/tree/v2.3.1) (2023-06-20)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- fix typo in the identify function resolve [\#205](https://github.com/mixpanel/mixpanel-react-native/pull/205)
|
|
8
|
+
|
|
9
|
+
#
|
|
10
|
+
|
|
3
11
|
## [v2.3.0](https://github.com/mixpanel/mixpanel-react-native/tree/v2.3.0) (2023-06-16)
|
|
4
12
|
|
|
5
13
|
### Enhancements
|
|
@@ -323,6 +331,8 @@ Report issues or give us any feedback is appreciated!
|
|
|
323
331
|
|
|
324
332
|
|
|
325
333
|
|
|
334
|
+
|
|
335
|
+
|
|
326
336
|
|
|
327
337
|
|
|
328
338
|
|
|
@@ -12,12 +12,6 @@ export const MixpanelProvider = ({children}) => {
|
|
|
12
12
|
const trackAutomaticEvents = true;
|
|
13
13
|
const mixpanelInstance = new Mixpanel(`Your Project Token`, trackAutomaticEvents);
|
|
14
14
|
mixpanelInstance.init();
|
|
15
|
-
mixpanelInstance.identify('Unique User ID').then(() => {
|
|
16
|
-
mixpanelInstance.getDistinctId().then(distinctId => {
|
|
17
|
-
console.log(`DistinctId is ${ distinctId }`);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
15
|
setMixpanel(mixpanelInstance);
|
|
22
16
|
}, []);
|
|
23
17
|
|
package/__tests__/index.test.js
CHANGED
|
@@ -2,105 +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);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test(`it calls MixpanelReactNative setFlushBatchSize`, async () => {
|
|
63
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
64
|
+
mixpanel.setFlushBatchSize(20);
|
|
65
|
+
expect(NativeModules.MixpanelReactNative.setFlushBatchSize).toBeCalledWith(
|
|
66
|
+
"token",
|
|
67
|
+
20
|
|
68
|
+
);
|
|
37
69
|
});
|
|
38
70
|
|
|
39
71
|
test(`it calls MixpanelReactNative hasOptedOutTracking`, async () => {
|
|
40
72
|
const mixpanel = await Mixpanel.init("token", true);
|
|
41
73
|
mixpanel.hasOptedOutTracking();
|
|
42
|
-
expect(NativeModules.MixpanelReactNative.hasOptedOutTracking).toBeCalledWith(
|
|
74
|
+
expect(NativeModules.MixpanelReactNative.hasOptedOutTracking).toBeCalledWith(
|
|
75
|
+
"token"
|
|
76
|
+
);
|
|
43
77
|
});
|
|
44
78
|
|
|
45
|
-
|
|
46
79
|
test(`it calls MixpanelReactNative optInTracking`, async () => {
|
|
47
80
|
const mixpanel = await Mixpanel.init("token", true);
|
|
48
81
|
mixpanel.optInTracking();
|
|
49
|
-
expect(NativeModules.MixpanelReactNative.optInTracking).toBeCalledWith(
|
|
82
|
+
expect(NativeModules.MixpanelReactNative.optInTracking).toBeCalledWith(
|
|
83
|
+
"token"
|
|
84
|
+
);
|
|
50
85
|
});
|
|
51
86
|
|
|
52
87
|
test(`it calls MixpanelReactNative optOutTracking`, async () => {
|
|
53
88
|
const mixpanel = await Mixpanel.init("token", true);
|
|
54
89
|
mixpanel.optOutTracking();
|
|
55
|
-
expect(NativeModules.MixpanelReactNative.optOutTracking).toBeCalledWith(
|
|
90
|
+
expect(NativeModules.MixpanelReactNative.optOutTracking).toBeCalledWith(
|
|
91
|
+
"token"
|
|
92
|
+
);
|
|
56
93
|
});
|
|
57
94
|
|
|
58
95
|
test(`it calls MixpanelReactNative identify`, async () => {
|
|
59
96
|
const mixpanel = await Mixpanel.init("token", true);
|
|
60
97
|
mixpanel.identify("distinct_id");
|
|
61
|
-
expect(NativeModules.MixpanelReactNative.identify).toBeCalledWith(
|
|
98
|
+
expect(NativeModules.MixpanelReactNative.identify).toBeCalledWith(
|
|
99
|
+
"token",
|
|
100
|
+
"distinct_id"
|
|
101
|
+
);
|
|
62
102
|
});
|
|
63
103
|
|
|
64
104
|
test(`it calls MixpanelReactNative alias`, async () => {
|
|
65
105
|
const mixpanel = await Mixpanel.init("token", true);
|
|
66
106
|
mixpanel.alias("alias", "distinct_id");
|
|
67
|
-
expect(NativeModules.MixpanelReactNative.alias).toBeCalledWith(
|
|
107
|
+
expect(NativeModules.MixpanelReactNative.alias).toBeCalledWith(
|
|
108
|
+
"token",
|
|
109
|
+
"alias",
|
|
110
|
+
"distinct_id"
|
|
111
|
+
);
|
|
68
112
|
});
|
|
69
113
|
|
|
70
114
|
test(`it calls MixpanelReactNative track`, async () => {
|
|
71
115
|
const mixpanel = await Mixpanel.init("token", true);
|
|
72
|
-
mixpanel.track("event name",
|
|
73
|
-
|
|
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
|
+
);
|
|
74
128
|
});
|
|
75
129
|
|
|
76
130
|
test(`it calls MixpanelReactNative trackWithGroups`, async () => {
|
|
77
131
|
const mixpanel = await Mixpanel.init("token", true);
|
|
78
|
-
mixpanel.trackWithGroups(
|
|
79
|
-
|
|
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
|
+
);
|
|
80
143
|
});
|
|
81
144
|
|
|
82
145
|
test(`it calls MixpanelReactNative setGroup`, async () => {
|
|
83
146
|
const mixpanel = await Mixpanel.init("token", true);
|
|
84
147
|
mixpanel.setGroup("company_id", 12345);
|
|
85
|
-
expect(NativeModules.MixpanelReactNative.setGroup).toBeCalledWith(
|
|
148
|
+
expect(NativeModules.MixpanelReactNative.setGroup).toBeCalledWith(
|
|
149
|
+
"token",
|
|
150
|
+
"company_id",
|
|
151
|
+
12345
|
|
152
|
+
);
|
|
86
153
|
});
|
|
87
154
|
|
|
88
155
|
test(`it calls MixpanelReactNative addGroup`, async () => {
|
|
89
156
|
const mixpanel = await Mixpanel.init("token", true);
|
|
90
157
|
mixpanel.addGroup("company_id", 12345);
|
|
91
|
-
expect(NativeModules.MixpanelReactNative.addGroup).toBeCalledWith(
|
|
158
|
+
expect(NativeModules.MixpanelReactNative.addGroup).toBeCalledWith(
|
|
159
|
+
"token",
|
|
160
|
+
"company_id",
|
|
161
|
+
12345
|
|
162
|
+
);
|
|
92
163
|
});
|
|
93
164
|
|
|
94
165
|
test(`it calls MixpanelReactNative removeGroup`, async () => {
|
|
95
166
|
const mixpanel = await Mixpanel.init("token", true);
|
|
96
167
|
mixpanel.removeGroup("company_id", 12345);
|
|
97
|
-
expect(NativeModules.MixpanelReactNative.removeGroup).toBeCalledWith(
|
|
168
|
+
expect(NativeModules.MixpanelReactNative.removeGroup).toBeCalledWith(
|
|
169
|
+
"token",
|
|
170
|
+
"company_id",
|
|
171
|
+
12345
|
|
172
|
+
);
|
|
98
173
|
});
|
|
99
174
|
|
|
100
175
|
test(`it calls MixpanelReactNative deleteGroup`, async () => {
|
|
101
176
|
const mixpanel = await Mixpanel.init("token", true);
|
|
102
177
|
mixpanel.deleteGroup("company_id", 12345);
|
|
103
|
-
expect(NativeModules.MixpanelReactNative.deleteGroup).toBeCalledWith(
|
|
178
|
+
expect(NativeModules.MixpanelReactNative.deleteGroup).toBeCalledWith(
|
|
179
|
+
"token",
|
|
180
|
+
"company_id",
|
|
181
|
+
12345
|
|
182
|
+
);
|
|
104
183
|
});
|
|
105
184
|
|
|
106
185
|
test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
|
|
@@ -109,7 +188,9 @@ test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
|
|
|
109
188
|
"super property": "super property value",
|
|
110
189
|
"super property1": "super property value1",
|
|
111
190
|
});
|
|
112
|
-
expect(
|
|
191
|
+
expect(
|
|
192
|
+
NativeModules.MixpanelReactNative.registerSuperProperties
|
|
193
|
+
).toBeCalledWith("token", {
|
|
113
194
|
"super property": "super property value",
|
|
114
195
|
"super property1": "super property value1",
|
|
115
196
|
});
|
|
@@ -121,7 +202,9 @@ test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
|
|
|
121
202
|
"super property": "super property value",
|
|
122
203
|
"super property1": "super property value1",
|
|
123
204
|
});
|
|
124
|
-
expect(
|
|
205
|
+
expect(
|
|
206
|
+
NativeModules.MixpanelReactNative.registerSuperProperties
|
|
207
|
+
).toBeCalledWith("token", {
|
|
125
208
|
"super property": "super property value",
|
|
126
209
|
"super property1": "super property value1",
|
|
127
210
|
});
|
|
@@ -130,31 +213,43 @@ test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
|
|
|
130
213
|
test(`it calls MixpanelReactNative unregisterSuperProperty`, async () => {
|
|
131
214
|
const mixpanel = await Mixpanel.init("token", true);
|
|
132
215
|
mixpanel.unregisterSuperProperty("super property");
|
|
133
|
-
expect(
|
|
216
|
+
expect(
|
|
217
|
+
NativeModules.MixpanelReactNative.unregisterSuperProperty
|
|
218
|
+
).toBeCalledWith("token", "super property");
|
|
134
219
|
});
|
|
135
220
|
|
|
136
221
|
test(`it calls MixpanelReactNative getSuperProperties`, async () => {
|
|
137
222
|
const mixpanel = await Mixpanel.init("token", true);
|
|
138
223
|
mixpanel.getSuperProperties();
|
|
139
|
-
expect(NativeModules.MixpanelReactNative.getSuperProperties).toBeCalledWith(
|
|
224
|
+
expect(NativeModules.MixpanelReactNative.getSuperProperties).toBeCalledWith(
|
|
225
|
+
"token"
|
|
226
|
+
);
|
|
140
227
|
});
|
|
141
228
|
|
|
142
229
|
test(`it calls MixpanelReactNative clearSuperProperties`, async () => {
|
|
143
230
|
const mixpanel = await Mixpanel.init("token", true);
|
|
144
231
|
mixpanel.clearSuperProperties();
|
|
145
|
-
expect(NativeModules.MixpanelReactNative.clearSuperProperties).toBeCalledWith(
|
|
232
|
+
expect(NativeModules.MixpanelReactNative.clearSuperProperties).toBeCalledWith(
|
|
233
|
+
"token"
|
|
234
|
+
);
|
|
146
235
|
});
|
|
147
236
|
|
|
148
237
|
test(`it calls MixpanelReactNative timeEvent`, async () => {
|
|
149
238
|
const mixpanel = await Mixpanel.init("token", true);
|
|
150
239
|
mixpanel.timeEvent("Timed Event");
|
|
151
|
-
expect(NativeModules.MixpanelReactNative.timeEvent).toBeCalledWith(
|
|
240
|
+
expect(NativeModules.MixpanelReactNative.timeEvent).toBeCalledWith(
|
|
241
|
+
"token",
|
|
242
|
+
"Timed Event"
|
|
243
|
+
);
|
|
152
244
|
});
|
|
153
245
|
|
|
154
246
|
test(`it calls MixpanelReactNative eventElapsedTime`, async () => {
|
|
155
247
|
const mixpanel = await Mixpanel.init("token", true);
|
|
156
248
|
mixpanel.eventElapsedTime("Timed Event");
|
|
157
|
-
expect(NativeModules.MixpanelReactNative.eventElapsedTime).toBeCalledWith(
|
|
249
|
+
expect(NativeModules.MixpanelReactNative.eventElapsedTime).toBeCalledWith(
|
|
250
|
+
"token",
|
|
251
|
+
"Timed Event"
|
|
252
|
+
);
|
|
158
253
|
});
|
|
159
254
|
|
|
160
255
|
test(`it calls MixpanelReactNative reset`, async () => {
|
|
@@ -166,74 +261,86 @@ test(`it calls MixpanelReactNative reset`, async () => {
|
|
|
166
261
|
test(`it calls MixpanelReactNative getDistinctId`, async () => {
|
|
167
262
|
const mixpanel = await Mixpanel.init("token", true);
|
|
168
263
|
mixpanel.getDistinctId();
|
|
169
|
-
expect(NativeModules.MixpanelReactNative.getDistinctId).toBeCalledWith(
|
|
264
|
+
expect(NativeModules.MixpanelReactNative.getDistinctId).toBeCalledWith(
|
|
265
|
+
"token"
|
|
266
|
+
);
|
|
170
267
|
});
|
|
171
268
|
|
|
172
269
|
test(`it calls MixpanelReactNative profile set`, async () => {
|
|
173
270
|
const mixpanel = await Mixpanel.init("token", true);
|
|
174
271
|
mixpanel.getPeople().set({
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
272
|
+
a: 1,
|
|
273
|
+
b: 2.3,
|
|
274
|
+
c: ["4", 5],
|
|
178
275
|
});
|
|
179
276
|
expect(NativeModules.MixpanelReactNative.set).toBeCalledWith("token", {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
277
|
+
a: 1,
|
|
278
|
+
b: 2.3,
|
|
279
|
+
c: ["4", 5],
|
|
183
280
|
});
|
|
184
281
|
// set one property
|
|
185
282
|
mixpanel.getPeople().set("a", 1);
|
|
186
|
-
expect(NativeModules.MixpanelReactNative.set).toBeCalledWith("token", {
|
|
283
|
+
expect(NativeModules.MixpanelReactNative.set).toBeCalledWith("token", {a: 1});
|
|
187
284
|
});
|
|
188
285
|
|
|
189
286
|
test(`it calls MixpanelReactNative profile setOnce`, async () => {
|
|
190
287
|
const mixpanel = await Mixpanel.init("token", true);
|
|
191
288
|
mixpanel.getPeople().setOnce({
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
289
|
+
a: 1,
|
|
290
|
+
b: 2.3,
|
|
291
|
+
c: ["4", 5],
|
|
195
292
|
});
|
|
196
293
|
expect(NativeModules.MixpanelReactNative.setOnce).toBeCalledWith("token", {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
294
|
+
a: 1,
|
|
295
|
+
b: 2.3,
|
|
296
|
+
c: ["4", 5],
|
|
200
297
|
});
|
|
201
298
|
// set one property
|
|
202
299
|
mixpanel.getPeople().setOnce("a", 1);
|
|
203
|
-
expect(NativeModules.MixpanelReactNative.setOnce).toBeCalledWith("token", {
|
|
300
|
+
expect(NativeModules.MixpanelReactNative.setOnce).toBeCalledWith("token", {
|
|
301
|
+
a: 1,
|
|
302
|
+
});
|
|
204
303
|
});
|
|
205
304
|
|
|
206
305
|
test(`it calls MixpanelReactNative profile increment`, async () => {
|
|
207
306
|
const mixpanel = await Mixpanel.init("token", true);
|
|
208
307
|
mixpanel.getPeople().increment({
|
|
209
|
-
|
|
210
|
-
|
|
308
|
+
a: 1,
|
|
309
|
+
b: 2.3,
|
|
211
310
|
});
|
|
212
311
|
expect(NativeModules.MixpanelReactNative.increment).toBeCalledWith("token", {
|
|
213
|
-
|
|
214
|
-
|
|
312
|
+
a: 1,
|
|
313
|
+
b: 2.3,
|
|
215
314
|
});
|
|
216
315
|
// set one property
|
|
217
316
|
mixpanel.getPeople().increment("a", 1);
|
|
218
|
-
expect(NativeModules.MixpanelReactNative.increment).toBeCalledWith("token", {
|
|
317
|
+
expect(NativeModules.MixpanelReactNative.increment).toBeCalledWith("token", {
|
|
318
|
+
a: 1,
|
|
319
|
+
});
|
|
219
320
|
});
|
|
220
321
|
|
|
221
322
|
test(`it calls MixpanelReactNative profile append`, async () => {
|
|
222
323
|
const mixpanel = await Mixpanel.init("token", true);
|
|
223
324
|
mixpanel.getPeople().append("a", "1");
|
|
224
|
-
expect(NativeModules.MixpanelReactNative.append).toBeCalledWith("token", {
|
|
325
|
+
expect(NativeModules.MixpanelReactNative.append).toBeCalledWith("token", {
|
|
326
|
+
a: "1",
|
|
327
|
+
});
|
|
225
328
|
});
|
|
226
329
|
|
|
227
330
|
test(`it calls MixpanelReactNative profile union`, async () => {
|
|
228
331
|
const mixpanel = await Mixpanel.init("token", true);
|
|
229
332
|
mixpanel.getPeople().union("a1", "1");
|
|
230
|
-
expect(NativeModules.MixpanelReactNative.union).toBeCalledWith("token", {
|
|
333
|
+
expect(NativeModules.MixpanelReactNative.union).toBeCalledWith("token", {
|
|
334
|
+
a1: ["1"],
|
|
335
|
+
});
|
|
231
336
|
});
|
|
232
337
|
|
|
233
338
|
test(`it calls MixpanelReactNative profile remove`, async () => {
|
|
234
339
|
const mixpanel = await Mixpanel.init("token", true);
|
|
235
340
|
mixpanel.getPeople().remove("a", "1");
|
|
236
|
-
expect(NativeModules.MixpanelReactNative.remove).toBeCalledWith("token", {
|
|
341
|
+
expect(NativeModules.MixpanelReactNative.remove).toBeCalledWith("token", {
|
|
342
|
+
a: "1",
|
|
343
|
+
});
|
|
237
344
|
});
|
|
238
345
|
|
|
239
346
|
test(`it calls MixpanelReactNative profile unset`, async () => {
|
|
@@ -245,13 +352,19 @@ test(`it calls MixpanelReactNative profile unset`, async () => {
|
|
|
245
352
|
test(`it calls MixpanelReactNative profile trackCharge`, async () => {
|
|
246
353
|
const mixpanel = await Mixpanel.init("token", true);
|
|
247
354
|
mixpanel.getPeople().trackCharge(22.8);
|
|
248
|
-
expect(NativeModules.MixpanelReactNative.trackCharge).toBeCalledWith(
|
|
355
|
+
expect(NativeModules.MixpanelReactNative.trackCharge).toBeCalledWith(
|
|
356
|
+
"token",
|
|
357
|
+
22.8,
|
|
358
|
+
{}
|
|
359
|
+
);
|
|
249
360
|
});
|
|
250
361
|
|
|
251
362
|
test(`it calls MixpanelReactNative profile clearCharges`, async () => {
|
|
252
363
|
const mixpanel = await Mixpanel.init("token", true);
|
|
253
364
|
mixpanel.getPeople().clearCharges();
|
|
254
|
-
expect(NativeModules.MixpanelReactNative.clearCharges).toBeCalledWith(
|
|
365
|
+
expect(NativeModules.MixpanelReactNative.clearCharges).toBeCalledWith(
|
|
366
|
+
"token"
|
|
367
|
+
);
|
|
255
368
|
});
|
|
256
369
|
|
|
257
370
|
test(`it calls MixpanelReactNative profile deleteUser`, async () => {
|
|
@@ -263,29 +376,42 @@ test(`it calls MixpanelReactNative profile deleteUser`, async () => {
|
|
|
263
376
|
test(`it calls MixpanelReactNative group set properties`, async () => {
|
|
264
377
|
const mixpanel = await Mixpanel.init("token", true);
|
|
265
378
|
mixpanel.getGroup("company_id", 12345).set("prop_key", "prop_value");
|
|
266
|
-
expect(
|
|
379
|
+
expect(
|
|
380
|
+
NativeModules.MixpanelReactNative.groupSetProperties
|
|
381
|
+
).toBeCalledWith("token", "company_id", 12345, {prop_key: "prop_value"});
|
|
267
382
|
});
|
|
268
383
|
|
|
269
384
|
test(`it calls MixpanelReactNative group set property once`, async () => {
|
|
270
385
|
const mixpanel = await Mixpanel.init("token", true);
|
|
271
386
|
mixpanel.getGroup("company_id", 12345).setOnce("prop_key", "prop_value");
|
|
272
|
-
expect(
|
|
387
|
+
expect(
|
|
388
|
+
NativeModules.MixpanelReactNative.groupSetPropertyOnce
|
|
389
|
+
).toBeCalledWith("token", "company_id", 12345, {prop_key: "prop_value"});
|
|
273
390
|
});
|
|
274
391
|
|
|
275
392
|
test(`it calls MixpanelReactNative group unset property`, async () => {
|
|
276
393
|
const mixpanel = await Mixpanel.init("token", true);
|
|
277
394
|
mixpanel.getGroup("company_id", 12345).unset("prop_key");
|
|
278
|
-
expect(NativeModules.MixpanelReactNative.groupUnsetProperty).toBeCalledWith(
|
|
395
|
+
expect(NativeModules.MixpanelReactNative.groupUnsetProperty).toBeCalledWith(
|
|
396
|
+
"token",
|
|
397
|
+
"company_id",
|
|
398
|
+
12345,
|
|
399
|
+
"prop_key"
|
|
400
|
+
);
|
|
279
401
|
});
|
|
280
402
|
|
|
281
403
|
test(`it calls MixpanelReactNative group remove property`, async () => {
|
|
282
404
|
const mixpanel = await Mixpanel.init("token", true);
|
|
283
405
|
mixpanel.getGroup("company_id", 12345).remove("prop_key", "334");
|
|
284
|
-
expect(
|
|
406
|
+
expect(
|
|
407
|
+
NativeModules.MixpanelReactNative.groupRemovePropertyValue
|
|
408
|
+
).toBeCalledWith("token", "company_id", 12345, "prop_key", "334");
|
|
285
409
|
});
|
|
286
410
|
|
|
287
411
|
test(`it calls MixpanelReactNative group union property`, async () => {
|
|
288
412
|
const mixpanel = await Mixpanel.init("token", true);
|
|
289
413
|
mixpanel.getGroup("company_id", 12345).union("prop_key", "334");
|
|
290
|
-
expect(
|
|
414
|
+
expect(
|
|
415
|
+
NativeModules.MixpanelReactNative.groupRemovePropertyValue
|
|
416
|
+
).toBeCalledWith("token", "company_id", 12345, "prop_key", "334");
|
|
291
417
|
});
|
package/__tests__/jest_setup.js
CHANGED
|
@@ -22,6 +22,7 @@ jest.doMock('react-native', () => {
|
|
|
22
22
|
setLoggingEnabled: jest.fn(),
|
|
23
23
|
setFlushOnBackground: jest.fn(),
|
|
24
24
|
setUseIpAddressForGeolocation: jest.fn(),
|
|
25
|
+
setFlushBatchSize: jest.fn(),
|
|
25
26
|
hasOptedOutTracking: jest.fn(),
|
|
26
27
|
optInTracking: jest.fn(),
|
|
27
28
|
optOutTracking: jest.fn(),
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
+
<component name="GradleSettings">
|
|
5
|
+
<option name="linkedExternalProjectsSettings">
|
|
6
|
+
<GradleProjectSettings>
|
|
7
|
+
<option name="testRunner" value="PLATFORM" />
|
|
8
|
+
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
+
<option name="gradleJvm" value="1.8" />
|
|
11
|
+
<option name="modules">
|
|
12
|
+
<set>
|
|
13
|
+
<option value="$PROJECT_DIR$" />
|
|
14
|
+
</set>
|
|
15
|
+
</option>
|
|
16
|
+
<option name="resolveModulePerSourceSet" value="false" />
|
|
17
|
+
<option name="useQualifiedModuleNames" value="true" />
|
|
18
|
+
</GradleProjectSettings>
|
|
19
|
+
</option>
|
|
20
|
+
</component>
|
|
21
|
+
</project>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="RemoteRepositoriesConfiguration">
|
|
4
|
+
<remote-repository>
|
|
5
|
+
<option name="id" value="central" />
|
|
6
|
+
<option name="name" value="Maven Central repository" />
|
|
7
|
+
<option name="url" value="https://repo1.maven.org/maven2" />
|
|
8
|
+
</remote-repository>
|
|
9
|
+
<remote-repository>
|
|
10
|
+
<option name="id" value="jboss.community" />
|
|
11
|
+
<option name="name" value="JBoss Community repository" />
|
|
12
|
+
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
|
13
|
+
</remote-repository>
|
|
14
|
+
<remote-repository>
|
|
15
|
+
<option name="id" value="Google" />
|
|
16
|
+
<option name="name" value="Google" />
|
|
17
|
+
<option name="url" value="https://maven.google.com/" />
|
|
18
|
+
</remote-repository>
|
|
19
|
+
<remote-repository>
|
|
20
|
+
<option name="id" value="BintrayJCenter" />
|
|
21
|
+
<option name="name" value="BintrayJCenter" />
|
|
22
|
+
<option name="url" value="https://jcenter.bintray.com/" />
|
|
23
|
+
</remote-repository>
|
|
24
|
+
<remote-repository>
|
|
25
|
+
<option name="id" value="MavenRepo" />
|
|
26
|
+
<option name="name" value="MavenRepo" />
|
|
27
|
+
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
|
28
|
+
</remote-repository>
|
|
29
|
+
</component>
|
|
30
|
+
</project>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<component name="libraryTable">
|
|
2
|
+
<library name="Gradle: com.android.support:appcompat-v7:23.0.1@aar">
|
|
3
|
+
<ANNOTATIONS>
|
|
4
|
+
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/96a8d2edc92089ad2712d9fca5fc6eef/annotations.zip!/" />
|
|
5
|
+
</ANNOTATIONS>
|
|
6
|
+
<CLASSES>
|
|
7
|
+
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/96a8d2edc92089ad2712d9fca5fc6eef/jars/classes.jar!/" />
|
|
8
|
+
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/96a8d2edc92089ad2712d9fca5fc6eef/res" />
|
|
9
|
+
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/96a8d2edc92089ad2712d9fca5fc6eef/AndroidManifest.xml" />
|
|
10
|
+
</CLASSES>
|
|
11
|
+
<JAVADOC />
|
|
12
|
+
<SOURCES>
|
|
13
|
+
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.support/appcompat-v7/23.0.1/787ec3e10ff774b1906e4b58c4985077a95ec944/appcompat-v7-23.0.1-sources.jar!/" />
|
|
14
|
+
</SOURCES>
|
|
15
|
+
</library>
|
|
16
|
+
</component>
|
package/android/bin/.idea/libraries/Gradle__com_android_support_recyclerview_v7_23_0_1_aar.xml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<component name="libraryTable">
|
|
2
|
+
<library name="Gradle: com.android.support:recyclerview-v7:23.0.1@aar">
|
|
3
|
+
<CLASSES>
|
|
4
|
+
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/35451fa6fcb922c2ca666cc6da2ef6ca/jars/classes.jar!/" />
|
|
5
|
+
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/35451fa6fcb922c2ca666cc6da2ef6ca/res" />
|
|
6
|
+
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/35451fa6fcb922c2ca666cc6da2ef6ca/AndroidManifest.xml" />
|
|
7
|
+
</CLASSES>
|
|
8
|
+
<JAVADOC />
|
|
9
|
+
<SOURCES>
|
|
10
|
+
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.support/recyclerview-v7/23.0.1/266b4883a1ee9001baa81f40dd4f98f8f4be9430/recyclerview-v7-23.0.1-sources.jar!/" />
|
|
11
|
+
</SOURCES>
|
|
12
|
+
</library>
|
|
13
|
+
</component>
|
package/android/bin/.idea/libraries/Gradle__com_android_support_support_annotations_23_0_1.xml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<component name="libraryTable">
|
|
2
|
+
<library name="Gradle: com.android.support:support-annotations:23.0.1">
|
|
3
|
+
<CLASSES>
|
|
4
|
+
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.support/support-annotations/23.0.1/1fce89a6428c51467090d7f424e4c9c3dbd55f7e/support-annotations-23.0.1.jar!/" />
|
|
5
|
+
</CLASSES>
|
|
6
|
+
<JAVADOC />
|
|
7
|
+
<SOURCES>
|
|
8
|
+
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.support/support-annotations/23.0.1/fb3328451a24e73a766989bd3b211db817351eb4/support-annotations-23.0.1-sources.jar!/" />
|
|
9
|
+
</SOURCES>
|
|
10
|
+
</library>
|
|
11
|
+
</component>
|