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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
#
|
|
2
2
|
|
|
3
|
+
## [v2.0.1](https://github.com/mixpanel/mixpanel-react-native/tree/v2.0.1) (2022-09-12)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- update typescript and iOS bridging header [\#158](https://github.com/mixpanel/mixpanel-react-native/pull/158)
|
|
8
|
+
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
## [v2.0.0](https://github.com/mixpanel/mixpanel-react-native/tree/v2.0.0) (2022-09-09)
|
|
12
|
+
|
|
13
|
+
### BREAKING CHANGE:
|
|
14
|
+
This major release removes all remaining calls to Mixpanel's `/decide` API endpoint. The main effect of this is that the SDK no longer fetches the remote status of your [project's "Automatically collect common mobile events" setting](https://help.mixpanel.com/hc/en-us/articles/115004596186#enable-or-disable-common-mobile-events). From this version forward, automatic event tracking can only be controlled by the, now required, parameter `trackAutomaticEvents`. Upon upgrading, existing implementations will need to add this parameter to their Mixpanel initializer calls.
|
|
15
|
+
|
|
16
|
+
### Enhancements
|
|
17
|
+
|
|
18
|
+
- make trackAutomaticEvents required and bump versions to deprecate Decide [\#153](https://github.com/mixpanel/mixpanel-react-native/pull/153)
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
|
|
22
|
+
## [v1.5.0](https://github.com/mixpanel/mixpanel-react-native/tree/v1.5.0) (2022-06-24)
|
|
23
|
+
|
|
24
|
+
### Enhancements
|
|
25
|
+
|
|
26
|
+
- bump versions to get millisecond precision for event time property [\#146](https://github.com/mixpanel/mixpanel-react-native/pull/146)
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
|
|
3
30
|
## [v1.4.2](https://github.com/mixpanel/mixpanel-react-native/tree/v1.4.2) (2022-05-21)
|
|
4
31
|
|
|
5
32
|
### Enhancements
|
|
@@ -206,5 +233,11 @@ Report issues or give us any feedback is appreciated!
|
|
|
206
233
|
|
|
207
234
|
|
|
208
235
|
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
209
242
|
|
|
210
243
|
|
package/{LICENSE → LICENSE.md}
RENAMED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
Copyright 2022 Mixpanel, Inc.
|
|
2
2
|
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this work except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License below, or at:
|
|
6
|
-
|
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
See the License for the specific language governing permissions and
|
|
13
|
-
limitations under the License.
|
|
14
3
|
|
|
15
4
|
Apache License
|
|
16
5
|
Version 2.0, January 2004
|
|
17
|
-
|
|
6
|
+
https://www.apache.org/licenses/
|
|
18
7
|
|
|
19
8
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
20
9
|
|
package/README.md
CHANGED
|
@@ -55,7 +55,8 @@ To start tracking with the library you must first initialize with your project t
|
|
|
55
55
|
```js
|
|
56
56
|
import { Mixpanel } from 'mixpanel-react-native';
|
|
57
57
|
|
|
58
|
-
const
|
|
58
|
+
const trackAutomaticEvents = true;
|
|
59
|
+
const mixpanel = new Mixpanel("Your Project Token", trackAutomaticEvents);
|
|
59
60
|
mixpanel.init();
|
|
60
61
|
|
|
61
62
|
```
|
|
@@ -70,7 +71,7 @@ mixpanel.track('Plan Selected', {'Plan': 'Premium'});
|
|
|
70
71
|
```
|
|
71
72
|
In addition to event data, you can also send [user profile data](https://developer.mixpanel.com/docs/react-native#storing-user-profiles). We recommend this after completing the quickstart guide.
|
|
72
73
|
### 4. Check for Success
|
|
73
|
-
[Open up
|
|
74
|
+
[Open up Events in Mixpanel](http://mixpanel.com/report/events) to view incoming events.
|
|
74
75
|
Once data hits our API, it generally takes ~60 seconds for it to be processed, stored, and queryable in your project.
|
|
75
76
|
<a name="i-want-to-know-more"></a>
|
|
76
77
|
|
|
@@ -81,7 +82,8 @@ import React from 'react';
|
|
|
81
82
|
import { Button, SafeAreaView } from "react-native";
|
|
82
83
|
import { Mixpanel } from 'mixpanel-react-native';
|
|
83
84
|
|
|
84
|
-
const
|
|
85
|
+
const trackAutomaticEvents = true;
|
|
86
|
+
const mixpanel = new Mixpanel("Your Project Token", trackAutomaticEvents);
|
|
85
87
|
mixpanel.init();
|
|
86
88
|
|
|
87
89
|
const SampleApp = () => {
|
|
@@ -99,6 +101,7 @@ export default SampleApp;
|
|
|
99
101
|
|
|
100
102
|
```
|
|
101
103
|
|
|
104
|
+
👋 👋 Tell us about the Mixpanel developer experience! [https://www.mixpanel.com/devnps](https://www.mixpanel.com/devnps) 👍 👎
|
|
102
105
|
|
|
103
106
|
|
|
104
107
|
## FAQ
|
|
@@ -9,7 +9,8 @@ export const MixpanelProvider = ({children}) => {
|
|
|
9
9
|
const [mixpanel, setMixpanel] = React.useState(null);
|
|
10
10
|
|
|
11
11
|
React.useEffect(() => {
|
|
12
|
-
const
|
|
12
|
+
const trackAutomaticEvents = true;
|
|
13
|
+
const mixpanelInstance = new Mixpanel(`Your Project Token`, trackAutomaticEvents);
|
|
13
14
|
mixpanelInstance.init();
|
|
14
15
|
setMixpanel(mixpanelInstance);
|
|
15
16
|
}, []);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {Mixpanel} from 'mixpanel-react-native';
|
|
2
|
-
import {token as MixpanelToken} from './app.json';
|
|
2
|
+
import {token as MixpanelToken, trackAutomaticEvents} from './app.json';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export class MixpanelManager {
|
|
6
6
|
static sharedInstance = MixpanelManager.sharedInstance || new MixpanelManager();
|
|
7
7
|
|
|
8
8
|
constructor() {
|
|
9
|
-
this.mixpanel = new Mixpanel(MixpanelToken);
|
|
9
|
+
this.mixpanel = new Mixpanel(MixpanelToken, trackAutomaticEvents);
|
|
10
10
|
this.mixpanel.init();
|
|
11
11
|
this.mixpanel.setLoggingEnabled(true);
|
|
12
12
|
}
|
|
@@ -2,7 +2,8 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { Button, SafeAreaView } from "react-native";
|
|
3
3
|
import { Mixpanel } from 'mixpanel-react-native';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const trackAutomaticEvents = true;
|
|
6
|
+
const mixpanel = new Mixpanel("Your Project Token", trackAutomaticEvents);
|
|
6
7
|
mixpanel.init();
|
|
7
8
|
|
|
8
9
|
// *************************************
|
package/__tests__/index.test.js
CHANGED
|
@@ -8,103 +8,103 @@ import { NativeModules } from 'react-native';
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
test(`it calls MixpanelReactNative initialize`, async () => {
|
|
11
|
-
const mixpanel = await Mixpanel.init("token");
|
|
12
|
-
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", false, {"$lib_version": "
|
|
11
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
12
|
+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, false, {"$lib_version": "2.0.1", "mp_lib": "react-native"});
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
test(`it calls MixpanelReactNative initialize with optOut and superProperties`, async () => {
|
|
16
|
-
const mixpanel = new Mixpanel("token");
|
|
16
|
+
const mixpanel = new Mixpanel("token", true);
|
|
17
17
|
mixpanel.init(true, {"super": "property"})
|
|
18
|
-
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, {"$lib_version": "
|
|
18
|
+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, true, {"$lib_version": "2.0.1", "mp_lib": "react-native", "super": "property"});
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
test(`it calls MixpanelReactNative setServerURL`, async () => {
|
|
22
|
-
const mixpanel = await Mixpanel.init("token");
|
|
22
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
23
23
|
mixpanel.setServerURL("https://api-eu.mixpanel.com");
|
|
24
24
|
expect(NativeModules.MixpanelReactNative.setServerURL).toBeCalledWith("token", "https://api-eu.mixpanel.com");
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
test(`it calls MixpanelReactNative setLoggingEnabled`, async () => {
|
|
28
|
-
const mixpanel = await Mixpanel.init("token");
|
|
28
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
29
29
|
mixpanel.setLoggingEnabled(true);
|
|
30
30
|
expect(NativeModules.MixpanelReactNative.setLoggingEnabled).toBeCalledWith("token", true);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
test(`it calls MixpanelReactNative setUseIpAddressForGeolocation`, async () => {
|
|
34
|
-
const mixpanel = await Mixpanel.init("token");
|
|
34
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
35
35
|
mixpanel.setUseIpAddressForGeolocation(true);
|
|
36
36
|
expect(NativeModules.MixpanelReactNative.setUseIpAddressForGeolocation).toBeCalledWith("token", true);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test(`it calls MixpanelReactNative hasOptedOutTracking`, async () => {
|
|
40
|
-
const mixpanel = await Mixpanel.init("token");
|
|
40
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
41
41
|
mixpanel.hasOptedOutTracking();
|
|
42
42
|
expect(NativeModules.MixpanelReactNative.hasOptedOutTracking).toBeCalledWith("token");
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
test(`it calls MixpanelReactNative optInTracking`, async () => {
|
|
47
|
-
const mixpanel = await Mixpanel.init("token");
|
|
47
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
48
48
|
mixpanel.optInTracking();
|
|
49
49
|
expect(NativeModules.MixpanelReactNative.optInTracking).toBeCalledWith("token");
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
test(`it calls MixpanelReactNative optOutTracking`, async () => {
|
|
53
|
-
const mixpanel = await Mixpanel.init("token");
|
|
53
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
54
54
|
mixpanel.optOutTracking();
|
|
55
55
|
expect(NativeModules.MixpanelReactNative.optOutTracking).toBeCalledWith("token");
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
test(`it calls MixpanelReactNative identify`, async () => {
|
|
59
|
-
const mixpanel = await Mixpanel.init("token");
|
|
59
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
60
60
|
mixpanel.identify("distinct_id");
|
|
61
61
|
expect(NativeModules.MixpanelReactNative.identify).toBeCalledWith("token", "distinct_id");
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
test(`it calls MixpanelReactNative alias`, async () => {
|
|
65
|
-
const mixpanel = await Mixpanel.init("token");
|
|
65
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
66
66
|
mixpanel.alias("alias", "distinct_id");
|
|
67
67
|
expect(NativeModules.MixpanelReactNative.alias).toBeCalledWith("token", "alias", "distinct_id");
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
test(`it calls MixpanelReactNative track`, async () => {
|
|
71
|
-
const mixpanel = await Mixpanel.init("token");
|
|
71
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
72
72
|
mixpanel.track("event name", {"Cool Property": "Property Value"});
|
|
73
73
|
expect(NativeModules.MixpanelReactNative.track).toBeCalledWith("token", "event name", {"Cool Property": "Property Value"});
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test(`it calls MixpanelReactNative trackWithGroups`, async () => {
|
|
77
|
-
const mixpanel = await Mixpanel.init("token");
|
|
77
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
78
78
|
mixpanel.trackWithGroups("tracked with groups", {"a": 1, "b": 2.3}, {"company_id": "Mixpanel"});
|
|
79
79
|
expect(NativeModules.MixpanelReactNative.trackWithGroups).toBeCalledWith("token", "tracked with groups", {"a": 1, "b": 2.3}, {"company_id": "Mixpanel"});
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
test(`it calls MixpanelReactNative setGroup`, async () => {
|
|
83
|
-
const mixpanel = await Mixpanel.init("token");
|
|
83
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
84
84
|
mixpanel.setGroup("company_id", 12345);
|
|
85
85
|
expect(NativeModules.MixpanelReactNative.setGroup).toBeCalledWith("token", "company_id", 12345);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
test(`it calls MixpanelReactNative addGroup`, async () => {
|
|
89
|
-
const mixpanel = await Mixpanel.init("token");
|
|
89
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
90
90
|
mixpanel.addGroup("company_id", 12345);
|
|
91
91
|
expect(NativeModules.MixpanelReactNative.addGroup).toBeCalledWith("token", "company_id", 12345);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
test(`it calls MixpanelReactNative removeGroup`, async () => {
|
|
95
|
-
const mixpanel = await Mixpanel.init("token");
|
|
95
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
96
96
|
mixpanel.removeGroup("company_id", 12345);
|
|
97
97
|
expect(NativeModules.MixpanelReactNative.removeGroup).toBeCalledWith("token", "company_id", 12345);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
test(`it calls MixpanelReactNative deleteGroup`, async () => {
|
|
101
|
-
const mixpanel = await Mixpanel.init("token");
|
|
101
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
102
102
|
mixpanel.deleteGroup("company_id", 12345);
|
|
103
103
|
expect(NativeModules.MixpanelReactNative.deleteGroup).toBeCalledWith("token", "company_id", 12345);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
|
|
107
|
-
const mixpanel = await Mixpanel.init("token");
|
|
107
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
108
108
|
mixpanel.registerSuperProperties({
|
|
109
109
|
"super property": "super property value",
|
|
110
110
|
"super property1": "super property value1",
|
|
@@ -116,7 +116,7 @@ test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
|
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
|
|
119
|
-
const mixpanel = await Mixpanel.init("token");
|
|
119
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
120
120
|
mixpanel.registerSuperPropertiesOnce({
|
|
121
121
|
"super property": "super property value",
|
|
122
122
|
"super property1": "super property value1",
|
|
@@ -128,49 +128,49 @@ test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
|
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
test(`it calls MixpanelReactNative unregisterSuperProperty`, async () => {
|
|
131
|
-
const mixpanel = await Mixpanel.init("token");
|
|
131
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
132
132
|
mixpanel.unregisterSuperProperty("super property");
|
|
133
133
|
expect(NativeModules.MixpanelReactNative.unregisterSuperProperty).toBeCalledWith("token", "super property");
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
test(`it calls MixpanelReactNative getSuperProperties`, async () => {
|
|
137
|
-
const mixpanel = await Mixpanel.init("token");
|
|
137
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
138
138
|
mixpanel.getSuperProperties();
|
|
139
139
|
expect(NativeModules.MixpanelReactNative.getSuperProperties).toBeCalledWith("token");
|
|
140
140
|
});
|
|
141
141
|
|
|
142
142
|
test(`it calls MixpanelReactNative clearSuperProperties`, async () => {
|
|
143
|
-
const mixpanel = await Mixpanel.init("token");
|
|
143
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
144
144
|
mixpanel.clearSuperProperties();
|
|
145
145
|
expect(NativeModules.MixpanelReactNative.clearSuperProperties).toBeCalledWith("token");
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
test(`it calls MixpanelReactNative timeEvent`, async () => {
|
|
149
|
-
const mixpanel = await Mixpanel.init("token");
|
|
149
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
150
150
|
mixpanel.timeEvent("Timed Event");
|
|
151
151
|
expect(NativeModules.MixpanelReactNative.timeEvent).toBeCalledWith("token", "Timed Event");
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
test(`it calls MixpanelReactNative eventElapsedTime`, async () => {
|
|
155
|
-
const mixpanel = await Mixpanel.init("token");
|
|
155
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
156
156
|
mixpanel.eventElapsedTime("Timed Event");
|
|
157
157
|
expect(NativeModules.MixpanelReactNative.eventElapsedTime).toBeCalledWith("token", "Timed Event");
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
test(`it calls MixpanelReactNative reset`, async () => {
|
|
161
|
-
const mixpanel = await Mixpanel.init("token");
|
|
161
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
162
162
|
mixpanel.reset();
|
|
163
163
|
expect(NativeModules.MixpanelReactNative.reset).toBeCalledWith("token");
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
test(`it calls MixpanelReactNative getDistinctId`, async () => {
|
|
167
|
-
const mixpanel = await Mixpanel.init("token");
|
|
167
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
168
168
|
mixpanel.getDistinctId();
|
|
169
169
|
expect(NativeModules.MixpanelReactNative.getDistinctId).toBeCalledWith("token");
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
test(`it calls MixpanelReactNative profile set`, async () => {
|
|
173
|
-
const mixpanel = await Mixpanel.init("token");
|
|
173
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
174
174
|
mixpanel.getPeople().set({
|
|
175
175
|
"a": 1,
|
|
176
176
|
"b": 2.3,
|
|
@@ -187,7 +187,7 @@ test(`it calls MixpanelReactNative profile set`, async () => {
|
|
|
187
187
|
});
|
|
188
188
|
|
|
189
189
|
test(`it calls MixpanelReactNative profile setOnce`, async () => {
|
|
190
|
-
const mixpanel = await Mixpanel.init("token");
|
|
190
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
191
191
|
mixpanel.getPeople().setOnce({
|
|
192
192
|
"a": 1,
|
|
193
193
|
"b": 2.3,
|
|
@@ -204,7 +204,7 @@ test(`it calls MixpanelReactNative profile setOnce`, async () => {
|
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
test(`it calls MixpanelReactNative profile increment`, async () => {
|
|
207
|
-
const mixpanel = await Mixpanel.init("token");
|
|
207
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
208
208
|
mixpanel.getPeople().increment({
|
|
209
209
|
"a": 1,
|
|
210
210
|
"b": 2.3,
|
|
@@ -219,73 +219,73 @@ test(`it calls MixpanelReactNative profile increment`, async () => {
|
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
test(`it calls MixpanelReactNative profile append`, async () => {
|
|
222
|
-
const mixpanel = await Mixpanel.init("token");
|
|
222
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
223
223
|
mixpanel.getPeople().append("a", "1");
|
|
224
224
|
expect(NativeModules.MixpanelReactNative.append).toBeCalledWith("token", {"a": "1"});
|
|
225
225
|
});
|
|
226
226
|
|
|
227
227
|
test(`it calls MixpanelReactNative profile union`, async () => {
|
|
228
|
-
const mixpanel = await Mixpanel.init("token");
|
|
228
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
229
229
|
mixpanel.getPeople().union("a1", "1");
|
|
230
230
|
expect(NativeModules.MixpanelReactNative.union).toBeCalledWith("token", {"a1": ["1"]});
|
|
231
231
|
});
|
|
232
232
|
|
|
233
233
|
test(`it calls MixpanelReactNative profile remove`, async () => {
|
|
234
|
-
const mixpanel = await Mixpanel.init("token");
|
|
234
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
235
235
|
mixpanel.getPeople().remove("a", "1");
|
|
236
236
|
expect(NativeModules.MixpanelReactNative.remove).toBeCalledWith("token", {"a": "1"});
|
|
237
237
|
});
|
|
238
238
|
|
|
239
239
|
test(`it calls MixpanelReactNative profile unset`, async () => {
|
|
240
|
-
const mixpanel = await Mixpanel.init("token");
|
|
240
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
241
241
|
mixpanel.getPeople().unset("a");
|
|
242
242
|
expect(NativeModules.MixpanelReactNative.unset).toBeCalledWith("token", "a");
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
test(`it calls MixpanelReactNative profile trackCharge`, async () => {
|
|
246
|
-
const mixpanel = await Mixpanel.init("token");
|
|
246
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
247
247
|
mixpanel.getPeople().trackCharge(22.8);
|
|
248
248
|
expect(NativeModules.MixpanelReactNative.trackCharge).toBeCalledWith("token", 22.8, {});
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
test(`it calls MixpanelReactNative profile clearCharges`, async () => {
|
|
252
|
-
const mixpanel = await Mixpanel.init("token");
|
|
252
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
253
253
|
mixpanel.getPeople().clearCharges();
|
|
254
254
|
expect(NativeModules.MixpanelReactNative.clearCharges).toBeCalledWith("token");
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
test(`it calls MixpanelReactNative profile deleteUser`, async () => {
|
|
258
|
-
const mixpanel = await Mixpanel.init("token");
|
|
258
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
259
259
|
mixpanel.getPeople().deleteUser();
|
|
260
260
|
expect(NativeModules.MixpanelReactNative.deleteUser).toBeCalledWith("token");
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
test(`it calls MixpanelReactNative group set properties`, async () => {
|
|
264
|
-
const mixpanel = await Mixpanel.init("token");
|
|
264
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
265
265
|
mixpanel.getGroup("company_id", 12345).set("prop_key", "prop_value");
|
|
266
266
|
expect(NativeModules.MixpanelReactNative.groupSetProperties).toBeCalledWith("token", "company_id", 12345, {"prop_key": "prop_value"});
|
|
267
267
|
});
|
|
268
268
|
|
|
269
269
|
test(`it calls MixpanelReactNative group set property once`, async () => {
|
|
270
|
-
const mixpanel = await Mixpanel.init("token");
|
|
270
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
271
271
|
mixpanel.getGroup("company_id", 12345).setOnce("prop_key", "prop_value");
|
|
272
272
|
expect(NativeModules.MixpanelReactNative.groupSetPropertyOnce).toBeCalledWith("token", "company_id", 12345, {"prop_key": "prop_value"});
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
test(`it calls MixpanelReactNative group unset property`, async () => {
|
|
276
|
-
const mixpanel = await Mixpanel.init("token");
|
|
276
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
277
277
|
mixpanel.getGroup("company_id", 12345).unset("prop_key");
|
|
278
278
|
expect(NativeModules.MixpanelReactNative.groupUnsetProperty).toBeCalledWith("token", "company_id", 12345, "prop_key");
|
|
279
279
|
});
|
|
280
280
|
|
|
281
281
|
test(`it calls MixpanelReactNative group remove property`, async () => {
|
|
282
|
-
const mixpanel = await Mixpanel.init("token");
|
|
282
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
283
283
|
mixpanel.getGroup("company_id", 12345).remove("prop_key", "334");
|
|
284
284
|
expect(NativeModules.MixpanelReactNative.groupRemovePropertyValue).toBeCalledWith("token", "company_id", 12345, "prop_key", "334");
|
|
285
285
|
});
|
|
286
286
|
|
|
287
287
|
test(`it calls MixpanelReactNative group union property`, async () => {
|
|
288
|
-
const mixpanel = await Mixpanel.init("token");
|
|
288
|
+
const mixpanel = await Mixpanel.init("token", true);
|
|
289
289
|
mixpanel.getGroup("company_id", 12345).union("prop_key", "334");
|
|
290
290
|
expect(NativeModules.MixpanelReactNative.groupRemovePropertyValue).toBeCalledWith("token", "company_id", 12345, "prop_key", "334");
|
|
291
291
|
});
|
package/android/build.gradle
CHANGED