@leanbase-giangnd/js 0.3.0 → 0.3.2
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/index.cjs +154 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +58 -81
- package/dist/index.mjs +154 -189
- package/dist/index.mjs.map +1 -1
- package/dist/leanbase.iife.js +154 -189
- package/dist/leanbase.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/extensions/replay/extension-shim.ts +1 -114
- package/src/extensions/replay/external/lazy-loaded-session-recorder.ts +130 -38
- package/src/extensions/replay/external/mutation-throttler.ts +1 -4
- package/src/extensions/replay/session-recording.ts +0 -59
- package/src/leanbase.ts +4 -1
- package/src/utils/request-router.ts +39 -0
- package/src/version.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1381,29 +1381,17 @@ declare class SessionRecording$1 {
|
|
|
1381
1381
|
private readonly _instance;
|
|
1382
1382
|
_forceAllowLocalhostNetworkCapture: boolean;
|
|
1383
1383
|
private _receivedFlags;
|
|
1384
|
-
private _serverRecordingEnabled;
|
|
1385
1384
|
private _persistFlagsOnSessionListener;
|
|
1386
1385
|
private _lazyLoadedSessionRecording;
|
|
1387
1386
|
get started(): boolean;
|
|
1388
|
-
/**
|
|
1389
|
-
* defaults to buffering mode until a flags response is received
|
|
1390
|
-
* once a flags response is received status can be disabled, active or sampled
|
|
1391
|
-
*/
|
|
1392
1387
|
get status(): SessionRecordingStatus$1;
|
|
1393
1388
|
constructor(_instance: Leanbase);
|
|
1394
1389
|
private get _isRecordingEnabled();
|
|
1395
1390
|
startIfEnabledOrStop(startReason?: SessionStartReason$1): void;
|
|
1396
|
-
/**
|
|
1397
|
-
* session recording waits until it receives remote config before loading the script
|
|
1398
|
-
* this is to ensure we can control the script name remotely
|
|
1399
|
-
* and because we wait until we have local and remote config to determine if we should start at all
|
|
1400
|
-
* if start is called and there is no remote config then we wait until there is
|
|
1401
|
-
*/
|
|
1402
1391
|
private _lazyLoadAndStart;
|
|
1403
1392
|
stopRecording(): void;
|
|
1404
1393
|
private _resetSampling;
|
|
1405
1394
|
private _persistRemoteConfig;
|
|
1406
|
-
private _clearRemoteConfig;
|
|
1407
1395
|
onRemoteConfig(response: RemoteConfig$1): void;
|
|
1408
1396
|
log(message: string, level?: 'log' | 'warn' | 'error'): void;
|
|
1409
1397
|
private get _scriptName();
|
|
@@ -1414,39 +1402,28 @@ declare class SessionRecording$1 {
|
|
|
1414
1402
|
* @deprecated
|
|
1415
1403
|
*/
|
|
1416
1404
|
onRRwebEmit(rawEvent: eventWithTime$1): void;
|
|
1417
|
-
/**
|
|
1418
|
-
* this ignores the linked flag config and (if other conditions are met) causes capture to start
|
|
1419
|
-
*
|
|
1420
|
-
* It is not usual to call this directly,
|
|
1421
|
-
* instead call `posthog.startSessionRecording({linked_flag: true})`
|
|
1422
|
-
* */
|
|
1423
1405
|
overrideLinkedFlag(): void;
|
|
1424
|
-
/**
|
|
1425
|
-
* this ignores the sampling config and (if other conditions are met) causes capture to start
|
|
1426
|
-
*
|
|
1427
|
-
* It is not usual to call this directly,
|
|
1428
|
-
* instead call `posthog.startSessionRecording({sampling: true})`
|
|
1429
|
-
* */
|
|
1430
1406
|
overrideSampling(): void;
|
|
1431
|
-
/**
|
|
1432
|
-
* this ignores the URL/Event trigger config and (if other conditions are met) causes capture to start
|
|
1433
|
-
*
|
|
1434
|
-
* It is not usual to call this directly,
|
|
1435
|
-
* instead call `posthog.startSessionRecording({trigger: 'url' | 'event'})`
|
|
1436
|
-
* */
|
|
1437
1407
|
overrideTrigger(triggerType: TriggerType$1): void;
|
|
1438
1408
|
get sdkDebugProperties(): Properties$1;
|
|
1439
|
-
/**
|
|
1440
|
-
* This adds a custom event to the session recording
|
|
1441
|
-
*
|
|
1442
|
-
* It is not intended for arbitrary public use - playback only displays known custom events
|
|
1443
|
-
* And is exposed on the public interface only so that other parts of the SDK are able to use it
|
|
1444
|
-
*
|
|
1445
|
-
* if you are calling this from client code, you're probably looking for `posthog.capture('$custom_event', {...})`
|
|
1446
|
-
*/
|
|
1447
1409
|
tryAddCustomEvent(tag: string, payload: any): boolean;
|
|
1448
1410
|
}
|
|
1449
1411
|
|
|
1412
|
+
type RequestRouterTarget$1 = 'api' | 'ui' | 'assets';
|
|
1413
|
+
/**
|
|
1414
|
+
* Leanbase-local version of PostHog's RequestRouter.
|
|
1415
|
+
*
|
|
1416
|
+
* Browser SDK always has a requestRouter instance; Leanbase IIFE needs this too so
|
|
1417
|
+
* features like Session Replay can construct ingestion URLs.
|
|
1418
|
+
*/
|
|
1419
|
+
declare class RequestRouter$1 {
|
|
1420
|
+
private readonly instance;
|
|
1421
|
+
constructor(instance: Leanbase);
|
|
1422
|
+
get apiHost(): string;
|
|
1423
|
+
get uiHost(): string | undefined;
|
|
1424
|
+
endpointFor(target: RequestRouterTarget$1, path?: string): string;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1450
1427
|
declare class RageClick {
|
|
1451
1428
|
clicks: {
|
|
1452
1429
|
x: number;
|
|
@@ -3760,31 +3737,6 @@ declare class Autocapture {
|
|
|
3760
3737
|
isBrowserSupported(): boolean;
|
|
3761
3738
|
}
|
|
3762
3739
|
|
|
3763
|
-
declare enum ConsentStatus {
|
|
3764
|
-
PENDING = -1,
|
|
3765
|
-
DENIED = 0,
|
|
3766
|
-
GRANTED = 1
|
|
3767
|
-
}
|
|
3768
|
-
/**
|
|
3769
|
-
* ConsentManager provides tools for managing user consent as configured by the application.
|
|
3770
|
-
*/
|
|
3771
|
-
declare class ConsentManager {
|
|
3772
|
-
private _instance;
|
|
3773
|
-
private _persistentStore?;
|
|
3774
|
-
constructor(_instance: PostHog);
|
|
3775
|
-
private get _config();
|
|
3776
|
-
get consent(): ConsentStatus;
|
|
3777
|
-
isOptedOut(): boolean;
|
|
3778
|
-
isOptedIn(): boolean;
|
|
3779
|
-
isExplicitlyOptedOut(): boolean;
|
|
3780
|
-
optInOut(isOptedIn: boolean): void;
|
|
3781
|
-
reset(): void;
|
|
3782
|
-
private get _storageKey();
|
|
3783
|
-
private get _storedConsent();
|
|
3784
|
-
private get _storage();
|
|
3785
|
-
private _getDnt;
|
|
3786
|
-
}
|
|
3787
|
-
|
|
3788
3740
|
declare class SessionIdManager {
|
|
3789
3741
|
private readonly _sessionIdGenerator;
|
|
3790
3742
|
private readonly _windowIdGenerator;
|
|
@@ -4448,6 +4400,27 @@ declare class SiteApps {
|
|
|
4448
4400
|
onRemoteConfig(response: RemoteConfig): void;
|
|
4449
4401
|
}
|
|
4450
4402
|
|
|
4403
|
+
/**
|
|
4404
|
+
* The request router helps simplify the logic to determine which endpoints should be called for which things
|
|
4405
|
+
* The basic idea is that for a given region (US or EU), we have a set of endpoints that we should call depending
|
|
4406
|
+
* on the type of request (events, replays, flags, etc.) and handle overrides that may come from configs or the flags endpoint
|
|
4407
|
+
*/
|
|
4408
|
+
declare enum RequestRouterRegion {
|
|
4409
|
+
US = "us",
|
|
4410
|
+
EU = "eu",
|
|
4411
|
+
CUSTOM = "custom"
|
|
4412
|
+
}
|
|
4413
|
+
type RequestRouterTarget = 'api' | 'ui' | 'assets';
|
|
4414
|
+
declare class RequestRouter {
|
|
4415
|
+
instance: PostHog;
|
|
4416
|
+
private _regionCache;
|
|
4417
|
+
constructor(instance: PostHog);
|
|
4418
|
+
get apiHost(): string;
|
|
4419
|
+
get uiHost(): string | undefined;
|
|
4420
|
+
get region(): RequestRouterRegion;
|
|
4421
|
+
endpointFor(target: RequestRouterTarget, path?: string): string;
|
|
4422
|
+
}
|
|
4423
|
+
|
|
4451
4424
|
interface WebExperimentTransform {
|
|
4452
4425
|
attributes?: {
|
|
4453
4426
|
name: string;
|
|
@@ -6093,25 +6066,29 @@ declare class PostHog {
|
|
|
6093
6066
|
private _checkLocalStorageForDebug;
|
|
6094
6067
|
}
|
|
6095
6068
|
|
|
6069
|
+
declare enum ConsentStatus {
|
|
6070
|
+
PENDING = -1,
|
|
6071
|
+
DENIED = 0,
|
|
6072
|
+
GRANTED = 1
|
|
6073
|
+
}
|
|
6096
6074
|
/**
|
|
6097
|
-
*
|
|
6098
|
-
* The basic idea is that for a given region (US or EU), we have a set of endpoints that we should call depending
|
|
6099
|
-
* on the type of request (events, replays, flags, etc.) and handle overrides that may come from configs or the flags endpoint
|
|
6075
|
+
* ConsentManager provides tools for managing user consent as configured by the application.
|
|
6100
6076
|
*/
|
|
6101
|
-
declare
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
get
|
|
6113
|
-
get
|
|
6114
|
-
|
|
6077
|
+
declare class ConsentManager {
|
|
6078
|
+
private _instance;
|
|
6079
|
+
private _persistentStore?;
|
|
6080
|
+
constructor(_instance: PostHog);
|
|
6081
|
+
private get _config();
|
|
6082
|
+
get consent(): ConsentStatus;
|
|
6083
|
+
isOptedOut(): boolean;
|
|
6084
|
+
isOptedIn(): boolean;
|
|
6085
|
+
isExplicitlyOptedOut(): boolean;
|
|
6086
|
+
optInOut(isOptedIn: boolean): void;
|
|
6087
|
+
reset(): void;
|
|
6088
|
+
private get _storageKey();
|
|
6089
|
+
private get _storedConsent();
|
|
6090
|
+
private get _storage();
|
|
6091
|
+
private _getDnt;
|
|
6115
6092
|
}
|
|
6116
6093
|
|
|
6117
6094
|
declare class Leanbase extends PostHogCore {
|
|
@@ -6123,7 +6100,7 @@ declare class Leanbase extends PostHogCore {
|
|
|
6123
6100
|
sessionPersistence?: LeanbasePersistence;
|
|
6124
6101
|
sessionManager?: SessionIdManager$1;
|
|
6125
6102
|
sessionPropsManager?: SessionPropsManager$1;
|
|
6126
|
-
requestRouter: RequestRouter;
|
|
6103
|
+
requestRouter: RequestRouter$1;
|
|
6127
6104
|
consent: ConsentManager;
|
|
6128
6105
|
sessionRecording?: SessionRecording$1;
|
|
6129
6106
|
isRemoteConfigLoaded?: boolean;
|