posthog-js 1.135.2 → 1.136.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.
@@ -0,0 +1,24 @@
1
+ import { PostHog } from './posthog-core';
2
+ export declare enum ConsentStatus {
3
+ PENDING = -1,
4
+ DENIED = 0,
5
+ GRANTED = 1
6
+ }
7
+ /**
8
+ * ConsentManager provides tools for managing user consent as configured by the application.
9
+ */
10
+ export declare class ConsentManager {
11
+ private instance;
12
+ private _storage?;
13
+ constructor(instance: PostHog);
14
+ private get config();
15
+ get consent(): ConsentStatus;
16
+ isOptedOut(): boolean;
17
+ isOptedIn(): boolean;
18
+ optInOut(isOptedIn: boolean): void;
19
+ reset(): void;
20
+ private get storageKey();
21
+ private get storedConsent();
22
+ private get storage();
23
+ private getDnt;
24
+ }
@@ -6,7 +6,7 @@ import { RequestQueue } from './request-queue';
6
6
  import { RetryQueue } from './retry-queue';
7
7
  import { SessionIdManager } from './sessionid';
8
8
  import { RequestRouter } from './utils/request-router';
9
- import { CaptureOptions, CaptureResult, Compression, DecideResponse, EarlyAccessFeatureCallback, GDPROptions, IsFeatureEnabledOptions, JsonType, OptInOutCapturingOptions, PostHogConfig, Properties, Property, QueuedRequestOptions, RequestCallback, SessionIdChangedCallback, SnippetArrayItem, ToolbarParams } from './types';
9
+ import { CaptureOptions, CaptureResult, Compression, DecideResponse, EarlyAccessFeatureCallback, IsFeatureEnabledOptions, JsonType, PostHogConfig, Properties, Property, QueuedRequestOptions, RequestCallback, SessionIdChangedCallback, SnippetArrayItem, ToolbarParams } from './types';
10
10
  import { SentryIntegration } from './extensions/sentry-integration';
11
11
  import { PageViewManager } from './page-view';
12
12
  import { PostHogSurveys } from './posthog-surveys';
@@ -16,6 +16,7 @@ import { SessionPropsManager } from './session-props';
16
16
  import { Heatmaps } from './heatmaps';
17
17
  import { ScrollManager } from './scroll-manager';
18
18
  import { Autocapture } from './autocapture';
19
+ import { ConsentManager } from './consent';
19
20
  type OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never;
20
21
  export declare const defaultConfig: () => PostHogConfig;
21
22
  export declare const configRenames: (origConfig: Partial<PostHogConfig>) => Partial<PostHogConfig>;
@@ -37,6 +38,7 @@ export declare class PostHog {
37
38
  featureFlags: PostHogFeatureFlags;
38
39
  surveys: PostHogSurveys;
39
40
  toolbar: Toolbar;
41
+ consent: ConsentManager;
40
42
  persistence?: PostHogPersistence;
41
43
  sessionPersistence?: PostHogPersistence;
42
44
  sessionManager?: SessionIdManager;
@@ -127,9 +129,9 @@ export declare class PostHog {
127
129
  *
128
130
  * @param {String} event_name The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.
129
131
  * @param {Object} [properties] A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.
130
- * @param {Object} [options] Optional configuration for this capture request.
131
- * @param {String} [options.transport] Transport method for network request ('XHR' or 'sendBeacon').
132
- * @param {Date} [options.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.
132
+ * @param {Object} [config] Optional configuration for this capture request.
133
+ * @param {String} [config.transport] Transport method for network request ('XHR' or 'sendBeacon').
134
+ * @param {Date} [config.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.
133
135
  */
134
136
  capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): CaptureResult | void;
135
137
  _addCaptureHook(callback: (eventName: string) => void): void;
@@ -610,17 +612,15 @@ export declare class PostHog {
610
612
  * @param function_name
611
613
  */
612
614
  _requirePersonProcessing(function_name: string): boolean;
613
- _gdpr_init(): void;
614
615
  /**
615
616
  * Enable or disable persistence based on options
616
617
  * only enable/disable if persistence is not already in this state
617
- * @param {boolean} [options.clear_persistence] If true, will delete all data stored by the sdk in persistence and disable it
618
- * @param {boolean} [options.enable_persistence] If true, will re-enable sdk persistence
618
+ * @param {boolean} [disabled] If true, will re-enable sdk persistence
619
619
  */
620
- _gdpr_update_persistence(options: Partial<OptInOutCapturingOptions>): void;
621
- _gdpr_call_func<R = any>(func: (token: string, options: GDPROptions) => R, options?: Partial<OptInOutCapturingOptions>): R;
620
+ private _sync_opt_out_with_persistence;
622
621
  /**
623
622
  * Opt the user in to data capturing and cookies/localstorage for this PostHog instance
623
+ * If the config.opt_out_persistence_by_default is set to false, the SDK persistence will be enabled.
624
624
  *
625
625
  * ### Usage
626
626
  *
@@ -631,47 +631,28 @@ export declare class PostHog {
631
631
  * posthog.opt_in_capturing({
632
632
  * capture_event_name: 'User opted in',
633
633
  * capture_event_properties: {
634
- * 'Email': 'jdoe@example.com'
635
- * },
636
- * cookie_expiration: 30,
637
- * secure_cookie: true
634
+ * 'email': 'jdoe@example.com'
635
+ * }
638
636
  * });
639
637
  *
640
- * @param {Object} [options] A dictionary of config options to override
641
- * @param {function} [options.capture] Function used for capturing a PostHog event to record the opt-in action (default is this PostHog instance's capture method)
642
- * @param {string} [options.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action
643
- * @param {Object} [options.capture_properties] Set of properties to be captured along with the opt-in action
644
- * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence
645
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
646
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
647
- * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)
648
- * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)
649
- * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)
638
+ * @param {Object} [config] A dictionary of config options to override
639
+ * @param {string} [config.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action
640
+ * @param {Object} [config.capture_properties] Set of properties to be captured along with the opt-in action
650
641
  */
651
- opt_in_capturing(options?: Partial<OptInOutCapturingOptions>): void;
642
+ opt_in_capturing(options?: {
643
+ captureEventName?: string; /** event name to be used for capturing the opt-in action */
644
+ captureProperties?: Properties; /** set of properties to be captured along with the opt-in action */
645
+ }): void;
652
646
  /**
653
- * Opt the user out of data capturing and cookies/localstorage for this PostHog instance
647
+ * Opt the user out of data capturing and cookies/localstorage for this PostHog instance.
648
+ * If the config.opt_out_persistence_by_default is set to true, the SDK persistence will be disabled.
654
649
  *
655
650
  * ### Usage
656
651
  *
657
652
  * // opt user out
658
- * posthog.opt_out_capturing();
659
- *
660
- * // opt user out with different cookie configuration from PostHog instance
661
- * posthog.opt_out_capturing({
662
- * cookie_expiration: 30,
663
- * secure_cookie: true
664
- * });
665
- *
666
- * @param {Object} [options] A dictionary of config options to override
667
- * @param {boolean} [options.clear_persistence=true] If true, will delete all data stored by the sdk in persistence
668
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
669
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
670
- * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)
671
- * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)
672
- * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)
653
+ * posthog.opt_out_capturing()
673
654
  */
674
- opt_out_capturing(options?: Partial<OptInOutCapturingOptions>): void;
655
+ opt_out_capturing(): void;
675
656
  /**
676
657
  * Check whether the user has opted in to data capturing and cookies/localstorage for this PostHog instance
677
658
  *
@@ -680,12 +661,9 @@ export declare class PostHog {
680
661
  * const has_opted_in = posthog.has_opted_in_capturing();
681
662
  * // use has_opted_in value
682
663
  *
683
- * @param {Object} [options] A dictionary of config options to override
684
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
685
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
686
664
  * @returns {boolean} current opt-in status
687
665
  */
688
- has_opted_in_capturing(options?: Partial<OptInOutCapturingOptions>): boolean;
666
+ has_opted_in_capturing(): boolean;
689
667
  /**
690
668
  * Check whether the user has opted out of data capturing and cookies/localstorage for this PostHog instance
691
669
  *
@@ -694,12 +672,9 @@ export declare class PostHog {
694
672
  * const has_opted_out = posthog.has_opted_out_capturing();
695
673
  * // use has_opted_out value
696
674
  *
697
- * @param {Object} [options] A dictionary of config options to override
698
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
699
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
700
675
  * @returns {boolean} current opt-out status
701
676
  */
702
- has_opted_out_capturing(options?: Partial<OptInOutCapturingOptions>): boolean;
677
+ has_opted_out_capturing(): boolean;
703
678
  /**
704
679
  * Clear the user's opt in/out status of data capturing and cookies/localstorage for this PostHog instance
705
680
  *
@@ -707,23 +682,10 @@ export declare class PostHog {
707
682
  *
708
683
  * // clear user's opt-in/out status
709
684
  * posthog.clear_opt_in_out_capturing();
710
- *
711
- * // clear user's opt-in/out status with specific cookie configuration - should match
712
- * // configuration used when opt_in_capturing/opt_out_capturing methods were called.
713
- * posthog.clear_opt_in_out_capturing({
714
- * cookie_expiration: 30,
715
- * secure_cookie: true
716
- * });
717
- *
718
- * @param {Object} [options] A dictionary of config options to override
719
- * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence
720
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
721
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
722
- * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)
723
- * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)
724
- * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)
685
+ * *
686
+ * @param {Object} [config] A dictionary of config options to override
725
687
  */
726
- clear_opt_in_out_capturing(options?: Partial<OptInOutCapturingOptions>): void;
688
+ clear_opt_in_out_capturing(): void;
727
689
  debug(debug?: boolean): void;
728
690
  }
729
691
  export declare function init_from_snippet(): void;
@@ -91,11 +91,13 @@ export interface PostHogConfig {
91
91
  enable_recording_console_log?: boolean;
92
92
  secure_cookie: boolean;
93
93
  ip: boolean;
94
+ /** Starts the SDK in an opted out state requiring opt_in_capturing() to be called before events will b captured */
94
95
  opt_out_capturing_by_default: boolean;
95
- opt_out_persistence_by_default: boolean;
96
+ opt_out_capturing_persistence_type: 'localStorage' | 'cookie';
97
+ /** If set to true this will disable persistence if the user is opted out of capturing. @default false */
98
+ opt_out_persistence_by_default?: boolean;
96
99
  /** Opt out of user agent filtering such as googlebot or other bots. Defaults to `false` */
97
100
  opt_out_useragent_filter: boolean;
98
- opt_out_capturing_persistence_type: 'localStorage' | 'cookie';
99
101
  opt_out_capturing_cookie_prefix: string | null;
100
102
  opt_in_site_apps: boolean;
101
103
  respect_dnt: boolean;
@@ -276,19 +278,6 @@ export interface DecideResponse {
276
278
  export type FeatureFlagsCallback = (flags: string[], variants: Record<string, string | boolean>, context?: {
277
279
  errorsLoading?: boolean;
278
280
  }) => void;
279
- export interface GDPROptions {
280
- capture?: (event: string, properties: Properties, options: CaptureOptions) => void; /** function used for capturing a PostHog event to record the opt-in action */
281
- captureEventName?: string; /** event name to be used for capturing the opt-in action */
282
- captureProperties?: Properties; /** set of properties to be captured along with the opt-in action */
283
- /** persistence mechanism used */
284
- persistenceType?: 'cookie' | 'localStorage' | 'localStorage+cookie';
285
- persistencePrefix?: string; /** [__ph_opt_in_out] - custom prefix to be used in the cookie/localstorage name */
286
- cookieExpiration?: number; /** number of days until the opt-in cookie expires */
287
- crossSubdomainCookie?: boolean; /** whether the opt-in cookie is set as cross-subdomain or not */
288
- secureCookie?: boolean; /** whether the opt-in cookie is set as secure or not */
289
- respectDnt?: boolean;
290
- window?: Window;
291
- }
292
281
  export interface PersistentStore {
293
282
  is_supported: () => boolean;
294
283
  error: (error: any) => void;
package/dist/module.d.ts CHANGED
@@ -223,11 +223,13 @@ interface PostHogConfig {
223
223
  enable_recording_console_log?: boolean;
224
224
  secure_cookie: boolean;
225
225
  ip: boolean;
226
+ /** Starts the SDK in an opted out state requiring opt_in_capturing() to be called before events will b captured */
226
227
  opt_out_capturing_by_default: boolean;
227
- opt_out_persistence_by_default: boolean;
228
+ opt_out_capturing_persistence_type: 'localStorage' | 'cookie';
229
+ /** If set to true this will disable persistence if the user is opted out of capturing. @default false */
230
+ opt_out_persistence_by_default?: boolean;
228
231
  /** Opt out of user agent filtering such as googlebot or other bots. Defaults to `false` */
229
232
  opt_out_useragent_filter: boolean;
230
- opt_out_capturing_persistence_type: 'localStorage' | 'cookie';
231
233
  opt_out_capturing_cookie_prefix: string | null;
232
234
  opt_in_site_apps: boolean;
233
235
  respect_dnt: boolean;
@@ -408,19 +410,6 @@ interface DecideResponse {
408
410
  type FeatureFlagsCallback = (flags: string[], variants: Record<string, string | boolean>, context?: {
409
411
  errorsLoading?: boolean;
410
412
  }) => void;
411
- interface GDPROptions {
412
- capture?: (event: string, properties: Properties, options: CaptureOptions) => void; /** function used for capturing a PostHog event to record the opt-in action */
413
- captureEventName?: string; /** event name to be used for capturing the opt-in action */
414
- captureProperties?: Properties; /** set of properties to be captured along with the opt-in action */
415
- /** persistence mechanism used */
416
- persistenceType?: 'cookie' | 'localStorage' | 'localStorage+cookie';
417
- persistencePrefix?: string; /** [__ph_opt_in_out] - custom prefix to be used in the cookie/localstorage name */
418
- cookieExpiration?: number; /** number of days until the opt-in cookie expires */
419
- crossSubdomainCookie?: boolean; /** whether the opt-in cookie is set as cross-subdomain or not */
420
- secureCookie?: boolean; /** whether the opt-in cookie is set as secure or not */
421
- respectDnt?: boolean;
422
- window?: Window;
423
- }
424
413
  interface PersistentStore {
425
414
  is_supported: () => boolean;
426
415
  error: (error: any) => void;
@@ -1387,6 +1376,30 @@ declare class Autocapture {
1387
1376
  isBrowserSupported(): boolean;
1388
1377
  }
1389
1378
 
1379
+ declare enum ConsentStatus {
1380
+ PENDING = -1,
1381
+ DENIED = 0,
1382
+ GRANTED = 1
1383
+ }
1384
+ /**
1385
+ * ConsentManager provides tools for managing user consent as configured by the application.
1386
+ */
1387
+ declare class ConsentManager {
1388
+ private instance;
1389
+ private _storage?;
1390
+ constructor(instance: PostHog);
1391
+ private get config();
1392
+ get consent(): ConsentStatus;
1393
+ isOptedOut(): boolean;
1394
+ isOptedIn(): boolean;
1395
+ optInOut(isOptedIn: boolean): void;
1396
+ reset(): void;
1397
+ private get storageKey();
1398
+ private get storedConsent();
1399
+ private get storage();
1400
+ private getDnt;
1401
+ }
1402
+
1390
1403
  type OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never;
1391
1404
  declare class DeprecatedWebPerformanceObserver {
1392
1405
  get _forceAllowLocalhost(): boolean;
@@ -1406,6 +1419,7 @@ declare class PostHog {
1406
1419
  featureFlags: PostHogFeatureFlags;
1407
1420
  surveys: PostHogSurveys;
1408
1421
  toolbar: Toolbar;
1422
+ consent: ConsentManager;
1409
1423
  persistence?: PostHogPersistence;
1410
1424
  sessionPersistence?: PostHogPersistence;
1411
1425
  sessionManager?: SessionIdManager;
@@ -1496,9 +1510,9 @@ declare class PostHog {
1496
1510
  *
1497
1511
  * @param {String} event_name The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.
1498
1512
  * @param {Object} [properties] A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.
1499
- * @param {Object} [options] Optional configuration for this capture request.
1500
- * @param {String} [options.transport] Transport method for network request ('XHR' or 'sendBeacon').
1501
- * @param {Date} [options.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.
1513
+ * @param {Object} [config] Optional configuration for this capture request.
1514
+ * @param {String} [config.transport] Transport method for network request ('XHR' or 'sendBeacon').
1515
+ * @param {Date} [config.timestamp] Timestamp is a Date object. If not set, it'll automatically be set to the current time.
1502
1516
  */
1503
1517
  capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): CaptureResult | void;
1504
1518
  _addCaptureHook(callback: (eventName: string) => void): void;
@@ -1979,17 +1993,15 @@ declare class PostHog {
1979
1993
  * @param function_name
1980
1994
  */
1981
1995
  _requirePersonProcessing(function_name: string): boolean;
1982
- _gdpr_init(): void;
1983
1996
  /**
1984
1997
  * Enable or disable persistence based on options
1985
1998
  * only enable/disable if persistence is not already in this state
1986
- * @param {boolean} [options.clear_persistence] If true, will delete all data stored by the sdk in persistence and disable it
1987
- * @param {boolean} [options.enable_persistence] If true, will re-enable sdk persistence
1999
+ * @param {boolean} [disabled] If true, will re-enable sdk persistence
1988
2000
  */
1989
- _gdpr_update_persistence(options: Partial<OptInOutCapturingOptions>): void;
1990
- _gdpr_call_func<R = any>(func: (token: string, options: GDPROptions) => R, options?: Partial<OptInOutCapturingOptions>): R;
2001
+ private _sync_opt_out_with_persistence;
1991
2002
  /**
1992
2003
  * Opt the user in to data capturing and cookies/localstorage for this PostHog instance
2004
+ * If the config.opt_out_persistence_by_default is set to false, the SDK persistence will be enabled.
1993
2005
  *
1994
2006
  * ### Usage
1995
2007
  *
@@ -2000,47 +2012,28 @@ declare class PostHog {
2000
2012
  * posthog.opt_in_capturing({
2001
2013
  * capture_event_name: 'User opted in',
2002
2014
  * capture_event_properties: {
2003
- * 'Email': 'jdoe@example.com'
2004
- * },
2005
- * cookie_expiration: 30,
2006
- * secure_cookie: true
2015
+ * 'email': 'jdoe@example.com'
2016
+ * }
2007
2017
  * });
2008
2018
  *
2009
- * @param {Object} [options] A dictionary of config options to override
2010
- * @param {function} [options.capture] Function used for capturing a PostHog event to record the opt-in action (default is this PostHog instance's capture method)
2011
- * @param {string} [options.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action
2012
- * @param {Object} [options.capture_properties] Set of properties to be captured along with the opt-in action
2013
- * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence
2014
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
2015
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
2016
- * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)
2017
- * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)
2018
- * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)
2019
+ * @param {Object} [config] A dictionary of config options to override
2020
+ * @param {string} [config.capture_event_name=$opt_in] Event name to be used for capturing the opt-in action
2021
+ * @param {Object} [config.capture_properties] Set of properties to be captured along with the opt-in action
2019
2022
  */
2020
- opt_in_capturing(options?: Partial<OptInOutCapturingOptions>): void;
2023
+ opt_in_capturing(options?: {
2024
+ captureEventName?: string; /** event name to be used for capturing the opt-in action */
2025
+ captureProperties?: Properties; /** set of properties to be captured along with the opt-in action */
2026
+ }): void;
2021
2027
  /**
2022
- * Opt the user out of data capturing and cookies/localstorage for this PostHog instance
2028
+ * Opt the user out of data capturing and cookies/localstorage for this PostHog instance.
2029
+ * If the config.opt_out_persistence_by_default is set to true, the SDK persistence will be disabled.
2023
2030
  *
2024
2031
  * ### Usage
2025
2032
  *
2026
2033
  * // opt user out
2027
- * posthog.opt_out_capturing();
2028
- *
2029
- * // opt user out with different cookie configuration from PostHog instance
2030
- * posthog.opt_out_capturing({
2031
- * cookie_expiration: 30,
2032
- * secure_cookie: true
2033
- * });
2034
- *
2035
- * @param {Object} [options] A dictionary of config options to override
2036
- * @param {boolean} [options.clear_persistence=true] If true, will delete all data stored by the sdk in persistence
2037
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
2038
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
2039
- * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)
2040
- * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)
2041
- * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)
2034
+ * posthog.opt_out_capturing()
2042
2035
  */
2043
- opt_out_capturing(options?: Partial<OptInOutCapturingOptions>): void;
2036
+ opt_out_capturing(): void;
2044
2037
  /**
2045
2038
  * Check whether the user has opted in to data capturing and cookies/localstorage for this PostHog instance
2046
2039
  *
@@ -2049,12 +2042,9 @@ declare class PostHog {
2049
2042
  * const has_opted_in = posthog.has_opted_in_capturing();
2050
2043
  * // use has_opted_in value
2051
2044
  *
2052
- * @param {Object} [options] A dictionary of config options to override
2053
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
2054
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
2055
2045
  * @returns {boolean} current opt-in status
2056
2046
  */
2057
- has_opted_in_capturing(options?: Partial<OptInOutCapturingOptions>): boolean;
2047
+ has_opted_in_capturing(): boolean;
2058
2048
  /**
2059
2049
  * Check whether the user has opted out of data capturing and cookies/localstorage for this PostHog instance
2060
2050
  *
@@ -2063,12 +2053,9 @@ declare class PostHog {
2063
2053
  * const has_opted_out = posthog.has_opted_out_capturing();
2064
2054
  * // use has_opted_out value
2065
2055
  *
2066
- * @param {Object} [options] A dictionary of config options to override
2067
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
2068
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
2069
2056
  * @returns {boolean} current opt-out status
2070
2057
  */
2071
- has_opted_out_capturing(options?: Partial<OptInOutCapturingOptions>): boolean;
2058
+ has_opted_out_capturing(): boolean;
2072
2059
  /**
2073
2060
  * Clear the user's opt in/out status of data capturing and cookies/localstorage for this PostHog instance
2074
2061
  *
@@ -2076,26 +2063,13 @@ declare class PostHog {
2076
2063
  *
2077
2064
  * // clear user's opt-in/out status
2078
2065
  * posthog.clear_opt_in_out_capturing();
2079
- *
2080
- * // clear user's opt-in/out status with specific cookie configuration - should match
2081
- * // configuration used when opt_in_capturing/opt_out_capturing methods were called.
2082
- * posthog.clear_opt_in_out_capturing({
2083
- * cookie_expiration: 30,
2084
- * secure_cookie: true
2085
- * });
2086
- *
2087
- * @param {Object} [options] A dictionary of config options to override
2088
- * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence
2089
- * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
2090
- * @param {string} [options.cookie_prefix=__ph_opt_in_out] Custom prefix to be used in the cookie/localstorage name
2091
- * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this PostHog instance's config)
2092
- * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this PostHog instance's config)
2093
- * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this PostHog instance's config)
2066
+ * *
2067
+ * @param {Object} [config] A dictionary of config options to override
2094
2068
  */
2095
- clear_opt_in_out_capturing(options?: Partial<OptInOutCapturingOptions>): void;
2069
+ clear_opt_in_out_capturing(): void;
2096
2070
  debug(debug?: boolean): void;
2097
2071
  }
2098
2072
 
2099
2073
  declare const posthog: PostHog;
2100
2074
 
2101
- export { 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 EventHandler, type FeatureFlagsCallback, type FlagVariant, type GDPROptions, type Headers, type InitiatorType, type IsFeatureEnabledOptions, type JsonType, type LinkSurveyQuestion, type MultipleSurveyQuestion, type NetworkRecordOptions, type NetworkRequest, type OptInOutCapturingOptions, 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 SnippetArrayItem, type Survey, type SurveyAppearance, type SurveyCallback, type SurveyQuestion, SurveyQuestionType, type SurveyResponse, SurveyType, type SurveyUrlMatchType, type ToolbarParams, type ToolbarSource, type ToolbarUserIntent, type ToolbarVersion, posthog as default, posthog };
2075
+ export { 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 EventHandler, type FeatureFlagsCallback, type FlagVariant, type Headers, type InitiatorType, type IsFeatureEnabledOptions, type JsonType, type LinkSurveyQuestion, type MultipleSurveyQuestion, type NetworkRecordOptions, type NetworkRequest, type OptInOutCapturingOptions, 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 SnippetArrayItem, type Survey, type SurveyAppearance, type SurveyCallback, type SurveyQuestion, SurveyQuestionType, type SurveyResponse, SurveyType, type SurveyUrlMatchType, type ToolbarParams, type ToolbarSource, type ToolbarUserIntent, type ToolbarVersion, posthog as default, posthog };