@snowplow/react-native-tracker 1.4.0 → 2.1.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.
- package/.editorconfig +15 -0
- package/.eslintignore +6 -0
- package/.gitattributes +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/actions/setup/action.yml +28 -0
- package/.github/workflows/build.yml +155 -0
- package/.github/workflows/deploy.yml +97 -0
- package/.github/workflows/e2e-android.yml +121 -0
- package/.github/workflows/e2e-ios.yml +95 -0
- package/.github/workflows/snyk.yml +21 -0
- package/.gitignore +70 -0
- package/.npmignore +60 -0
- package/.nvmrc +1 -0
- package/.watchmanconfig +1 -0
- package/.yarnrc +3 -0
- package/CHANGELOG +176 -0
- package/CONTRIBUTING.md +80 -0
- package/LICENSE +1 -1
- package/README.md +24 -111
- package/android/build.gradle +93 -37
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/android/gradle.properties +5 -2
- package/android/gradlew +172 -110
- package/android/gradlew.bat +24 -19
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +744 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +17 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +274 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +233 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +5 -0
- package/babel.config.js +3 -0
- package/example/.watchmanconfig +1 -0
- package/example/Gemfile +6 -0
- package/example/android/app/build.gradle +129 -0
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +10 -0
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +36 -0
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +21 -0
- package/example/android/app/src/debug/AndroidManifest.xml +13 -0
- package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +75 -0
- package/example/android/app/src/main/AndroidManifest.xml +26 -0
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +32 -0
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +62 -0
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +3 -0
- package/example/android/app/src/main/res/values/styles.xml +9 -0
- package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +20 -0
- package/example/android/build.gradle +31 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/example/android/gradle.properties +44 -0
- package/example/android/gradlew +244 -0
- package/example/android/gradlew.bat +92 -0
- package/example/android/settings.gradle +4 -0
- package/example/app.json +4 -0
- package/example/babel.config.js +17 -0
- package/example/detox.config.js +92 -0
- package/example/e2e/config.json +10 -0
- package/example/e2e/emitEvents.e2e.detox.js +95 -0
- package/example/e2e/environment.js +23 -0
- package/example/e2e/helpers/microCommands.js +140 -0
- package/example/e2e/helpers/microHelpers.js +333 -0
- package/example/e2e/helpers/microHelpers.test.js +295 -0
- package/example/e2e/helpers/schemas.js +49 -0
- package/example/e2e/jest.config.js +16 -0
- package/example/e2e/setup.js +4 -0
- package/example/e2e/testEvents.micro.test.js +287 -0
- package/example/index.js +5 -0
- package/example/ios/.xcode.env +11 -0
- package/example/ios/Podfile +62 -0
- package/example/ios/Podfile.lock +730 -0
- package/example/ios/ReactNativeTrackerExample/AppDelegate.h +6 -0
- package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +26 -0
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +6 -0
- package/example/ios/ReactNativeTrackerExample/Info.plist +55 -0
- package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +47 -0
- package/example/ios/ReactNativeTrackerExample/main.m +10 -0
- package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +3 -0
- package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +722 -0
- package/{ios/RNSnowplowTracker.xcodeproj/xcshareddata/xcschemes/RNSnowplowTracker.xcscheme → example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme} +29 -21
- package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/example/ios/ReactNativeTrackerExampleTests/Info.plist +24 -0
- package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +66 -0
- package/example/metro.config.js +45 -0
- package/example/package.json +54 -0
- package/example/react-native.config.js +10 -0
- package/example/src/App.js +566 -0
- package/example/tsconfig.json +5 -0
- package/example/yarn.lock +7379 -0
- package/ios/ReactNativeTracker-Bridging-Header.h +2 -0
- package/ios/ReactNativeTracker.mm +175 -0
- package/ios/ReactNativeTracker.swift +822 -0
- package/ios/{RNSnowplowTracker.xcodeproj → ReactNativeTracker.xcodeproj}/project.pbxproj +55 -79
- package/ios/Util/ConfigUtils.swift +209 -0
- package/ios/Util/TrackerVersion.swift +3 -0
- package/ios/Util/Utilities.swift +37 -0
- package/lefthook.yml +11 -0
- package/lib/commonjs/api.js +490 -0
- package/lib/commonjs/api.js.map +1 -0
- package/lib/commonjs/configurations.js +196 -0
- package/lib/commonjs/configurations.js.map +1 -0
- package/lib/commonjs/constants.js +77 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/events.js +277 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/index.js +132 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/jsCore.js +427 -0
- package/lib/commonjs/jsCore.js.map +1 -0
- package/lib/commonjs/native.js +16 -0
- package/lib/commonjs/native.js.map +1 -0
- package/lib/commonjs/subject.js +235 -0
- package/lib/commonjs/subject.js.map +1 -0
- package/lib/commonjs/tracker.js +248 -0
- package/lib/commonjs/tracker.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +72 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/webViewInterface.js +66 -0
- package/lib/commonjs/webViewInterface.js.map +1 -0
- package/lib/module/api.js +452 -0
- package/lib/module/api.js.map +1 -0
- package/lib/module/configurations.js +184 -0
- package/lib/module/configurations.js.map +1 -0
- package/lib/module/constants.js +72 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/events.js +259 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +120 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/jsCore.js +424 -0
- package/lib/module/jsCore.js.map +1 -0
- package/lib/module/native.js +12 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/subject.js +222 -0
- package/lib/module/subject.js.map +1 -0
- package/lib/module/tracker.js +234 -0
- package/lib/module/tracker.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +66 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/webViewInterface.js +62 -0
- package/lib/module/webViewInterface.js.map +1 -0
- package/lib/typescript/__tests__/api.test.d.ts +2 -0
- package/lib/typescript/__tests__/api.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/configurations.test.d.ts +2 -0
- package/lib/typescript/__tests__/configurations.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/events.test.d.ts +2 -0
- package/lib/typescript/__tests__/events.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/index.test.d.ts +2 -0
- package/lib/typescript/__tests__/index.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/jsCore.test.d.ts +2 -0
- package/lib/typescript/__tests__/jsCore.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/utils.test.d.ts +2 -0
- package/lib/typescript/__tests__/utils.test.d.ts.map +1 -0
- package/lib/typescript/api.d.ts +240 -0
- package/lib/typescript/api.d.ts.map +1 -0
- package/lib/typescript/configurations.d.ts +73 -0
- package/lib/typescript/configurations.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +64 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/events.d.ts +115 -0
- package/lib/typescript/events.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +27 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/jsCore.d.ts +152 -0
- package/lib/typescript/jsCore.d.ts.map +1 -0
- package/lib/typescript/native.d.ts +4 -0
- package/lib/typescript/native.d.ts.map +1 -0
- package/lib/typescript/subject.d.ts +91 -0
- package/lib/typescript/subject.d.ts.map +1 -0
- package/lib/typescript/tracker.d.ts +111 -0
- package/lib/typescript/tracker.d.ts.map +1 -0
- package/{dist/index.d.ts → lib/typescript/types.d.ts} +264 -73
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +35 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/lib/typescript/webViewInterface.d.ts +15 -0
- package/lib/typescript/webViewInterface.d.ts.map +1 -0
- package/package.json +135 -53
- package/scripts/bootstrap.js +29 -0
- package/snowplow-react-native-tracker.podspec +42 -0
- package/src/__mocks__/react-native.js +7 -0
- package/src/__tests__/api.test.ts +21 -0
- package/src/__tests__/configurations.test.ts +608 -0
- package/src/__tests__/events.test.ts +736 -0
- package/src/__tests__/index.test.ts +14 -0
- package/src/__tests__/jsCore.test.ts +199 -0
- package/src/__tests__/utils.test.ts +10 -0
- package/src/api.ts +556 -0
- package/src/configurations.ts +325 -0
- package/src/constants.ts +97 -0
- package/src/events.ts +355 -0
- package/src/index.ts +184 -0
- package/src/jsCore.ts +603 -0
- package/src/native.ts +21 -0
- package/src/subject.ts +302 -0
- package/src/tracker.ts +377 -0
- package/src/types.ts +1162 -0
- package/src/utils.ts +65 -0
- package/src/webViewInterface.ts +92 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +28 -0
- package/turbo.json +34 -0
- package/yarn.lock +9333 -0
- package/RNSnowplowTracker.podspec +0 -24
- package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerModule.java +0 -750
- package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerPackage.java +0 -29
- package/android/src/main/java/com/snowplowanalytics/react/util/ConfigUtil.java +0 -351
- package/android/src/main/java/com/snowplowanalytics/react/util/EventUtil.java +0 -339
- package/android/src/main/java/com/snowplowanalytics/react/util/TrackerVersion.java +0 -7
- package/dist/index.js +0 -2026
- package/dist/index.js.map +0 -1
- package/ios/RNSnowplowTracker.h +0 -34
- package/ios/RNSnowplowTracker.m +0 -911
- package/ios/Util/NSDictionary+RNSP_TypeMethods.h +0 -33
- package/ios/Util/NSDictionary+RNSP_TypeMethods.m +0 -40
- package/ios/Util/RNConfigUtils.h +0 -44
- package/ios/Util/RNConfigUtils.m +0 -209
- package/ios/Util/RNTrackerVersion.h +0 -27
- package/ios/Util/RNTrackerVersion.m +0 -27
- package/ios/Util/RNUtilities.h +0 -32
- 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
|
package/ios/Util/RNConfigUtils.h
DELETED
|
@@ -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
|
package/ios/Util/RNConfigUtils.m
DELETED
|
@@ -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
|
package/ios/Util/RNUtilities.h
DELETED
|
@@ -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
|
package/ios/Util/RNUtilities.m
DELETED
|
@@ -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
|