@leanbase.com/js 0.1.3 → 0.2.0-alpha.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/LICENSE +37 -0
- package/dist/autocapture-utils.d.ts +17 -0
- package/dist/autocapture.d.ts +35 -0
- package/dist/config.d.ts +5 -0
- package/dist/constants.d.ts +54 -0
- package/dist/entrypoints/main.cjs.d.ts +4 -0
- package/dist/entrypoints/module.es.d.ts +4 -0
- package/dist/extensions/rageclick.d.ts +9 -0
- package/dist/iife.d.ts +19 -0
- package/dist/index.d.ts +2 -779
- package/dist/leanbase-logger.d.ts +6 -0
- package/dist/leanbase-persistence.d.ts +64 -0
- package/dist/leanbase.d.ts +49 -0
- package/dist/leanbase.iife.js +1 -4747
- package/dist/leanbase.iife.js.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -0
- package/dist/module.d.ts +780 -0
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -0
- package/dist/page-view.d.ts +29 -0
- package/dist/scroll-manager.d.ts +21 -0
- package/dist/session-props.d.ts +32 -0
- package/dist/sessionid.d.ts +50 -0
- package/dist/storage.d.ts +24 -0
- package/{src/types.ts → dist/types.d.ts} +145 -235
- package/dist/utils/blocked-uas.d.ts +17 -0
- package/dist/utils/element-utils.d.ts +5 -0
- package/dist/utils/event-utils.d.ts +22 -0
- package/dist/utils/index.d.ts +44 -0
- package/dist/utils/request-utils.d.ts +12 -0
- package/dist/utils/simple-event-emitter.d.ts +6 -0
- package/dist/utils/user-agent-utils.d.ts +18 -0
- package/dist/uuidv7.d.ts +43 -0
- package/dist/version.d.ts +1 -0
- package/lib/autocapture-utils.d.ts +17 -0
- package/{src/autocapture-utils.ts → lib/autocapture-utils.js} +196 -280
- package/lib/autocapture-utils.js.map +1 -0
- package/lib/autocapture.d.ts +35 -0
- package/lib/autocapture.js +311 -0
- package/lib/autocapture.js.map +1 -0
- package/lib/config.d.ts +5 -0
- package/lib/config.js +7 -0
- package/lib/config.js.map +1 -0
- package/lib/constants.d.ts +54 -0
- package/{src/constants.ts → lib/constants.js} +50 -57
- package/lib/constants.js.map +1 -0
- package/lib/entrypoints/main.cjs.d.ts +4 -0
- package/lib/entrypoints/main.cjs.js +3 -0
- package/lib/entrypoints/main.cjs.js.map +1 -0
- package/lib/entrypoints/module.es.d.ts +4 -0
- package/lib/entrypoints/module.es.js +3 -0
- package/lib/entrypoints/module.es.js.map +1 -0
- package/lib/extensions/rageclick.d.ts +9 -0
- package/lib/extensions/rageclick.js +27 -0
- package/lib/extensions/rageclick.js.map +1 -0
- package/lib/iife.d.ts +19 -0
- package/lib/iife.js +67 -0
- package/lib/iife.js.map +1 -0
- package/{src/index.ts → lib/index.d.ts} +2 -2
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/leanbase-logger.d.ts +6 -0
- package/lib/leanbase-logger.js +25 -0
- package/lib/leanbase-logger.js.map +1 -0
- package/lib/leanbase-persistence.d.ts +64 -0
- package/lib/leanbase-persistence.js +287 -0
- package/lib/leanbase-persistence.js.map +1 -0
- package/lib/leanbase.d.ts +49 -0
- package/lib/leanbase.js +294 -0
- package/lib/leanbase.js.map +1 -0
- package/lib/page-view.d.ts +29 -0
- package/lib/page-view.js +81 -0
- package/lib/page-view.js.map +1 -0
- package/lib/scroll-manager.d.ts +21 -0
- package/lib/scroll-manager.js +79 -0
- package/lib/scroll-manager.js.map +1 -0
- package/lib/session-props.d.ts +32 -0
- package/lib/session-props.js +73 -0
- package/lib/session-props.js.map +1 -0
- package/lib/sessionid.d.ts +50 -0
- package/{src/sessionid.ts → lib/sessionid.js} +128 -204
- package/lib/sessionid.js.map +1 -0
- package/lib/storage.d.ts +24 -0
- package/{src/storage.ts → lib/storage.js} +182 -225
- package/lib/storage.js.map +1 -0
- package/lib/types.d.ts +544 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/blocked-uas.d.ts +17 -0
- package/{src/utils/blocked-uas.ts → lib/utils/blocked-uas.js} +19 -48
- package/lib/utils/blocked-uas.js.map +1 -0
- package/lib/utils/element-utils.d.ts +5 -0
- package/{src/utils/element-utils.ts → lib/utils/element-utils.js} +13 -17
- package/lib/utils/element-utils.js.map +1 -0
- package/lib/utils/event-utils.d.ts +22 -0
- package/lib/utils/event-utils.js +258 -0
- package/lib/utils/event-utils.js.map +1 -0
- package/lib/utils/index.d.ts +44 -0
- package/lib/utils/index.js +183 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/request-utils.d.ts +12 -0
- package/lib/utils/request-utils.js +107 -0
- package/lib/utils/request-utils.js.map +1 -0
- package/lib/utils/simple-event-emitter.d.ts +6 -0
- package/lib/utils/simple-event-emitter.js +24 -0
- package/lib/utils/simple-event-emitter.js.map +1 -0
- package/lib/utils/user-agent-utils.d.ts +18 -0
- package/lib/utils/user-agent-utils.js +369 -0
- package/lib/utils/user-agent-utils.js.map +1 -0
- package/lib/uuidv7.d.ts +43 -0
- package/{src/uuidv7.ts → lib/uuidv7.js} +103 -131
- package/lib/uuidv7.js.map +1 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/package.json +56 -45
- package/dist/index.cjs +0 -3034
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs +0 -3032
- package/dist/index.mjs.map +0 -1
- package/src/autocapture.ts +0 -415
- package/src/config.ts +0 -8
- package/src/extensions/rageclick.ts +0 -34
- package/src/iife.ts +0 -87
- package/src/leanbase-logger.ts +0 -26
- package/src/leanbase-persistence.ts +0 -374
- package/src/leanbase.ts +0 -424
- package/src/page-view.ts +0 -124
- package/src/scroll-manager.ts +0 -103
- package/src/session-props.ts +0 -114
- package/src/utils/event-utils.ts +0 -304
- package/src/utils/index.ts +0 -222
- package/src/utils/request-utils.ts +0 -128
- package/src/utils/simple-event-emitter.ts +0 -27
- package/src/utils/user-agent-utils.ts +0 -357
- package/src/version.ts +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LeanbaseConfig, Properties } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Leanbase Persistence Object
|
|
4
|
+
* @constructor
|
|
5
|
+
*/
|
|
6
|
+
export declare class LeanbasePersistence {
|
|
7
|
+
private _config;
|
|
8
|
+
props: Properties;
|
|
9
|
+
private _storage;
|
|
10
|
+
private _campaign_params_saved;
|
|
11
|
+
private readonly _name;
|
|
12
|
+
_disabled: boolean | undefined;
|
|
13
|
+
private _secure;
|
|
14
|
+
private _expire_days;
|
|
15
|
+
private _default_expiry;
|
|
16
|
+
private _cross_subdomain;
|
|
17
|
+
/**
|
|
18
|
+
* @param {LeanbaseConfig} config initial PostHog configuration
|
|
19
|
+
* @param {boolean=} isDisabled should persistence be disabled (e.g. because of consent management)
|
|
20
|
+
*/
|
|
21
|
+
constructor(config: LeanbaseConfig, isDisabled?: boolean);
|
|
22
|
+
/**
|
|
23
|
+
* Returns whether persistence is disabled. Only available in SDKs > 1.257.1. Do not use on extensions, otherwise
|
|
24
|
+
* it'll break backwards compatibility for any version before 1.257.1.
|
|
25
|
+
*/
|
|
26
|
+
isDisabled?(): boolean;
|
|
27
|
+
private _buildStorage;
|
|
28
|
+
properties(): Properties;
|
|
29
|
+
load(): void;
|
|
30
|
+
/**
|
|
31
|
+
* NOTE: Saving frequently causes issues with Recordings and Consent Management Platform (CMP) tools which
|
|
32
|
+
* observe cookie changes, and modify their UI, often causing infinite loops.
|
|
33
|
+
* As such callers of this should ideally check that the data has changed beforehand
|
|
34
|
+
*/
|
|
35
|
+
save(): void;
|
|
36
|
+
remove(): void;
|
|
37
|
+
clear(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @param {Object} props
|
|
40
|
+
* @param {*=} default_value
|
|
41
|
+
* @param {number=} days
|
|
42
|
+
*/
|
|
43
|
+
register_once(props: Properties, default_value: any, days?: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @param {Object} props
|
|
46
|
+
* @param {number=} days
|
|
47
|
+
*/
|
|
48
|
+
register(props: Properties, days?: number): boolean;
|
|
49
|
+
unregister(prop: string): void;
|
|
50
|
+
update_campaign_params(): void;
|
|
51
|
+
update_search_keyword(): void;
|
|
52
|
+
update_referrer_info(): void;
|
|
53
|
+
set_initial_person_info(): void;
|
|
54
|
+
get_initial_props(): Properties;
|
|
55
|
+
safe_merge(props: Properties): Properties;
|
|
56
|
+
update_config(config: LeanbaseConfig, oldConfig: LeanbaseConfig, isDisabled?: boolean): void;
|
|
57
|
+
set_disabled(disabled: boolean): void;
|
|
58
|
+
set_cross_subdomain(cross_subdomain: boolean): void;
|
|
59
|
+
set_secure(secure: boolean): void;
|
|
60
|
+
set_event_timer(event_name: string, timestamp: number): void;
|
|
61
|
+
remove_event_timer(event_name: string): number;
|
|
62
|
+
get_property(prop: string): any;
|
|
63
|
+
set_property(prop: string, to: any): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PostHogCore } from '@posthog/core';
|
|
2
|
+
import type { PostHogEventProperties, PostHogFetchOptions, PostHogFetchResponse, PostHogPersistedProperty } from '@posthog/core';
|
|
3
|
+
import { LeanbaseConfig, LeanbasegCaptureOptions as LeanbaseCaptureOptions, RemoteConfig, Properties } from './types';
|
|
4
|
+
import { LeanbasePersistence } from './leanbase-persistence';
|
|
5
|
+
import { Autocapture } from './autocapture';
|
|
6
|
+
import { SessionIdManager } from './sessionid';
|
|
7
|
+
import { SessionPropsManager } from './session-props';
|
|
8
|
+
import { PageViewManager } from './page-view';
|
|
9
|
+
import { ScrollManager } from './scroll-manager';
|
|
10
|
+
export declare class Leanbase extends PostHogCore {
|
|
11
|
+
config: LeanbaseConfig;
|
|
12
|
+
scrollManager: ScrollManager;
|
|
13
|
+
pageViewManager: PageViewManager;
|
|
14
|
+
replayAutocapture?: Autocapture;
|
|
15
|
+
persistence?: LeanbasePersistence;
|
|
16
|
+
sessionPersistence?: LeanbasePersistence;
|
|
17
|
+
sessionManager?: SessionIdManager;
|
|
18
|
+
sessionPropsManager?: SessionPropsManager;
|
|
19
|
+
isRemoteConfigLoaded?: boolean;
|
|
20
|
+
personProcessingSetOncePropertiesSent: boolean;
|
|
21
|
+
isLoaded: boolean;
|
|
22
|
+
initialPageviewCaptured: boolean;
|
|
23
|
+
visibilityStateListener: (() => void) | null;
|
|
24
|
+
constructor(token: string, config?: Partial<LeanbaseConfig>);
|
|
25
|
+
init(token: string, config: Partial<LeanbaseConfig>): void;
|
|
26
|
+
captureInitialPageview(): void;
|
|
27
|
+
capturePageLeave(): void;
|
|
28
|
+
loadRemoteConfig(): Promise<void>;
|
|
29
|
+
onRemoteConfig(config: RemoteConfig): void;
|
|
30
|
+
fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
|
|
31
|
+
setConfig(config: Partial<LeanbaseConfig>): void;
|
|
32
|
+
getLibraryId(): string;
|
|
33
|
+
getLibraryVersion(): string;
|
|
34
|
+
getCustomUserAgent(): void;
|
|
35
|
+
getPersistedProperty<T>(key: PostHogPersistedProperty): T | undefined;
|
|
36
|
+
setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void;
|
|
37
|
+
calculateEventProperties(eventName: string, eventProperties: PostHogEventProperties, timestamp: Date, uuid: string, readOnly?: boolean): Properties;
|
|
38
|
+
isIdentified(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Add additional set_once properties to the event when creating a person profile. This allows us to create the
|
|
41
|
+
* profile with mostly-accurate properties, despite earlier events not setting them. We do this by storing them in
|
|
42
|
+
* persistence.
|
|
43
|
+
* @param dataSetOnce
|
|
44
|
+
*/
|
|
45
|
+
calculateSetOnceProperties(dataSetOnce?: Properties): Properties | undefined;
|
|
46
|
+
capture(event: string, properties?: PostHogEventProperties, options?: LeanbaseCaptureOptions): void;
|
|
47
|
+
identify(distinctId?: string, properties?: PostHogEventProperties, options?: LeanbaseCaptureOptions): void;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
}
|