mixpanel-react-native 2.2.3 → 2.2.5
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 +20 -0
- package/MixpanelReactNative.podspec +1 -1
- package/__tests__/index.test.js +2 -2
- package/android/build.gradle +1 -1
- package/ios/AutomaticProperties.swift +1 -1
- package/ios/MixpanelReactNative.swift +6 -4
- package/ios/MixpanelTypeHandler.swift +1 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
#
|
|
2
2
|
|
|
3
|
+
## [v2.2.5](https://github.com/mixpanel/mixpanel-react-native/tree/v2.2.5) (2023-04-29)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Remove semaphores, copy properties, use .merging, don't includeLibInfo in init [\#191](https://github.com/mixpanel/mixpanel-react-native/pull/191)
|
|
8
|
+
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
## [v2.2.4](https://github.com/mixpanel/mixpanel-react-native/tree/v2.2.4) (2023-04-25)
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
- use semaphore to prevent concurrent access to properties object [\#188](https://github.com/mixpanel/mixpanel-react-native/pull/188)
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
|
|
3
19
|
## [v2.2.3](https://github.com/mixpanel/mixpanel-react-native/tree/v2.2.3) (2023-04-17)
|
|
4
20
|
|
|
5
21
|
### Fixes
|
|
@@ -278,6 +294,10 @@ Report issues or give us any feedback is appreciated!
|
|
|
278
294
|
|
|
279
295
|
|
|
280
296
|
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
281
301
|
|
|
282
302
|
|
|
283
303
|
|
package/__tests__/index.test.js
CHANGED
|
@@ -9,13 +9,13 @@ import { NativeModules } from 'react-native';
|
|
|
9
9
|
|
|
10
10
|
test(`it calls MixpanelReactNative initialize`, async () => {
|
|
11
11
|
const mixpanel = await Mixpanel.init("token", true);
|
|
12
|
-
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, false, {"$lib_version": "2.2.
|
|
12
|
+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, false, {"$lib_version": "2.2.5", "mp_lib": "react-native"});
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
test(`it calls MixpanelReactNative initialize with optOut and superProperties`, async () => {
|
|
16
16
|
const mixpanel = new Mixpanel("token", true);
|
|
17
17
|
mixpanel.init(true, {"super": "property"})
|
|
18
|
-
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, true, {"$lib_version": "2.2.
|
|
18
|
+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, true, {"$lib_version": "2.2.5", "mp_lib": "react-native", "super": "property"}, "https://api.mixpanel.com");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
test(`it calls MixpanelReactNative setServerURL`, async () => {
|
package/android/build.gradle
CHANGED
|
@@ -5,7 +5,7 @@ class AutomaticProperties {
|
|
|
5
5
|
static var peopleProperties: Dictionary<String, MixpanelType> = [:];
|
|
6
6
|
|
|
7
7
|
static func setAutomaticProperties(_ properties: [String: Any]) {
|
|
8
|
-
for (key,value) in properties
|
|
8
|
+
for (key,value) in properties {
|
|
9
9
|
peopleProperties[key] = MixpanelTypeHandler.mixpanelTypeValue(value)
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -19,10 +19,12 @@ open class MixpanelReactNative: NSObject {
|
|
|
19
19
|
serverURL: String,
|
|
20
20
|
resolver resolve: RCTPromiseResolveBlock,
|
|
21
21
|
rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
22
|
-
|
|
22
|
+
let autoProps = properties // copy
|
|
23
|
+
AutomaticProperties.setAutomaticProperties(autoProps)
|
|
24
|
+
let propsProcessed = MixpanelTypeHandler.processProperties(properties: properties)
|
|
23
25
|
Mixpanel.initialize(token: token, trackAutomaticEvents: trackAutomaticEvents, flushInterval: Constants.DEFAULT_FLUSH_INTERVAL,
|
|
24
26
|
instanceName: token, optOutTrackingByDefault: optOutTrackingByDefault,
|
|
25
|
-
superProperties:
|
|
27
|
+
superProperties: propsProcessed,
|
|
26
28
|
serverURL: serverURL)
|
|
27
29
|
resolve(true)
|
|
28
30
|
}
|
|
@@ -101,7 +103,7 @@ open class MixpanelReactNative: NSObject {
|
|
|
101
103
|
resolver resolve: RCTPromiseResolveBlock,
|
|
102
104
|
rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
103
105
|
let instance = MixpanelReactNative.getMixpanelInstance(token)
|
|
104
|
-
let mpProperties = MixpanelTypeHandler.processProperties(properties: properties
|
|
106
|
+
let mpProperties = MixpanelTypeHandler.processProperties(properties: properties)
|
|
105
107
|
instance?.track(event: event, properties: mpProperties)
|
|
106
108
|
resolve(nil)
|
|
107
109
|
}
|
|
@@ -318,7 +320,7 @@ open class MixpanelReactNative: NSObject {
|
|
|
318
320
|
resolver resolve: RCTPromiseResolveBlock,
|
|
319
321
|
rejecter reject: RCTPromiseRejectBlock) -> Void {
|
|
320
322
|
let instance = MixpanelReactNative.getMixpanelInstance(token)
|
|
321
|
-
let mpProperties = MixpanelTypeHandler.processProperties(properties: properties
|
|
323
|
+
let mpProperties = MixpanelTypeHandler.processProperties(properties: properties)
|
|
322
324
|
var mpGroups = Dictionary<String, MixpanelType>()
|
|
323
325
|
for (key,value) in groups ?? [:] {
|
|
324
326
|
mpGroups[key] = MixpanelTypeHandler.mixpanelTypeValue(value)
|
|
@@ -78,16 +78,8 @@
|
|
|
78
78
|
mpProperties[key] = mixpanelTypeValue(value)
|
|
79
79
|
}
|
|
80
80
|
if (includeLibInfo) {
|
|
81
|
-
mpProperties.
|
|
81
|
+
return mpProperties.merging(AutomaticProperties.peopleProperties) { (_, new) in new }
|
|
82
82
|
}
|
|
83
83
|
return mpProperties
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
extension Dictionary {
|
|
88
|
-
mutating func merge(dict: [Key: Value]){
|
|
89
|
-
for (k, v) in dict {
|
|
90
|
-
updateValue(v, forKey: k)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|