@snowplow/react-native-tracker 1.3.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.
- 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 +150 -0
- package/.github/workflows/deploy.yml +98 -0
- package/.github/workflows/e2e-android.yml +121 -0
- package/.github/workflows/e2e-ios.yml +90 -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 +166 -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 +704 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +17 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +271 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +213 -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 +108 -0
- package/example/e2e/environment.js +23 -0
- package/example/e2e/helpers/microCommands.js +153 -0
- package/example/e2e/helpers/microHelpers.js +346 -0
- package/example/e2e/helpers/microHelpers.test.js +308 -0
- package/example/e2e/helpers/schemas.js +62 -0
- package/example/e2e/jest.config.js +16 -0
- package/example/e2e/setup.js +4 -0
- package/example/e2e/testEvents.micro.test.js +300 -0
- package/example/index.js +5 -0
- package/example/ios/.xcode.env +11 -0
- package/example/ios/Podfile +64 -0
- package/example/ios/Podfile.lock +737 -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 +557 -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 +165 -0
- package/ios/ReactNativeTracker.swift +757 -0
- package/ios/{RNSnowplowTracker.xcodeproj → ReactNativeTracker.xcodeproj}/project.pbxproj +55 -79
- package/ios/Util/ConfigUtils.swift +206 -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 +475 -0
- package/lib/commonjs/api.js.map +1 -0
- package/lib/commonjs/configurations.js +209 -0
- package/lib/commonjs/configurations.js.map +1 -0
- package/lib/commonjs/constants.js +85 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/events.js +256 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/index.js +141 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/jsCore.js +393 -0
- package/lib/commonjs/jsCore.js.map +1 -0
- package/lib/commonjs/native.js +29 -0
- package/lib/commonjs/native.js.map +1 -0
- package/lib/commonjs/subject.js +248 -0
- package/lib/commonjs/subject.js.map +1 -0
- package/lib/commonjs/tracker.js +221 -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 +85 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/webViewInterface.js +79 -0
- package/lib/commonjs/webViewInterface.js.map +1 -0
- package/lib/module/api.js +439 -0
- package/lib/module/api.js.map +1 -0
- package/lib/module/configurations.js +197 -0
- package/lib/module/configurations.js.map +1 -0
- package/lib/module/constants.js +80 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/events.js +240 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +129 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/jsCore.js +390 -0
- package/lib/module/jsCore.js.map +1 -0
- package/lib/module/native.js +25 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/subject.js +235 -0
- package/lib/module/subject.js.map +1 -0
- package/lib/module/tracker.js +209 -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 +79 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/webViewInterface.js +75 -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 +226 -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 +59 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/events.d.ts +101 -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 +140 -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 +93 -0
- package/lib/typescript/tracker.d.ts.map +1 -0
- package/{dist/index.d.ts → lib/typescript/types.d.ts} +188 -75
- 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 +138 -51
- 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 +34 -0
- package/src/__tests__/configurations.test.ts +620 -0
- package/src/__tests__/events.test.ts +749 -0
- package/src/__tests__/index.test.ts +27 -0
- package/src/__tests__/jsCore.test.ts +169 -0
- package/src/__tests__/utils.test.ts +23 -0
- package/src/api.ts +535 -0
- package/src/configurations.ts +337 -0
- package/src/constants.ts +102 -0
- package/src/events.ts +330 -0
- package/src/index.ts +189 -0
- package/src/jsCore.ts +553 -0
- package/src/native.ts +34 -0
- package/src/subject.ts +315 -0
- package/src/tracker.ts +330 -0
- package/src/types.ts +1087 -0
- package/src/utils.ts +78 -0
- package/src/webViewInterface.ts +105 -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 -1650
- 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
package/src/types.ts
ADDED
|
@@ -0,0 +1,1087 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This program is licensed to you under the Apache License Version 2.0,
|
|
5
|
+
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
6
|
+
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing,
|
|
9
|
+
* software distributed under the Apache License Version 2.0 is distributed on an
|
|
10
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* HttpMethod type
|
|
16
|
+
*/
|
|
17
|
+
export type HttpMethod = 'post' | 'get';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* DevicePlatform type
|
|
21
|
+
*/
|
|
22
|
+
export type DevicePlatform =
|
|
23
|
+
| 'web'
|
|
24
|
+
| 'mob'
|
|
25
|
+
| 'pc'
|
|
26
|
+
| 'srv'
|
|
27
|
+
| 'app'
|
|
28
|
+
| 'tv'
|
|
29
|
+
| 'cnsl'
|
|
30
|
+
| 'iot';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* LogLevel type
|
|
34
|
+
*/
|
|
35
|
+
export type LogLevel = 'off' | 'error' | 'debug' | 'verbose';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* BasisForProsessing
|
|
39
|
+
*/
|
|
40
|
+
export type Basis =
|
|
41
|
+
| 'consent'
|
|
42
|
+
| 'contract'
|
|
43
|
+
| 'legal_obligation'
|
|
44
|
+
| 'legitimate_interests'
|
|
45
|
+
| 'public_task'
|
|
46
|
+
| 'vital_interests';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* BufferOption
|
|
50
|
+
*/
|
|
51
|
+
export type BufferOption = 'single' | 'default' | 'large';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Trigger for MessageNotification event
|
|
55
|
+
*/
|
|
56
|
+
export type Trigger =
|
|
57
|
+
| 'push'
|
|
58
|
+
| 'location'
|
|
59
|
+
| 'calendar'
|
|
60
|
+
| 'timeInterval'
|
|
61
|
+
| 'other';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* ScreenSize
|
|
65
|
+
*/
|
|
66
|
+
export type ScreenSize = [number, number];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* SelfDescribing type
|
|
70
|
+
*/
|
|
71
|
+
export type SelfDescribing<
|
|
72
|
+
T extends Record<keyof T, unknown> = Record<string, unknown>
|
|
73
|
+
> = {
|
|
74
|
+
/**
|
|
75
|
+
* Schema
|
|
76
|
+
*/
|
|
77
|
+
schema: string;
|
|
78
|
+
/**
|
|
79
|
+
* Data
|
|
80
|
+
*/
|
|
81
|
+
data: T;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* EventContext type
|
|
86
|
+
*/
|
|
87
|
+
export type EventContext = SelfDescribing;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* NetworkConfiguration
|
|
91
|
+
*/
|
|
92
|
+
export interface NetworkConfiguration {
|
|
93
|
+
/**
|
|
94
|
+
* The collector endpoint
|
|
95
|
+
* - if the protocol is not included it defaults to https
|
|
96
|
+
*/
|
|
97
|
+
endpoint: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The Http Method to use when sending events to the collector
|
|
101
|
+
* @defaultValue 'post'
|
|
102
|
+
*/
|
|
103
|
+
method?: HttpMethod;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A custom path which will be added to the endpoint URL to specify the
|
|
107
|
+
* complete URL of the collector when paired with the POST method.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue `com.snowplowanalytics.snowplow/tp2`.
|
|
110
|
+
*/
|
|
111
|
+
customPostPath?: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Custom headers for HTTP requests to the Collector.
|
|
115
|
+
*/
|
|
116
|
+
requestHeaders?: Record<string, string>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* TrackerConfiguration
|
|
121
|
+
*/
|
|
122
|
+
export interface TrackerConfiguration {
|
|
123
|
+
/**
|
|
124
|
+
* Identifier of the app.
|
|
125
|
+
*/
|
|
126
|
+
appId?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The device platform the tracker runs on.
|
|
129
|
+
* @defaultValue 'mob'
|
|
130
|
+
*/
|
|
131
|
+
devicePlatform?: DevicePlatform;
|
|
132
|
+
/**
|
|
133
|
+
* Whether payload JSON data should be base64 encoded.
|
|
134
|
+
* @defaultValue true
|
|
135
|
+
*/
|
|
136
|
+
base64Encoding?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* The log level of tracker logs.
|
|
139
|
+
* @defaultValue 'off'
|
|
140
|
+
*/
|
|
141
|
+
logLevel?: LogLevel;
|
|
142
|
+
/**
|
|
143
|
+
* Whether application context is attached to tracked events.
|
|
144
|
+
* @defaultValue true
|
|
145
|
+
*/
|
|
146
|
+
applicationContext?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Whether platform context is attached to tracked events.
|
|
149
|
+
* @defaultValue true
|
|
150
|
+
*/
|
|
151
|
+
platformContext?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether geo-location context is attached to tracked events.
|
|
154
|
+
* @defaultValue false
|
|
155
|
+
*/
|
|
156
|
+
geoLocationContext?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Whether session context is attached to tracked events.
|
|
159
|
+
* @defaultValue true
|
|
160
|
+
*/
|
|
161
|
+
sessionContext?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Whether to attach a Deep Link entity to the first ScreenView tracked in the tracker after DeepLinkReceived event.
|
|
164
|
+
* @defaultValue true
|
|
165
|
+
*/
|
|
166
|
+
deepLinkContext?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Whether screen context is attached to tracked events.
|
|
169
|
+
* @defaultValue true
|
|
170
|
+
*/
|
|
171
|
+
screenContext?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Whether to enable automatic tracking of ScreenView events from the native side.
|
|
174
|
+
* Only tracking UIKit views on iOS and Activity on Android are supported.
|
|
175
|
+
* For tracking React Native views, see the tracker docs for manual and auto-tracking options.
|
|
176
|
+
* @defaultValue false
|
|
177
|
+
*/
|
|
178
|
+
screenViewAutotracking?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Whether enable automatic tracking of background and foreground transitions.
|
|
181
|
+
* @defaultValue false
|
|
182
|
+
*/
|
|
183
|
+
lifecycleAutotracking?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Whether enable automatic tracking of install event.
|
|
186
|
+
* @defaultValue true
|
|
187
|
+
*/
|
|
188
|
+
installAutotracking?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Whether enable crash reporting.
|
|
191
|
+
* @defaultValue true
|
|
192
|
+
*/
|
|
193
|
+
exceptionAutotracking?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Whether enable diagnostic reporting.
|
|
196
|
+
* @defaultValue false
|
|
197
|
+
*/
|
|
198
|
+
diagnosticAutotracking?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Whether to anonymise client-side user identifiers in session and platform context entities
|
|
201
|
+
* @defaultValue false
|
|
202
|
+
*/
|
|
203
|
+
userAnonymisation?: boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* SessionConfiguration
|
|
208
|
+
*/
|
|
209
|
+
export interface SessionConfiguration {
|
|
210
|
+
/**
|
|
211
|
+
* The amount of time in seconds before the session id is updated while the app is in the foreground
|
|
212
|
+
* @defaultValue 1800
|
|
213
|
+
*/
|
|
214
|
+
foregroundTimeout: number;
|
|
215
|
+
/**
|
|
216
|
+
* The amount of time in seconds before the session id is updated while the app is in the background
|
|
217
|
+
* @defaultValue 1800
|
|
218
|
+
*/
|
|
219
|
+
backgroundTimeout: number;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* EmitterConfiguration
|
|
224
|
+
*/
|
|
225
|
+
export interface EmitterConfiguration {
|
|
226
|
+
/**
|
|
227
|
+
* The buffer option for post requests.
|
|
228
|
+
* @defaultValue 'single'
|
|
229
|
+
*/
|
|
230
|
+
bufferOption?: BufferOption;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Maximum number of events collected from the EventStore to be sent in a request.
|
|
234
|
+
* @defaultValue 150
|
|
235
|
+
*/
|
|
236
|
+
emitRange?: number;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
*Maximum number of threads working in parallel in the tracker to send requests.
|
|
240
|
+
* @defaultValue 15
|
|
241
|
+
*/
|
|
242
|
+
threadPoolSize?: number;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Maximum amount of bytes allowed to be sent in a payload in a POST request.
|
|
246
|
+
* @defaultValue 40000
|
|
247
|
+
*/
|
|
248
|
+
byteLimitPost?: number;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Maximum amount of bytes allowed to be sent in a payload in a GET request.
|
|
252
|
+
* @defaultValue 40000
|
|
253
|
+
*/
|
|
254
|
+
byteLimitGet?: number;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Whether to anonymise server-side user identifiers including the `network_userid` and `user_ipaddress`
|
|
258
|
+
* @defaultValue false
|
|
259
|
+
*/
|
|
260
|
+
serverAnonymisation?: boolean;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* SubjectConfiguration
|
|
265
|
+
*/
|
|
266
|
+
export interface SubjectConfiguration {
|
|
267
|
+
[index: string]: unknown;
|
|
268
|
+
/**
|
|
269
|
+
* user id
|
|
270
|
+
*/
|
|
271
|
+
userId?: string | null;
|
|
272
|
+
/**
|
|
273
|
+
* network user id (UUIDv4)
|
|
274
|
+
*/
|
|
275
|
+
networkUserId?: string | null;
|
|
276
|
+
/**
|
|
277
|
+
* domain user id
|
|
278
|
+
*/
|
|
279
|
+
domainUserId?: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* The custom user-agent. It overrides the user-agent used by default.
|
|
282
|
+
*/
|
|
283
|
+
useragent?: string | null;
|
|
284
|
+
/**
|
|
285
|
+
* IP address
|
|
286
|
+
*/
|
|
287
|
+
ipAddress?: string | null;
|
|
288
|
+
/**
|
|
289
|
+
* The timezone label
|
|
290
|
+
*/
|
|
291
|
+
timezone?: string | null;
|
|
292
|
+
/**
|
|
293
|
+
* The language set in the device
|
|
294
|
+
*/
|
|
295
|
+
language?: string | null;
|
|
296
|
+
/**
|
|
297
|
+
* The screen resolution
|
|
298
|
+
*/
|
|
299
|
+
screenResolution?: ScreenSize | null;
|
|
300
|
+
/**
|
|
301
|
+
* The screen viewport size
|
|
302
|
+
*/
|
|
303
|
+
screenViewport?: ScreenSize | null;
|
|
304
|
+
/**
|
|
305
|
+
* color depth (integer)
|
|
306
|
+
*/
|
|
307
|
+
colorDepth?: number | null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* GdprConfiguration
|
|
312
|
+
*/
|
|
313
|
+
export interface GdprConfiguration {
|
|
314
|
+
/**
|
|
315
|
+
* Basis for processing
|
|
316
|
+
*/
|
|
317
|
+
basisForProcessing: Basis;
|
|
318
|
+
/**
|
|
319
|
+
* ID of a GDPR basis document.
|
|
320
|
+
*/
|
|
321
|
+
documentId: string;
|
|
322
|
+
/**
|
|
323
|
+
* Version of the document.
|
|
324
|
+
*/
|
|
325
|
+
documentVersion: string;
|
|
326
|
+
/**
|
|
327
|
+
* Description of the document.
|
|
328
|
+
*/
|
|
329
|
+
documentDescription: string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Global Context
|
|
334
|
+
*/
|
|
335
|
+
export interface GlobalContext {
|
|
336
|
+
/**
|
|
337
|
+
* tag
|
|
338
|
+
*/
|
|
339
|
+
tag: string;
|
|
340
|
+
/**
|
|
341
|
+
* contexts
|
|
342
|
+
*/
|
|
343
|
+
globalContexts: SelfDescribing[];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Global Contexts configuration
|
|
348
|
+
*/
|
|
349
|
+
export type GCConfiguration = GlobalContext[];
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* The TrackerControllerConfiguration
|
|
353
|
+
*/
|
|
354
|
+
export interface TrackerControllerConfiguration {
|
|
355
|
+
trackerConfig?: TrackerConfiguration;
|
|
356
|
+
sessionConfig?: SessionConfiguration;
|
|
357
|
+
emitterConfig?: EmitterConfiguration;
|
|
358
|
+
subjectConfig?: SubjectConfiguration;
|
|
359
|
+
gdprConfig?: GdprConfiguration;
|
|
360
|
+
gcConfig?: GCConfiguration;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* The TrackerConfiguration
|
|
365
|
+
*/
|
|
366
|
+
export interface InitTrackerConfiguration
|
|
367
|
+
extends TrackerControllerConfiguration {
|
|
368
|
+
namespace: string;
|
|
369
|
+
networkConfig: NetworkConfiguration;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* ScreenView event properties
|
|
374
|
+
* schema: iglu:com.snowplowanalytics.mobile/screen_view/jsonschema/1-0-0
|
|
375
|
+
*/
|
|
376
|
+
export type ScreenViewProps = {
|
|
377
|
+
/**
|
|
378
|
+
* The name of the screen viewed
|
|
379
|
+
*/
|
|
380
|
+
name: string;
|
|
381
|
+
/**
|
|
382
|
+
* The id(UUID) of screen that was viewed
|
|
383
|
+
*/
|
|
384
|
+
id?: string;
|
|
385
|
+
/**
|
|
386
|
+
* The type of screen that was viewed
|
|
387
|
+
*/
|
|
388
|
+
type?: string;
|
|
389
|
+
/**
|
|
390
|
+
* The name of the previous screen that was viewed
|
|
391
|
+
*/
|
|
392
|
+
previousName?: string;
|
|
393
|
+
/**
|
|
394
|
+
* The id(UUID) of the previous screen that was viewed
|
|
395
|
+
*/
|
|
396
|
+
previousId?: string;
|
|
397
|
+
/**
|
|
398
|
+
* The type of the previous screen that was viewed
|
|
399
|
+
*/
|
|
400
|
+
previousType?: string;
|
|
401
|
+
/**
|
|
402
|
+
* The type of transition that led to the screen being viewed
|
|
403
|
+
*/
|
|
404
|
+
transitionType?: string;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Structured event properties
|
|
409
|
+
*/
|
|
410
|
+
export type StructuredProps = {
|
|
411
|
+
/**
|
|
412
|
+
* The category of the event
|
|
413
|
+
*/
|
|
414
|
+
category: string;
|
|
415
|
+
/**
|
|
416
|
+
* The action the event represents
|
|
417
|
+
*/
|
|
418
|
+
action: string;
|
|
419
|
+
/**
|
|
420
|
+
* The label the action refers to
|
|
421
|
+
*/
|
|
422
|
+
label?: string;
|
|
423
|
+
/**
|
|
424
|
+
* The property associated with the user action
|
|
425
|
+
*/
|
|
426
|
+
property?: string;
|
|
427
|
+
/**
|
|
428
|
+
* The value associated with the user action
|
|
429
|
+
*/
|
|
430
|
+
value?: number;
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* PageView event properties
|
|
435
|
+
*/
|
|
436
|
+
export type PageViewProps = {
|
|
437
|
+
/**
|
|
438
|
+
* The page URL
|
|
439
|
+
*/
|
|
440
|
+
pageUrl: string;
|
|
441
|
+
/**
|
|
442
|
+
* The page title
|
|
443
|
+
*/
|
|
444
|
+
pageTitle?: string;
|
|
445
|
+
/**
|
|
446
|
+
* The referrer URL
|
|
447
|
+
*/
|
|
448
|
+
referrer?: string;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Timing event properties
|
|
453
|
+
*/
|
|
454
|
+
export type TimingProps = {
|
|
455
|
+
/**
|
|
456
|
+
* The timing category
|
|
457
|
+
*/
|
|
458
|
+
category: string;
|
|
459
|
+
/**
|
|
460
|
+
* The timing variable
|
|
461
|
+
*/
|
|
462
|
+
variable: string;
|
|
463
|
+
/**
|
|
464
|
+
* The time
|
|
465
|
+
*/
|
|
466
|
+
timing: number;
|
|
467
|
+
/**
|
|
468
|
+
* The timing label
|
|
469
|
+
*/
|
|
470
|
+
label?: string;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* ConsentDocument properties
|
|
475
|
+
*/
|
|
476
|
+
export interface ConsentDocument {
|
|
477
|
+
/**
|
|
478
|
+
* The consent document id
|
|
479
|
+
*/
|
|
480
|
+
documentId: string;
|
|
481
|
+
/**
|
|
482
|
+
* The consent document version
|
|
483
|
+
*/
|
|
484
|
+
version: string;
|
|
485
|
+
/**
|
|
486
|
+
* The consent document name
|
|
487
|
+
*/
|
|
488
|
+
name?: string;
|
|
489
|
+
/**
|
|
490
|
+
* The consent document description
|
|
491
|
+
*/
|
|
492
|
+
documentDescription?: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* ConsentGranted event properties
|
|
497
|
+
*/
|
|
498
|
+
export interface ConsentGrantedProps extends ConsentDocument {
|
|
499
|
+
/**
|
|
500
|
+
* The expiry (date-time string, e.g.: '2022-01-01T00:00:00Z')
|
|
501
|
+
*/
|
|
502
|
+
expiry: string;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* ConsentWithdrawn event properties
|
|
507
|
+
*/
|
|
508
|
+
export interface ConsentWithdrawnProps extends ConsentDocument {
|
|
509
|
+
/**
|
|
510
|
+
* Whether user opts out of all data collection
|
|
511
|
+
*/
|
|
512
|
+
all: boolean;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* EcommerceItem
|
|
517
|
+
*/
|
|
518
|
+
export type EcommerceItem = {
|
|
519
|
+
/*
|
|
520
|
+
* The item sku
|
|
521
|
+
*/
|
|
522
|
+
sku: string;
|
|
523
|
+
/*
|
|
524
|
+
* The item price
|
|
525
|
+
*/
|
|
526
|
+
price: number;
|
|
527
|
+
/*
|
|
528
|
+
* The item quantity
|
|
529
|
+
*/
|
|
530
|
+
quantity: number;
|
|
531
|
+
/*
|
|
532
|
+
* The item name
|
|
533
|
+
*/
|
|
534
|
+
name?: string;
|
|
535
|
+
/*
|
|
536
|
+
* The item category
|
|
537
|
+
*/
|
|
538
|
+
category?: string;
|
|
539
|
+
/*
|
|
540
|
+
* The item quantity
|
|
541
|
+
*/
|
|
542
|
+
currency?: string;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* EcommerceTransaction event properties
|
|
547
|
+
*/
|
|
548
|
+
export type EcommerceTransactionProps = {
|
|
549
|
+
/*
|
|
550
|
+
* The order ID of the transaction
|
|
551
|
+
*/
|
|
552
|
+
orderId: string;
|
|
553
|
+
/*
|
|
554
|
+
* The total value of the transaction
|
|
555
|
+
*/
|
|
556
|
+
totalValue: number;
|
|
557
|
+
/*
|
|
558
|
+
* The items(array) purchased in the transaction
|
|
559
|
+
*/
|
|
560
|
+
items: EcommerceItem[];
|
|
561
|
+
/*
|
|
562
|
+
* The transaction affiliation
|
|
563
|
+
*/
|
|
564
|
+
affiliation?: string;
|
|
565
|
+
/*
|
|
566
|
+
* The tax value of the transaction
|
|
567
|
+
*/
|
|
568
|
+
taxValue?: number;
|
|
569
|
+
/*
|
|
570
|
+
* The shipping value of the transaction
|
|
571
|
+
*/
|
|
572
|
+
shipping?: number;
|
|
573
|
+
/*
|
|
574
|
+
* The city of the transaction
|
|
575
|
+
*/
|
|
576
|
+
city?: string;
|
|
577
|
+
/*
|
|
578
|
+
* The state(US) of the transaction
|
|
579
|
+
*/
|
|
580
|
+
state?: string;
|
|
581
|
+
/*
|
|
582
|
+
* The country of the transaction
|
|
583
|
+
*/
|
|
584
|
+
country?: string;
|
|
585
|
+
/*
|
|
586
|
+
* The currency of the transaction
|
|
587
|
+
*/
|
|
588
|
+
currency?: string;
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* DeepLinkReceived event properties
|
|
593
|
+
* schema: iglu:com.snowplowanalytics.mobile/deep_link_received/jsonschema/1-0-0
|
|
594
|
+
*/
|
|
595
|
+
export type DeepLinkReceivedProps = {
|
|
596
|
+
/**
|
|
597
|
+
* URL in the received deep-link.
|
|
598
|
+
*/
|
|
599
|
+
url: string;
|
|
600
|
+
/**
|
|
601
|
+
* Referrer URL, source of this deep-link.
|
|
602
|
+
*/
|
|
603
|
+
referrer?: string;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Attachment object that identify an attachment in the MessageNotification.
|
|
608
|
+
*/
|
|
609
|
+
export type MessageNotificationAttachmentProps = {
|
|
610
|
+
identifier: string;
|
|
611
|
+
type: string;
|
|
612
|
+
url: string;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* MessageNotification event properties
|
|
617
|
+
* schema: iglu:com.snowplowanalytics.mobile/message_notification/jsonschema/1-0-0
|
|
618
|
+
*/
|
|
619
|
+
export type MessageNotificationProps = {
|
|
620
|
+
/**
|
|
621
|
+
* The action associated with the notification.
|
|
622
|
+
*/
|
|
623
|
+
action?: string;
|
|
624
|
+
/*
|
|
625
|
+
* Attachments added to the notification (they can be part of the data object).
|
|
626
|
+
*/
|
|
627
|
+
attachments?: MessageNotificationAttachmentProps[];
|
|
628
|
+
/**
|
|
629
|
+
* The notification's body.
|
|
630
|
+
*/
|
|
631
|
+
body: string;
|
|
632
|
+
/*
|
|
633
|
+
* Variable string values to be used in place of the format specifiers in bodyLocArgs to use to localize the body text to the user's current localization.
|
|
634
|
+
*/
|
|
635
|
+
bodyLocArgs?: string[];
|
|
636
|
+
/**
|
|
637
|
+
* The key to the body string in the app's string resources to use to localize the body text to the user's current localization.
|
|
638
|
+
*/
|
|
639
|
+
bodyLocKey?: string;
|
|
640
|
+
/**
|
|
641
|
+
* The category associated to the notification.
|
|
642
|
+
*/
|
|
643
|
+
category?: string;
|
|
644
|
+
/**
|
|
645
|
+
* The application is notified of the delivery of the notification if it's in the foreground or background, the app will be woken up (iOS only).
|
|
646
|
+
*/
|
|
647
|
+
contentAvailable?: boolean;
|
|
648
|
+
/**
|
|
649
|
+
* The group which this notification is part of.
|
|
650
|
+
*/
|
|
651
|
+
group?: string;
|
|
652
|
+
/**
|
|
653
|
+
* The icon associated to the notification (Android only).
|
|
654
|
+
*/
|
|
655
|
+
icon?: string;
|
|
656
|
+
/**
|
|
657
|
+
* The number of items this notification represent.
|
|
658
|
+
*/
|
|
659
|
+
notificationCount?: number;
|
|
660
|
+
/**
|
|
661
|
+
* The time when the event of the notification occurred.
|
|
662
|
+
*/
|
|
663
|
+
notificationTimestamp?: string;
|
|
664
|
+
/**
|
|
665
|
+
* The sound played when the device receives the notification.
|
|
666
|
+
*/
|
|
667
|
+
sound?: string;
|
|
668
|
+
/**
|
|
669
|
+
* The notification's subtitle. (iOS only)
|
|
670
|
+
*/
|
|
671
|
+
subtitle?: string;
|
|
672
|
+
/**
|
|
673
|
+
* An identifier similar to 'group' but usable for different purposes (Android only).
|
|
674
|
+
*/
|
|
675
|
+
tag?: string;
|
|
676
|
+
/**
|
|
677
|
+
* An identifier similar to 'group' but usable for different purposes (iOS only).
|
|
678
|
+
*/
|
|
679
|
+
threadIdentifier?: string;
|
|
680
|
+
/**
|
|
681
|
+
* The notification's title.
|
|
682
|
+
*/
|
|
683
|
+
title: string;
|
|
684
|
+
/**
|
|
685
|
+
* Variable string values to be used in place of the format specifiers in titleLocArgs to use to localize the title text to the user's current localization.
|
|
686
|
+
*/
|
|
687
|
+
titleLocArgs?: string[];
|
|
688
|
+
/**
|
|
689
|
+
* The key to the title string in the app's string resources to use to localize the title text to the user's current localization.
|
|
690
|
+
*/
|
|
691
|
+
titleLocKey?: string;
|
|
692
|
+
/**
|
|
693
|
+
* The trigger that raised the notification message. Must be one of: push, location, calendar, timeInterval, other
|
|
694
|
+
*/
|
|
695
|
+
trigger: Trigger;
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* The ReactNativeTracker type
|
|
700
|
+
*/
|
|
701
|
+
export type ReactNativeTracker = {
|
|
702
|
+
/**
|
|
703
|
+
* Tracks a self-descibing event
|
|
704
|
+
*
|
|
705
|
+
* @param argmap - The self-describing event properties
|
|
706
|
+
* @param contexts - The array of event contexts
|
|
707
|
+
* @typeParam TData - The type of the data object within the SelfDescribing object
|
|
708
|
+
*/
|
|
709
|
+
readonly trackSelfDescribingEvent: <
|
|
710
|
+
TData extends Record<keyof TData, unknown> = Record<string, unknown>
|
|
711
|
+
>(
|
|
712
|
+
argmap: SelfDescribing<TData>,
|
|
713
|
+
contexts?: EventContext[]
|
|
714
|
+
) => Promise<void>;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Tracks a screen-view event
|
|
718
|
+
*
|
|
719
|
+
* @param argmap - The screen-view event's properties
|
|
720
|
+
* @param contexts - The array of event contexts
|
|
721
|
+
*/
|
|
722
|
+
readonly trackScreenViewEvent: (
|
|
723
|
+
argmap: ScreenViewProps,
|
|
724
|
+
contexts?: EventContext[]
|
|
725
|
+
) => Promise<void>;
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Tracks a structured event
|
|
729
|
+
*
|
|
730
|
+
* @param argmap - The structured event properties
|
|
731
|
+
* @param contexts - The array of event contexts
|
|
732
|
+
*/
|
|
733
|
+
readonly trackStructuredEvent: (
|
|
734
|
+
argmap: StructuredProps,
|
|
735
|
+
contexts?: EventContext[]
|
|
736
|
+
) => Promise<void>;
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Tracks a page-view event
|
|
740
|
+
*
|
|
741
|
+
* @param argmap - The page-view event properties
|
|
742
|
+
* @param contexts - The array of event contexts
|
|
743
|
+
*/
|
|
744
|
+
readonly trackPageViewEvent: (
|
|
745
|
+
argmap: PageViewProps,
|
|
746
|
+
contexts?: EventContext[]
|
|
747
|
+
) => Promise<void>;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Tracks a timing event
|
|
751
|
+
*
|
|
752
|
+
* @param argmap - The timing event properties
|
|
753
|
+
* @param contexts - The array of event contexts
|
|
754
|
+
*/
|
|
755
|
+
readonly trackTimingEvent: (
|
|
756
|
+
argmap: TimingProps,
|
|
757
|
+
contexts?: EventContext[]
|
|
758
|
+
) => Promise<void>;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Tracks a consent-granted event
|
|
762
|
+
*
|
|
763
|
+
* @param argmap - The consent-granted event properties
|
|
764
|
+
* @param contexts - The array of event contexts
|
|
765
|
+
*/
|
|
766
|
+
readonly trackConsentGrantedEvent: (
|
|
767
|
+
argmap: ConsentGrantedProps,
|
|
768
|
+
contexts?: EventContext[]
|
|
769
|
+
) => Promise<void>;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Tracks a consent-withdrawn event
|
|
773
|
+
*
|
|
774
|
+
* @param argmap - The consent-withdrawn event properties
|
|
775
|
+
* @param contexts - The array of event contexts
|
|
776
|
+
*/
|
|
777
|
+
readonly trackConsentWithdrawnEvent: (
|
|
778
|
+
argmap: ConsentWithdrawnProps,
|
|
779
|
+
contexts?: EventContext[]
|
|
780
|
+
) => Promise<void>;
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Tracks an ecommerce-transaction event
|
|
784
|
+
*
|
|
785
|
+
* @param argmap - The ecommerce-transaction event properties
|
|
786
|
+
* @param contexts - The array of event contexts
|
|
787
|
+
*/
|
|
788
|
+
readonly trackEcommerceTransactionEvent: (
|
|
789
|
+
argmap: EcommerceTransactionProps,
|
|
790
|
+
contexts?: EventContext[]
|
|
791
|
+
) => Promise<void>;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Tracks a deep link received event
|
|
795
|
+
*
|
|
796
|
+
* @param argmap - The deep link received event properties
|
|
797
|
+
* @param contexts - The array of event contexts
|
|
798
|
+
*/
|
|
799
|
+
readonly trackDeepLinkReceivedEvent: (
|
|
800
|
+
argmap: DeepLinkReceivedProps,
|
|
801
|
+
contexts?: EventContext[]
|
|
802
|
+
) => Promise<void>;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Tracks a message notification event
|
|
806
|
+
*
|
|
807
|
+
* @param argmap - The message notification event properties
|
|
808
|
+
* @param contexts - The array of event contexts
|
|
809
|
+
*/
|
|
810
|
+
readonly trackMessageNotificationEvent: (
|
|
811
|
+
argmap: MessageNotificationProps,
|
|
812
|
+
contexts?: EventContext[]
|
|
813
|
+
) => Promise<void>;
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Removes global contexts
|
|
817
|
+
*
|
|
818
|
+
* @param tag - The tag of the global contexts to remove
|
|
819
|
+
*/
|
|
820
|
+
readonly removeGlobalContexts: (tag: string) => Promise<void>;
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Adds global contexts
|
|
824
|
+
*
|
|
825
|
+
* @param gc - The global context to add
|
|
826
|
+
*/
|
|
827
|
+
readonly addGlobalContexts: (gc: GlobalContext) => Promise<void>;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Sets the userId of the tracker subject
|
|
831
|
+
*
|
|
832
|
+
* @param newUid - The new userId
|
|
833
|
+
*/
|
|
834
|
+
readonly setUserId: (newUid: string | null) => Promise<void>;
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Sets the networkUserId of the tracker subject
|
|
838
|
+
*
|
|
839
|
+
* @param newNuid - The new networkUserId
|
|
840
|
+
*/
|
|
841
|
+
readonly setNetworkUserId: (newNuid: string | null) => Promise<void>;
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Sets the domainUserId of the tracker subject
|
|
845
|
+
*
|
|
846
|
+
* @param newDuid - The new domainUserId
|
|
847
|
+
*/
|
|
848
|
+
readonly setDomainUserId: (newDuid: string | null) => Promise<void>;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Sets the ipAddress of the tracker subject
|
|
852
|
+
*
|
|
853
|
+
* @param newIp - The new ipAddress
|
|
854
|
+
*/
|
|
855
|
+
readonly setIpAddress: (newIp: string | null) => Promise<void>;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Sets the useragent of the tracker subject
|
|
859
|
+
*
|
|
860
|
+
* @param newUagent - The new useragent
|
|
861
|
+
*/
|
|
862
|
+
readonly setUseragent: (newUagent: string | null) => Promise<void>;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Sets the timezone of the tracker subject
|
|
866
|
+
*
|
|
867
|
+
* @param newTz - The new timezone
|
|
868
|
+
*/
|
|
869
|
+
readonly setTimezone: (newTz: string | null) => Promise<void>;
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Sets the language of the tracker subject
|
|
873
|
+
*
|
|
874
|
+
* @param newLang - The new language
|
|
875
|
+
*/
|
|
876
|
+
readonly setLanguage: (newLang: string | null) => Promise<void>;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Sets the screenResolution of the tracker subject
|
|
880
|
+
*
|
|
881
|
+
* @param newRes - The new screenResolution
|
|
882
|
+
*/
|
|
883
|
+
readonly setScreenResolution: (newRes: ScreenSize | null) => Promise<void>;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Sets the screenViewport of the tracker subject
|
|
887
|
+
*
|
|
888
|
+
* @param newView - The new screenViewport
|
|
889
|
+
*/
|
|
890
|
+
readonly setScreenViewport: (newView: ScreenSize | null) => Promise<void>;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Sets the colorDepth of the tracker subject
|
|
894
|
+
*
|
|
895
|
+
* @param newColorD - The new colorDepth
|
|
896
|
+
*/
|
|
897
|
+
readonly setColorDepth: (newLang: number | null) => Promise<void>;
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Sets subject data
|
|
901
|
+
*
|
|
902
|
+
* @param config - The new subject data
|
|
903
|
+
*/
|
|
904
|
+
readonly setSubjectData: (config: SubjectConfiguration) => Promise<void>;
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Gets the dentifier for the user of the session
|
|
908
|
+
*
|
|
909
|
+
* @returns {Promise<string | undefined>}
|
|
910
|
+
*/
|
|
911
|
+
readonly getSessionUserId: () => Promise<string | undefined>;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Gets the identifier for the session
|
|
915
|
+
*
|
|
916
|
+
* @returns {Promise<string | undefined>}
|
|
917
|
+
*/
|
|
918
|
+
readonly getSessionId: () => Promise<string | undefined>;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Gets the index of the current session for this user
|
|
922
|
+
*
|
|
923
|
+
* @returns {Promise<number | undefined>}
|
|
924
|
+
*/
|
|
925
|
+
readonly getSessionIndex: () => Promise<number | undefined>;
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Gets whether the app is currently in background state
|
|
929
|
+
*
|
|
930
|
+
* @returns {Promise<boolean | undefined>}
|
|
931
|
+
*/
|
|
932
|
+
readonly getIsInBackground: () => Promise<boolean | undefined>;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Gets the number of background transitions in the current session
|
|
936
|
+
*
|
|
937
|
+
* @returns {Promise<number | undefined>}
|
|
938
|
+
*/
|
|
939
|
+
readonly getBackgroundIndex: () => Promise<number | undefined>;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Gets the number of foreground transitions in the current session.
|
|
943
|
+
*
|
|
944
|
+
* @returns {Promise<number | undefined>}
|
|
945
|
+
*/
|
|
946
|
+
readonly getForegroundIndex: () => Promise<number | undefined>;
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Internal event type for page views tracked using the WebView tracker.
|
|
951
|
+
*/
|
|
952
|
+
export interface WebViewPageViewEvent {
|
|
953
|
+
title?: string | null;
|
|
954
|
+
url?: string;
|
|
955
|
+
referrer?: string;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Internal type exchanged in messages received from the WebView tracker in Web views through the web view callback.
|
|
960
|
+
*/
|
|
961
|
+
export type WebViewMessage = {
|
|
962
|
+
command:
|
|
963
|
+
| 'trackSelfDescribingEvent'
|
|
964
|
+
| 'trackStructEvent'
|
|
965
|
+
| 'trackPageView'
|
|
966
|
+
| 'trackScreenView';
|
|
967
|
+
event:
|
|
968
|
+
| StructuredProps
|
|
969
|
+
| SelfDescribing
|
|
970
|
+
| ScreenViewProps
|
|
971
|
+
| WebViewPageViewEvent;
|
|
972
|
+
context?: Array<SelfDescribing> | null;
|
|
973
|
+
trackers?: Array<string>;
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Internal type for representing the interface to the native trackers.
|
|
978
|
+
*/
|
|
979
|
+
export interface Native {
|
|
980
|
+
createTracker: (configuration: InitTrackerConfiguration) => Promise<void>;
|
|
981
|
+
removeTracker: (details: { tracker: string }) => Promise<boolean>;
|
|
982
|
+
removeAllTrackers: () => Promise<boolean>;
|
|
983
|
+
trackSelfDescribingEvent: (details: {
|
|
984
|
+
tracker: string | null;
|
|
985
|
+
eventData: SelfDescribing;
|
|
986
|
+
contexts: EventContext[];
|
|
987
|
+
}) => Promise<void>;
|
|
988
|
+
trackStructuredEvent: (details: {
|
|
989
|
+
tracker: string | null;
|
|
990
|
+
eventData: StructuredProps;
|
|
991
|
+
contexts: EventContext[];
|
|
992
|
+
}) => Promise<void>;
|
|
993
|
+
trackScreenViewEvent: (details: {
|
|
994
|
+
tracker: string | null;
|
|
995
|
+
eventData: ScreenViewProps;
|
|
996
|
+
contexts: EventContext[];
|
|
997
|
+
}) => Promise<void>;
|
|
998
|
+
trackPageViewEvent: (details: {
|
|
999
|
+
tracker: string | null;
|
|
1000
|
+
eventData: PageViewProps;
|
|
1001
|
+
contexts: EventContext[];
|
|
1002
|
+
}) => Promise<void>;
|
|
1003
|
+
trackTimingEvent: (details: {
|
|
1004
|
+
tracker: string | null;
|
|
1005
|
+
eventData: TimingProps;
|
|
1006
|
+
contexts: EventContext[];
|
|
1007
|
+
}) => Promise<void>;
|
|
1008
|
+
trackConsentGrantedEvent: (details: {
|
|
1009
|
+
tracker: string | null;
|
|
1010
|
+
eventData: ConsentGrantedProps;
|
|
1011
|
+
contexts: EventContext[];
|
|
1012
|
+
}) => Promise<void>;
|
|
1013
|
+
trackConsentWithdrawnEvent: (details: {
|
|
1014
|
+
tracker: string | null;
|
|
1015
|
+
eventData: ConsentWithdrawnProps;
|
|
1016
|
+
contexts: EventContext[];
|
|
1017
|
+
}) => Promise<void>;
|
|
1018
|
+
trackEcommerceTransactionEvent: (details: {
|
|
1019
|
+
tracker: string | null;
|
|
1020
|
+
eventData: EcommerceTransactionProps;
|
|
1021
|
+
contexts: EventContext[];
|
|
1022
|
+
}) => Promise<void>;
|
|
1023
|
+
trackDeepLinkReceivedEvent: (details: {
|
|
1024
|
+
tracker: string | null;
|
|
1025
|
+
eventData: DeepLinkReceivedProps;
|
|
1026
|
+
contexts: EventContext[];
|
|
1027
|
+
}) => Promise<void>;
|
|
1028
|
+
trackMessageNotificationEvent: (details: {
|
|
1029
|
+
tracker: string | null;
|
|
1030
|
+
eventData: MessageNotificationProps;
|
|
1031
|
+
contexts: EventContext[];
|
|
1032
|
+
}) => Promise<void>;
|
|
1033
|
+
removeGlobalContexts: (details: {
|
|
1034
|
+
tracker: string;
|
|
1035
|
+
removeTag: string;
|
|
1036
|
+
}) => Promise<void>;
|
|
1037
|
+
addGlobalContexts: (details: {
|
|
1038
|
+
tracker: string;
|
|
1039
|
+
addGlobalContext: GlobalContext;
|
|
1040
|
+
}) => Promise<void>;
|
|
1041
|
+
setUserId: (details: {
|
|
1042
|
+
tracker: string;
|
|
1043
|
+
userId: string | null;
|
|
1044
|
+
}) => Promise<void>;
|
|
1045
|
+
setNetworkUserId: (details: {
|
|
1046
|
+
tracker: string;
|
|
1047
|
+
networkUserId: string | null;
|
|
1048
|
+
}) => Promise<void>;
|
|
1049
|
+
setDomainUserId: (details: {
|
|
1050
|
+
tracker: string;
|
|
1051
|
+
domainUserId: string | null;
|
|
1052
|
+
}) => Promise<void>;
|
|
1053
|
+
setIpAddress: (details: {
|
|
1054
|
+
tracker: string;
|
|
1055
|
+
ipAddress: string | null;
|
|
1056
|
+
}) => Promise<void>;
|
|
1057
|
+
setUseragent: (details: {
|
|
1058
|
+
tracker: string;
|
|
1059
|
+
useragent: string | null;
|
|
1060
|
+
}) => Promise<void>;
|
|
1061
|
+
setTimezone: (details: {
|
|
1062
|
+
tracker: string;
|
|
1063
|
+
timezone: string | null;
|
|
1064
|
+
}) => Promise<void>;
|
|
1065
|
+
setLanguage: (details: {
|
|
1066
|
+
tracker: string;
|
|
1067
|
+
language: string | null;
|
|
1068
|
+
}) => Promise<void>;
|
|
1069
|
+
setScreenResolution: (details: {
|
|
1070
|
+
tracker: string;
|
|
1071
|
+
screenResolution: ScreenSize | null;
|
|
1072
|
+
}) => Promise<void>;
|
|
1073
|
+
setScreenViewport: (details: {
|
|
1074
|
+
tracker: string;
|
|
1075
|
+
screenViewport: ScreenSize | null;
|
|
1076
|
+
}) => Promise<void>;
|
|
1077
|
+
setColorDepth: (details: {
|
|
1078
|
+
tracker: string;
|
|
1079
|
+
colorDepth: number | null;
|
|
1080
|
+
}) => Promise<void>;
|
|
1081
|
+
getSessionUserId: (details: { tracker: string }) => Promise<string>;
|
|
1082
|
+
getSessionId: (details: { tracker: string }) => Promise<string>;
|
|
1083
|
+
getSessionIndex: (details: { tracker: string }) => Promise<number>;
|
|
1084
|
+
getIsInBackground: (details: { tracker: string }) => Promise<boolean>;
|
|
1085
|
+
getBackgroundIndex: (details: { tracker: string }) => Promise<number>;
|
|
1086
|
+
getForegroundIndex: (details: { tracker: string }) => Promise<number>;
|
|
1087
|
+
}
|