@snowplow/react-native-tracker 1.4.0 → 2.0.0

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.
Files changed (239) hide show
  1. package/.editorconfig +15 -0
  2. package/.eslintignore +6 -0
  3. package/.gitattributes +3 -0
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. package/.github/actions/setup/action.yml +28 -0
  7. package/.github/workflows/build.yml +150 -0
  8. package/.github/workflows/deploy.yml +98 -0
  9. package/.github/workflows/e2e-android.yml +121 -0
  10. package/.github/workflows/e2e-ios.yml +90 -0
  11. package/.github/workflows/snyk.yml +21 -0
  12. package/.gitignore +70 -0
  13. package/.npmignore +60 -0
  14. package/.nvmrc +1 -0
  15. package/.watchmanconfig +1 -0
  16. package/.yarnrc +3 -0
  17. package/CHANGELOG +166 -0
  18. package/CONTRIBUTING.md +80 -0
  19. package/README.md +23 -110
  20. package/android/build.gradle +93 -37
  21. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  22. package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
  23. package/android/gradle.properties +5 -2
  24. package/android/gradlew +172 -110
  25. package/android/gradlew.bat +24 -19
  26. package/android/src/main/AndroidManifest.xml +1 -3
  27. package/android/src/main/AndroidManifestNew.xml +2 -0
  28. package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +704 -0
  29. package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +17 -0
  30. package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +271 -0
  31. package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +213 -0
  32. package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +5 -0
  33. package/babel.config.js +3 -0
  34. package/example/.watchmanconfig +1 -0
  35. package/example/Gemfile +6 -0
  36. package/example/android/app/build.gradle +129 -0
  37. package/example/android/app/debug.keystore +0 -0
  38. package/example/android/app/proguard-rules.pro +10 -0
  39. package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +36 -0
  40. package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +21 -0
  41. package/example/android/app/src/debug/AndroidManifest.xml +13 -0
  42. package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +75 -0
  43. package/example/android/app/src/main/AndroidManifest.xml +26 -0
  44. package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +32 -0
  45. package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +62 -0
  46. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  47. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  48. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  49. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  50. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  51. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  52. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  53. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  54. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  55. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  56. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  57. package/example/android/app/src/main/res/values/strings.xml +3 -0
  58. package/example/android/app/src/main/res/values/styles.xml +9 -0
  59. package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +20 -0
  60. package/example/android/build.gradle +31 -0
  61. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  62. package/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  63. package/example/android/gradle.properties +44 -0
  64. package/example/android/gradlew +244 -0
  65. package/example/android/gradlew.bat +92 -0
  66. package/example/android/settings.gradle +4 -0
  67. package/example/app.json +4 -0
  68. package/example/babel.config.js +17 -0
  69. package/example/detox.config.js +92 -0
  70. package/example/e2e/config.json +10 -0
  71. package/example/e2e/emitEvents.e2e.detox.js +108 -0
  72. package/example/e2e/environment.js +23 -0
  73. package/example/e2e/helpers/microCommands.js +153 -0
  74. package/example/e2e/helpers/microHelpers.js +346 -0
  75. package/example/e2e/helpers/microHelpers.test.js +308 -0
  76. package/example/e2e/helpers/schemas.js +62 -0
  77. package/example/e2e/jest.config.js +16 -0
  78. package/example/e2e/setup.js +4 -0
  79. package/example/e2e/testEvents.micro.test.js +300 -0
  80. package/example/index.js +5 -0
  81. package/example/ios/.xcode.env +11 -0
  82. package/example/ios/Podfile +64 -0
  83. package/example/ios/Podfile.lock +737 -0
  84. package/example/ios/ReactNativeTrackerExample/AppDelegate.h +6 -0
  85. package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +26 -0
  86. package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  87. package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +6 -0
  88. package/example/ios/ReactNativeTrackerExample/Info.plist +55 -0
  89. package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +47 -0
  90. package/example/ios/ReactNativeTrackerExample/main.m +10 -0
  91. package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +3 -0
  92. package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +722 -0
  93. package/{ios/RNSnowplowTracker.xcodeproj/xcshareddata/xcschemes/RNSnowplowTracker.xcscheme → example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme} +29 -21
  94. package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +10 -0
  95. package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  96. package/example/ios/ReactNativeTrackerExampleTests/Info.plist +24 -0
  97. package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +66 -0
  98. package/example/metro.config.js +45 -0
  99. package/example/package.json +54 -0
  100. package/example/react-native.config.js +10 -0
  101. package/example/src/App.js +557 -0
  102. package/example/tsconfig.json +5 -0
  103. package/example/yarn.lock +7379 -0
  104. package/ios/ReactNativeTracker-Bridging-Header.h +2 -0
  105. package/ios/ReactNativeTracker.mm +165 -0
  106. package/ios/ReactNativeTracker.swift +757 -0
  107. package/ios/{RNSnowplowTracker.xcodeproj → ReactNativeTracker.xcodeproj}/project.pbxproj +55 -79
  108. package/ios/Util/ConfigUtils.swift +206 -0
  109. package/ios/Util/TrackerVersion.swift +3 -0
  110. package/ios/Util/Utilities.swift +37 -0
  111. package/lefthook.yml +11 -0
  112. package/lib/commonjs/api.js +475 -0
  113. package/lib/commonjs/api.js.map +1 -0
  114. package/lib/commonjs/configurations.js +209 -0
  115. package/lib/commonjs/configurations.js.map +1 -0
  116. package/lib/commonjs/constants.js +85 -0
  117. package/lib/commonjs/constants.js.map +1 -0
  118. package/lib/commonjs/events.js +256 -0
  119. package/lib/commonjs/events.js.map +1 -0
  120. package/lib/commonjs/index.js +141 -0
  121. package/lib/commonjs/index.js.map +1 -0
  122. package/lib/commonjs/jsCore.js +393 -0
  123. package/lib/commonjs/jsCore.js.map +1 -0
  124. package/lib/commonjs/native.js +29 -0
  125. package/lib/commonjs/native.js.map +1 -0
  126. package/lib/commonjs/subject.js +248 -0
  127. package/lib/commonjs/subject.js.map +1 -0
  128. package/lib/commonjs/tracker.js +221 -0
  129. package/lib/commonjs/tracker.js.map +1 -0
  130. package/lib/commonjs/types.js +2 -0
  131. package/lib/commonjs/types.js.map +1 -0
  132. package/lib/commonjs/utils.js +85 -0
  133. package/lib/commonjs/utils.js.map +1 -0
  134. package/lib/commonjs/webViewInterface.js +79 -0
  135. package/lib/commonjs/webViewInterface.js.map +1 -0
  136. package/lib/module/api.js +439 -0
  137. package/lib/module/api.js.map +1 -0
  138. package/lib/module/configurations.js +197 -0
  139. package/lib/module/configurations.js.map +1 -0
  140. package/lib/module/constants.js +80 -0
  141. package/lib/module/constants.js.map +1 -0
  142. package/lib/module/events.js +240 -0
  143. package/lib/module/events.js.map +1 -0
  144. package/lib/module/index.js +129 -0
  145. package/lib/module/index.js.map +1 -0
  146. package/lib/module/jsCore.js +390 -0
  147. package/lib/module/jsCore.js.map +1 -0
  148. package/lib/module/native.js +25 -0
  149. package/lib/module/native.js.map +1 -0
  150. package/lib/module/subject.js +235 -0
  151. package/lib/module/subject.js.map +1 -0
  152. package/lib/module/tracker.js +209 -0
  153. package/lib/module/tracker.js.map +1 -0
  154. package/lib/module/types.js +2 -0
  155. package/lib/module/types.js.map +1 -0
  156. package/lib/module/utils.js +79 -0
  157. package/lib/module/utils.js.map +1 -0
  158. package/lib/module/webViewInterface.js +75 -0
  159. package/lib/module/webViewInterface.js.map +1 -0
  160. package/lib/typescript/__tests__/api.test.d.ts +2 -0
  161. package/lib/typescript/__tests__/api.test.d.ts.map +1 -0
  162. package/lib/typescript/__tests__/configurations.test.d.ts +2 -0
  163. package/lib/typescript/__tests__/configurations.test.d.ts.map +1 -0
  164. package/lib/typescript/__tests__/events.test.d.ts +2 -0
  165. package/lib/typescript/__tests__/events.test.d.ts.map +1 -0
  166. package/lib/typescript/__tests__/index.test.d.ts +2 -0
  167. package/lib/typescript/__tests__/index.test.d.ts.map +1 -0
  168. package/lib/typescript/__tests__/jsCore.test.d.ts +2 -0
  169. package/lib/typescript/__tests__/jsCore.test.d.ts.map +1 -0
  170. package/lib/typescript/__tests__/utils.test.d.ts +2 -0
  171. package/lib/typescript/__tests__/utils.test.d.ts.map +1 -0
  172. package/lib/typescript/api.d.ts +226 -0
  173. package/lib/typescript/api.d.ts.map +1 -0
  174. package/lib/typescript/configurations.d.ts +73 -0
  175. package/lib/typescript/configurations.d.ts.map +1 -0
  176. package/lib/typescript/constants.d.ts +59 -0
  177. package/lib/typescript/constants.d.ts.map +1 -0
  178. package/lib/typescript/events.d.ts +101 -0
  179. package/lib/typescript/events.d.ts.map +1 -0
  180. package/lib/typescript/index.d.ts +27 -0
  181. package/lib/typescript/index.d.ts.map +1 -0
  182. package/lib/typescript/jsCore.d.ts +140 -0
  183. package/lib/typescript/jsCore.d.ts.map +1 -0
  184. package/lib/typescript/native.d.ts +4 -0
  185. package/lib/typescript/native.d.ts.map +1 -0
  186. package/lib/typescript/subject.d.ts +91 -0
  187. package/lib/typescript/subject.d.ts.map +1 -0
  188. package/lib/typescript/tracker.d.ts +93 -0
  189. package/lib/typescript/tracker.d.ts.map +1 -0
  190. package/{dist/index.d.ts → lib/typescript/types.d.ts} +188 -75
  191. package/lib/typescript/types.d.ts.map +1 -0
  192. package/lib/typescript/utils.d.ts +35 -0
  193. package/lib/typescript/utils.d.ts.map +1 -0
  194. package/lib/typescript/webViewInterface.d.ts +15 -0
  195. package/lib/typescript/webViewInterface.d.ts.map +1 -0
  196. package/package.json +134 -52
  197. package/scripts/bootstrap.js +29 -0
  198. package/snowplow-react-native-tracker.podspec +42 -0
  199. package/src/__mocks__/react-native.js +7 -0
  200. package/src/__tests__/api.test.ts +34 -0
  201. package/src/__tests__/configurations.test.ts +620 -0
  202. package/src/__tests__/events.test.ts +749 -0
  203. package/src/__tests__/index.test.ts +27 -0
  204. package/src/__tests__/jsCore.test.ts +169 -0
  205. package/src/__tests__/utils.test.ts +23 -0
  206. package/src/api.ts +535 -0
  207. package/src/configurations.ts +337 -0
  208. package/src/constants.ts +102 -0
  209. package/src/events.ts +330 -0
  210. package/src/index.ts +189 -0
  211. package/src/jsCore.ts +553 -0
  212. package/src/native.ts +34 -0
  213. package/src/subject.ts +315 -0
  214. package/src/tracker.ts +330 -0
  215. package/src/types.ts +1087 -0
  216. package/src/utils.ts +78 -0
  217. package/src/webViewInterface.ts +105 -0
  218. package/tsconfig.build.json +5 -0
  219. package/tsconfig.json +28 -0
  220. package/turbo.json +34 -0
  221. package/yarn.lock +9333 -0
  222. package/RNSnowplowTracker.podspec +0 -24
  223. package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerModule.java +0 -750
  224. package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerPackage.java +0 -29
  225. package/android/src/main/java/com/snowplowanalytics/react/util/ConfigUtil.java +0 -351
  226. package/android/src/main/java/com/snowplowanalytics/react/util/EventUtil.java +0 -339
  227. package/android/src/main/java/com/snowplowanalytics/react/util/TrackerVersion.java +0 -7
  228. package/dist/index.js +0 -2026
  229. package/dist/index.js.map +0 -1
  230. package/ios/RNSnowplowTracker.h +0 -34
  231. package/ios/RNSnowplowTracker.m +0 -911
  232. package/ios/Util/NSDictionary+RNSP_TypeMethods.h +0 -33
  233. package/ios/Util/NSDictionary+RNSP_TypeMethods.m +0 -40
  234. package/ios/Util/RNConfigUtils.h +0 -44
  235. package/ios/Util/RNConfigUtils.m +0 -209
  236. package/ios/Util/RNTrackerVersion.h +0 -27
  237. package/ios/Util/RNTrackerVersion.m +0 -27
  238. package/ios/Util/RNUtilities.h +0 -32
  239. package/ios/Util/RNUtilities.m +0 -68
@@ -1,33 +0,0 @@
1
- //
2
- // NSDictionary+RNSP_TypeMethods.h
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import <Foundation/Foundation.h>
22
-
23
- NS_ASSUME_NONNULL_BEGIN
24
-
25
- @interface NSDictionary (RNSP_TypeMethods)
26
-
27
- - (nullable NSString *)rnsp_stringForKey:(NSString *)key defaultValue:(nullable NSString *)defaultValue;
28
- - (nullable NSNumber *)rnsp_numberForKey:(NSString *)key defaultValue:(nullable NSNumber *)defaultValue;
29
- - (BOOL)rnsp_boolForKey:(NSString *)key defaultValue:(BOOL)defaultValue;
30
-
31
- @end
32
-
33
- NS_ASSUME_NONNULL_END
@@ -1,40 +0,0 @@
1
- //
2
- // NSDictionary+RNSP_TypeMethods.m
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import "NSDictionary+RNSP_TypeMethods.h"
22
-
23
- @implementation NSDictionary (RNSP_TypeMethods)
24
-
25
- - (nullable NSString *)rnsp_stringForKey:(NSString *)key defaultValue:(nullable NSString *)defaultValue {
26
- NSObject *obj = [self objectForKey:key];
27
- return [obj isKindOfClass:NSString.class] ? (NSString *)obj : defaultValue;
28
- }
29
-
30
- - (nullable NSNumber *)rnsp_numberForKey:(NSString *)key defaultValue:(nullable NSNumber *)defaultValue {
31
- NSObject *obj = [self objectForKey:key];
32
- return [obj isKindOfClass:NSNumber.class] ? (NSNumber *)obj : defaultValue;
33
- }
34
-
35
- - (BOOL)rnsp_boolForKey:(NSString *)key defaultValue:(BOOL)defaultValue {
36
- NSNumber *num = [self rnsp_numberForKey:key defaultValue:nil];
37
- return num ? num.boolValue : defaultValue;
38
- }
39
-
40
- @end
@@ -1,44 +0,0 @@
1
- //
2
- // RNConfigUtils.h
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import <Foundation/Foundation.h>
22
-
23
- #import <SnowplowTracker/SPTrackerConfiguration.h>
24
- #import <SnowplowTracker/SPSessionConfiguration.h>
25
- #import <SnowplowTracker/SPEmitterConfiguration.h>
26
- #import <SnowplowTracker/SPSubjectConfiguration.h>
27
- #import <SnowplowTracker/SPGDPRConfiguration.h>
28
- #import <SnowplowTracker/SPGlobalContextsConfiguration.h>
29
-
30
- @interface RNConfigUtils : NSObject
31
-
32
- + (SPTrackerConfiguration *) mkTrackerConfig:(NSDictionary *) trackerConfig;
33
-
34
- + (SPSessionConfiguration *) mkSessionConfig:(NSDictionary *) sessionConfig;
35
-
36
- + (SPEmitterConfiguration *) mkEmitterConfig:(NSDictionary *) emitterConfig;
37
-
38
- + (SPSubjectConfiguration *) mkSubjectConfig:(NSDictionary *) subjectConfig;
39
-
40
- + (SPGDPRConfiguration *) mkGdprConfig:(NSDictionary *) gdprConfig;
41
-
42
- + (SPGlobalContextsConfiguration *) mkGCConfig:(NSArray *) gcConfig;
43
-
44
- @end
@@ -1,209 +0,0 @@
1
- //
2
- // RNConfigUtils.m
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import "RNConfigUtils.h"
22
- #import "RNTrackerVersion.h"
23
- #import "RNUtilities.h"
24
- #import "NSDictionary+RNSP_TypeMethods.h"
25
-
26
- #import <Foundation/Foundation.h>
27
-
28
- #import <SnowplowTracker/SPSnowplow.h>
29
- #import <SnowplowTracker/SPTrackerConfiguration.h>
30
- #import <SnowplowTracker/SPDevicePlatform.h>
31
- #import <SnowplowTracker/SPLoggerDelegate.h>
32
- #import <SnowplowTracker/SPSessionConfiguration.h>
33
- #import <SnowplowTracker/SPEmitterConfiguration.h>
34
- #import <SnowplowTracker/SPSubjectConfiguration.h>
35
- #import <SnowplowTracker/SPGDPRConfiguration.h>
36
- #import <SnowplowTracker/SPGlobalContextsConfiguration.h>
37
-
38
- @implementation RNConfigUtils
39
-
40
- + (SPTrackerConfiguration *) mkTrackerConfig:(NSDictionary *) trackerConfig {
41
- SPTrackerConfiguration *trackerConfiguration = [SPTrackerConfiguration new];
42
- trackerConfiguration.trackerVersionSuffix = kRNTrackerVersion;
43
-
44
- NSString *appId = [trackerConfig rnsp_stringForKey:@"appId" defaultValue:nil];
45
- if (appId) {
46
- trackerConfiguration.appId = appId;
47
- }
48
-
49
- NSString *devicePlatform = [trackerConfig rnsp_stringForKey:@"devicePlatform" defaultValue:nil];
50
- if (devicePlatform) {
51
- trackerConfiguration.devicePlatform = SPStringToDevicePlatform(devicePlatform);
52
- }
53
-
54
- trackerConfiguration.base64Encoding = [trackerConfig rnsp_boolForKey:@"base64Encoding" defaultValue:YES];
55
-
56
- NSString *logLevel = [trackerConfig rnsp_stringForKey:@"logLevel" defaultValue:nil];
57
- if (logLevel) {
58
- NSUInteger index = [@[@"off", @"error", @"debug", @"verbose"] indexOfObject:logLevel];
59
- trackerConfiguration.logLevel = index != NSNotFound ? index : SPLogLevelOff;
60
- }
61
-
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];
73
- trackerConfiguration.userAnonymisation = [trackerConfig rnsp_boolForKey:@"userAnonymisation" defaultValue:NO];
74
-
75
- return trackerConfiguration;
76
- }
77
-
78
- + (SPSessionConfiguration *) mkSessionConfig:(NSDictionary *) sessionConfig {
79
-
80
- NSInteger foreground = [[sessionConfig rnsp_numberForKey:@"foregroundTimeout" defaultValue:@1800] integerValue];
81
- NSInteger background = [[sessionConfig rnsp_numberForKey:@"backgroundTimeout" defaultValue:@1800] integerValue];
82
- SPSessionConfiguration *sessionConfiguration = [[SPSessionConfiguration alloc] initWithForegroundTimeoutInSeconds:foreground backgroundTimeoutInSeconds:background];
83
-
84
- return sessionConfiguration;
85
- }
86
-
87
- + (SPEmitterConfiguration *) mkEmitterConfig:(NSDictionary *) emitterConfig {
88
- SPEmitterConfiguration *emitterConfiguration = [[SPEmitterConfiguration alloc] init];
89
- NSString *bufferOption = [emitterConfig rnsp_stringForKey:@"bufferOption" defaultValue:@"single"];
90
- if ([bufferOption isEqualToString:@"default"]) {
91
- emitterConfiguration.bufferOption = SPBufferOptionDefaultGroup;
92
- } else if ([bufferOption isEqualToString:@"large"]) {
93
- emitterConfiguration.bufferOption = SPBufferOptionLargeGroup;
94
- } else {
95
- emitterConfiguration.bufferOption = SPBufferOptionSingle;
96
- }
97
-
98
- emitterConfiguration.emitRange = [[emitterConfig rnsp_numberForKey:@"emitRange" defaultValue:@150] integerValue];
99
- emitterConfiguration.threadPoolSize = [[emitterConfig rnsp_numberForKey:@"threadPoolSize" defaultValue:@15] integerValue];
100
- emitterConfiguration.byteLimitGet = [[emitterConfig rnsp_numberForKey:@"byteLimitGet" defaultValue:@40000] integerValue];
101
- emitterConfiguration.byteLimitPost = [[emitterConfig rnsp_numberForKey:@"byteLimitPost" defaultValue:@40000] integerValue];
102
- emitterConfiguration.serverAnonymisation = [emitterConfig rnsp_boolForKey:@"serverAnonymisation" defaultValue:NO];
103
-
104
- return emitterConfiguration;
105
- }
106
-
107
- + (SPSubjectConfiguration *) mkSubjectConfig:(NSDictionary *) subjectConfig {
108
-
109
- SPSubjectConfiguration *subjectConfiguration = [SPSubjectConfiguration new];
110
-
111
- NSString *userId = [subjectConfig rnsp_stringForKey:@"userId" defaultValue:nil];
112
- if (userId) {
113
- subjectConfiguration.userId = userId;
114
- }
115
-
116
- NSString *networkUserId = [subjectConfig rnsp_stringForKey:@"networkUserId" defaultValue:nil];
117
- if (networkUserId) {
118
- subjectConfiguration.networkUserId = networkUserId;
119
- }
120
-
121
- NSString *domainUserId = [subjectConfig rnsp_stringForKey:@"domainUserId" defaultValue:nil];
122
- if (domainUserId) {
123
- subjectConfiguration.domainUserId = domainUserId;
124
- }
125
-
126
- NSString *useragent = [subjectConfig rnsp_stringForKey:@"useragent" defaultValue:nil];
127
- if (useragent) {
128
- subjectConfiguration.useragent = useragent;
129
- }
130
-
131
- NSString *ipAddress = [subjectConfig rnsp_stringForKey:@"ipAddress" defaultValue:nil];
132
- if (ipAddress) {
133
- subjectConfiguration.ipAddress = ipAddress;
134
- }
135
-
136
- NSString *timezone = [subjectConfig rnsp_stringForKey:@"timezone" defaultValue:nil];
137
- if (timezone) {
138
- subjectConfiguration.timezone = timezone;
139
- }
140
-
141
- NSString *language = [subjectConfig rnsp_stringForKey:@"language" defaultValue:nil];
142
- if (language) {
143
- subjectConfiguration.language = language;
144
- }
145
-
146
- // screenResolution - type checked RN side
147
- NSArray *screenRSize = [subjectConfig objectForKey:@"screenResolution"];
148
- if (screenRSize != nil) {
149
- NSNumber *resWidth = [screenRSize objectAtIndex:0];
150
- NSNumber *resHeight = [screenRSize objectAtIndex:1];
151
- SPSize *resSize = [[SPSize alloc] initWithWidth:[resWidth integerValue] height:[resHeight integerValue]];
152
- subjectConfiguration.screenResolution = resSize;
153
- }
154
-
155
- // screenViewport - type checked RN side
156
- NSArray *screenVPSize = [subjectConfig objectForKey:@"screenViewport"];
157
- if (screenVPSize != nil) {
158
- NSNumber *vpWidth = [screenVPSize objectAtIndex:0];
159
- NSNumber *vpHeight = [screenVPSize objectAtIndex:1];
160
- SPSize *vpSize = [[SPSize alloc] initWithWidth:[vpWidth integerValue] height:[vpHeight integerValue]];
161
- subjectConfiguration.screenViewPort = vpSize;
162
- }
163
-
164
- // colorDepth
165
- NSNumber *colorDepth = [subjectConfig rnsp_numberForKey:@"colorDepth" defaultValue: nil];
166
- if (colorDepth != nil) {
167
- subjectConfiguration.colorDepth = colorDepth;
168
- }
169
-
170
- return subjectConfiguration;
171
- }
172
-
173
- + (SPGDPRConfiguration *) mkGdprConfig:(NSDictionary *) gdprConfig {
174
- NSString *basis = [gdprConfig objectForKey:@"basisForProcessing"];
175
- NSString *docId = [gdprConfig objectForKey:@"documentId"];
176
- NSString *docVer = [gdprConfig objectForKey:@"documentVersion"];
177
- NSString *docDesc = [gdprConfig objectForKey:@"documentDescription"];
178
-
179
- SPGDPRConfiguration *gdprConfiguration = [[SPGDPRConfiguration alloc] initWithBasis:[RNUtilities getBasis:basis] documentId:docId documentVersion:docVer documentDescription:docDesc];
180
-
181
- return gdprConfiguration;
182
- }
183
-
184
- + (SPGlobalContextsConfiguration *) mkGCConfig:(NSArray *) gcConfig {
185
-
186
- SPGlobalContextsConfiguration *gcConfiguration = [[SPGlobalContextsConfiguration alloc] init];
187
- //NSMutableDictionary *contextGens = [NSMutableDictionary dictionary];
188
-
189
- for (NSDictionary *gcMap in gcConfig) {
190
- NSString *itag = [gcMap objectForKey:@"tag"];
191
- NSArray *globalContexts = [gcMap objectForKey:@"globalContexts"];
192
-
193
- NSMutableArray *staticContexts = [NSMutableArray array];
194
- for (NSDictionary *sdj in globalContexts) {
195
- SPSelfDescribingJson *gContext = [[SPSelfDescribingJson alloc] initWithSchema:(NSString *)[sdj objectForKey:@"schema"]
196
- andDictionary:(NSDictionary *)[sdj objectForKey:@"data"]];
197
-
198
- [staticContexts addObject:gContext];
199
- }
200
-
201
- SPGlobalContext *gcStatic = [[SPGlobalContext alloc] initWithStaticContexts:(NSArray *)[staticContexts copy]];
202
-
203
- [gcConfiguration addWithTag:itag contextGenerator:gcStatic];
204
- }
205
-
206
- return gcConfiguration;
207
- }
208
-
209
- @end
@@ -1,27 +0,0 @@
1
- //
2
- // RNTrackerVersion.h
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import <Foundation/Foundation.h>
22
-
23
- @interface RNTrackerVersion : NSObject
24
-
25
- extern NSString * const kRNTrackerVersion;
26
-
27
- @end
@@ -1,27 +0,0 @@
1
- //
2
- // RNTrackerVersion.m
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import "RNTrackerVersion.h"
22
-
23
- @implementation RNTrackerVersion
24
-
25
- NSString * const kRNTrackerVersion = @"rn-1.4.0";
26
-
27
- @end
@@ -1,32 +0,0 @@
1
- //
2
- // RNUtilities.h
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import <Foundation/Foundation.h>
22
- #import <SnowplowTracker/SPGDPRConfiguration.h>
23
-
24
- @interface RNUtilities : NSObject
25
-
26
- + (NSDictionary *) removeNSNullFromDict:(NSDictionary *)trackerConfig;
27
-
28
- + (SPGdprProcessingBasis) getBasis:(NSString *)basis;
29
-
30
- + (NSMutableArray *) mkSDJArray:(NSArray<NSDictionary *> *)sdjArray;
31
-
32
- @end
@@ -1,68 +0,0 @@
1
- //
2
- // RNUtilities.m
3
- //
4
- // Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
5
- //
6
- // This program is licensed to you under the Apache License Version 2.0,
7
- // and you may not use this file except in compliance with the Apache License
8
- // Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
- // http://www.apache.org/licenses/LICENSE-2.0.
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the Apache License Version 2.0 is distributed on
13
- // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
- // express or implied. See the Apache License Version 2.0 for the specific
15
- // language governing permissions and limitations there under.
16
- //
17
- // Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
18
- // License: Apache License Version 2.0
19
- //
20
-
21
- #import "RNUtilities.h"
22
- #import <Foundation/Foundation.h>
23
- #import <SnowplowTracker/SPGDPRConfiguration.h>
24
- #import <SnowplowTracker/SPSelfDescribingJson.h>
25
-
26
- @implementation RNUtilities
27
-
28
- + (NSDictionary *) removeNSNullFromDict:(NSDictionary *)dictionary {
29
- const NSMutableDictionary *newDict = [dictionary mutableCopy];
30
- const id nullPointer = [NSNull null];
31
-
32
- for (NSString *key in dictionary) {
33
- id obj = [dictionary objectForKey:key];
34
- if (obj == nullPointer) {
35
- [newDict removeObjectForKey:key];
36
- }
37
- }
38
- return [NSDictionary dictionaryWithDictionary:[newDict copy]];
39
- }
40
-
41
- + (SPGdprProcessingBasis) getBasis:(NSString *)basis {
42
- if ([basis isEqualToString:@"consent"]) {
43
- return SPGdprProcessingBasisConsent;
44
- } else if ([basis isEqualToString:@"contract"]) {
45
- return SPGdprProcessingBasisContract;
46
- } else if ([basis isEqualToString:@"legal_obligation"]) {
47
- return SPGdprProcessingBasisLegalObligation;
48
- } else if ([basis isEqualToString:@"legitimate_interests"]) {
49
- return SPGdprProcessingBasisLegitimateInterests;
50
- } else if ([basis isEqualToString:@"public_task"]) {
51
- return SPGdprProcessingBasisPublicTask;
52
- } else {
53
- return SPGdprProcessingBasisVitalInterest;;
54
- }
55
- }
56
-
57
- + (NSMutableArray *) mkSDJArray:(NSArray<NSDictionary *> *)sdjArray {
58
- NSMutableArray *sdjs = [NSMutableArray array];
59
- for (NSDictionary* sdj in sdjArray) {
60
- SPSelfDescribingJson *nativeSdj = [[SPSelfDescribingJson alloc] initWithSchema:(NSString *)[sdj objectForKey:@"schema"]
61
- andDictionary:(NSDictionary *)[sdj objectForKey:@"data"]];
62
- [sdjs addObject:nativeSdj];
63
- }
64
-
65
- return sdjs;
66
- }
67
-
68
- @end