@snowplow/react-native-tracker 1.0.0 → 1.2.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.
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // RNConfigUtils.m
3
3
  //
4
- // Copyright (c) 2021 Snowplow Analytics Ltd. All rights reserved.
4
+ // Copyright (c) 2021-2022 Snowplow Analytics Ltd. All rights reserved.
5
5
  //
6
6
  // This program is licensed to you under the Apache License Version 2.0,
7
7
  // and you may not use this file except in compliance with the Apache License
@@ -14,18 +14,18 @@
14
14
  // express or implied. See the Apache License Version 2.0 for the specific
15
15
  // language governing permissions and limitations there under.
16
16
  //
17
- // Copyright: Copyright (c) 2021 Snowplow Analytics Ltd
17
+ // Copyright: Copyright (c) 2022 Snowplow Analytics Ltd
18
18
  // License: Apache License Version 2.0
19
19
  //
20
20
 
21
21
  #import "RNConfigUtils.h"
22
22
  #import "RNTrackerVersion.h"
23
23
  #import "RNUtilities.h"
24
+ #import "NSDictionary+RNSP_TypeMethods.h"
24
25
 
25
26
  #import <Foundation/Foundation.h>
26
27
 
27
28
  #import <SnowplowTracker/SPSnowplow.h>
28
- #import <SnowplowTracker/NSDictionary+SP_TypeMethods.h>
29
29
  #import <SnowplowTracker/SPTrackerConfiguration.h>
30
30
  #import <SnowplowTracker/SPDevicePlatform.h>
31
31
  #import <SnowplowTracker/SPLoggerDelegate.h>
@@ -41,42 +41,43 @@
41
41
  SPTrackerConfiguration *trackerConfiguration = [SPTrackerConfiguration new];
42
42
  trackerConfiguration.trackerVersionSuffix = kRNTrackerVersion;
43
43
 
44
- NSString *appId = [trackerConfig sp_stringForKey:@"appId" defaultValue:nil];
44
+ NSString *appId = [trackerConfig rnsp_stringForKey:@"appId" defaultValue:nil];
45
45
  if (appId) {
46
46
  trackerConfiguration.appId = appId;
47
47
  }
48
48
 
49
- NSString *devicePlatform = [trackerConfig sp_stringForKey:@"devicePlatform" defaultValue:nil];
49
+ NSString *devicePlatform = [trackerConfig rnsp_stringForKey:@"devicePlatform" defaultValue:nil];
50
50
  if (devicePlatform) {
51
51
  trackerConfiguration.devicePlatform = SPStringToDevicePlatform(devicePlatform);
52
52
  }
53
53
 
54
- trackerConfiguration.base64Encoding = [trackerConfig sp_boolForKey:@"base64Encoding" defaultValue:YES];
54
+ trackerConfiguration.base64Encoding = [trackerConfig rnsp_boolForKey:@"base64Encoding" defaultValue:YES];
55
55
 
56
- NSString *logLevel = [trackerConfig sp_stringForKey:@"logLevel" defaultValue:nil];
56
+ NSString *logLevel = [trackerConfig rnsp_stringForKey:@"logLevel" defaultValue:nil];
57
57
  if (logLevel) {
58
58
  NSUInteger index = [@[@"off", @"error", @"debug", @"verbose"] indexOfObject:logLevel];
59
59
  trackerConfiguration.logLevel = index != NSNotFound ? index : SPLogLevelOff;
60
60
  }
61
61
 
62
- trackerConfiguration.sessionContext = [trackerConfig sp_boolForKey:@"sessionContext" defaultValue:YES];
63
- trackerConfiguration.applicationContext = [trackerConfig sp_boolForKey:@"applicationContext" defaultValue:YES];
64
- trackerConfiguration.platformContext = [trackerConfig sp_boolForKey:@"platformContext" defaultValue:YES];
65
- trackerConfiguration.geoLocationContext = [trackerConfig sp_boolForKey:@"geoLocationContext" defaultValue:NO];
66
- trackerConfiguration.screenContext = [trackerConfig sp_boolForKey:@"screenContext" defaultValue:YES];
67
- trackerConfiguration.screenViewAutotracking = [trackerConfig sp_boolForKey:@"screenViewAutotracking" defaultValue:YES];
68
- trackerConfiguration.lifecycleAutotracking = [trackerConfig sp_boolForKey:@"lifecycleAutotracking" defaultValue:NO];
69
- trackerConfiguration.installAutotracking = [trackerConfig sp_boolForKey:@"installAutotracking" defaultValue:YES];
70
- trackerConfiguration.exceptionAutotracking = [trackerConfig sp_boolForKey:@"exceptionAutotracking" defaultValue:YES];
71
- trackerConfiguration.diagnosticAutotracking = [trackerConfig sp_boolForKey:@"diagnosticAutotracking" defaultValue:NO];
62
+ trackerConfiguration.sessionContext = [trackerConfig rnsp_boolForKey:@"sessionContext" defaultValue:YES];
63
+ trackerConfiguration.applicationContext = [trackerConfig rnsp_boolForKey:@"applicationContext" defaultValue:YES];
64
+ trackerConfiguration.platformContext = [trackerConfig rnsp_boolForKey:@"platformContext" defaultValue:YES];
65
+ trackerConfiguration.geoLocationContext = [trackerConfig rnsp_boolForKey:@"geoLocationContext" defaultValue:NO];
66
+ trackerConfiguration.screenContext = [trackerConfig rnsp_boolForKey:@"screenContext" defaultValue:YES];
67
+ trackerConfiguration.deepLinkContext = [trackerConfig rnsp_boolForKey:@"deepLinkContext" defaultValue:YES];
68
+ trackerConfiguration.screenViewAutotracking = [trackerConfig rnsp_boolForKey:@"screenViewAutotracking" defaultValue:YES];
69
+ trackerConfiguration.lifecycleAutotracking = [trackerConfig rnsp_boolForKey:@"lifecycleAutotracking" defaultValue:NO];
70
+ trackerConfiguration.installAutotracking = [trackerConfig rnsp_boolForKey:@"installAutotracking" defaultValue:YES];
71
+ trackerConfiguration.exceptionAutotracking = [trackerConfig rnsp_boolForKey:@"exceptionAutotracking" defaultValue:YES];
72
+ trackerConfiguration.diagnosticAutotracking = [trackerConfig rnsp_boolForKey:@"diagnosticAutotracking" defaultValue:NO];
72
73
 
73
74
  return trackerConfiguration;
74
75
  }
75
76
 
76
77
  + (SPSessionConfiguration *) mkSessionConfig:(NSDictionary *) sessionConfig {
77
78
 
78
- NSInteger foreground = [[sessionConfig sp_numberForKey:@"foregroundTimeout" defaultValue:@1800] integerValue];
79
- NSInteger background = [[sessionConfig sp_numberForKey:@"backgroundTimeout" defaultValue:@1800] integerValue];
79
+ NSInteger foreground = [[sessionConfig rnsp_numberForKey:@"foregroundTimeout" defaultValue:@1800] integerValue];
80
+ NSInteger background = [[sessionConfig rnsp_numberForKey:@"backgroundTimeout" defaultValue:@1800] integerValue];
80
81
  SPSessionConfiguration *sessionConfiguration = [[SPSessionConfiguration alloc] initWithForegroundTimeoutInSeconds:foreground backgroundTimeoutInSeconds:background];
81
82
 
82
83
  return sessionConfiguration;
@@ -84,7 +85,7 @@
84
85
 
85
86
  + (SPEmitterConfiguration *) mkEmitterConfig:(NSDictionary *) emitterConfig {
86
87
  SPEmitterConfiguration *emitterConfiguration = [[SPEmitterConfiguration alloc] init];
87
- NSString *bufferOption = [emitterConfig sp_stringForKey:@"bufferOption" defaultValue:@"single"];
88
+ NSString *bufferOption = [emitterConfig rnsp_stringForKey:@"bufferOption" defaultValue:@"single"];
88
89
  if ([bufferOption isEqualToString:@"default"]) {
89
90
  emitterConfiguration.bufferOption = SPBufferOptionDefaultGroup;
90
91
  } else if ([bufferOption isEqualToString:@"large"]) {
@@ -93,10 +94,10 @@
93
94
  emitterConfiguration.bufferOption = SPBufferOptionSingle;
94
95
  }
95
96
 
96
- emitterConfiguration.emitRange = [[emitterConfig sp_numberForKey:@"emitRange" defaultValue:@150] integerValue];
97
- emitterConfiguration.threadPoolSize = [[emitterConfig sp_numberForKey:@"threadPoolSize" defaultValue:@15] integerValue];
98
- emitterConfiguration.byteLimitGet = [[emitterConfig sp_numberForKey:@"byteLimitGet" defaultValue:@40000] integerValue];
99
- emitterConfiguration.byteLimitPost = [[emitterConfig sp_numberForKey:@"byteLimitPost" defaultValue:@40000] integerValue];
97
+ emitterConfiguration.emitRange = [[emitterConfig rnsp_numberForKey:@"emitRange" defaultValue:@150] integerValue];
98
+ emitterConfiguration.threadPoolSize = [[emitterConfig rnsp_numberForKey:@"threadPoolSize" defaultValue:@15] integerValue];
99
+ emitterConfiguration.byteLimitGet = [[emitterConfig rnsp_numberForKey:@"byteLimitGet" defaultValue:@40000] integerValue];
100
+ emitterConfiguration.byteLimitPost = [[emitterConfig rnsp_numberForKey:@"byteLimitPost" defaultValue:@40000] integerValue];
100
101
 
101
102
  return emitterConfiguration;
102
103
  }
@@ -105,37 +106,37 @@
105
106
 
106
107
  SPSubjectConfiguration *subjectConfiguration = [SPSubjectConfiguration new];
107
108
 
108
- NSString *userId = [subjectConfig sp_stringForKey:@"userId" defaultValue:nil];
109
+ NSString *userId = [subjectConfig rnsp_stringForKey:@"userId" defaultValue:nil];
109
110
  if (userId) {
110
111
  subjectConfiguration.userId = userId;
111
112
  }
112
113
 
113
- NSString *networkUserId = [subjectConfig sp_stringForKey:@"networkUserId" defaultValue:nil];
114
+ NSString *networkUserId = [subjectConfig rnsp_stringForKey:@"networkUserId" defaultValue:nil];
114
115
  if (networkUserId) {
115
116
  subjectConfiguration.networkUserId = networkUserId;
116
117
  }
117
118
 
118
- NSString *domainUserId = [subjectConfig sp_stringForKey:@"domainUserId" defaultValue:nil];
119
+ NSString *domainUserId = [subjectConfig rnsp_stringForKey:@"domainUserId" defaultValue:nil];
119
120
  if (domainUserId) {
120
121
  subjectConfiguration.domainUserId = domainUserId;
121
122
  }
122
123
 
123
- NSString *useragent = [subjectConfig sp_stringForKey:@"useragent" defaultValue:nil];
124
+ NSString *useragent = [subjectConfig rnsp_stringForKey:@"useragent" defaultValue:nil];
124
125
  if (useragent) {
125
126
  subjectConfiguration.useragent = useragent;
126
127
  }
127
128
 
128
- NSString *ipAddress = [subjectConfig sp_stringForKey:@"ipAddress" defaultValue:nil];
129
+ NSString *ipAddress = [subjectConfig rnsp_stringForKey:@"ipAddress" defaultValue:nil];
129
130
  if (ipAddress) {
130
131
  subjectConfiguration.ipAddress = ipAddress;
131
132
  }
132
133
 
133
- NSString *timezone = [subjectConfig sp_stringForKey:@"timezone" defaultValue:nil];
134
+ NSString *timezone = [subjectConfig rnsp_stringForKey:@"timezone" defaultValue:nil];
134
135
  if (timezone) {
135
136
  subjectConfiguration.timezone = timezone;
136
137
  }
137
138
 
138
- NSString *language = [subjectConfig sp_stringForKey:@"language" defaultValue:nil];
139
+ NSString *language = [subjectConfig rnsp_stringForKey:@"language" defaultValue:nil];
139
140
  if (language) {
140
141
  subjectConfiguration.language = language;
141
142
  }
@@ -159,7 +160,7 @@
159
160
  }
160
161
 
161
162
  // colorDepth
162
- NSNumber *colorDepth = [subjectConfig sp_numberForKey:@"colorDepth" defaultValue: nil];
163
+ NSNumber *colorDepth = [subjectConfig rnsp_numberForKey:@"colorDepth" defaultValue: nil];
163
164
  if (colorDepth != nil) {
164
165
  subjectConfiguration.colorDepth = colorDepth;
165
166
  }
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // RNTrackerVersion.h
3
3
  //
4
- // Copyright (c) 2021 Snowplow Analytics Ltd. All rights reserved.
4
+ // Copyright (c) 2021-2022 Snowplow Analytics Ltd. All rights reserved.
5
5
  //
6
6
  // This program is licensed to you under the Apache License Version 2.0,
7
7
  // and you may not use this file except in compliance with the Apache License
@@ -14,7 +14,7 @@
14
14
  // express or implied. See the Apache License Version 2.0 for the specific
15
15
  // language governing permissions and limitations there under.
16
16
  //
17
- // Copyright: Copyright (c) 2021 Snowplow Analytics Ltd
17
+ // Copyright: Copyright (c) 2022 Snowplow Analytics Ltd
18
18
  // License: Apache License Version 2.0
19
19
  //
20
20
 
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // RNTrackerVersion.m
3
3
  //
4
- // Copyright (c) 2021 Snowplow Analytics Ltd. All rights reserved.
4
+ // Copyright (c) 2021-2022 Snowplow Analytics Ltd. All rights reserved.
5
5
  //
6
6
  // This program is licensed to you under the Apache License Version 2.0,
7
7
  // and you may not use this file except in compliance with the Apache License
@@ -14,7 +14,7 @@
14
14
  // express or implied. See the Apache License Version 2.0 for the specific
15
15
  // language governing permissions and limitations there under.
16
16
  //
17
- // Copyright: Copyright (c) 2021 Snowplow Analytics Ltd
17
+ // Copyright: Copyright (c) 2022 Snowplow Analytics Ltd
18
18
  // License: Apache License Version 2.0
19
19
  //
20
20
 
@@ -22,6 +22,6 @@
22
22
 
23
23
  @implementation RNTrackerVersion
24
24
 
25
- NSString * const kRNTrackerVersion = @"rn-1.0.0";
25
+ NSString * const kRNTrackerVersion = @"rn-1.2.1";
26
26
 
27
27
  @end
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // RNUtilities.h
3
3
  //
4
- // Copyright (c) 2021 Snowplow Analytics Ltd. All rights reserved.
4
+ // Copyright (c) 2021-2022 Snowplow Analytics Ltd. All rights reserved.
5
5
  //
6
6
  // This program is licensed to you under the Apache License Version 2.0,
7
7
  // and you may not use this file except in compliance with the Apache License
@@ -14,7 +14,7 @@
14
14
  // express or implied. See the Apache License Version 2.0 for the specific
15
15
  // language governing permissions and limitations there under.
16
16
  //
17
- // Copyright: Copyright (c) 2021 Snowplow Analytics Ltd
17
+ // Copyright: Copyright (c) 2022 Snowplow Analytics Ltd
18
18
  // License: Apache License Version 2.0
19
19
  //
20
20
 
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // RNUtilities.m
3
3
  //
4
- // Copyright (c) 2021 Snowplow Analytics Ltd. All rights reserved.
4
+ // Copyright (c) 2021-2022 Snowplow Analytics Ltd. All rights reserved.
5
5
  //
6
6
  // This program is licensed to you under the Apache License Version 2.0,
7
7
  // and you may not use this file except in compliance with the Apache License
@@ -14,7 +14,7 @@
14
14
  // express or implied. See the Apache License Version 2.0 for the specific
15
15
  // language governing permissions and limitations there under.
16
16
  //
17
- // Copyright: Copyright (c) 2021 Snowplow Analytics Ltd
17
+ // Copyright: Copyright (c) 2022 Snowplow Analytics Ltd
18
18
  // License: Apache License Version 2.0
19
19
  //
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowplow/react-native-tracker",
3
- "version": "1.0.0",
3
+ "version": "1.2.1",
4
4
  "description": "A library for tracking Snowplow events in React Native",
5
5
  "homepage": "https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/react-native-tracker/",
6
6
  "main": "dist/index.js",
@@ -30,7 +30,8 @@
30
30
  "James Munro",
31
31
  "Max Bondarenko",
32
32
  "Paul Boocock",
33
- "Ada Tzereme"
33
+ "Ada Tzereme",
34
+ "Matus Tomlein"
34
35
  ],
35
36
  "license": "Apache-2.0",
36
37
  "repository": {
@@ -39,24 +40,24 @@
39
40
  },
40
41
  "peerDependencies": {
41
42
  "react": ">=16.8.6",
42
- "react-native": ">=0.59.8"
43
+ "react-native": ">=0.65.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@types/jest": "^26.0.24",
46
- "@types/react": "^17.0.15",
47
- "@types/react-native": "^0.64.12",
48
- "@typescript-eslint/eslint-plugin": "^4.29.0",
49
- "@typescript-eslint/parser": "^4.29.0",
50
- "eslint": "^7.32.0",
51
- "eslint-plugin-jest": "^24.4.0",
52
- "eslint-plugin-promise": "^5.1.0",
53
- "jest": "^27.0.6",
46
+ "@types/jest": "^27.4.1",
47
+ "@types/react": "^16.8.25",
48
+ "@types/react-native": "^0.65.21",
49
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
50
+ "@typescript-eslint/parser": "^5.13.0",
51
+ "eslint": "^8.10.0",
52
+ "eslint-plugin-jest": "^26.1.1",
53
+ "eslint-plugin-promise": "^6.0.0",
54
+ "jest": "^27.5.1",
54
55
  "rimraf": "^3.0.2",
55
- "rollup": "^2.56.0",
56
- "rollup-plugin-dts": "^3.0.2",
56
+ "rollup": "^2.69.0",
57
+ "rollup-plugin-dts": "^4.2.0",
57
58
  "rollup-plugin-sourcemaps": "^0.6.3",
58
- "ts-jest": "^27.0.4",
59
- "typescript": "^4.3.5"
59
+ "ts-jest": "^27.1.3",
60
+ "typescript": "^4.6.2"
60
61
  },
61
62
  "jest": {
62
63
  "testEnvironment": "node",