@bluenath/engage 1.0.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/dist/core/Analytics.d.ts +13 -0
- package/dist/core/Context.d.ts +22 -0
- package/dist/core/EventQueue.d.ts +15 -0
- package/dist/core/Queue.d.ts +15 -0
- package/dist/core/Transport.d.ts +7 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1579 -0
- package/dist/lib/fingerprint.d.ts +11 -0
- package/dist/lib/hash.d.ts +6 -0
- package/dist/lib/storage.d.ts +24 -0
- package/dist/react/EngageProProvider.d.ts +10 -0
- package/dist/types/index.d.ts +63 -0
- package/package.json +40 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DeviceSignal {
|
|
2
|
+
userAgent: string;
|
|
3
|
+
screenRes: string;
|
|
4
|
+
colorDepth: number;
|
|
5
|
+
timezone: number;
|
|
6
|
+
language: string;
|
|
7
|
+
platform: string;
|
|
8
|
+
hardwareConcurrency: number;
|
|
9
|
+
deviceMemory?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const getDeviceFingerprint: () => string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare class StorageEngine {
|
|
2
|
+
private type;
|
|
3
|
+
private memoryStore;
|
|
4
|
+
private keyPrefix;
|
|
5
|
+
private domain;
|
|
6
|
+
constructor(type?: "local" | "cookie" | "memory");
|
|
7
|
+
/**
|
|
8
|
+
* Safe Getter that tries Memory -> Storage Strategy
|
|
9
|
+
*/
|
|
10
|
+
getItem(key: string): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Safe Setter with Automatic Fallback
|
|
13
|
+
*/
|
|
14
|
+
setItem(key: string, value: string): void;
|
|
15
|
+
removeItem(key: string): void;
|
|
16
|
+
private getCookie;
|
|
17
|
+
private setCookie;
|
|
18
|
+
/**
|
|
19
|
+
* Tries to find the highest level domain (e.g. .nike.com) to allow cross-subdomain tracking
|
|
20
|
+
*/
|
|
21
|
+
private getCookieDomain;
|
|
22
|
+
private isBrowser;
|
|
23
|
+
private isQuotaError;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { EngagePro } from '../core/Analytics';
|
|
3
|
+
import { EngageConfig } from '../types';
|
|
4
|
+
|
|
5
|
+
export declare const useAnalytics: () => EngagePro;
|
|
6
|
+
interface ProviderProps extends EngageConfig {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const EngageProProvider: React.FC<ProviderProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type StandardEvent = "ADD_TO_CART" | "INITIATE_CHECKOUT" | "PURCHASE" | "SEARCH" | "ORDER_CANCEL" | "ORDER_REFUND" | "REORDER" | "TRACK_PACKAGE" | "RATE_PRODUCT" | "SHARE_PRODUCT" | "REGISTER" | "LOGIN" | "VIEW_CONTENT" | "PAGE_VIEW" | "PERFORMANCE" | "RAGE_CLICK" | "FORM_START" | "FORM_SUBMIT" | "GENERIC";
|
|
2
|
+
export type IntentType = "commerce" | "lifecycle" | "engagement" | "identity" | "search" | "frustration" | "performance" | "navigation" | "interaction" | "form" | "generic";
|
|
3
|
+
export interface AnalyticsContext {
|
|
4
|
+
library: {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
};
|
|
8
|
+
user: {
|
|
9
|
+
anonymousId: string;
|
|
10
|
+
id?: string | null;
|
|
11
|
+
};
|
|
12
|
+
session: {
|
|
13
|
+
id: string;
|
|
14
|
+
startTime: number;
|
|
15
|
+
};
|
|
16
|
+
page: {
|
|
17
|
+
path: string;
|
|
18
|
+
referrer: string;
|
|
19
|
+
title: string;
|
|
20
|
+
search: string;
|
|
21
|
+
url: string;
|
|
22
|
+
};
|
|
23
|
+
network: {
|
|
24
|
+
online: boolean;
|
|
25
|
+
downlink?: number;
|
|
26
|
+
};
|
|
27
|
+
screen: {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
density: number;
|
|
31
|
+
};
|
|
32
|
+
device: {
|
|
33
|
+
fingerprint: string;
|
|
34
|
+
type: "mobile" | "tablet" | "desktop";
|
|
35
|
+
userAgent: string;
|
|
36
|
+
};
|
|
37
|
+
locale: string;
|
|
38
|
+
timezone: string;
|
|
39
|
+
}
|
|
40
|
+
export interface AnalyticsEvent {
|
|
41
|
+
event: string;
|
|
42
|
+
properties?: Record<string, any>;
|
|
43
|
+
standardEvent?: StandardEvent;
|
|
44
|
+
intent?: IntentType;
|
|
45
|
+
confidence?: number;
|
|
46
|
+
rawLabel?: string;
|
|
47
|
+
userId?: string;
|
|
48
|
+
anonymousId?: string;
|
|
49
|
+
timestamp?: string;
|
|
50
|
+
messageId?: string;
|
|
51
|
+
writeKey?: string;
|
|
52
|
+
context?: Partial<AnalyticsContext>;
|
|
53
|
+
}
|
|
54
|
+
export interface EngageConfig {
|
|
55
|
+
writeKey: string;
|
|
56
|
+
apiHost?: string;
|
|
57
|
+
tracking: {
|
|
58
|
+
useCookies: boolean;
|
|
59
|
+
fingerprint: boolean;
|
|
60
|
+
autoTrack: boolean;
|
|
61
|
+
};
|
|
62
|
+
debug?: boolean;
|
|
63
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bluenath/engage",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "tsc --noEmit && vite build",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": ">=16.8.0",
|
|
24
|
+
"react-dom": ">=16.8.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"uuid": "^9.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/react": "^18.2.0",
|
|
31
|
+
"@types/react-dom": "^18.2.0",
|
|
32
|
+
"@types/uuid": "^9.0.0",
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0",
|
|
35
|
+
"terser": "^5.46.0",
|
|
36
|
+
"typescript": "^5.0.0",
|
|
37
|
+
"vite": "^5.0.0",
|
|
38
|
+
"vite-plugin-dts": "^3.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|