mixpanel-react-native 3.0.5 → 3.0.7
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/.github/workflows/node.js.yml +7 -7
- package/.github/workflows/release-tag.yml +21 -0
- package/CHANGELOG.md +26 -0
- package/MixpanelReactNative.podspec +1 -1
- package/Samples/SimpleMixpanel/android/build.gradle +1 -1
- package/Samples/SimpleMixpanel/package.json +1 -1
- package/__tests__/main.test.js +48 -0
- package/android/build.gradle +4 -4
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/javascript/mixpanel-main.js +16 -5
- package/package.json +1 -1
- package/Samples/SimpleMixpanel/ios/Podfile.lock +0 -1414
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
- run: npm test
|
|
28
28
|
|
|
29
29
|
test_android:
|
|
30
|
-
runs-on: macos-
|
|
30
|
+
runs-on: macos-13
|
|
31
31
|
strategy:
|
|
32
32
|
matrix:
|
|
33
33
|
node-version: [18.x]
|
|
@@ -51,18 +51,18 @@ jobs:
|
|
|
51
51
|
working-directory: ./Samples/SimpleMixpanel
|
|
52
52
|
run: yarn install
|
|
53
53
|
- name: Setup Android
|
|
54
|
-
uses: reactivecircus/android-emulator-runner@v2.
|
|
54
|
+
uses: reactivecircus/android-emulator-runner@v2.32.0
|
|
55
55
|
with:
|
|
56
|
-
api-level:
|
|
57
|
-
profile: Nexus
|
|
56
|
+
api-level: 34
|
|
57
|
+
profile: Nexus 5X
|
|
58
58
|
arch: x86_64
|
|
59
59
|
working-directory: ./Samples/SimpleMixpanel/android
|
|
60
60
|
script: ./gradlew
|
|
61
61
|
- name: Test Android
|
|
62
|
-
uses: reactivecircus/android-emulator-runner@v2.
|
|
62
|
+
uses: reactivecircus/android-emulator-runner@v2.32.0
|
|
63
63
|
with:
|
|
64
|
-
api-level:
|
|
65
|
-
profile: Nexus
|
|
64
|
+
api-level: 34
|
|
65
|
+
profile: Nexus 5X
|
|
66
66
|
arch: x86_64
|
|
67
67
|
working-directory: ./Samples/SimpleMixpanel
|
|
68
68
|
script: react-native run-android
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test_main_code:
|
|
8
|
+
runs-on: macos-latest
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
node-version: [18.x]
|
|
12
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v2
|
|
16
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
17
|
+
uses: actions/setup-node@v2
|
|
18
|
+
with:
|
|
19
|
+
node-version: ${{ matrix.node-version }}
|
|
20
|
+
- run: npm install
|
|
21
|
+
- run: npm test
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
#
|
|
2
2
|
|
|
3
|
+
## [v3.0.7](https://github.com/mixpanel/mixpanel-react-native/tree/v3.0.7) (2024-09-26)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Revert the minSDK to 21 [\#271](https://github.com/mixpanel/mixpanel-react-native/pull/271)
|
|
8
|
+
- revert android [\#267](https://github.com/mixpanel/mixpanel-react-native/pull/267)
|
|
9
|
+
|
|
10
|
+
#
|
|
11
|
+
|
|
12
|
+
## [v3.0.6](https://github.com/mixpanel/mixpanel-react-native/tree/v3.0.6) (2024-09-10)
|
|
13
|
+
|
|
14
|
+
### Enhancements
|
|
15
|
+
|
|
16
|
+
- bump iOS to 4.3.0 and Android minSDK to 23 [\#264](https://github.com/mixpanel/mixpanel-react-native/pull/264)
|
|
17
|
+
- upgrade android sdk to 7.5.3 [\#263](https://github.com/mixpanel/mixpanel-react-native/pull/263)
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- fix: opt in tracking issue during initialize [\#257](https://github.com/mixpanel/mixpanel-react-native/pull/257)
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
|
|
3
25
|
## [v3.0.5](https://github.com/mixpanel/mixpanel-react-native/tree/v3.0.5) (2024-05-14)
|
|
4
26
|
|
|
5
27
|
### Fixes
|
|
@@ -446,3 +468,7 @@ This major release removes all remaining calls to Mixpanel's `/decide` API endpo
|
|
|
446
468
|
|
|
447
469
|
|
|
448
470
|
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
package/__tests__/main.test.js
CHANGED
|
@@ -153,6 +153,54 @@ describe("MixpanelMain", () => {
|
|
|
153
153
|
).toHaveBeenCalledWith(token);
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
it("should not track if initialize with optOutTrackingDefault being true", async () => {
|
|
157
|
+
const trackAutomaticEvents = false;
|
|
158
|
+
const optOutTrackingDefault = true;
|
|
159
|
+
const superProperties = {superProp1: "value1", superProp2: "value2"};
|
|
160
|
+
const serverURL = "https://api.mixpanel.com";
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
await mixpanelMain.initialize(
|
|
164
|
+
token,
|
|
165
|
+
trackAutomaticEvents,
|
|
166
|
+
optOutTrackingDefault,
|
|
167
|
+
superProperties,
|
|
168
|
+
serverURL
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const eventName = "Test Event";
|
|
172
|
+
const eventProperties = {prop1: "value1", prop2: "value2"};
|
|
173
|
+
|
|
174
|
+
expect(
|
|
175
|
+
mixpanelMain.mixpanelPersistent.updateOptedOut
|
|
176
|
+
).toHaveBeenCalledWith(token, true);
|
|
177
|
+
|
|
178
|
+
mixpanelMain.mixpanelPersistent.getOptedOut.mockReturnValue(true);
|
|
179
|
+
await mixpanelMain.track(token, eventName, eventProperties);
|
|
180
|
+
expect(mixpanelMain.core.addToMixpanelQueue).not.toHaveBeenCalled();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("should track if initialize with optOutTrackingDefault being false", async () => {
|
|
184
|
+
const trackAutomaticEvents = false;
|
|
185
|
+
const optOutTrackingDefault = false;
|
|
186
|
+
const superProperties = {superProp1: "value1", superProp2: "value2"};
|
|
187
|
+
const serverURL = "https://api.mixpanel.com";
|
|
188
|
+
console.info("here111");
|
|
189
|
+
await mixpanelMain.initialize(
|
|
190
|
+
token,
|
|
191
|
+
trackAutomaticEvents,
|
|
192
|
+
optOutTrackingDefault,
|
|
193
|
+
superProperties,
|
|
194
|
+
serverURL
|
|
195
|
+
);
|
|
196
|
+
mixpanelMain.setLoggingEnabled(token, true);
|
|
197
|
+
const eventName = "Test Event";
|
|
198
|
+
const eventProperties = {prop1: "value1", prop2: "value2"};
|
|
199
|
+
|
|
200
|
+
await mixpanelMain.track(token, eventName, eventProperties);
|
|
201
|
+
expect(mixpanelMain.core.addToMixpanelQueue).toHaveBeenCalled();
|
|
202
|
+
});
|
|
203
|
+
|
|
156
204
|
it("register super properties should update properties", async () => {
|
|
157
205
|
mixpanelMain.registerSuperProperties(token, {superProp3: "value3"});
|
|
158
206
|
expect(
|
package/android/build.gradle
CHANGED
|
@@ -4,15 +4,15 @@ buildscript {
|
|
|
4
4
|
google()
|
|
5
5
|
}
|
|
6
6
|
dependencies {
|
|
7
|
-
classpath 'com.android.tools.build:gradle:
|
|
7
|
+
classpath 'com.android.tools.build:gradle:8.1.0'
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
apply plugin: 'com.android.library'
|
|
12
12
|
|
|
13
13
|
android {
|
|
14
|
-
compileSdkVersion
|
|
15
|
-
buildToolsVersion "
|
|
14
|
+
compileSdkVersion 34
|
|
15
|
+
buildToolsVersion "34.0.0"
|
|
16
16
|
|
|
17
17
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ android {
|
|
|
22
22
|
|
|
23
23
|
defaultConfig {
|
|
24
24
|
minSdkVersion 21
|
|
25
|
-
targetSdkVersion
|
|
25
|
+
targetSdkVersion 34
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
}
|
|
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|
|
3
3
|
distributionPath=wrapper/dists
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
|
|
@@ -30,7 +30,7 @@ export default class MixpanelMain {
|
|
|
30
30
|
await this.optOutTracking(token);
|
|
31
31
|
return;
|
|
32
32
|
} else {
|
|
33
|
-
await this.
|
|
33
|
+
await this._setOptedOutTrackingFlag(token, false);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
this.setServerURL(token, serverURL);
|
|
@@ -71,6 +71,14 @@ export default class MixpanelMain {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async track(token, eventName, properties) {
|
|
74
|
+
if (this.mixpanelPersistent.getOptedOut(token)) {
|
|
75
|
+
MixpanelLogger.log(
|
|
76
|
+
token,
|
|
77
|
+
`User has opted out of tracking, skipping tracking.`
|
|
78
|
+
);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
74
82
|
MixpanelLogger.log(
|
|
75
83
|
token,
|
|
76
84
|
`Track '${eventName}' with properties`,
|
|
@@ -133,19 +141,22 @@ export default class MixpanelMain {
|
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
async optOutTracking(token) {
|
|
136
|
-
this.
|
|
137
|
-
await this.mixpanelPersistent.persistOptedOut(token);
|
|
144
|
+
await this._setOptedOutTrackingFlag(token, true);
|
|
138
145
|
MixpanelLogger.log(token, "User has opted out of tracking");
|
|
139
146
|
await this.mixpanelPersistent.reset(token);
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
async optInTracking(token) {
|
|
143
|
-
this.
|
|
144
|
-
await this.mixpanelPersistent.persistOptedOut(token);
|
|
150
|
+
await this._setOptedOutTrackingFlag(token, false);
|
|
145
151
|
MixpanelLogger.log(token, "User has opted in to tracking");
|
|
146
152
|
await this.track(token, "$opt_in");
|
|
147
153
|
}
|
|
148
154
|
|
|
155
|
+
async _setOptedOutTrackingFlag(token, optedOut) {
|
|
156
|
+
this.mixpanelPersistent.updateOptedOut(token, optedOut);
|
|
157
|
+
await this.mixpanelPersistent.persistOptedOut(token);
|
|
158
|
+
}
|
|
159
|
+
|
|
149
160
|
hasOptedOutTracking(token) {
|
|
150
161
|
return this.mixpanelPersistent.getOptOut(token);
|
|
151
162
|
}
|