@armco/analytics 0.1.6 → 0.2.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/.npmignore +6 -0
- package/{dist/analytics.d.ts → analytics.d.ts} +1 -1
- package/{dist/flush.d.ts → flush.d.ts} +1 -1
- package/index.d.ts +1 -36
- package/index.interface.d.ts +27 -0
- package/index.interface.js +1 -0
- package/index.js +13 -9
- package/package.json +4 -26
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -13
- /package/{dist/analytics.js → analytics.js} +0 -0
- /package/{dist/constants.d.ts → constants.d.ts} +0 -0
- /package/{dist/constants.js → constants.js} +0 -0
- /package/{dist/flush.js → flush.js} +0 -0
- /package/{dist/helper.d.ts → helper.d.ts} +0 -0
- /package/{dist/helper.js → helper.js} +0 -0
- /package/{dist/location.d.ts → location.d.ts} +0 -0
- /package/{dist/location.js → location.js} +0 -0
- /package/{dist/session.d.ts → session.d.ts} +0 -0
- /package/{dist/session.js → session.js} +0 -0
package/.npmignore
ADDED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { startSession, getSessionId } from "./session";
|
|
2
|
-
import { User, Event, ConfigType } from "./index.
|
|
2
|
+
import { User, Event, ConfigType } from "./index.interface";
|
|
3
3
|
declare let enabled: boolean | null;
|
|
4
4
|
declare function loadConfiguration(): Promise<any>;
|
|
5
5
|
declare function getEnvironment(): string;
|
package/index.d.ts
CHANGED
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./
|
|
2
|
-
import main from "./dist";
|
|
3
|
-
|
|
4
|
-
export interface User {
|
|
5
|
-
email: string;
|
|
6
|
-
// Other user properties...
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface Event {
|
|
10
|
-
eventType: string;
|
|
11
|
-
timestamp?: Date;
|
|
12
|
-
region?: string,
|
|
13
|
-
address?: string,
|
|
14
|
-
coordinates?: {
|
|
15
|
-
latitude: number
|
|
16
|
-
longitude: number
|
|
17
|
-
}
|
|
18
|
-
[key: string]: any; // Index signature to accept any other properties with their associated types
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export interface ConfigType {
|
|
23
|
-
apiKey?: string;
|
|
24
|
-
analyticsEndpoint?: string;
|
|
25
|
-
hostProjectName?: string;
|
|
26
|
-
trackEvents?: Array<string>;
|
|
27
|
-
submissionStrategy?: SubmissionStrategy
|
|
28
|
-
showPopUp?: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type SubmissionStrategy = "ONEVENT" | "DEFER"
|
|
32
|
-
export type objType = { [key: string]: any }
|
|
33
|
-
export type EVENT_TYPES = "CLICK" | "SUBMIT" | "SCROLL" | string
|
|
34
|
-
|
|
1
|
+
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./analytics";
|
|
35
2
|
export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
|
36
|
-
export default main;
|
|
37
|
-
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
email: string;
|
|
3
|
+
}
|
|
4
|
+
export interface Event {
|
|
5
|
+
eventType: string;
|
|
6
|
+
timestamp?: Date;
|
|
7
|
+
region?: string;
|
|
8
|
+
address?: string;
|
|
9
|
+
coordinates?: {
|
|
10
|
+
latitude: number;
|
|
11
|
+
longitude: number;
|
|
12
|
+
};
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export interface ConfigType {
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
analyticsEndpoint?: string;
|
|
18
|
+
hostProjectName?: string;
|
|
19
|
+
trackEvents?: Array<string>;
|
|
20
|
+
submissionStrategy?: SubmissionStrategy;
|
|
21
|
+
showPopUp?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type SubmissionStrategy = "ONEVENT" | "DEFER";
|
|
24
|
+
export type objType = {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
export type EVENT_TYPES = "CLICK" | "SUBMIT" | "SCROLL" | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, } from "./analytics";
|
|
2
|
+
document.addEventListener("DOMContentLoaded", function (event) {
|
|
3
|
+
const environment = getEnvironment();
|
|
4
|
+
console.info("[ANALYTICS] Idenfitied environment: ", environment);
|
|
5
|
+
if (!environment || environment === "development") {
|
|
6
|
+
console.info("[ANALYTICS] Attempting to auto-load analytics configurations from environment...");
|
|
7
|
+
init();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
console.info("[ANALYTICS] Identified non-dev environment, analytics auto load wouldn't be attempted.");
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
package/package.json
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armco/analytics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Browser Based Analytics interceptor for configured events",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "npx ts-node build.js",
|
|
9
|
-
"lint": "npx eslint --ext .ts src/",
|
|
10
|
-
"lint:tests": "npx eslint --ext .ts spec/",
|
|
11
|
-
"start": "node ./dist --env=production",
|
|
12
|
-
"dev": "nodemon",
|
|
13
|
-
"test": "nodemon --config ./spec/nodemon.json",
|
|
14
|
-
"test:no-reloading": "npx ts-node --files -r tsconfig-paths/register ./spec",
|
|
15
|
-
"publish:local": "npm run build && npm pack --pack-destination ~/__Projects__/Common",
|
|
16
|
-
"publish:sh": "./publish.sh",
|
|
17
|
-
"publish:sh:minor": "./publish.sh minor"
|
|
18
|
-
},
|
|
7
|
+
"scripts": {},
|
|
19
8
|
"repository": {
|
|
20
9
|
"type": "git",
|
|
21
10
|
"url": "git+https://github.com/ReStruct-Corporate-Advantage/analytics.git"
|
|
@@ -34,20 +23,9 @@
|
|
|
34
23
|
},
|
|
35
24
|
"homepage": "https://github.com/ReStruct-Corporate-Advantage/analytics#readme",
|
|
36
25
|
"files": [
|
|
37
|
-
"
|
|
38
|
-
"./index.js",
|
|
39
|
-
"./index.d.ts",
|
|
40
|
-
"./global-modules.d.ts"
|
|
26
|
+
"*"
|
|
41
27
|
],
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@types/fs-extra": "^11.0.1",
|
|
44
|
-
"@types/jquery": "^3.5.16",
|
|
45
|
-
"@types/js-cookie": "^3.0.3",
|
|
46
|
-
"@types/node": "^20.4.2",
|
|
47
|
-
"@types/uuid": "^9.0.2",
|
|
48
|
-
"fs-extra": "^11.1.1",
|
|
49
|
-
"typescript": "^5.1.6"
|
|
50
|
-
},
|
|
28
|
+
"devDependencies": {},
|
|
51
29
|
"dependencies": {
|
|
52
30
|
"jet-logger": "^1.3.1",
|
|
53
31
|
"jquery": "^3.7.0",
|
package/dist/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./analytics";
|
|
2
|
-
export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
package/dist/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, } from "./analytics";
|
|
2
|
-
document.addEventListener("DOMContentLoaded", function (event) {
|
|
3
|
-
const environment = getEnvironment();
|
|
4
|
-
console.info("[ANALYTICS] Idenfitied environment: ", environment);
|
|
5
|
-
if (!environment || environment === "development") {
|
|
6
|
-
console.info("[ANALYTICS] Attempting to auto-load analytics configurations from environment...");
|
|
7
|
-
init();
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
console.info("[ANALYTICS] Identified non-dev environment, analytics auto load wouldn't be attempted.");
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
export { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession, };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|