@leanbase.com/js 0.1.2 → 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.
Files changed (136) hide show
  1. package/dist/autocapture-utils.d.ts +17 -0
  2. package/dist/autocapture.d.ts +35 -0
  3. package/dist/config.d.ts +5 -0
  4. package/dist/constants.d.ts +54 -0
  5. package/dist/entrypoints/main.cjs.d.ts +4 -0
  6. package/dist/entrypoints/module.es.d.ts +4 -0
  7. package/dist/extensions/rageclick.d.ts +9 -0
  8. package/dist/iife.d.ts +19 -0
  9. package/dist/index.d.ts +2 -779
  10. package/dist/leanbase-logger.d.ts +6 -0
  11. package/dist/leanbase-persistence.d.ts +64 -0
  12. package/dist/leanbase.d.ts +49 -0
  13. package/dist/leanbase.iife.js +1 -4745
  14. package/dist/leanbase.iife.js.map +1 -1
  15. package/dist/main.js +2 -0
  16. package/dist/main.js.map +1 -0
  17. package/dist/module.d.ts +780 -0
  18. package/dist/module.js +2 -0
  19. package/dist/module.js.map +1 -0
  20. package/dist/page-view.d.ts +29 -0
  21. package/dist/scroll-manager.d.ts +21 -0
  22. package/dist/session-props.d.ts +32 -0
  23. package/dist/sessionid.d.ts +50 -0
  24. package/dist/storage.d.ts +24 -0
  25. package/{src/types.ts → dist/types.d.ts} +145 -235
  26. package/dist/utils/blocked-uas.d.ts +17 -0
  27. package/dist/utils/element-utils.d.ts +5 -0
  28. package/dist/utils/event-utils.d.ts +22 -0
  29. package/dist/utils/index.d.ts +44 -0
  30. package/dist/utils/request-utils.d.ts +12 -0
  31. package/dist/utils/simple-event-emitter.d.ts +6 -0
  32. package/dist/utils/user-agent-utils.d.ts +18 -0
  33. package/dist/uuidv7.d.ts +43 -0
  34. package/dist/version.d.ts +1 -0
  35. package/lib/autocapture-utils.d.ts +17 -0
  36. package/{src/autocapture-utils.ts → lib/autocapture-utils.js} +196 -280
  37. package/lib/autocapture-utils.js.map +1 -0
  38. package/lib/autocapture.d.ts +35 -0
  39. package/lib/autocapture.js +311 -0
  40. package/lib/autocapture.js.map +1 -0
  41. package/lib/config.d.ts +5 -0
  42. package/lib/config.js +7 -0
  43. package/lib/config.js.map +1 -0
  44. package/lib/constants.d.ts +54 -0
  45. package/{src/constants.ts → lib/constants.js} +58 -55
  46. package/lib/constants.js.map +1 -0
  47. package/lib/entrypoints/main.cjs.d.ts +4 -0
  48. package/lib/entrypoints/main.cjs.js +3 -0
  49. package/lib/entrypoints/main.cjs.js.map +1 -0
  50. package/lib/entrypoints/module.es.d.ts +4 -0
  51. package/lib/entrypoints/module.es.js +3 -0
  52. package/lib/entrypoints/module.es.js.map +1 -0
  53. package/lib/extensions/rageclick.d.ts +9 -0
  54. package/lib/extensions/rageclick.js +27 -0
  55. package/lib/extensions/rageclick.js.map +1 -0
  56. package/lib/iife.d.ts +19 -0
  57. package/lib/iife.js +67 -0
  58. package/lib/iife.js.map +1 -0
  59. package/{src/index.ts → lib/index.d.ts} +2 -2
  60. package/lib/index.js +2 -0
  61. package/lib/index.js.map +1 -0
  62. package/lib/leanbase-logger.d.ts +6 -0
  63. package/lib/leanbase-logger.js +25 -0
  64. package/lib/leanbase-logger.js.map +1 -0
  65. package/lib/leanbase-persistence.d.ts +64 -0
  66. package/lib/leanbase-persistence.js +287 -0
  67. package/lib/leanbase-persistence.js.map +1 -0
  68. package/lib/leanbase.d.ts +49 -0
  69. package/lib/leanbase.js +294 -0
  70. package/lib/leanbase.js.map +1 -0
  71. package/lib/page-view.d.ts +29 -0
  72. package/lib/page-view.js +81 -0
  73. package/lib/page-view.js.map +1 -0
  74. package/lib/scroll-manager.d.ts +21 -0
  75. package/lib/scroll-manager.js +79 -0
  76. package/lib/scroll-manager.js.map +1 -0
  77. package/lib/session-props.d.ts +32 -0
  78. package/lib/session-props.js +73 -0
  79. package/lib/session-props.js.map +1 -0
  80. package/lib/sessionid.d.ts +50 -0
  81. package/{src/sessionid.ts → lib/sessionid.js} +128 -204
  82. package/lib/sessionid.js.map +1 -0
  83. package/lib/storage.d.ts +24 -0
  84. package/{src/storage.ts → lib/storage.js} +182 -225
  85. package/lib/storage.js.map +1 -0
  86. package/lib/types.d.ts +544 -0
  87. package/lib/types.js +7 -0
  88. package/lib/types.js.map +1 -0
  89. package/lib/utils/blocked-uas.d.ts +17 -0
  90. package/{src/utils/blocked-uas.ts → lib/utils/blocked-uas.js} +19 -48
  91. package/lib/utils/blocked-uas.js.map +1 -0
  92. package/lib/utils/element-utils.d.ts +5 -0
  93. package/{src/utils/element-utils.ts → lib/utils/element-utils.js} +13 -17
  94. package/lib/utils/element-utils.js.map +1 -0
  95. package/lib/utils/event-utils.d.ts +22 -0
  96. package/lib/utils/event-utils.js +258 -0
  97. package/lib/utils/event-utils.js.map +1 -0
  98. package/lib/utils/index.d.ts +44 -0
  99. package/lib/utils/index.js +183 -0
  100. package/lib/utils/index.js.map +1 -0
  101. package/lib/utils/request-utils.d.ts +12 -0
  102. package/lib/utils/request-utils.js +107 -0
  103. package/lib/utils/request-utils.js.map +1 -0
  104. package/lib/utils/simple-event-emitter.d.ts +6 -0
  105. package/lib/utils/simple-event-emitter.js +24 -0
  106. package/lib/utils/simple-event-emitter.js.map +1 -0
  107. package/lib/utils/user-agent-utils.d.ts +18 -0
  108. package/lib/utils/user-agent-utils.js +369 -0
  109. package/lib/utils/user-agent-utils.js.map +1 -0
  110. package/lib/uuidv7.d.ts +43 -0
  111. package/{src/uuidv7.ts → lib/uuidv7.js} +103 -131
  112. package/lib/uuidv7.js.map +1 -0
  113. package/lib/version.d.ts +1 -0
  114. package/lib/version.js +2 -0
  115. package/lib/version.js.map +1 -0
  116. package/package.json +23 -11
  117. package/dist/index.cjs +0 -3032
  118. package/dist/index.cjs.map +0 -1
  119. package/dist/index.mjs +0 -3030
  120. package/dist/index.mjs.map +0 -1
  121. package/src/autocapture.ts +0 -415
  122. package/src/config.ts +0 -8
  123. package/src/extensions/rageclick.ts +0 -34
  124. package/src/iife.ts +0 -87
  125. package/src/leanbase-logger.ts +0 -26
  126. package/src/leanbase-persistence.ts +0 -374
  127. package/src/leanbase.ts +0 -424
  128. package/src/page-view.ts +0 -124
  129. package/src/scroll-manager.ts +0 -103
  130. package/src/session-props.ts +0 -114
  131. package/src/utils/event-utils.ts +0 -304
  132. package/src/utils/index.ts +0 -222
  133. package/src/utils/request-utils.ts +0 -128
  134. package/src/utils/simple-event-emitter.ts +0 -27
  135. package/src/utils/user-agent-utils.ts +0 -357
  136. package/src/version.ts +0 -1
@@ -0,0 +1,17 @@
1
+ import { AutocaptureConfig, LeanbaseConfig, Properties } from './types';
2
+ export declare function splitClassString(s: string): string[];
3
+ export declare function getClassNames(el: Element): string[];
4
+ export declare function makeSafeText(s: string | null | undefined): string | null;
5
+ export declare function getSafeText(el: Element): string;
6
+ export declare function getEventTarget(e: Event): Element | null;
7
+ export declare const autocaptureCompatibleElements: string[];
8
+ export declare function getParentElement(curEl: Element): Element | false;
9
+ export declare function shouldCaptureRageclick(el: Element | null, _config: LeanbaseConfig['rageclick']): boolean;
10
+ export declare function shouldCaptureDomEvent(el: Element, event: Event, autocaptureConfig?: AutocaptureConfig | undefined, captureOnAnyElement?: boolean, allowedEventTypes?: string[]): boolean;
11
+ export declare function shouldCaptureElement(el: Element): boolean;
12
+ export declare function isSensitiveElement(el: Element): boolean;
13
+ export declare function shouldCaptureValue(value: string, anchorRegexes?: boolean): boolean;
14
+ export declare function isAngularStyleAttr(attributeName: string): boolean;
15
+ export declare function getDirectAndNestedSpanText(target: Element): string;
16
+ export declare function getNestedSpanText(target: Element): string;
17
+ export declare function getElementsChainString(elements: Properties[]): string;
@@ -0,0 +1,35 @@
1
+ import RageClick from './extensions/rageclick';
2
+ import { Properties, RemoteConfig } from './types';
3
+ import { Leanbase } from './leanbase';
4
+ export declare function getAugmentPropertiesFromElement(elem: Element): Properties;
5
+ export declare function previousElementSibling(el: Element): Element | null;
6
+ export declare function getDefaultProperties(eventType: string): Properties;
7
+ export declare function getPropertiesFromElement(elem: Element, maskAllAttributes: boolean, maskText: boolean, elementAttributeIgnorelist: string[] | undefined): Properties;
8
+ export declare function autocapturePropertiesForElement(target: Element, { e, maskAllElementAttributes, maskAllText, elementAttributeIgnoreList, elementsChainAsString, }: {
9
+ e: Event;
10
+ maskAllElementAttributes: boolean;
11
+ maskAllText: boolean;
12
+ elementAttributeIgnoreList?: string[] | undefined;
13
+ elementsChainAsString: boolean;
14
+ }): {
15
+ props: Properties;
16
+ explicitNoCapture?: boolean;
17
+ };
18
+ export declare class Autocapture {
19
+ instance: Leanbase;
20
+ _initialized: boolean;
21
+ _isDisabledServerSide: boolean | null;
22
+ _elementSelectors: Set<string> | null;
23
+ rageclicks: RageClick;
24
+ _elementsChainAsString: boolean;
25
+ constructor(instance: Leanbase);
26
+ private get _config();
27
+ _addDomEventHandlers(): void;
28
+ startIfEnabled(): void;
29
+ onRemoteConfig(response: RemoteConfig): void;
30
+ setElementSelectors(selectors: Set<string>): void;
31
+ getElementSelectors(element: Element | null): string[] | null;
32
+ get isEnabled(): boolean;
33
+ private _captureEvent;
34
+ isBrowserSupported(): boolean;
35
+ }
@@ -0,0 +1,5 @@
1
+ declare const Config: {
2
+ DEBUG: boolean;
3
+ LIB_VERSION: string;
4
+ };
5
+ export default Config;
@@ -0,0 +1,54 @@
1
+ export declare const PEOPLE_DISTINCT_ID_KEY = "$people_distinct_id";
2
+ export declare const DISTINCT_ID = "distinct_id";
3
+ export declare const ALIAS_ID_KEY = "__alias";
4
+ export declare const CAMPAIGN_IDS_KEY = "__cmpns";
5
+ export declare const EVENT_TIMERS_KEY = "__timers";
6
+ export declare const AUTOCAPTURE_DISABLED_SERVER_SIDE = "$autocapture_disabled_server_side";
7
+ export declare const HEATMAPS_ENABLED_SERVER_SIDE = "$heatmaps_enabled_server_side";
8
+ export declare const EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE = "$exception_capture_enabled_server_side";
9
+ export declare const ERROR_TRACKING_SUPPRESSION_RULES = "$error_tracking_suppression_rules";
10
+ export declare const ERROR_TRACKING_CAPTURE_EXTENSION_EXCEPTIONS = "$error_tracking_capture_extension_exceptions";
11
+ export declare const WEB_VITALS_ENABLED_SERVER_SIDE = "$web_vitals_enabled_server_side";
12
+ export declare const DEAD_CLICKS_ENABLED_SERVER_SIDE = "$dead_clicks_enabled_server_side";
13
+ export declare const WEB_VITALS_ALLOWED_METRICS = "$web_vitals_allowed_metrics";
14
+ export declare const SESSION_RECORDING_REMOTE_CONFIG = "$session_recording_remote_config";
15
+ export declare const SESSION_RECORDING_ENABLED_SERVER_SIDE = "$session_recording_enabled_server_side";
16
+ export declare const CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE = "$console_log_recording_enabled_server_side";
17
+ export declare const SESSION_RECORDING_NETWORK_PAYLOAD_CAPTURE = "$session_recording_network_payload_capture";
18
+ export declare const SESSION_RECORDING_MASKING = "$session_recording_masking";
19
+ export declare const SESSION_RECORDING_CANVAS_RECORDING = "$session_recording_canvas_recording";
20
+ export declare const SESSION_RECORDING_SAMPLE_RATE = "$replay_sample_rate";
21
+ export declare const SESSION_RECORDING_MINIMUM_DURATION = "$replay_minimum_duration";
22
+ export declare const SESSION_RECORDING_SCRIPT_CONFIG = "$replay_script_config";
23
+ export declare const SESSION_ID = "$sesid";
24
+ export declare const SESSION_RECORDING_IS_SAMPLED = "$session_is_sampled";
25
+ export declare const SESSION_RECORDING_URL_TRIGGER_ACTIVATED_SESSION = "$session_recording_url_trigger_activated_session";
26
+ export declare const SESSION_RECORDING_EVENT_TRIGGER_ACTIVATED_SESSION = "$session_recording_event_trigger_activated_session";
27
+ export declare const ENABLED_FEATURE_FLAGS = "$enabled_feature_flags";
28
+ export declare const PERSISTENCE_EARLY_ACCESS_FEATURES = "$early_access_features";
29
+ export declare const PERSISTENCE_FEATURE_FLAG_DETAILS = "$feature_flag_details";
30
+ export declare const STORED_PERSON_PROPERTIES_KEY = "$stored_person_properties";
31
+ export declare const STORED_GROUP_PROPERTIES_KEY = "$stored_group_properties";
32
+ export declare const SURVEYS = "$surveys";
33
+ export declare const SURVEYS_ACTIVATED = "$surveys_activated";
34
+ export declare const FLAG_CALL_REPORTED = "$flag_call_reported";
35
+ export declare const USER_STATE = "$user_state";
36
+ export declare const CLIENT_SESSION_PROPS = "$client_session_props";
37
+ export declare const CAPTURE_RATE_LIMIT = "$capture_rate_limit";
38
+ /** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */
39
+ export declare const INITIAL_CAMPAIGN_PARAMS = "$initial_campaign_params";
40
+ /** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */
41
+ export declare const INITIAL_REFERRER_INFO = "$initial_referrer_info";
42
+ export declare const INITIAL_PERSON_INFO = "$initial_person_info";
43
+ export declare const ENABLE_PERSON_PROCESSING = "$epp";
44
+ export declare const TOOLBAR_ID = "__POSTHOG_TOOLBAR__";
45
+ export declare const TOOLBAR_CONTAINER_CLASS = "toolbar-global-fade-container";
46
+ /**
47
+ * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION
48
+ * Sentinel value for distinct id, device id, session id. Signals that the server should generate the value
49
+ * */
50
+ export declare const COOKIELESS_SENTINEL_VALUE = "$posthog_cookieless";
51
+ export declare const COOKIELESS_MODE_FLAG_PROPERTY = "$cookieless_mode";
52
+ export declare const WEB_EXPERIMENTS = "$web_experiments";
53
+ export declare const PERSISTENCE_RESERVED_PROPERTIES: string[];
54
+ export declare const SURVEYS_REQUEST_TIMEOUT_MS = 10000;
@@ -0,0 +1,4 @@
1
+ import { Leanbase } from '../leanbase';
2
+ import type { LeanbaseConfig } from '../types';
3
+ export { Leanbase };
4
+ export type { LeanbaseConfig };
@@ -0,0 +1,4 @@
1
+ import { Leanbase } from '../leanbase';
2
+ import type { LeanbaseConfig } from '../types';
3
+ export { Leanbase };
4
+ export type { LeanbaseConfig };
@@ -0,0 +1,9 @@
1
+ export default class RageClick {
2
+ clicks: {
3
+ x: number;
4
+ y: number;
5
+ timestamp: number;
6
+ }[];
7
+ constructor();
8
+ isRageClick(x: number, y: number, timestamp: number): boolean;
9
+ }
package/dist/iife.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { Leanbase } from './leanbase';
2
+ import type { LeanbaseConfig } from './types';
3
+ type QueuedCall = {
4
+ fn: keyof typeof api;
5
+ args: any[];
6
+ };
7
+ declare const api: {
8
+ _instance: Leanbase | null;
9
+ _queue: QueuedCall[];
10
+ init(apiKey: string, options?: LeanbaseConfig): void;
11
+ capture(event: string, properties?: import("@posthog/core").PostHogEventProperties | undefined, options?: import("./types").LeanbasegCaptureOptions | undefined): void;
12
+ captureException(error: unknown, additionalProperties?: import("@posthog/core").PostHogEventProperties | undefined): void;
13
+ identify(distinctId?: string | undefined, properties?: import("@posthog/core").PostHogEventProperties | undefined, options?: import("./types").LeanbasegCaptureOptions | undefined): void;
14
+ group(groupType: string, groupKey: string | number, groupProperties?: import("@posthog/core").PostHogEventProperties | undefined, options?: import("@posthog/core").PostHogCaptureOptions | undefined): void;
15
+ alias(alias: string): void;
16
+ reset(): void;
17
+ getInstance(): Leanbase | null;
18
+ };
19
+ export default api;