posthog-js 1.161.2 → 1.161.4
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/array.full.js +2 -2
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/exception-autocapture.js.map +1 -1
- package/dist/lib/src/constants.d.ts +1 -0
- package/dist/lib/src/extensions/replay/sessionrecording.d.ts +1 -0
- package/dist/lib/src/posthog-core.d.ts +3 -1
- package/dist/lib/src/types.d.ts +4 -2
- package/dist/lib/src/web-experiments-types.d.ts +33 -0
- package/dist/lib/src/web-experiments.d.ts +21 -0
- package/dist/lib/src/web-experiments.test.d.ts +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +60 -4
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/constants.d.ts +1 -0
- package/lib/src/constants.js +1 -0
- package/lib/src/constants.js.map +1 -1
- package/lib/src/extensions/replay/sessionrecording.d.ts +1 -0
- package/lib/src/extensions/replay/sessionrecording.js +28 -20
- package/lib/src/extensions/replay/sessionrecording.js.map +1 -1
- package/lib/src/posthog-core.d.ts +3 -1
- package/lib/src/posthog-core.js +10 -6
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/request.js +19 -6
- package/lib/src/request.js.map +1 -1
- package/lib/src/types.d.ts +4 -2
- package/lib/src/types.js.map +1 -1
- package/lib/src/web-experiments-types.d.ts +33 -0
- package/lib/src/web-experiments-types.js +2 -0
- package/lib/src/web-experiments-types.js.map +1 -0
- package/lib/src/web-experiments.d.ts +21 -0
- package/lib/src/web-experiments.js +205 -0
- package/lib/src/web-experiments.js.map +1 -0
- package/lib/src/web-experiments.test.d.ts +1 -0
- package/lib/src/web-experiments.test.js +310 -0
- package/lib/src/web-experiments.test.js.map +1 -0
- package/package.json +1 -1
package/dist/module.d.ts
CHANGED
|
@@ -267,6 +267,7 @@ interface PostHogConfig {
|
|
|
267
267
|
/** @deprecated - use `disable_persistence` instead */
|
|
268
268
|
disable_cookie?: boolean;
|
|
269
269
|
disable_surveys: boolean;
|
|
270
|
+
disable_web_experiments: boolean;
|
|
270
271
|
/** If set, posthog-js will never load external scripts such as those needed for Session Replay or Surveys. */
|
|
271
272
|
disable_external_dependency_loading?: boolean;
|
|
272
273
|
enable_recording_console_log?: boolean;
|
|
@@ -500,9 +501,10 @@ interface ToolbarParams {
|
|
|
500
501
|
featureFlags?: Record<string, string | boolean>;
|
|
501
502
|
}
|
|
502
503
|
type SnippetArrayItem = [method: string, ...args: any[]];
|
|
503
|
-
type
|
|
504
|
+
type JsonRecord = {
|
|
504
505
|
[key: string]: JsonType;
|
|
505
|
-
}
|
|
506
|
+
};
|
|
507
|
+
type JsonType = string | number | boolean | null | JsonRecord | Array<JsonType>;
|
|
506
508
|
/** A feature that isn't publicly available yet.*/
|
|
507
509
|
interface EarlyAccessFeature {
|
|
508
510
|
name: string;
|
|
@@ -1034,6 +1036,7 @@ declare class SessionRecording {
|
|
|
1034
1036
|
private sessionId;
|
|
1035
1037
|
private _linkedFlag;
|
|
1036
1038
|
private _fullSnapshotTimer?;
|
|
1039
|
+
private _removePageViewCaptureHook;
|
|
1037
1040
|
private _lastHref?;
|
|
1038
1041
|
_forceAllowLocalhostNetworkCapture: boolean;
|
|
1039
1042
|
private get rrwebRecord();
|
|
@@ -1704,6 +1707,58 @@ declare class WebVitalsAutocapture {
|
|
|
1704
1707
|
private _startCapturing;
|
|
1705
1708
|
}
|
|
1706
1709
|
|
|
1710
|
+
interface WebExperimentTransform {
|
|
1711
|
+
attributes?: {
|
|
1712
|
+
name: string;
|
|
1713
|
+
value: string;
|
|
1714
|
+
}[];
|
|
1715
|
+
selector?: string;
|
|
1716
|
+
text?: string;
|
|
1717
|
+
html?: string;
|
|
1718
|
+
imgUrl?: string;
|
|
1719
|
+
className?: string;
|
|
1720
|
+
}
|
|
1721
|
+
type WebExperimentUrlMatchType = 'regex' | 'not_regex' | 'exact' | 'is_not' | 'icontains' | 'not_icontains';
|
|
1722
|
+
interface WebExperimentVariant {
|
|
1723
|
+
conditions?: {
|
|
1724
|
+
url?: string;
|
|
1725
|
+
urlMatchType?: WebExperimentUrlMatchType;
|
|
1726
|
+
utm?: {
|
|
1727
|
+
utm_source?: string;
|
|
1728
|
+
utm_medium?: string;
|
|
1729
|
+
utm_campaign?: string;
|
|
1730
|
+
utm_term?: string;
|
|
1731
|
+
};
|
|
1732
|
+
};
|
|
1733
|
+
variant_name: string;
|
|
1734
|
+
transforms: WebExperimentTransform[];
|
|
1735
|
+
}
|
|
1736
|
+
interface WebExperiment {
|
|
1737
|
+
id: number;
|
|
1738
|
+
name: string;
|
|
1739
|
+
feature_flag_key?: string;
|
|
1740
|
+
variants: Record<string, WebExperimentVariant>;
|
|
1741
|
+
}
|
|
1742
|
+
type WebExperimentsCallback = (webExperiments: WebExperiment[]) => void;
|
|
1743
|
+
|
|
1744
|
+
declare class WebExperiments {
|
|
1745
|
+
instance: PostHog;
|
|
1746
|
+
private _featureFlags?;
|
|
1747
|
+
private _flagToExperiments?;
|
|
1748
|
+
constructor(instance: PostHog);
|
|
1749
|
+
applyFeatureFlagChanges(flags: string[]): void;
|
|
1750
|
+
afterDecideResponse(response: DecideResponse): void;
|
|
1751
|
+
loadIfEnabled(): void;
|
|
1752
|
+
getWebExperimentsAndEvaluateDisplayLogic: (forceReload?: boolean) => void;
|
|
1753
|
+
getWebExperiments(callback: WebExperimentsCallback, forceReload: boolean): void;
|
|
1754
|
+
private static matchesTestVariant;
|
|
1755
|
+
private static matchUrlConditions;
|
|
1756
|
+
static getWindowLocation(): Location | undefined;
|
|
1757
|
+
private static matchUTMConditions;
|
|
1758
|
+
private static logInfo;
|
|
1759
|
+
private static applyTransforms;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1707
1762
|
declare class PostHogExceptions {
|
|
1708
1763
|
private readonly instance;
|
|
1709
1764
|
private _endpointSuffix;
|
|
@@ -1734,6 +1789,7 @@ declare class PostHog {
|
|
|
1734
1789
|
pageViewManager: PageViewManager;
|
|
1735
1790
|
featureFlags: PostHogFeatureFlags;
|
|
1736
1791
|
surveys: PostHogSurveys;
|
|
1792
|
+
experiments: WebExperiments;
|
|
1737
1793
|
toolbar: Toolbar;
|
|
1738
1794
|
exceptions: PostHogExceptions;
|
|
1739
1795
|
consent: ConsentManager;
|
|
@@ -1837,7 +1893,7 @@ declare class PostHog {
|
|
|
1837
1893
|
* @param {Date} [config.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.
|
|
1838
1894
|
*/
|
|
1839
1895
|
capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): CaptureResult | undefined;
|
|
1840
|
-
_addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): void;
|
|
1896
|
+
_addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): () => void;
|
|
1841
1897
|
_calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties;
|
|
1842
1898
|
_calculate_set_once_properties(dataSetOnce?: Properties): Properties | undefined;
|
|
1843
1899
|
/**
|
|
@@ -2407,4 +2463,4 @@ declare class PostHog {
|
|
|
2407
2463
|
|
|
2408
2464
|
declare const posthog: PostHog;
|
|
2409
2465
|
|
|
2410
|
-
export { type ActionStepStringMatching, type ActionStepType, type ActionType, type AutocaptureCompatibleElement, type AutocaptureConfig, type BasicSurveyQuestion, type BootstrapConfig, type Breaker, type CaptureOptions, type CaptureResult, type CapturedNetworkRequest, Compression, type DecideResponse, type DomAutocaptureEvents, type EarlyAccessFeature, type EarlyAccessFeatureCallback, type EarlyAccessFeatureResponse, type ErrorConversions, type ErrorEventArgs, type ErrorProperties, type EventHandler, type FeatureFlagsCallback, type FlagVariant, type Headers, type HeatmapConfig, type InitiatorType, type IsFeatureEnabledOptions, type JsonType, type LinkSurveyQuestion, type MultipleSurveyQuestion, type NetworkRecordOptions, type NetworkRequest, type OptInOutCapturingOptions, type PerformanceCaptureConfig, type PersistentStore, PostHog, type PostHogConfig, type Properties, type Property, type QueuedRequestOptions, type RatingSurveyQuestion, type RequestCallback, type RequestOptions, type RequestResponse, type RetriableRequestOptions, type SessionIdChangedCallback, type SessionRecordingOptions, type SeverityLevel, type SnippetArrayItem, type SupportedWebVitalsMetrics, type Survey, type SurveyAppearance, type SurveyCallback, type SurveyElement, type SurveyQuestion, SurveyQuestionBranchingType, type SurveyQuestionDescriptionContentType, SurveyQuestionType, type SurveyRenderReason, type SurveyResponse, SurveyType, type SurveyUrlMatchType, type ToolbarParams, type ToolbarSource, type ToolbarUserIntent, type ToolbarVersion, posthog as default, posthog, severityLevels };
|
|
2466
|
+
export { type ActionStepStringMatching, type ActionStepType, type ActionType, type AutocaptureCompatibleElement, type AutocaptureConfig, type BasicSurveyQuestion, type BootstrapConfig, type Breaker, type CaptureOptions, type CaptureResult, type CapturedNetworkRequest, Compression, type DecideResponse, type DomAutocaptureEvents, type EarlyAccessFeature, type EarlyAccessFeatureCallback, type EarlyAccessFeatureResponse, type ErrorConversions, type ErrorEventArgs, type ErrorProperties, type EventHandler, type FeatureFlagsCallback, type FlagVariant, type Headers, type HeatmapConfig, type InitiatorType, type IsFeatureEnabledOptions, type JsonRecord, type JsonType, type LinkSurveyQuestion, type MultipleSurveyQuestion, type NetworkRecordOptions, type NetworkRequest, type OptInOutCapturingOptions, type PerformanceCaptureConfig, type PersistentStore, PostHog, type PostHogConfig, type Properties, type Property, type QueuedRequestOptions, type RatingSurveyQuestion, type RequestCallback, type RequestOptions, type RequestResponse, type RetriableRequestOptions, type SessionIdChangedCallback, type SessionRecordingOptions, type SeverityLevel, type SnippetArrayItem, type SupportedWebVitalsMetrics, type Survey, type SurveyAppearance, type SurveyCallback, type SurveyElement, type SurveyQuestion, SurveyQuestionBranchingType, type SurveyQuestionDescriptionContentType, SurveyQuestionType, type SurveyRenderReason, type SurveyResponse, SurveyType, type SurveyUrlMatchType, type ToolbarParams, type ToolbarSource, type ToolbarUserIntent, type ToolbarVersion, posthog as default, posthog, severityLevels };
|