@snowplow/react-native-tracker 4.0.2-dev.0 → 4.1.1-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +38 -30
  2. package/dist/commonjs/constants.js +20 -0
  3. package/dist/commonjs/constants.js.map +1 -0
  4. package/dist/commonjs/event_store.js +150 -0
  5. package/dist/commonjs/event_store.js.map +1 -0
  6. package/dist/commonjs/events.js +42 -0
  7. package/dist/commonjs/events.js.map +1 -0
  8. package/dist/commonjs/index.js +29 -0
  9. package/dist/commonjs/index.js.map +1 -0
  10. package/dist/commonjs/plugins/app_context/index.js +47 -0
  11. package/dist/commonjs/plugins/app_context/index.js.map +1 -0
  12. package/dist/commonjs/plugins/app_install/index.js +60 -0
  13. package/dist/commonjs/plugins/app_install/index.js.map +1 -0
  14. package/dist/commonjs/plugins/app_lifecycle/index.js +126 -0
  15. package/dist/commonjs/plugins/app_lifecycle/index.js.map +1 -0
  16. package/dist/commonjs/plugins/deep_links/index.js +64 -0
  17. package/dist/commonjs/plugins/deep_links/index.js.map +1 -0
  18. package/dist/commonjs/plugins/platform_context/index.js +749 -0
  19. package/dist/commonjs/plugins/platform_context/index.js.map +1 -0
  20. package/dist/commonjs/plugins/session/index.js +197 -0
  21. package/dist/commonjs/plugins/session/index.js.map +1 -0
  22. package/dist/commonjs/plugins.js +147 -0
  23. package/dist/commonjs/plugins.js.map +1 -0
  24. package/dist/commonjs/subject.js +82 -0
  25. package/dist/commonjs/subject.js.map +1 -0
  26. package/dist/commonjs/tracker.js +188 -0
  27. package/dist/commonjs/tracker.js.map +1 -0
  28. package/dist/commonjs/types.js +313 -0
  29. package/dist/commonjs/types.js.map +1 -0
  30. package/dist/commonjs/utils.js +35 -0
  31. package/dist/commonjs/utils.js.map +1 -0
  32. package/dist/module/constants.js +16 -0
  33. package/dist/module/constants.js.map +1 -0
  34. package/dist/module/event_store.js +145 -0
  35. package/dist/module/event_store.js.map +1 -0
  36. package/dist/module/events.js +38 -0
  37. package/dist/module/events.js.map +1 -0
  38. package/dist/module/index.js +7 -0
  39. package/dist/module/index.js.map +1 -0
  40. package/dist/module/plugins/app_context/index.js +44 -0
  41. package/dist/module/plugins/app_context/index.js.map +1 -0
  42. package/dist/module/plugins/app_install/index.js +56 -0
  43. package/dist/module/plugins/app_install/index.js.map +1 -0
  44. package/dist/module/plugins/app_lifecycle/index.js +122 -0
  45. package/dist/module/plugins/app_lifecycle/index.js.map +1 -0
  46. package/dist/module/plugins/deep_links/index.js +60 -0
  47. package/dist/module/plugins/deep_links/index.js.map +1 -0
  48. package/dist/module/plugins/platform_context/index.js +745 -0
  49. package/dist/module/plugins/platform_context/index.js.map +1 -0
  50. package/dist/module/plugins/session/index.js +192 -0
  51. package/dist/module/plugins/session/index.js.map +1 -0
  52. package/dist/module/plugins.js +143 -0
  53. package/dist/module/plugins.js.map +1 -0
  54. package/dist/module/subject.js +78 -0
  55. package/dist/module/subject.js.map +1 -0
  56. package/dist/module/tracker.js +183 -0
  57. package/dist/module/tracker.js.map +1 -0
  58. package/dist/module/types.js +113 -0
  59. package/dist/module/types.js.map +1 -0
  60. package/dist/module/utils.js +31 -0
  61. package/dist/module/utils.js.map +1 -0
  62. package/dist/typescript/commonjs/package.json +1 -0
  63. package/dist/typescript/commonjs/src/constants.d.ts +14 -0
  64. package/dist/typescript/commonjs/src/constants.d.ts.map +1 -0
  65. package/dist/typescript/commonjs/src/event_store.d.ts +4 -0
  66. package/dist/typescript/commonjs/src/event_store.d.ts.map +1 -0
  67. package/dist/typescript/commonjs/src/events.d.ts +10 -0
  68. package/dist/typescript/commonjs/src/events.d.ts.map +1 -0
  69. package/dist/typescript/commonjs/src/index.d.ts +4 -0
  70. package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
  71. package/dist/typescript/commonjs/src/plugins/app_context/index.d.ts +11 -0
  72. package/dist/typescript/commonjs/src/plugins/app_context/index.d.ts.map +1 -0
  73. package/dist/typescript/commonjs/src/plugins/app_install/index.d.ts +10 -0
  74. package/dist/typescript/commonjs/src/plugins/app_install/index.d.ts.map +1 -0
  75. package/dist/typescript/commonjs/src/plugins/app_lifecycle/index.d.ts +13 -0
  76. package/dist/typescript/commonjs/src/plugins/app_lifecycle/index.d.ts.map +1 -0
  77. package/dist/typescript/commonjs/src/plugins/deep_links/index.d.ts +8 -0
  78. package/dist/typescript/commonjs/src/plugins/deep_links/index.d.ts.map +1 -0
  79. package/dist/typescript/commonjs/src/plugins/platform_context/index.d.ts +12 -0
  80. package/dist/typescript/commonjs/src/plugins/platform_context/index.d.ts.map +1 -0
  81. package/dist/typescript/commonjs/src/plugins/session/index.d.ts +19 -0
  82. package/dist/typescript/commonjs/src/plugins/session/index.d.ts.map +1 -0
  83. package/dist/typescript/commonjs/src/plugins.d.ts +6 -0
  84. package/dist/typescript/commonjs/src/plugins.d.ts.map +1 -0
  85. package/dist/typescript/commonjs/src/subject.d.ts +19 -0
  86. package/dist/typescript/commonjs/src/subject.d.ts.map +1 -0
  87. package/dist/typescript/commonjs/src/tracker.d.ts +28 -0
  88. package/dist/typescript/commonjs/src/tracker.d.ts.map +1 -0
  89. package/dist/typescript/commonjs/src/types.d.ts +784 -0
  90. package/dist/typescript/commonjs/src/types.d.ts.map +1 -0
  91. package/dist/typescript/commonjs/src/utils.d.ts +3 -0
  92. package/dist/typescript/commonjs/src/utils.d.ts.map +1 -0
  93. package/dist/typescript/module/package.json +1 -0
  94. package/dist/typescript/module/src/constants.d.ts +14 -0
  95. package/dist/typescript/module/src/constants.d.ts.map +1 -0
  96. package/dist/typescript/module/src/event_store.d.ts +4 -0
  97. package/dist/typescript/module/src/event_store.d.ts.map +1 -0
  98. package/dist/typescript/module/src/events.d.ts +10 -0
  99. package/dist/typescript/module/src/events.d.ts.map +1 -0
  100. package/dist/typescript/module/src/index.d.ts +4 -0
  101. package/dist/typescript/module/src/index.d.ts.map +1 -0
  102. package/dist/typescript/module/src/plugins/app_context/index.d.ts +11 -0
  103. package/dist/typescript/module/src/plugins/app_context/index.d.ts.map +1 -0
  104. package/dist/typescript/module/src/plugins/app_install/index.d.ts +10 -0
  105. package/dist/typescript/module/src/plugins/app_install/index.d.ts.map +1 -0
  106. package/dist/typescript/module/src/plugins/app_lifecycle/index.d.ts +13 -0
  107. package/dist/typescript/module/src/plugins/app_lifecycle/index.d.ts.map +1 -0
  108. package/dist/typescript/module/src/plugins/deep_links/index.d.ts +8 -0
  109. package/dist/typescript/module/src/plugins/deep_links/index.d.ts.map +1 -0
  110. package/dist/typescript/module/src/plugins/platform_context/index.d.ts +12 -0
  111. package/dist/typescript/module/src/plugins/platform_context/index.d.ts.map +1 -0
  112. package/dist/typescript/module/src/plugins/session/index.d.ts +19 -0
  113. package/dist/typescript/module/src/plugins/session/index.d.ts.map +1 -0
  114. package/dist/typescript/module/src/plugins.d.ts +6 -0
  115. package/dist/typescript/module/src/plugins.d.ts.map +1 -0
  116. package/dist/typescript/module/src/subject.d.ts +19 -0
  117. package/dist/typescript/module/src/subject.d.ts.map +1 -0
  118. package/dist/typescript/module/src/tracker.d.ts +28 -0
  119. package/dist/typescript/module/src/tracker.d.ts.map +1 -0
  120. package/dist/typescript/module/src/types.d.ts +784 -0
  121. package/dist/typescript/module/src/types.d.ts.map +1 -0
  122. package/dist/typescript/module/src/utils.d.ts +3 -0
  123. package/dist/typescript/module/src/utils.d.ts.map +1 -0
  124. package/package.json +57 -14
  125. package/dist/index.cjs.d.ts +0 -499
  126. package/dist/index.cjs.js +0 -2656
  127. package/dist/index.cjs.js.map +0 -1
  128. package/dist/index.cjs.min.d.ts +0 -499
  129. package/dist/index.cjs.min.js +0 -63
  130. package/dist/index.cjs.min.js.map +0 -1
  131. package/dist/index.module.d.ts +0 -499
  132. package/dist/index.module.js +0 -250
  133. package/dist/index.module.js.map +0 -1
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ import { buildSelfDescribingEvent } from '@snowplow/tracker-core';
4
+ import { DEEP_LINK_ENTITY_SCHEMA, DEEP_LINK_RECEIVED_EVENT_SCHEMA, PAGE_REFERRER_PROPERTY, PAGE_URL_PROPERTY, SCREEN_VIEW_EVENT_SCHEMA } from "../../constants.js";
5
+ import { getUsefulSchema } from "../../utils.js";
6
+ export function newDeepLinksPlugin(_ref, core) {
7
+ var _ref$deepLinkContext = _ref.deepLinkContext,
8
+ deepLinkContext = _ref$deepLinkContext === void 0 ? true : _ref$deepLinkContext;
9
+ var lastDeepLink;
10
+ var beforeTrack = function beforeTrack(payloadBuilder) {
11
+ var schema = getUsefulSchema(payloadBuilder);
12
+ if (schema == SCREEN_VIEW_EVENT_SCHEMA && lastDeepLink) {
13
+ var _lastDeepLink = lastDeepLink,
14
+ url = _lastDeepLink.url,
15
+ referrer = _lastDeepLink.referrer;
16
+ if (url) {
17
+ payloadBuilder.add(PAGE_URL_PROPERTY, url);
18
+ }
19
+ if (referrer) {
20
+ payloadBuilder.add(PAGE_REFERRER_PROPERTY, referrer);
21
+ }
22
+ if (deepLinkContext) {
23
+ payloadBuilder.addContextEntity({
24
+ schema: DEEP_LINK_ENTITY_SCHEMA,
25
+ data: lastDeepLink
26
+ });
27
+ }
28
+
29
+ // Clear the last deep link since we only add it to the first screen view event
30
+ lastDeepLink = undefined;
31
+ }
32
+ };
33
+ var trackDeepLinkReceivedEvent = function trackDeepLinkReceivedEvent(argmap, contexts) {
34
+ lastDeepLink = argmap;
35
+ var payload = buildSelfDescribingEvent({
36
+ event: {
37
+ schema: DEEP_LINK_RECEIVED_EVENT_SCHEMA,
38
+ data: argmap
39
+ }
40
+ });
41
+
42
+ // Add atomic event properties
43
+ var url = argmap.url,
44
+ referrer = argmap.referrer;
45
+ if (url) {
46
+ payload.add(PAGE_URL_PROPERTY, url);
47
+ }
48
+ if (referrer) {
49
+ payload.add(PAGE_REFERRER_PROPERTY, referrer);
50
+ }
51
+ core.track(payload, contexts);
52
+ };
53
+ return {
54
+ trackDeepLinkReceivedEvent: trackDeepLinkReceivedEvent,
55
+ plugin: {
56
+ beforeTrack: beforeTrack
57
+ }
58
+ };
59
+ }
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["buildSelfDescribingEvent","DEEP_LINK_ENTITY_SCHEMA","DEEP_LINK_RECEIVED_EVENT_SCHEMA","PAGE_REFERRER_PROPERTY","PAGE_URL_PROPERTY","SCREEN_VIEW_EVENT_SCHEMA","getUsefulSchema","newDeepLinksPlugin","_ref","core","_ref$deepLinkContext","deepLinkContext","lastDeepLink","beforeTrack","payloadBuilder","schema","_lastDeepLink","url","referrer","add","addContextEntity","data","undefined","trackDeepLinkReceivedEvent","argmap","contexts","payload","event","track","plugin"],"sourceRoot":"../../../../src","sources":["plugins/deep_links/index.ts"],"mappings":";;AAAA,SAASA,wBAAwB,QAA8D,wBAAwB;AAEvH,SAASC,uBAAuB,EAAEC,+BAA+B,EAAEC,sBAAsB,EAAEC,iBAAiB,EAAEC,wBAAwB,QAAQ,oBAAiB;AAC/J,SAASC,eAAe,QAAQ,gBAAa;AAM7C,OAAO,SAASC,kBAAkBA,CAAAC,IAAA,EAEhCC,IAAiB,EACA;EAAA,IAAAC,oBAAA,GAAAF,IAAA,CAFfG,eAAe;IAAfA,eAAe,GAAAD,oBAAA,cAAG,IAAI,GAAAA,oBAAA;EAGxB,IAAIE,YAA+C;EAEnD,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,cAA8B,EAAK;IACtD,IAAMC,MAAM,GAAGT,eAAe,CAACQ,cAAc,CAAC;IAE9C,IAAIC,MAAM,IAAIV,wBAAwB,IAAIO,YAAY,EAAE;MACtD,IAAAI,aAAA,GAA0BJ,YAAY;QAA9BK,GAAG,GAAAD,aAAA,CAAHC,GAAG;QAAEC,QAAQ,GAAAF,aAAA,CAARE,QAAQ;MACrB,IAAID,GAAG,EAAE;QACPH,cAAc,CAACK,GAAG,CAACf,iBAAiB,EAAEa,GAAG,CAAC;MAC5C;MACA,IAAIC,QAAQ,EAAE;QACZJ,cAAc,CA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