@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.
- package/README.md +38 -30
- package/dist/commonjs/constants.js +20 -0
- package/dist/commonjs/constants.js.map +1 -0
- package/dist/commonjs/event_store.js +150 -0
- package/dist/commonjs/event_store.js.map +1 -0
- package/dist/commonjs/events.js +42 -0
- package/dist/commonjs/events.js.map +1 -0
- package/dist/commonjs/index.js +29 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/plugins/app_context/index.js +47 -0
- package/dist/commonjs/plugins/app_context/index.js.map +1 -0
- package/dist/commonjs/plugins/app_install/index.js +60 -0
- package/dist/commonjs/plugins/app_install/index.js.map +1 -0
- package/dist/commonjs/plugins/app_lifecycle/index.js +126 -0
- package/dist/commonjs/plugins/app_lifecycle/index.js.map +1 -0
- package/dist/commonjs/plugins/deep_links/index.js +64 -0
- package/dist/commonjs/plugins/deep_links/index.js.map +1 -0
- package/dist/commonjs/plugins/platform_context/index.js +749 -0
- package/dist/commonjs/plugins/platform_context/index.js.map +1 -0
- package/dist/commonjs/plugins/session/index.js +197 -0
- package/dist/commonjs/plugins/session/index.js.map +1 -0
- package/dist/commonjs/plugins.js +147 -0
- package/dist/commonjs/plugins.js.map +1 -0
- package/dist/commonjs/subject.js +82 -0
- package/dist/commonjs/subject.js.map +1 -0
- package/dist/commonjs/tracker.js +188 -0
- package/dist/commonjs/tracker.js.map +1 -0
- package/dist/commonjs/types.js +313 -0
- package/dist/commonjs/types.js.map +1 -0
- package/dist/commonjs/utils.js +35 -0
- package/dist/commonjs/utils.js.map +1 -0
- package/dist/module/constants.js +16 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/event_store.js +145 -0
- package/dist/module/event_store.js.map +1 -0
- package/dist/module/events.js +38 -0
- package/dist/module/events.js.map +1 -0
- package/dist/module/index.js +7 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/plugins/app_context/index.js +44 -0
- package/dist/module/plugins/app_context/index.js.map +1 -0
- package/dist/module/plugins/app_install/index.js +56 -0
- package/dist/module/plugins/app_install/index.js.map +1 -0
- package/dist/module/plugins/app_lifecycle/index.js +122 -0
- package/dist/module/plugins/app_lifecycle/index.js.map +1 -0
- package/dist/module/plugins/deep_links/index.js +60 -0
- package/dist/module/plugins/deep_links/index.js.map +1 -0
- package/dist/module/plugins/platform_context/index.js +745 -0
- package/dist/module/plugins/platform_context/index.js.map +1 -0
- package/dist/module/plugins/session/index.js +192 -0
- package/dist/module/plugins/session/index.js.map +1 -0
- package/dist/module/plugins.js +143 -0
- package/dist/module/plugins.js.map +1 -0
- package/dist/module/subject.js +78 -0
- package/dist/module/subject.js.map +1 -0
- package/dist/module/tracker.js +183 -0
- package/dist/module/tracker.js.map +1 -0
- package/dist/module/types.js +113 -0
- package/dist/module/types.js.map +1 -0
- package/dist/module/utils.js +31 -0
- package/dist/module/utils.js.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/commonjs/src/constants.d.ts +14 -0
- package/dist/typescript/commonjs/src/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/event_store.d.ts +4 -0
- package/dist/typescript/commonjs/src/event_store.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/events.d.ts +10 -0
- package/dist/typescript/commonjs/src/events.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins/app_context/index.d.ts +11 -0
- package/dist/typescript/commonjs/src/plugins/app_context/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins/app_install/index.d.ts +10 -0
- package/dist/typescript/commonjs/src/plugins/app_install/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins/app_lifecycle/index.d.ts +13 -0
- package/dist/typescript/commonjs/src/plugins/app_lifecycle/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins/deep_links/index.d.ts +8 -0
- package/dist/typescript/commonjs/src/plugins/deep_links/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins/platform_context/index.d.ts +12 -0
- package/dist/typescript/commonjs/src/plugins/platform_context/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins/session/index.d.ts +19 -0
- package/dist/typescript/commonjs/src/plugins/session/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/plugins.d.ts +6 -0
- package/dist/typescript/commonjs/src/plugins.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/subject.d.ts +19 -0
- package/dist/typescript/commonjs/src/subject.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/tracker.d.ts +28 -0
- package/dist/typescript/commonjs/src/tracker.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/types.d.ts +784 -0
- package/dist/typescript/commonjs/src/types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/utils.d.ts +3 -0
- package/dist/typescript/commonjs/src/utils.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/dist/typescript/module/src/constants.d.ts +14 -0
- package/dist/typescript/module/src/constants.d.ts.map +1 -0
- package/dist/typescript/module/src/event_store.d.ts +4 -0
- package/dist/typescript/module/src/event_store.d.ts.map +1 -0
- package/dist/typescript/module/src/events.d.ts +10 -0
- package/dist/typescript/module/src/events.d.ts.map +1 -0
- package/dist/typescript/module/src/index.d.ts +4 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins/app_context/index.d.ts +11 -0
- package/dist/typescript/module/src/plugins/app_context/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins/app_install/index.d.ts +10 -0
- package/dist/typescript/module/src/plugins/app_install/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins/app_lifecycle/index.d.ts +13 -0
- package/dist/typescript/module/src/plugins/app_lifecycle/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins/deep_links/index.d.ts +8 -0
- package/dist/typescript/module/src/plugins/deep_links/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins/platform_context/index.d.ts +12 -0
- package/dist/typescript/module/src/plugins/platform_context/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins/session/index.d.ts +19 -0
- package/dist/typescript/module/src/plugins/session/index.d.ts.map +1 -0
- package/dist/typescript/module/src/plugins.d.ts +6 -0
- package/dist/typescript/module/src/plugins.d.ts.map +1 -0
- package/dist/typescript/module/src/subject.d.ts +19 -0
- package/dist/typescript/module/src/subject.d.ts.map +1 -0
- package/dist/typescript/module/src/tracker.d.ts +28 -0
- package/dist/typescript/module/src/tracker.d.ts.map +1 -0
- package/dist/typescript/module/src/types.d.ts +784 -0
- package/dist/typescript/module/src/types.d.ts.map +1 -0
- package/dist/typescript/module/src/utils.d.ts +3 -0
- package/dist/typescript/module/src/utils.d.ts.map +1 -0
- package/package.json +57 -14
- package/dist/index.cjs.d.ts +0 -499
- package/dist/index.cjs.js +0 -2656
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.cjs.min.d.ts +0 -499
- package/dist/index.cjs.min.js +0 -63
- package/dist/index.cjs.min.js.map +0 -1
- package/dist/index.module.d.ts +0 -499
- package/dist/index.module.js +0 -250
- 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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