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 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
 
@@ -19,5 +19,5 @@ Pod::Spec.new do |s|
19
19
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
20
20
 
21
21
  s.dependency "React-Core"
22
- s.dependency "Mixpanel-swift", '4.1.0'
22
+ s.dependency "Mixpanel-swift", '4.1.1'
23
23
  end
@@ -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.3", "mp_lib": "react-native"});
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.3", "mp_lib": "react-native", "super": "property"}, "https://api.mixpanel.com");
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 () => {
@@ -34,5 +34,5 @@ repositories {
34
34
 
35
35
  dependencies {
36
36
  implementation 'com.facebook.react:react-native:+'
37
- implementation 'com.mixpanel.android:mixpanel-android:7.3.0'
37
+ implementation 'com.mixpanel.android:mixpanel-android:7.3.1'
38
38
  }
@@ -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
- AutomaticProperties.setAutomaticProperties(properties)
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: MixpanelTypeHandler.processProperties(properties: properties, includeLibInfo: true),
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, includeLibInfo: true)
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, includeLibInfo: true)
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.merge(dict: AutomaticProperties.peopleProperties)
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
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-react-native",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Official React Native Tracking Library for Mixpanel Analytics",
5
5
  "main": "index.js",
6
6
  "scripts": {