@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 ADDED
@@ -0,0 +1,6 @@
1
+ tsconfig*
2
+ package-lock.json
3
+ build.ts
4
+ build.js
5
+ node_modules
6
+ index.ts
@@ -1,5 +1,5 @@
1
1
  import { startSession, getSessionId } from "./session";
2
- import { User, Event, ConfigType } from "./index.d";
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;
@@ -1,3 +1,3 @@
1
- import { Event, SubmissionStrategy } from "./index.d";
1
+ import { Event, SubmissionStrategy } from "./index.interface";
2
2
  export declare function queueEvent(event: Event): void;
3
3
  export declare function hookFlushHandlers(submissionStrategy?: SubmissionStrategy): void;
package/index.d.ts CHANGED
@@ -1,37 +1,2 @@
1
- import { init, identify, getEnvironment, getEnvironmentType, trackEvent, trackPageView, trackError, enableTracking, generateAnonymousId, sendHostProjectName, getSessionId, startSession } from "./dist";
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
- "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : {default: mod};
6
- };
7
- Object.defineProperty(exports, "__esModule", {value: true});
8
- const init_1 = __importDefault(require("./dist"));
9
- exports.default = init_1.default;
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.1.6",
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
- "./dist/**/*",
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