piral-tracking 1.0.0-pre.2117 → 1.0.1-beta.5640

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 - 2021 smapiot
3
+ Copyright (c) 2019 - 2023 smapiot
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- [![Piral Logo](https://github.com/smapiot/piral/raw/master/docs/assets/logo.png)](https://piral.io)
1
+ [![Piral Logo](https://github.com/smapiot/piral/raw/main/docs/assets/logo.png)](https://piral.io)
2
2
 
3
- # [Piral Tracking](https://piral.io) · [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smapiot/piral/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/piral-tracking.svg?style=flat)](https://www.npmjs.com/package/piral-tracking) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://jestjs.io) [![Gitter Chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/piral-io/community)
3
+ # [Piral Tracking](https://piral.io) · [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smapiot/piral/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/piral-tracking.svg?style=flat)](https://www.npmjs.com/package/piral-tracking) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://jestjs.io) [![Gitter Chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/piral-io/community)
4
4
 
5
5
  This is a plugin that only has a peer dependency to `piral-core`. What `piral-tracking` brings to the table is a set of Pilet API extensions that can be used with `piral` or `piral-core`.
6
6
 
@@ -16,6 +16,12 @@ Usually, the answer to this should be **no**. This plugin gives you an abstracti
16
16
 
17
17
  Alternatives: Use your preferred tracking application standalone.
18
18
 
19
+ ## Video
20
+
21
+ We also have a video for this plugin:
22
+
23
+ @[youtube](https://youtu.be/wCNflOoXS2c)
24
+
19
25
  ## Documentation
20
26
 
21
27
  The following functions are brought to the Pilet API.
package/esm/create.js CHANGED
@@ -2,47 +2,37 @@ import { SeverityLevel } from './types';
2
2
  /**
3
3
  * Creates the Pilet API extensions for tracking and telemetry.
4
4
  */
5
- export function createTrackingApi(config) {
6
- if (config === void 0) { config = {}; }
7
- return function () { return function (api, meta) { return ({
8
- trackEvent: function (name, properties, measurements) {
9
- if (properties === void 0) { properties = {}; }
10
- if (measurements === void 0) { measurements = {}; }
5
+ export function createTrackingApi(config = {}) {
6
+ return () => (api, meta) => ({
7
+ trackEvent(name, properties = {}, measurements = {}) {
11
8
  api.emit('track-event', {
12
- name: name,
9
+ name,
13
10
  pilet: meta.name,
14
- properties: properties,
15
- measurements: measurements,
11
+ properties,
12
+ measurements,
16
13
  });
17
14
  },
18
- trackError: function (error, properties, measurements, severityLevel) {
19
- if (properties === void 0) { properties = {}; }
20
- if (measurements === void 0) { measurements = {}; }
21
- if (severityLevel === void 0) { severityLevel = SeverityLevel.information; }
15
+ trackError(error, properties = {}, measurements = {}, severityLevel = SeverityLevel.information) {
22
16
  api.emit('track-error', {
23
17
  pilet: meta.name,
24
- error: error,
25
- properties: properties,
26
- measurements: measurements,
27
- severityLevel: severityLevel,
18
+ error,
19
+ properties,
20
+ measurements,
21
+ severityLevel,
28
22
  });
29
23
  },
30
- trackFrame: function (name) {
24
+ trackFrame(name) {
31
25
  api.emit('track-frame-start', {
32
- name: name,
26
+ name,
33
27
  pilet: meta.name,
34
28
  });
35
- return function (properties, measurements) {
36
- if (properties === void 0) { properties = {}; }
37
- if (measurements === void 0) { measurements = {}; }
38
- return api.emit('track-frame-end', {
39
- name: name,
40
- pilet: meta.name,
41
- properties: properties,
42
- measurements: measurements,
43
- });
44
- };
29
+ return (properties = {}, measurements = {}) => api.emit('track-frame-end', {
30
+ name,
31
+ pilet: meta.name,
32
+ properties,
33
+ measurements,
34
+ });
45
35
  },
46
- }); }; };
36
+ });
47
37
  }
48
38
  //# sourceMappingURL=create.js.map
package/esm/create.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAO1D;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA2B;IAA3B,uBAAA,EAAA,WAA2B;IAC3D,OAAO,cAAM,OAAA,UAAC,GAAG,EAAE,IAAI,IAAK,OAAA,CAAC;QAC3B,UAAU,YAAC,IAAI,EAAE,UAAe,EAAE,YAAiB;YAAlC,2BAAA,EAAA,eAAe;YAAE,6BAAA,EAAA,iBAAiB;YACjD,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,MAAA;gBACJ,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,UAAU,YAAA;gBACV,YAAY,cAAA;aACb,CAAC,CAAC;QACL,CAAC;QACD,UAAU,YAAC,KAAK,EAAE,UAAe,EAAE,YAAiB,EAAE,aAAyC;YAA7E,2BAAA,EAAA,eAAe;YAAE,6BAAA,EAAA,iBAAiB;YAAE,8BAAA,EAAA,gBAAgB,aAAa,CAAC,WAAW;YAC7F,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;gBACtB,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,KAAK,OAAA;gBACL,UAAU,YAAA;gBACV,YAAY,cAAA;gBACZ,aAAa,eAAA;aACd,CAAC,CAAC;QACL,CAAC;QACD,UAAU,YAAC,IAAI;YACb,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAC5B,IAAI,MAAA;gBACJ,KAAK,EAAE,IAAI,CAAC,IAAI;aACjB,CAAC,CAAC;YACH,OAAO,UAAC,UAAe,EAAE,YAAiB;gBAAlC,2BAAA,EAAA,eAAe;gBAAE,6BAAA,EAAA,iBAAiB;gBACxC,O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,IAAI;gBACJ,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,UAAU;gBACV,YAAY;aACb,CAAC,CAAC;QACP,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/lib/create.js CHANGED
@@ -1,52 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTrackingApi = void 0;
4
- var types_1 = require("./types");
4
+ const types_1 = require("./types");
5
5
  /**
6
6
  * Creates the Pilet API extensions for tracking and telemetry.
7
7
  */
8
- function createTrackingApi(config) {
9
- if (config === void 0) { config = {}; }
10
- return function () { return function (api, meta) { return ({
11
- trackEvent: function (name, properties, measurements) {
12
- if (properties === void 0) { properties = {}; }
13
- if (measurements === void 0) { measurements = {}; }
8
+ function createTrackingApi(config = {}) {
9
+ return () => (api, meta) => ({
10
+ trackEvent(name, properties = {}, measurements = {}) {
14
11
  api.emit('track-event', {
15
- name: name,
12
+ name,
16
13
  pilet: meta.name,
17
- properties: properties,
18
- measurements: measurements,
14
+ properties,
15
+ measurements,
19
16
  });
20
17
  },
21
- trackError: function (error, properties, measurements, severityLevel) {
22
- if (properties === void 0) { properties = {}; }
23
- if (measurements === void 0) { measurements = {}; }
24
- if (severityLevel === void 0) { severityLevel = types_1.SeverityLevel.information; }
18
+ trackError(error, properties = {}, measurements = {}, severityLevel = types_1.SeverityLevel.information) {
25
19
  api.emit('track-error', {
26
20
  pilet: meta.name,
27
- error: error,
28
- properties: properties,
29
- measurements: measurements,
30
- severityLevel: severityLevel,
21
+ error,
22
+ properties,
23
+ measurements,
24
+ severityLevel,
31
25
  });
32
26
  },
33
- trackFrame: function (name) {
27
+ trackFrame(name) {
34
28
  api.emit('track-frame-start', {
35
- name: name,
29
+ name,
36
30
  pilet: meta.name,
37
31
  });
38
- return function (properties, measurements) {
39
- if (properties === void 0) { properties = {}; }
40
- if (measurements === void 0) { measurements = {}; }
41
- return api.emit('track-frame-end', {
42
- name: name,
43
- pilet: meta.name,
44
- properties: properties,
45
- measurements: measurements,
46
- });
47
- };
32
+ return (properties = {}, measurements = {}) => api.emit('track-frame-end', {
33
+ name,
34
+ pilet: meta.name,
35
+ properties,
36
+ measurements,
37
+ });
48
38
  },
49
- }); }; };
39
+ });
50
40
  }
51
41
  exports.createTrackingApi = createTrackingApi;
52
42
  //# sourceMappingURL=create.js.map
package/lib/create.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,iCAA0D;AAO1D;;GAEG;AACH,SAAgB,iBAAiB,CAAC,MAA2B;IAA3B,uBAAA,EAAA,WAA2B;IAC3D,OAAO,cAAM,OAAA,UAAC,GAAG,EAAE,IAAI,IAAK,OAAA,CAAC;QAC3B,UAAU,YAAC,IAAI,EAAE,UAAe,EAAE,YAAiB;YAAlC,2BAAA,EAAA,eAAe;YAAE,6BAAA,EAAA,iBAAiB;YACjD,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,MAAA;gBACJ,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,UAAU,YAAA;gBACV,YAAY,cAAA;aACb,CAAC,CAAC;QACL,CAAC;QACD,UAAU,YAAC,KAAK,EAAE,UAAe,EAAE,YAAiB,EAAE,aAAyC;YAA7E,2BAAA,EAAA,eAAe;YAAE,6BAAA,EAAA,iBAAiB;YAAE,8BAAA,EAAA,gBAAgB,qBAAa,CAAC,WAAW;YAC7F,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;gBACtB,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,KAAK,OAAA;gBACL,UAAU,YAAA;gBACV,YAAY,cAAA;gBACZ,aAAa,eAAA;aACd,CAAC,CAAC;QACL,CAAC;QACD,UAAU,YAAC,IAAI;YACb,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAC5B,IAAI,MAAA;gBACJ,KAAK,EAAE,IAAI,CAAC,IAAI;aACjB,CAAC,CAAC;YACH,OA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G,EAAE,EAAE,EAAE,CAC5C,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE;gBAC1B,IAAI;gBACJ,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,UAAU;gBACV,YAAY;aACb,CAAC,CAAC;QACP,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAjCD,8CAiCC"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./create"), exports);
5
5
  tslib_1.__exportStar(require("./types"), exports);
6
6
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-tracking",
3
- "version": "1.0.0-pre.2117",
3
+ "version": "1.0.1-beta.5640",
4
4
  "description": "Plugin for tracking and telemetry events in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -21,11 +21,29 @@
21
21
  "module": "esm/index.js",
22
22
  "main": "lib/index.js",
23
23
  "typings": "lib/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./esm/index.js",
27
+ "require": "./lib/index.js"
28
+ },
29
+ "./esm/*": {
30
+ "import": "./esm/*"
31
+ },
32
+ "./lib/*": {
33
+ "require": "./lib/*"
34
+ },
35
+ "./_/*": {
36
+ "import": "./esm/*.js",
37
+ "require": "./lib/*.js"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
24
41
  "sideEffects": false,
25
42
  "files": [
26
43
  "esm",
27
44
  "lib",
28
- "src"
45
+ "src",
46
+ "piral-tracking.min.js"
29
47
  ],
30
48
  "repository": {
31
49
  "type": "git",
@@ -35,17 +53,16 @@
35
53
  "url": "https://github.com/smapiot/piral/issues"
36
54
  },
37
55
  "scripts": {
38
- "build": "yarn build:commonjs && yarn build:esnext",
56
+ "cleanup": "rimraf esm lib piral-tracking.min.js",
57
+ "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
58
+ "build:bundle": "esbuild src/index.ts --outfile=piral-tracking.min.js --bundle --external:piral-core --minify --global-name=piralTracking",
39
59
  "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
40
60
  "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
41
61
  "typedoc": "typedoc --json ../../../docs/types/piral-tracking.json src --exclude \"src/**/*.test.*\"",
42
62
  "test": "echo \"Error: run tests from root\" && exit 1"
43
63
  },
44
64
  "devDependencies": {
45
- "piral-core": "^1.0.0-pre.2117"
46
- },
47
- "peerDependencies": {
48
- "piral-core": "1.x"
65
+ "piral-core": "1.0.1-beta.5640"
49
66
  },
50
- "gitHead": "2e9f74890d6babbe80c730317a415293c75fdebc"
67
+ "gitHead": "fa0a72b28fd0a20afec7ef491ec19e93c090fc72"
51
68
  }
@@ -0,0 +1 @@
1
+ var piralTracking=(()=>{var c=Object.defineProperty;var p=n=>c(n,"__esModule",{value:!0});var s=(n,e)=>{p(n);for(var t in e)c(n,t,{get:e[t],enumerable:!0})};var l={};s(l,{SeverityLevel:()=>o,createTrackingApi:()=>k});var o;(function(r){r[r.verbose=0]="verbose",r[r.information=1]="information",r[r.warning=2]="warning",r[r.error=3]="error",r[r.critical=4]="critical"})(o||(o={}));function k(n={}){return()=>(e,t)=>({trackEvent(a,i={},r={}){e.emit("track-event",{name:a,pilet:t.name,properties:i,measurements:r})},trackError(a,i={},r={},m=o.information){e.emit("track-error",{pilet:t.name,error:a,properties:i,measurements:r,severityLevel:m})},trackFrame(a){return e.emit("track-frame-start",{name:a,pilet:t.name}),(i={},r={})=>e.emit("track-frame-end",{name:a,pilet:t.name,properties:i,measurements:r})}})}return l;})();