@journium/core 0.1.0-alpha.1
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/browser-identity.d.ts +29 -0
- package/dist/browser-identity.d.ts.map +1 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +631 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +643 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface BrowserIdentity {
|
|
2
|
+
distinct_id: string;
|
|
3
|
+
$device_id: string;
|
|
4
|
+
$session_id: string;
|
|
5
|
+
session_timestamp: number;
|
|
6
|
+
}
|
|
7
|
+
export interface UserAgentInfo {
|
|
8
|
+
$raw_user_agent: string;
|
|
9
|
+
$browser: string;
|
|
10
|
+
$os: string;
|
|
11
|
+
$device_type: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class BrowserIdentityManager {
|
|
14
|
+
private identity;
|
|
15
|
+
private sessionTimeout;
|
|
16
|
+
private storageKey;
|
|
17
|
+
constructor(sessionTimeout?: number, token?: string);
|
|
18
|
+
private loadOrCreateIdentity;
|
|
19
|
+
private saveIdentity;
|
|
20
|
+
private isBrowser;
|
|
21
|
+
getIdentity(): BrowserIdentity | null;
|
|
22
|
+
updateSessionTimeout(timeoutMs: number): void;
|
|
23
|
+
refreshSession(): void;
|
|
24
|
+
getUserAgentInfo(): UserAgentInfo;
|
|
25
|
+
private parseBrowser;
|
|
26
|
+
private parseOS;
|
|
27
|
+
private parseDeviceType;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=browser-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-identity.d.ts","sourceRoot":"","sources":["../src/browser-identity.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB;AAID,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,UAAU,CAAS;gBAEf,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAWnD,OAAO,CAAC,oBAAoB;IAkD5B,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,SAAS;IAIV,WAAW,IAAI,eAAe,GAAG,IAAI;IAIrC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI7C,cAAc,IAAI,IAAI;IAYtB,gBAAgB,IAAI,aAAa;IAmBxC,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,eAAe;CASxB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
interface JourniumEvent {
|
|
2
|
+
uuid: string;
|
|
3
|
+
ingestion_key: string;
|
|
4
|
+
client_timestamp: string;
|
|
5
|
+
event: string;
|
|
6
|
+
properties: Record<string, any>;
|
|
7
|
+
distinct_id?: string;
|
|
8
|
+
session_id?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AutocaptureConfig {
|
|
11
|
+
captureClicks?: boolean;
|
|
12
|
+
captureFormSubmits?: boolean;
|
|
13
|
+
captureFormChanges?: boolean;
|
|
14
|
+
captureTextSelection?: boolean;
|
|
15
|
+
ignoreClasses?: string[];
|
|
16
|
+
ignoreElements?: string[];
|
|
17
|
+
captureContentText?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface RemoteConfig {
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
flushAt?: number;
|
|
22
|
+
flushInterval?: number;
|
|
23
|
+
autocapture?: boolean | AutocaptureConfig;
|
|
24
|
+
sessionTimeout?: number;
|
|
25
|
+
sampling?: {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
rate?: number;
|
|
28
|
+
};
|
|
29
|
+
features?: {
|
|
30
|
+
enableGeolocation?: boolean;
|
|
31
|
+
enableSessionRecording?: boolean;
|
|
32
|
+
enablePerformanceTracking?: boolean;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
interface ConfigResponse {
|
|
36
|
+
success: boolean;
|
|
37
|
+
config: RemoteConfig;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
}
|
|
40
|
+
interface JourniumConfig {
|
|
41
|
+
token: string;
|
|
42
|
+
apiHost: string;
|
|
43
|
+
debug?: boolean;
|
|
44
|
+
flushAt?: number;
|
|
45
|
+
flushInterval?: number;
|
|
46
|
+
autocapture?: boolean | AutocaptureConfig;
|
|
47
|
+
configEndpoint?: string;
|
|
48
|
+
sessionTimeout?: number;
|
|
49
|
+
}
|
|
50
|
+
interface PageviewProperties {
|
|
51
|
+
$current_url?: string;
|
|
52
|
+
$host?: string;
|
|
53
|
+
$pathname?: string;
|
|
54
|
+
$search?: string;
|
|
55
|
+
$title?: string;
|
|
56
|
+
$referrer?: string;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const generateId: () => string;
|
|
61
|
+
declare const generateUuidv7: () => string;
|
|
62
|
+
declare const getCurrentTimestamp: () => string;
|
|
63
|
+
declare const getCurrentUrl: () => string;
|
|
64
|
+
declare const getPageTitle: () => string;
|
|
65
|
+
declare const getReferrer: () => string;
|
|
66
|
+
declare const isBrowser: () => boolean;
|
|
67
|
+
declare const isNode: () => boolean;
|
|
68
|
+
declare const fetchRemoteConfig: (apiHost: string, token: string, configEndpoint?: string, fetchFn?: any) => Promise<any>;
|
|
69
|
+
declare const mergeConfigs: (localConfig: any, remoteConfig: any) => any;
|
|
70
|
+
|
|
71
|
+
interface BrowserIdentity {
|
|
72
|
+
distinct_id: string;
|
|
73
|
+
$device_id: string;
|
|
74
|
+
$session_id: string;
|
|
75
|
+
session_timestamp: number;
|
|
76
|
+
}
|
|
77
|
+
interface UserAgentInfo {
|
|
78
|
+
$raw_user_agent: string;
|
|
79
|
+
$browser: string;
|
|
80
|
+
$os: string;
|
|
81
|
+
$device_type: string;
|
|
82
|
+
}
|
|
83
|
+
declare class BrowserIdentityManager {
|
|
84
|
+
private identity;
|
|
85
|
+
private sessionTimeout;
|
|
86
|
+
private storageKey;
|
|
87
|
+
constructor(sessionTimeout?: number, token?: string);
|
|
88
|
+
private loadOrCreateIdentity;
|
|
89
|
+
private saveIdentity;
|
|
90
|
+
private isBrowser;
|
|
91
|
+
getIdentity(): BrowserIdentity | null;
|
|
92
|
+
updateSessionTimeout(timeoutMs: number): void;
|
|
93
|
+
refreshSession(): void;
|
|
94
|
+
getUserAgentInfo(): UserAgentInfo;
|
|
95
|
+
private parseBrowser;
|
|
96
|
+
private parseOS;
|
|
97
|
+
private parseDeviceType;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { AutocaptureConfig, BrowserIdentity, BrowserIdentityManager, ConfigResponse, JourniumConfig, JourniumEvent, PageviewProperties, RemoteConfig, UserAgentInfo, fetchRemoteConfig, generateId, generateUuidv7, getCurrentTimestamp, getCurrentUrl, getPageTitle, getReferrer, isBrowser, isNode, mergeConfigs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC"}
|