@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
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
const Micro = require('./microHelpers.js');
|
|
2
|
+
|
|
3
|
+
describe('tests helper functions of helpers.js', () => {
|
|
4
|
+
it('tests compare with null, numbers, strings, booleans', () => {
|
|
5
|
+
// null
|
|
6
|
+
expect(Micro.compare(null, null)).toBe(true);
|
|
7
|
+
expect(Micro.compare(null, [])).toBe(false);
|
|
8
|
+
expect(Micro.compare('not null', null)).toBe(false);
|
|
9
|
+
|
|
10
|
+
// numbers
|
|
11
|
+
expect(Micro.compare(1, 1)).toBe(true);
|
|
12
|
+
expect(Micro.compare(2.3, 0)).toBe(false);
|
|
13
|
+
|
|
14
|
+
// strings
|
|
15
|
+
expect(Micro.compare('a', 'a')).toBe(true);
|
|
16
|
+
expect(Micro.compare('a', 'ab')).toBe(false);
|
|
17
|
+
expect(Micro.compare('', 'b')).toBe(false);
|
|
18
|
+
|
|
19
|
+
// booleans
|
|
20
|
+
expect(Micro.compare(false, false)).toBe(true);
|
|
21
|
+
expect(Micro.compare(true, false)).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('tests compare with arrays', () => {
|
|
25
|
+
// arrays and nested arrays
|
|
26
|
+
expect(Micro.compare([], [])).toBe(true);
|
|
27
|
+
|
|
28
|
+
expect(Micro.compare([], [1, 2])).toBe(true);
|
|
29
|
+
|
|
30
|
+
expect(Micro.compare([1, 2], [])).toBe(false);
|
|
31
|
+
|
|
32
|
+
expect(Micro.compare([1, 2], [2])).toBe(false);
|
|
33
|
+
|
|
34
|
+
expect(Micro.compare([1, 2], [2, 1])).toBe(true);
|
|
35
|
+
|
|
36
|
+
expect(Micro.compare([1, 2, 3], [4, 2, 5, 3, 1, 6])).toBe(true);
|
|
37
|
+
|
|
38
|
+
expect(Micro.compare([1, [2, 3], 4], [5, 4, [3, 2, 0], 0, 1])).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('tests compare with objects', () => {
|
|
42
|
+
expect(Micro.compare({}, {})).toBe(true);
|
|
43
|
+
|
|
44
|
+
expect(Micro.compare({}, {a: 1})).toBe(true);
|
|
45
|
+
|
|
46
|
+
expect(Micro.compare({a: 1}, {})).toBe(false);
|
|
47
|
+
|
|
48
|
+
expect(
|
|
49
|
+
Micro.compare(
|
|
50
|
+
{
|
|
51
|
+
a: 1,
|
|
52
|
+
b: 2,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
a: 1,
|
|
56
|
+
b: 3,
|
|
57
|
+
},
|
|
58
|
+
),
|
|
59
|
+
).toBe(false);
|
|
60
|
+
|
|
61
|
+
expect(
|
|
62
|
+
Micro.compare(
|
|
63
|
+
{
|
|
64
|
+
a: 1,
|
|
65
|
+
b: 2,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
b: 2,
|
|
69
|
+
c: 3,
|
|
70
|
+
a: 1,
|
|
71
|
+
},
|
|
72
|
+
),
|
|
73
|
+
).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('tests compare with arrays of objects', () => {
|
|
77
|
+
// expected, actual
|
|
78
|
+
let exp, act;
|
|
79
|
+
|
|
80
|
+
exp = [
|
|
81
|
+
{
|
|
82
|
+
a: 1,
|
|
83
|
+
b: 2,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
c: 3,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
act = [
|
|
90
|
+
{
|
|
91
|
+
c: 3,
|
|
92
|
+
e: 5,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
b: 2,
|
|
96
|
+
a: 1,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
d: 4,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
expect(Micro.compare(exp, act)).toBe(true);
|
|
103
|
+
|
|
104
|
+
exp = [
|
|
105
|
+
{
|
|
106
|
+
a: 1,
|
|
107
|
+
b: 2,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
c: 3,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
act = [
|
|
114
|
+
{
|
|
115
|
+
c: 3,
|
|
116
|
+
e: 5,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
b: 2,
|
|
120
|
+
a: 2,
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
expect(Micro.compare(exp, act)).toBe(false);
|
|
124
|
+
|
|
125
|
+
exp = [
|
|
126
|
+
{
|
|
127
|
+
a: 1,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
c: [
|
|
131
|
+
{
|
|
132
|
+
d: 4,
|
|
133
|
+
e: {
|
|
134
|
+
f: 6,
|
|
135
|
+
g: [1, 2],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
act = [
|
|
142
|
+
{
|
|
143
|
+
z: 10,
|
|
144
|
+
c: [
|
|
145
|
+
{
|
|
146
|
+
e: {
|
|
147
|
+
g: [3, 2, 1],
|
|
148
|
+
f: 6,
|
|
149
|
+
i: 2,
|
|
150
|
+
},
|
|
151
|
+
d: 4,
|
|
152
|
+
h: 7,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
a: 1,
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
expect(Micro.compare(exp, act)).toBe(true);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('tests compare with nested objects', () => {
|
|
164
|
+
// expected, actual
|
|
165
|
+
let exp, act_1, act_2;
|
|
166
|
+
|
|
167
|
+
exp = {
|
|
168
|
+
a: {
|
|
169
|
+
b: {
|
|
170
|
+
c: [1, 2],
|
|
171
|
+
d: 'test',
|
|
172
|
+
e: 5,
|
|
173
|
+
},
|
|
174
|
+
f: 1,
|
|
175
|
+
},
|
|
176
|
+
aa: [
|
|
177
|
+
{},
|
|
178
|
+
{
|
|
179
|
+
bb: 1,
|
|
180
|
+
cc: {
|
|
181
|
+
dd: {
|
|
182
|
+
ee: {
|
|
183
|
+
ff: 0,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
[
|
|
189
|
+
[0, 1],
|
|
190
|
+
{
|
|
191
|
+
aaa: 'bbb',
|
|
192
|
+
ccc: [
|
|
193
|
+
{
|
|
194
|
+
ddd: 3.14,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
0,
|
|
199
|
+
],
|
|
200
|
+
true,
|
|
201
|
+
],
|
|
202
|
+
last: 'thing',
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// "innocent" diffs
|
|
206
|
+
act_1 = {
|
|
207
|
+
diff1: 0,
|
|
208
|
+
a: {
|
|
209
|
+
b: {
|
|
210
|
+
c: [1, 2],
|
|
211
|
+
diff2: 0,
|
|
212
|
+
d: 'test',
|
|
213
|
+
e: 5,
|
|
214
|
+
},
|
|
215
|
+
diff3: [0, 0, 0],
|
|
216
|
+
f: 1,
|
|
217
|
+
},
|
|
218
|
+
aa: [
|
|
219
|
+
{},
|
|
220
|
+
['diff41', 'diff42'],
|
|
221
|
+
{
|
|
222
|
+
bb: 1,
|
|
223
|
+
cc: {
|
|
224
|
+
dd: {
|
|
225
|
+
ee: {
|
|
226
|
+
ff: 0,
|
|
227
|
+
diff6: 0,
|
|
228
|
+
},
|
|
229
|
+
diff7: {},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
diff8: 0,
|
|
233
|
+
},
|
|
234
|
+
[
|
|
235
|
+
[0, 1],
|
|
236
|
+
['diff9'],
|
|
237
|
+
{
|
|
238
|
+
aaa: 'bbb',
|
|
239
|
+
ccc: [
|
|
240
|
+
{
|
|
241
|
+
ddd: 3.14,
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
0,
|
|
246
|
+
],
|
|
247
|
+
true,
|
|
248
|
+
],
|
|
249
|
+
last: 'thing',
|
|
250
|
+
diff0: 'last',
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// pi
|
|
254
|
+
act_2 = {
|
|
255
|
+
a: {
|
|
256
|
+
b: {
|
|
257
|
+
c: [1, 2],
|
|
258
|
+
d: 'test',
|
|
259
|
+
e: 5,
|
|
260
|
+
},
|
|
261
|
+
f: 1,
|
|
262
|
+
},
|
|
263
|
+
aa: [
|
|
264
|
+
{},
|
|
265
|
+
{
|
|
266
|
+
bb: 1,
|
|
267
|
+
cc: {
|
|
268
|
+
dd: {
|
|
269
|
+
ee: {
|
|
270
|
+
ff: 0,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
[
|
|
276
|
+
[0, 1],
|
|
277
|
+
{
|
|
278
|
+
aaa: 'bbb',
|
|
279
|
+
ccc: [
|
|
280
|
+
{
|
|
281
|
+
ddd: 3.1415, // only diff with exp
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
0,
|
|
286
|
+
],
|
|
287
|
+
true,
|
|
288
|
+
],
|
|
289
|
+
last: 'thing',
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
expect(Micro.compare(exp, act_1)).toBe(true);
|
|
293
|
+
expect(Micro.compare(exp, act_2)).toBe(false);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Self-describing schemas
|
|
2
|
+
const appInstall =
|
|
3
|
+
'iglu:com.snowplowanalytics.mobile/application_install/jsonschema/1-0-0';
|
|
4
|
+
const screenView =
|
|
5
|
+
'iglu:com.snowplowanalytics.mobile/screen_view/jsonschema/1-0-0';
|
|
6
|
+
const adImpression =
|
|
7
|
+
'iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0';
|
|
8
|
+
const linkClick =
|
|
9
|
+
'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1';
|
|
10
|
+
const consentWithdrawn =
|
|
11
|
+
'iglu:com.snowplowanalytics.snowplow/consent_withdrawn/jsonschema/1-0-0';
|
|
12
|
+
const consentGranted =
|
|
13
|
+
'iglu:com.snowplowanalytics.snowplow/consent_granted/jsonschema/1-0-0';
|
|
14
|
+
const consentDoc =
|
|
15
|
+
'iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0';
|
|
16
|
+
const timing = 'iglu:com.snowplowanalytics.snowplow/timing/jsonschema/1-0-0';
|
|
17
|
+
const deepLink =
|
|
18
|
+
'iglu:com.snowplowanalytics.mobile/deep_link_received/jsonschema/1-0-0';
|
|
19
|
+
const messageNotification =
|
|
20
|
+
'iglu:com.snowplowanalytics.mobile/message_notification/jsonschema/1-0-0';
|
|
21
|
+
|
|
22
|
+
// Context schemas
|
|
23
|
+
const mobileApplicationContext =
|
|
24
|
+
'iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0';
|
|
25
|
+
const mobileContext =
|
|
26
|
+
'iglu:com.snowplowanalytics.snowplow/mobile_context/jsonschema/1-0-3';
|
|
27
|
+
const mobileScreenContext =
|
|
28
|
+
'iglu:com.snowplowanalytics.mobile/screen/jsonschema/1-0-0';
|
|
29
|
+
const clientSessionContext =
|
|
30
|
+
'iglu:com.snowplowanalytics.snowplow/client_session/jsonschema/1-0-2';
|
|
31
|
+
const gdprContext = 'iglu:com.snowplowanalytics.snowplow/gdpr/jsonschema/1-0-0';
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
appInstall,
|
|
35
|
+
screenView,
|
|
36
|
+
adImpression,
|
|
37
|
+
linkClick,
|
|
38
|
+
consentWithdrawn,
|
|
39
|
+
consentGranted,
|
|
40
|
+
consentDoc,
|
|
41
|
+
timing,
|
|
42
|
+
mobileApplicationContext,
|
|
43
|
+
mobileContext,
|
|
44
|
+
mobileScreenContext,
|
|
45
|
+
clientSessionContext,
|
|
46
|
+
gdprContext,
|
|
47
|
+
deepLink,
|
|
48
|
+
messageNotification,
|
|
49
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
maxWorkers: 1,
|
|
4
|
+
globalSetup: "detox/runners/jest/globalSetup",
|
|
5
|
+
globalTeardown: "detox/runners/jest/globalTeardown",
|
|
6
|
+
testEnvironment: "detox/runners/jest/testEnvironment",
|
|
7
|
+
setupFilesAfterEnv: ["./setup.js"],
|
|
8
|
+
testRunner: "jest-circus/runner",
|
|
9
|
+
testTimeout: 300000,
|
|
10
|
+
testRegex: "\\.e2e.detox\\.js$",
|
|
11
|
+
transform: {
|
|
12
|
+
"\\.tsx?$": "ts-jest"
|
|
13
|
+
},
|
|
14
|
+
reporters: ["detox/runners/jest/reporter"],
|
|
15
|
+
verbose: true
|
|
16
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
const commands = require('./helpers/microCommands.js');
|
|
2
|
+
const schemas = require('./helpers/schemas.js');
|
|
3
|
+
|
|
4
|
+
test('no bad events', async () => {
|
|
5
|
+
await commands.assertNoBadEvents();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test('number of screen_view events', async () => {
|
|
9
|
+
await commands.eventsWithSchema(schemas.screenView, 9);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('number of structured events', async () => {
|
|
13
|
+
await commands.eventsWithEventType('struct', 6);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('number of page_view events', async () => {
|
|
17
|
+
await commands.eventsWithEventType('page_view', 4);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('screen_view with adImpression context', async () => {
|
|
21
|
+
await commands.eventsWithProperties(
|
|
22
|
+
{
|
|
23
|
+
schema: schemas.screenView,
|
|
24
|
+
values: {
|
|
25
|
+
name: 'withContext and screenId',
|
|
26
|
+
},
|
|
27
|
+
contexts: [
|
|
28
|
+
{
|
|
29
|
+
schema: schemas.adImpression,
|
|
30
|
+
data: {
|
|
31
|
+
impressionId: 'test_imp_id',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
1
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('self-describing ad_impression event', async () => {
|
|
41
|
+
await commands.eventsWithProperties(
|
|
42
|
+
{
|
|
43
|
+
schema: schemas.linkClick,
|
|
44
|
+
values: {
|
|
45
|
+
targetUrl: 'test.test',
|
|
46
|
+
},
|
|
47
|
+
contexts: [
|
|
48
|
+
{ schema: schemas.mobileApplicationContext },
|
|
49
|
+
{ schema: schemas.mobileContext },
|
|
50
|
+
{ schema: schemas.mobileScreenContext },
|
|
51
|
+
{ schema: schemas.clientSessionContext },
|
|
52
|
+
{ schema: schemas.gdprContext },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
1
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('consentWithdrawn event', async () => {
|
|
60
|
+
await commands.eventsWithProperties(
|
|
61
|
+
{
|
|
62
|
+
schema: schemas.consentWithdrawn,
|
|
63
|
+
values: {
|
|
64
|
+
all: true,
|
|
65
|
+
},
|
|
66
|
+
contexts: [
|
|
67
|
+
{
|
|
68
|
+
schema: schemas.consentDoc,
|
|
69
|
+
data: {
|
|
70
|
+
id: '0987',
|
|
71
|
+
version: '0.2.0',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
1
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('consentGranted event', async () => {
|
|
81
|
+
await commands.eventsWithProperties(
|
|
82
|
+
{
|
|
83
|
+
schema: schemas.consentGranted,
|
|
84
|
+
values: {
|
|
85
|
+
expiry: '2022-01-01T00:00:00Z',
|
|
86
|
+
},
|
|
87
|
+
contexts: [
|
|
88
|
+
{
|
|
89
|
+
schema: schemas.consentDoc,
|
|
90
|
+
data: {
|
|
91
|
+
id: '0123',
|
|
92
|
+
version: '0.1.0',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
1
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('timing event', async () => {
|
|
102
|
+
await commands.eventsWithProperties(
|
|
103
|
+
{
|
|
104
|
+
schema: schemas.timing,
|
|
105
|
+
values: {
|
|
106
|
+
variable: 'testTimingVariable',
|
|
107
|
+
category: 'testTimingCategory',
|
|
108
|
+
timing: 10,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
1
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('transaction item event', async () => {
|
|
116
|
+
await commands.eventsWithProperties(
|
|
117
|
+
{
|
|
118
|
+
parameters: {
|
|
119
|
+
event: 'transaction_item',
|
|
120
|
+
ti_orderid: '0000',
|
|
121
|
+
ti_sku: '123',
|
|
122
|
+
ti_price: 5,
|
|
123
|
+
ti_quantity: 2,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
1
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('ecommerce transaction event', async () => {
|
|
131
|
+
await commands.eventsWithProperties(
|
|
132
|
+
{
|
|
133
|
+
parameters: {
|
|
134
|
+
event: 'transaction',
|
|
135
|
+
tr_orderid: '0000',
|
|
136
|
+
tr_total: 10,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
1
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('deep link event', async () => {
|
|
144
|
+
await commands.eventsWithProperties(
|
|
145
|
+
{
|
|
146
|
+
schema: schemas.deepLink,
|
|
147
|
+
values: {
|
|
148
|
+
url: 'https://deeplink.com',
|
|
149
|
+
referrer: 'http://refr.com',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
1
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('message notification event', async () => {
|
|
157
|
+
await commands.eventsWithProperties(
|
|
158
|
+
{
|
|
159
|
+
schema: schemas.messageNotification,
|
|
160
|
+
values: {
|
|
161
|
+
title: 'title1',
|
|
162
|
+
body: 'body1',
|
|
163
|
+
trigger: 'push',
|
|
164
|
+
action: 'action1',
|
|
165
|
+
attachments: [
|
|
166
|
+
{
|
|
167
|
+
identifier: 'att_id1',
|
|
168
|
+
type: 'att_type1',
|
|
169
|
+
url: 'http://att.url.1',
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
bodyLocArgs: ['bodyArg1', 'bodyArg2'],
|
|
173
|
+
bodyLocKey: 'bodyKey1',
|
|
174
|
+
category: 'category1',
|
|
175
|
+
contentAvailable: true,
|
|
176
|
+
group: 'group1',
|
|
177
|
+
icon: 'icon1',
|
|
178
|
+
notificationCount: 3,
|
|
179
|
+
notificationTimestamp: '2022-02-02T15:17:42.767Z',
|
|
180
|
+
sound: 'sound1',
|
|
181
|
+
subtitle: 'subtitle1',
|
|
182
|
+
tag: 'tag1',
|
|
183
|
+
threadIdentifier: 'threadIdentifier1',
|
|
184
|
+
titleLocArgs: ['titleArg1', 'titleArg2'],
|
|
185
|
+
titleLocKey: 'titleKey1',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
1
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test('common in all first tracker events', async () => {
|
|
193
|
+
await commands.eventsWithProperties(
|
|
194
|
+
{
|
|
195
|
+
parameters: {
|
|
196
|
+
app_id: 'DemoAppId',
|
|
197
|
+
platform: 'iot',
|
|
198
|
+
name_tracker: 'sp1',
|
|
199
|
+
},
|
|
200
|
+
header: 'test: works',
|
|
201
|
+
contexts: [
|
|
202
|
+
{ schema: schemas.mobileApplicationContext },
|
|
203
|
+
{ schema: schemas.mobileContext },
|
|
204
|
+
{ schema: schemas.mobileScreenContext },
|
|
205
|
+
{ schema: schemas.clientSessionContext },
|
|
206
|
+
{
|
|
207
|
+
schema: schemas.gdprContext,
|
|
208
|
+
data: {
|
|
209
|
+
basisForProcessing: 'consent',
|
|
210
|
+
documentDescription: 'test gdpr document',
|
|
211
|
+
documentId: 'docId',
|
|
212
|
+
documentVersion: '0.0.1',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
schema: schemas.adImpression,
|
|
217
|
+
data: { impressionId: 'test_global_contexts_0' },
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
schema: schemas.adImpression,
|
|
221
|
+
data: { impressionId: 'test_global_contexts_1' },
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
29
|
|
226
|
+
);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('events after resetting the Subject', async () => {
|
|
230
|
+
await commands.eventsWithProperties(
|
|
231
|
+
{
|
|
232
|
+
parameters: {
|
|
233
|
+
user_id: 'nextTester',
|
|
234
|
+
dvce_screenwidth: 300,
|
|
235
|
+
dvce_screenheight: 300,
|
|
236
|
+
br_lang: 'es',
|
|
237
|
+
os_timezone: 'Europe/London',
|
|
238
|
+
},
|
|
239
|
+
schema: schemas.screenView,
|
|
240
|
+
values: {
|
|
241
|
+
name: 'afterSetSubjectTestSV',
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
1
|
|
245
|
+
);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
test('second tracker events', async () => {
|
|
249
|
+
await commands.eventsWithProperties(
|
|
250
|
+
{
|
|
251
|
+
parameters: {
|
|
252
|
+
name_tracker: 'sp2',
|
|
253
|
+
},
|
|
254
|
+
contexts: [
|
|
255
|
+
{ schema: schemas.mobileApplicationContext },
|
|
256
|
+
{ schema: schemas.mobileContext },
|
|
257
|
+
{ schema: schemas.mobileScreenContext },
|
|
258
|
+
{ schema: schemas.clientSessionContext },
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
2
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
test('anonymous tracker events', async () => {
|
|
266
|
+
await commands.eventsWithProperties(
|
|
267
|
+
{
|
|
268
|
+
parameters: {
|
|
269
|
+
name_tracker: 'sp_anon',
|
|
270
|
+
network_userid: '00000000-0000-0000-0000-000000000000',
|
|
271
|
+
},
|
|
272
|
+
event: {
|
|
273
|
+
contexts: {
|
|
274
|
+
data: [
|
|
275
|
+
{
|
|
276
|
+
schema: schemas.clientSessionContext,
|
|
277
|
+
data: {
|
|
278
|
+
userId: '00000000-0000-0000-0000-000000000000',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
2
|
|
286
|
+
);
|
|
287
|
+
});
|
package/example/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This `.xcode.env` file is versioned and is used to source the environment
|
|
2
|
+
# used when running script phases inside Xcode.
|
|
3
|
+
# To customize your local environment, you can create an `.xcode.env.local`
|
|
4
|
+
# file that is not versioned.
|
|
5
|
+
|
|
6
|
+
# NODE_BINARY variable contains the PATH to the node executable.
|
|
7
|
+
#
|
|
8
|
+
# Customize the NODE_BINARY variable here.
|
|
9
|
+
# For example, to use nvm with brew, add the following line
|
|
10
|
+
# . "$(brew --prefix nvm)/nvm.sh" --no-use
|
|
11
|
+
export NODE_BINARY=$(command -v node)
|