@snowplow/react-native-tracker 2.1.2 → 4.0.2-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/LICENSE +29 -203
  2. package/README.md +59 -143
  3. package/dist/commonjs/event_store.js +150 -0
  4. package/dist/commonjs/event_store.js.map +1 -0
  5. package/dist/commonjs/events.js +42 -0
  6. package/dist/commonjs/events.js.map +1 -0
  7. package/dist/commonjs/index.js +29 -0
  8. package/dist/commonjs/index.js.map +1 -0
  9. package/dist/commonjs/subject.js +82 -0
  10. package/dist/commonjs/subject.js.map +1 -0
  11. package/dist/commonjs/tracker.js +77 -0
  12. package/dist/commonjs/tracker.js.map +1 -0
  13. package/dist/commonjs/types.js +223 -0
  14. package/dist/commonjs/types.js.map +1 -0
  15. package/dist/module/event_store.js +145 -0
  16. package/dist/module/event_store.js.map +1 -0
  17. package/dist/module/events.js +38 -0
  18. package/dist/module/events.js.map +1 -0
  19. package/dist/module/index.js +7 -0
  20. package/dist/module/index.js.map +1 -0
  21. package/dist/module/subject.js +78 -0
  22. package/dist/module/subject.js.map +1 -0
  23. package/dist/module/tracker.js +74 -0
  24. package/dist/module/tracker.js.map +1 -0
  25. package/dist/module/types.js +73 -0
  26. package/dist/module/types.js.map +1 -0
  27. package/dist/typescript/commonjs/package.json +1 -0
  28. package/dist/typescript/commonjs/src/event_store.d.ts +4 -0
  29. package/dist/typescript/commonjs/src/event_store.d.ts.map +1 -0
  30. package/dist/typescript/commonjs/src/events.d.ts +10 -0
  31. package/dist/typescript/commonjs/src/events.d.ts.map +1 -0
  32. package/dist/typescript/commonjs/src/index.d.ts +4 -0
  33. package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
  34. package/dist/typescript/commonjs/src/subject.d.ts +19 -0
  35. package/dist/typescript/commonjs/src/subject.d.ts.map +1 -0
  36. package/dist/typescript/commonjs/src/tracker.d.ts +9 -0
  37. package/dist/typescript/commonjs/src/tracker.d.ts.map +1 -0
  38. package/dist/typescript/commonjs/src/types.d.ts +452 -0
  39. package/dist/typescript/commonjs/src/types.d.ts.map +1 -0
  40. package/dist/typescript/module/package.json +1 -0
  41. package/dist/typescript/module/src/event_store.d.ts +4 -0
  42. package/dist/typescript/module/src/event_store.d.ts.map +1 -0
  43. package/dist/typescript/module/src/events.d.ts +10 -0
  44. package/dist/typescript/module/src/events.d.ts.map +1 -0
  45. package/dist/typescript/module/src/index.d.ts +4 -0
  46. package/dist/typescript/module/src/index.d.ts.map +1 -0
  47. package/dist/typescript/module/src/subject.d.ts +19 -0
  48. package/dist/typescript/module/src/subject.d.ts.map +1 -0
  49. package/dist/typescript/module/src/tracker.d.ts +9 -0
  50. package/dist/typescript/module/src/tracker.d.ts.map +1 -0
  51. package/dist/typescript/module/src/types.d.ts +452 -0
  52. package/dist/typescript/module/src/types.d.ts.map +1 -0
  53. package/package.json +75 -147
  54. package/.editorconfig +0 -15
  55. package/.eslintignore +0 -6
  56. package/.gitattributes +0 -3
  57. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
  58. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  59. package/.github/actions/setup/action.yml +0 -28
  60. package/.github/workflows/build.yml +0 -155
  61. package/.github/workflows/deploy.yml +0 -97
  62. package/.github/workflows/e2e-android.yml +0 -121
  63. package/.github/workflows/e2e-ios.yml +0 -95
  64. package/.github/workflows/snyk.yml +0 -21
  65. package/.gitignore +0 -70
  66. package/.npmignore +0 -60
  67. package/.nvmrc +0 -1
  68. package/.watchmanconfig +0 -1
  69. package/.yarnrc +0 -3
  70. package/CHANGELOG +0 -184
  71. package/CONTRIBUTING.md +0 -80
  72. package/android/build.gradle +0 -110
  73. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  74. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  75. package/android/gradle.properties +0 -5
  76. package/android/gradlew +0 -234
  77. package/android/gradlew.bat +0 -89
  78. package/android/src/main/AndroidManifest.xml +0 -3
  79. package/android/src/main/AndroidManifestNew.xml +0 -2
  80. package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +0 -744
  81. package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +0 -17
  82. package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +0 -274
  83. package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +0 -233
  84. package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +0 -5
  85. package/babel.config.js +0 -3
  86. package/example/.watchmanconfig +0 -1
  87. package/example/Gemfile +0 -6
  88. package/example/android/app/build.gradle +0 -129
  89. package/example/android/app/debug.keystore +0 -0
  90. package/example/android/app/proguard-rules.pro +0 -10
  91. package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +0 -36
  92. package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +0 -21
  93. package/example/android/app/src/debug/AndroidManifest.xml +0 -13
  94. package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +0 -75
  95. package/example/android/app/src/main/AndroidManifest.xml +0 -26
  96. package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +0 -32
  97. package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +0 -62
  98. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
  99. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  100. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  101. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  102. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  103. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  104. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  105. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  106. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  107. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  108. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  109. package/example/android/app/src/main/res/values/strings.xml +0 -3
  110. package/example/android/app/src/main/res/values/styles.xml +0 -9
  111. package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +0 -20
  112. package/example/android/build.gradle +0 -31
  113. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  114. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  115. package/example/android/gradle.properties +0 -44
  116. package/example/android/gradlew +0 -244
  117. package/example/android/gradlew.bat +0 -92
  118. package/example/android/settings.gradle +0 -4
  119. package/example/app.json +0 -4
  120. package/example/babel.config.js +0 -17
  121. package/example/detox.config.js +0 -92
  122. package/example/e2e/config.json +0 -10
  123. package/example/e2e/emitEvents.e2e.detox.js +0 -95
  124. package/example/e2e/environment.js +0 -23
  125. package/example/e2e/helpers/microCommands.js +0 -140
  126. package/example/e2e/helpers/microHelpers.js +0 -333
  127. package/example/e2e/helpers/microHelpers.test.js +0 -295
  128. package/example/e2e/helpers/schemas.js +0 -49
  129. package/example/e2e/jest.config.js +0 -16
  130. package/example/e2e/setup.js +0 -4
  131. package/example/e2e/testEvents.micro.test.js +0 -287
  132. package/example/index.js +0 -5
  133. package/example/ios/.xcode.env +0 -11
  134. package/example/ios/Podfile +0 -62
  135. package/example/ios/Podfile.lock +0 -730
  136. package/example/ios/ReactNativeTrackerExample/AppDelegate.h +0 -6
  137. package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +0 -26
  138. package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  139. package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +0 -6
  140. package/example/ios/ReactNativeTrackerExample/Info.plist +0 -55
  141. package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +0 -47
  142. package/example/ios/ReactNativeTrackerExample/PrivacyInfo.xcprivacy +0 -37
  143. package/example/ios/ReactNativeTrackerExample/main.m +0 -10
  144. package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +0 -3
  145. package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +0 -739
  146. package/example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme +0 -88
  147. package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +0 -10
  148. package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  149. package/example/ios/ReactNativeTrackerExampleTests/Info.plist +0 -24
  150. package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +0 -66
  151. package/example/metro.config.js +0 -45
  152. package/example/package.json +0 -54
  153. package/example/react-native.config.js +0 -10
  154. package/example/src/App.js +0 -566
  155. package/example/tsconfig.json +0 -5
  156. package/example/yarn.lock +0 -7703
  157. package/ios/ReactNativeTracker-Bridging-Header.h +0 -2
  158. package/ios/ReactNativeTracker.mm +0 -171
  159. package/ios/ReactNativeTracker.swift +0 -822
  160. package/ios/ReactNativeTracker.xcodeproj/project.pbxproj +0 -301
  161. package/ios/Util/ConfigUtils.swift +0 -209
  162. package/ios/Util/TrackerVersion.swift +0 -3
  163. package/ios/Util/Utilities.swift +0 -37
  164. package/lefthook.yml +0 -11
  165. package/lib/commonjs/api.js +0 -490
  166. package/lib/commonjs/api.js.map +0 -1
  167. package/lib/commonjs/configurations.js +0 -196
  168. package/lib/commonjs/configurations.js.map +0 -1
  169. package/lib/commonjs/constants.js +0 -77
  170. package/lib/commonjs/constants.js.map +0 -1
  171. package/lib/commonjs/events.js +0 -277
  172. package/lib/commonjs/events.js.map +0 -1
  173. package/lib/commonjs/index.js +0 -132
  174. package/lib/commonjs/index.js.map +0 -1
  175. package/lib/commonjs/jsCore.js +0 -427
  176. package/lib/commonjs/jsCore.js.map +0 -1
  177. package/lib/commonjs/native.js +0 -16
  178. package/lib/commonjs/native.js.map +0 -1
  179. package/lib/commonjs/subject.js +0 -235
  180. package/lib/commonjs/subject.js.map +0 -1
  181. package/lib/commonjs/tracker.js +0 -248
  182. package/lib/commonjs/tracker.js.map +0 -1
  183. package/lib/commonjs/types.js +0 -2
  184. package/lib/commonjs/types.js.map +0 -1
  185. package/lib/commonjs/utils.js +0 -72
  186. package/lib/commonjs/utils.js.map +0 -1
  187. package/lib/commonjs/webViewInterface.js +0 -66
  188. package/lib/commonjs/webViewInterface.js.map +0 -1
  189. package/lib/module/api.js +0 -452
  190. package/lib/module/api.js.map +0 -1
  191. package/lib/module/configurations.js +0 -184
  192. package/lib/module/configurations.js.map +0 -1
  193. package/lib/module/constants.js +0 -72
  194. package/lib/module/constants.js.map +0 -1
  195. package/lib/module/events.js +0 -259
  196. package/lib/module/events.js.map +0 -1
  197. package/lib/module/index.js +0 -120
  198. package/lib/module/index.js.map +0 -1
  199. package/lib/module/jsCore.js +0 -424
  200. package/lib/module/jsCore.js.map +0 -1
  201. package/lib/module/native.js +0 -12
  202. package/lib/module/native.js.map +0 -1
  203. package/lib/module/subject.js +0 -222
  204. package/lib/module/subject.js.map +0 -1
  205. package/lib/module/tracker.js +0 -234
  206. package/lib/module/tracker.js.map +0 -1
  207. package/lib/module/types.js +0 -2
  208. package/lib/module/types.js.map +0 -1
  209. package/lib/module/utils.js +0 -66
  210. package/lib/module/utils.js.map +0 -1
  211. package/lib/module/webViewInterface.js +0 -62
  212. package/lib/module/webViewInterface.js.map +0 -1
  213. package/lib/typescript/__tests__/api.test.d.ts +0 -2
  214. package/lib/typescript/__tests__/api.test.d.ts.map +0 -1
  215. package/lib/typescript/__tests__/configurations.test.d.ts +0 -2
  216. package/lib/typescript/__tests__/configurations.test.d.ts.map +0 -1
  217. package/lib/typescript/__tests__/events.test.d.ts +0 -2
  218. package/lib/typescript/__tests__/events.test.d.ts.map +0 -1
  219. package/lib/typescript/__tests__/index.test.d.ts +0 -2
  220. package/lib/typescript/__tests__/index.test.d.ts.map +0 -1
  221. package/lib/typescript/__tests__/jsCore.test.d.ts +0 -2
  222. package/lib/typescript/__tests__/jsCore.test.d.ts.map +0 -1
  223. package/lib/typescript/__tests__/utils.test.d.ts +0 -2
  224. package/lib/typescript/__tests__/utils.test.d.ts.map +0 -1
  225. package/lib/typescript/api.d.ts +0 -240
  226. package/lib/typescript/api.d.ts.map +0 -1
  227. package/lib/typescript/configurations.d.ts +0 -73
  228. package/lib/typescript/configurations.d.ts.map +0 -1
  229. package/lib/typescript/constants.d.ts +0 -64
  230. package/lib/typescript/constants.d.ts.map +0 -1
  231. package/lib/typescript/events.d.ts +0 -115
  232. package/lib/typescript/events.d.ts.map +0 -1
  233. package/lib/typescript/index.d.ts +0 -27
  234. package/lib/typescript/index.d.ts.map +0 -1
  235. package/lib/typescript/jsCore.d.ts +0 -152
  236. package/lib/typescript/jsCore.d.ts.map +0 -1
  237. package/lib/typescript/native.d.ts +0 -4
  238. package/lib/typescript/native.d.ts.map +0 -1
  239. package/lib/typescript/subject.d.ts +0 -91
  240. package/lib/typescript/subject.d.ts.map +0 -1
  241. package/lib/typescript/tracker.d.ts +0 -111
  242. package/lib/typescript/tracker.d.ts.map +0 -1
  243. package/lib/typescript/types.d.ts +0 -981
  244. package/lib/typescript/types.d.ts.map +0 -1
  245. package/lib/typescript/utils.d.ts +0 -35
  246. package/lib/typescript/utils.d.ts.map +0 -1
  247. package/lib/typescript/webViewInterface.d.ts +0 -15
  248. package/lib/typescript/webViewInterface.d.ts.map +0 -1
  249. package/scripts/bootstrap.js +0 -29
  250. package/snowplow-react-native-tracker.podspec +0 -42
  251. package/src/__mocks__/react-native.js +0 -7
  252. package/src/__tests__/api.test.ts +0 -21
  253. package/src/__tests__/configurations.test.ts +0 -608
  254. package/src/__tests__/events.test.ts +0 -736
  255. package/src/__tests__/index.test.ts +0 -14
  256. package/src/__tests__/jsCore.test.ts +0 -199
  257. package/src/__tests__/utils.test.ts +0 -10
  258. package/src/api.ts +0 -556
  259. package/src/configurations.ts +0 -325
  260. package/src/constants.ts +0 -97
  261. package/src/events.ts +0 -355
  262. package/src/index.ts +0 -184
  263. package/src/jsCore.ts +0 -603
  264. package/src/native.ts +0 -21
  265. package/src/subject.ts +0 -302
  266. package/src/tracker.ts +0 -377
  267. package/src/types.ts +0 -1162
  268. package/src/utils.ts +0 -65
  269. package/src/webViewInterface.ts +0 -92
  270. package/tsconfig.build.json +0 -5
  271. package/tsconfig.json +0 -28
  272. package/turbo.json +0 -34
  273. package/yarn.lock +0 -9398
package/LICENSE CHANGED
@@ -1,203 +1,29 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright (c) 2020-present Snowplow Analytics Ltd, 2019 DataCamp.
191
- All rights reserved.
192
-
193
- Licensed under the Apache License, Version 2.0 (the "License");
194
- you may not use this file except in compliance with the License.
195
- You may obtain a copy of the License at
196
-
197
- http://www.apache.org/licenses/LICENSE-2.0
198
-
199
- Unless required by applicable law or agreed to in writing, software
200
- distributed under the License is distributed on an "AS IS" BASIS,
201
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
- See the License for the specific language governing permissions and
203
- limitations under the License.
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022 Snowplow Analytics Ltd
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,170 +1,86 @@
1
- # @snowplow/react-native-tracker
1
+ # Snowplow Node Tracker
2
2
 
3
- [![actively-maintained]][tracker-classification]
4
- [![Build Status][gh-actions-image]][gh-actions]
5
- [![License][license-image]][license]
3
+ [![npm version][npm-image]][npm-url]
4
+ [![License][license-image]](LICENSE)
6
5
 
7
- [![Release][release-image]][releases]
8
- [![RN version][react-native-v-image]][react-native-v]
9
- [![downloads][downloads-dm-image]][downloads-dm]
6
+ Add Snowplow Tracking to your Node.js Application with `@snowplow/node-tracker`.
10
7
 
11
- Snowplow is a scalable open-source platform for rich, high quality, low-latency data collection. It is designed to collect high quality, complete behavioral data for enterprise business.
12
-
13
- **To find out more, please check out the [Snowplow website][website] and our [documentation][docs].**
14
-
15
- ## Snowplow React-Native Tracker Overview
16
-
17
- The Snowplow React Native Tracker allows you to add analytics to your React Native apps when using a [Snowplow][snowplow] pipeline.
18
-
19
- With this library you can collect granular event-level data as your users interact with your React Native applications. It is build on top of Snowplow's [Mobile Native][native-trackers] [iOS][objc-tracker] and [Android][android-tracker] Trackers, in order to support the full range of out-of-the-box Snowplow events and tracking capabilities.
20
-
21
- ## Quick start
22
-
23
- From the root of your [React Native][react-native] project:
24
-
25
- ```sh
26
- npm install --save @snowplow/react-native-tracker
27
- npx pod-install
28
- ```
29
-
30
- In your `ios/Podfile` file (unless using Expo Go), please add the `FMDB` dependency with `modular_headers` set to `true`. This is necessary to make the `FMDB` package generate module maps so that it can be used by the tracker:
31
-
32
- ```rb
33
- pod 'FMDB', :modular_headers => true
34
- ```
35
-
36
- Then, instrument the tracker in your app and start tracking events. For example:
8
+ ## Maintainer quick start
37
9
 
38
- ```javascript
39
- import { createTracker } from '@snowplow/react-native-tracker';
10
+ Part of the Snowplow JavaScript Tracker monorepo.
11
+ Build with [Node.js](https://nodejs.org/en/) (18 - 20) and [Rush](https://rushjs.io/).
40
12
 
41
- const tracker = createTracker(
42
- 'my-namespace',
43
- { endpoint: 'https://my-collector.endpoint' }
44
- );
13
+ ### Setup repository
45
14
 
46
- tracker.trackScreenViewEvent({ name: 'myScreenName' });
15
+ ```bash
16
+ npm install -g @microsoft/rush
17
+ git clone https://github.com/snowplow/snowplow-javascript-tracker.git
18
+ rush update
47
19
  ```
48
20
 
49
- The Snowplow React Native Tracker also provides first-class support for TypeScript, as it is fully typed.
50
-
51
- See also our [DemoApp](example) for an example implementation.
52
-
53
- ## Find out more
21
+ ## Package Installation
54
22
 
55
- | Technical Docs | Setup Guide |
56
- |-----------------------------------|-----------------------------|
57
- | [![i1][techdocs-image]][techdocs] | [![i2][setup-image]][setup] |
58
- | [Technical Docs][techdocs] | [Setup Guide][setup] |
59
-
60
- ## Maintainer quick start
61
-
62
- Assuming a [react-native environment][react-native-environment] is set up, from the root of the repository:
23
+ With npm:
63
24
 
64
25
  ```bash
65
- yarn
26
+ npm install @snowplow/node-tracker
66
27
  ```
67
28
 
68
- ### Unit tests
29
+ ## Usage
69
30
 
70
- To run the unit tests, simply execute:
31
+ Initialize your tracker with your desired configuration:
71
32
 
72
- ```sh
73
- yarn test
33
+ ```js
34
+ import { newTracker } from '@snowplow/node-tracker';
35
+ const t = newTracker(
36
+ { namespace: 'myTracker', appId: 'myApp', encodeBase64: false },
37
+ { endpoint: 'collector.mydomain.net', port: 8080, bufferSize: 5 }
38
+ );
74
39
  ```
75
40
 
76
- ### Launching the example app
77
-
78
- Replace "placeholder" with the URI for your Snowplow Mini or other Snowplow collector in `DemoApp/App.js`.
79
-
80
- **For Android:**
81
-
82
- ```bash
83
- yarn example android
84
- ```
85
- _Note_: Linux users who want to run the DemoApp for Android, would also need to run `yarn start` in a separate terminal.
41
+ Then use the `track` function from this package, along with the `buildX` functions to send events to your configured emitters:
42
+
43
+ ```js
44
+ import {
45
+ buildSelfDescribingEvent,
46
+ buildPageView
47
+ } from '@snowplow/node-tracker';
48
+
49
+ const context = [
50
+ {
51
+ schema: 'iglu:com.acme/user/jsonschema/1-0-0',
52
+ data: {
53
+ type: 'tester',
54
+ },
55
+ },
56
+ ];
57
+
58
+ t.track(
59
+ buildPageView({ pageUrl: 'http://www.example.com', pageTitle: 'example page', referrer: 'http://google.com' }),
60
+ context
61
+ );
86
62
 
87
- **For iOS:**
63
+ const eventJson = {
64
+ schema: 'iglu:com.acme/viewed_product/jsonschema/1-0-0',
65
+ data: {
66
+ price: 20,
67
+ },
68
+ };
88
69
 
89
- ```bash
90
- yarn example ios
70
+ t.track(buildSelfDescribingEvent({ event: eventJson }), context);
91
71
  ```
92
72
 
93
- ### End-to-end tests
94
-
95
- Snowplow React-Native Tracker is being end-to-end tested using [Snowplow Micro][snowplow-micro] and [Detox][detox]. To run these tests locally:
96
-
97
- #### Testing
98
-
99
- 1. Start your [Snowplow Micro][snowplow-micro] instance locally.
100
- 2. Replace the `placeholder` value for the `collectorEndpoint` variable in `example/src/App.js` (use the network IP address of your computer or ngrok).
101
- 3. Start the end-to-end tests:
102
- * On Android, run `yarn e2e:android`
103
- * On iOS, run `yarn e2e:ios`
104
-
105
- ## Contributing
106
-
107
- Feedback and contributions are welcome - if you have identified a bug, please log an issue on this repo. For all other feedback, discussion or questions please open a thread on our [discourse forum][discourse].
108
-
109
- | Contributing |
110
- |-------------------------------------------|
111
- | [![i3][contributing-image]][contributing] |
112
- | [Contributing][contributing] |
73
+ To enable success and failure callback debugging, run your application with `NODE_DEBUG=snowplow`.
113
74
 
114
75
  ## Copyright and license
115
76
 
116
- The Snowplow React Native Tracker is copyright 2020-present Snowplow Analytics Ltd, 2019 DataCamp.
117
-
118
- Licensed under the **[Apache License, Version 2.0][license]** (the "License");
119
- you may not use this software except in compliance with the License.
120
-
121
- Unless required by applicable law or agreed to in writing, software
122
- distributed under the License is distributed on an "AS IS" BASIS,
123
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124
- See the License for the specific language governing permissions and
125
- limitations under the License.
126
-
127
- [tracker-classification]: https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/tracker-maintenance-classification/
128
- [actively-maintained]: https://img.shields.io/static/v1?style=flat&label=Snowplow&message=Actively%20Maintained&color=6638b8&labelColor=9ba0aa&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAeFBMVEVMaXGXANeYANeXANZbAJmXANeUANSQAM+XANeMAMpaAJhZAJeZANiXANaXANaOAM2WANVnAKWXANZ9ALtmAKVaAJmXANZaAJlXAJZdAJxaAJlZAJdbAJlbAJmQAM+UANKZANhhAJ+EAL+BAL9oAKZnAKVjAKF1ALNBd8J1AAAAKHRSTlMAa1hWXyteBTQJIEwRgUh2JjJon21wcBgNfmc+JlOBQjwezWF2l5dXzkW3/wAAAHpJREFUeNokhQOCA1EAxTL85hi7dXv/E5YPCYBq5DeN4pcqV1XbtW/xTVMIMAZE0cBHEaZhBmIQwCFofeprPUHqjmD/+7peztd62dWQRkvrQayXkn01f/gWp2CrxfjY7rcZ5V7DEMDQgmEozFpZqLUYDsNwOqbnMLwPAJEwCopZxKttAAAAAElFTkSuQmCC
129
- [gh-actions]: https://github.com/snowplow-incubator/snowplow-react-native-tracker/actions
130
- [gh-actions-image]: https://github.com/snowplow-incubator/snowplow-react-native-tracker/workflows/build/badge.svg?branch=master
131
-
132
- [license]: https://www.apache.org/licenses/LICENSE-2.0
133
- [license-image]: https://img.shields.io/badge/license-Apache--2-blue.svg?style=flat
134
-
135
- [releases]: https://www.npmjs.com/package/@snowplow/react-native-tracker
136
- [release-image]: https://img.shields.io/npm/v/@snowplow/react-native-tracker
137
-
138
- [react-native-v]: https://www.npmjs.com/package/@snowplow/react-native-tracker
139
- [react-native-v-image]: https://img.shields.io/npm/dependency-version/@snowplow/react-native-tracker/peer/react-native
140
-
141
- [downloads-dm]: https://www.npmjs.com/package/@snowplow/react-native-tracker
142
- [downloads-dm-image]: https://img.shields.io/npm/dm/@snowplow/react-native-tracker
143
-
144
- [website]: https://snowplowanalytics.com
145
- [docs]: https://docs.snowplowanalytics.com
146
- [snowplow]: https://github.com/snowplow/snowplow
147
- [discourse]: https://discourse.snowplowanalytics.com
148
-
149
- [techdocs]: https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/react-native-tracker/introduction
150
- [techdocs-image]: https://d3i6fms1cm1j0i.cloudfront.net/github/images/techdocs.png
151
- [setup]: https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/react-native-tracker/quick-start-guide/
152
- [setup-image]: https://d3i6fms1cm1j0i.cloudfront.net/github/images/setup.png
153
-
154
- [contributing]: https://github.com/snowplow-incubator/snowplow-react-native-tracker/blob/master/CONTRIBUTING.md
155
- [contributing-image]: https://d3i6fms1cm1j0i.cloudfront.net/github/images/contributing.png
77
+ Licensed and distributed under the [BSD 3-Clause License](LICENSE) ([An OSI Approved License][osi]).
156
78
 
157
- [react-native]: https://reactnative.dev/
158
- [react-native-environment]: https://reactnative.dev/docs/environment-setup
159
- [snowplow-micro]: https://github.com/snowplow-incubator/snowplow-micro
160
- [snowplow-mini]: https://github.com/snowplow/snowplow-mini
79
+ Copyright (c) 2022 Snowplow Analytics Ltd.
161
80
 
162
- [native-trackers]: https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/mobile-trackers/mobile-trackers-v2-0
163
- [objc-tracker]: https://github.com/snowplow/snowplow-objc-tracker
164
- [android-tracker]: https://github.com/snowplow/snowplow-android-tracker
81
+ All rights reserved.
165
82
 
166
- [demoapp]: https://github.com/snowplow-incubator/snowplow-react-native-tracker/tree/master/DemoApp
167
- [gh-actions-workflows]: https://github.com/snowplow-incubator/snowplow-react-native-tracker/tree/master/.github/workflows
168
- [detox]: https://github.com/wix/Detox
169
- [detox-android-env]: https://github.com/wix/Detox/blob/master/docs/Introduction.AndroidDevEnv.md
170
- [detox-ios-env]: https://github.com/wix/Detox/blob/master/docs/Introduction.iOSDevEnv.md
83
+ [osi]: https://opensource.org/licenses/BSD-3-Clause
84
+ [license-image]: https://img.shields.io/npm/l/@snowplow/node-tracker
85
+ [npm-url]: https://www.npmjs.com/package/@snowplow/node-tracker
86
+ [npm-image]: https://img.shields.io/npm/v/@snowplow/node-tracker
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.newReactNativeEventStore = newReactNativeEventStore;
7
+ var _trackerCore = require("@snowplow/tracker-core");
8
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
13
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
14
+ function newReactNativeEventStore(_x) {
15
+ return _newReactNativeEventStore.apply(this, arguments);
16
+ }
17
+ function _newReactNativeEventStore() {
18
+ _newReactNativeEventStore = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref) {
19
+ var namespace, _ref$maxEventStoreSiz, maxEventStoreSize, _ref$useAsyncStorageF, useAsyncStorage, queueName, newInMemoryEventStoreForReactNative, _newInMemoryEventStoreForReactNative, eventStore, getAll, getAllPayloads, _add, count, iterator, _removeHead, sync, _sync;
20
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
21
+ while (1) switch (_context5.prev = _context5.next) {
22
+ case 0:
23
+ _sync = function _sync3() {
24
+ _sync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
25
+ var events;
26
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
27
+ while (1) switch (_context4.prev = _context4.next) {
28
+ case 0:
29
+ if (!useAsyncStorage) {
30
+ _context4.next = 6;
31
+ break;
32
+ }
33
+ _context4.next = 3;
34
+ return getAll();
35
+ case 3:
36
+ events = _context4.sent;
37
+ _context4.next = 6;
38
+ return _asyncStorage["default"].setItem(queueName, JSON.stringify(events));
39
+ case 6:
40
+ case "end":
41
+ return _context4.stop();
42
+ }
43
+ }, _callee4);
44
+ }));
45
+ return _sync.apply(this, arguments);
46
+ };
47
+ sync = function _sync2() {
48
+ return _sync.apply(this, arguments);
49
+ };
50
+ _newInMemoryEventStoreForReactNative = function _newInMemoryEventStor2() {
51
+ _newInMemoryEventStoreForReactNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
52
+ var data, events;
53
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
54
+ while (1) switch (_context3.prev = _context3.next) {
55
+ case 0:
56
+ if (!useAsyncStorage) {
57
+ _context3.next = 8;
58
+ break;
59
+ }
60
+ _context3.next = 3;
61
+ return _asyncStorage["default"].getItem(queueName);
62
+ case 3:
63
+ data = _context3.sent;
64
+ events = data ? JSON.parse(data) : [];
65
+ return _context3.abrupt("return", (0, _trackerCore.newInMemoryEventStore)({
66
+ maxSize: maxEventStoreSize,
67
+ events: events
68
+ }));
69
+ case 8:
70
+ return _context3.abrupt("return", (0, _trackerCore.newInMemoryEventStore)({
71
+ maxSize: maxEventStoreSize
72
+ }));
73
+ case 9:
74
+ case "end":
75
+ return _context3.stop();
76
+ }
77
+ }, _callee3);
78
+ }));
79
+ return _newInMemoryEventStoreForReactNative.apply(this, arguments);
80
+ };
81
+ newInMemoryEventStoreForReactNative = function _newInMemoryEventStor() {
82
+ return _newInMemoryEventStoreForReactNative.apply(this, arguments);
83
+ };
84
+ namespace = _ref.namespace, _ref$maxEventStoreSiz = _ref.maxEventStoreSize, maxEventStoreSize = _ref$maxEventStoreSiz === void 0 ? 1000 : _ref$maxEventStoreSiz, _ref$useAsyncStorageF = _ref.useAsyncStorageForEventStore, useAsyncStorage = _ref$useAsyncStorageF === void 0 ? true : _ref$useAsyncStorageF;
85
+ queueName = "snowplow_".concat(namespace);
86
+ _context5.next = 8;
87
+ return newInMemoryEventStoreForReactNative();
88
+ case 8:
89
+ eventStore = _context5.sent;
90
+ getAll = eventStore.getAll, getAllPayloads = eventStore.getAllPayloads, _add = eventStore.add, count = eventStore.count, iterator = eventStore.iterator, _removeHead = eventStore.removeHead;
91
+ return _context5.abrupt("return", {
92
+ count: count,
93
+ add: function () {
94
+ var _add2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
95
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
96
+ while (1) switch (_context.prev = _context.next) {
97
+ case 0:
98
+ _context.next = 2;
99
+ return _add(payload);
100
+ case 2:
101
+ _context.next = 4;
102
+ return sync();
103
+ case 4:
104
+ _context.next = 6;
105
+ return count();
106
+ case 6:
107
+ return _context.abrupt("return", _context.sent);
108
+ case 7:
109
+ case "end":
110
+ return _context.stop();
111
+ }
112
+ }, _callee);
113
+ }));
114
+ function add(_x2) {
115
+ return _add2.apply(this, arguments);
116
+ }
117
+ return add;
118
+ }(),
119
+ removeHead: function () {
120
+ var _removeHead2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(n) {
121
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
122
+ while (1) switch (_context2.prev = _context2.next) {
123
+ case 0:
124
+ _removeHead(n);
125
+ _context2.next = 3;
126
+ return sync();
127
+ case 3:
128
+ case "end":
129
+ return _context2.stop();
130
+ }
131
+ }, _callee2);
132
+ }));
133
+ function removeHead(_x3) {
134
+ return _removeHead2.apply(this, arguments);
135
+ }
136
+ return removeHead;
137
+ }(),
138
+ iterator: iterator,
139
+ getAll: getAll,
140
+ getAllPayloads: getAllPayloads
141
+ });
142
+ case 11:
143
+ case "end":
144
+ return _context5.stop();
145
+ }
146
+ }, _callee5);
147
+ }));
148
+ return _newReactNativeEventStore.apply(this, arguments);
149
+ }
150
+ //# sourceMappingURL=event_store.js.map