posthog-react-native 4.87.1 → 4.87.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.
@@ -47,9 +47,9 @@ export interface PostHogProviderProps {
47
47
  style?: StyleProp<ViewStyle>;
48
48
  }
49
49
  /**
50
- * PostHogProvider is a React component that provides PostHog functionality to your React Native app. You can find all configuration options in the [React Native SDK docs](https://posthog.com/docs/libraries/react-native#configuration-options).
50
+ * PostHogProvider is a React component that provides PostHog functionality to your React Native app. See [`PostHogOptions`](#posthogoptions) for all configuration options.
51
51
  *
52
- * Autocapturing navigation requires further configuration. See the [React Native SDK navigation docs](https://posthog.com/docs/libraries/react-native#capturing-screen-views)
52
+ * Autocapturing navigation requires further configuration. See [`PostHogAutocaptureOptions`](#posthogautocaptureoptions)
53
53
  * for more information about autocapturing navigation.
54
54
  *
55
55
  * This is the recommended way to set up PostHog for React Native. This utilizes the Context API to pass the PostHog client around, enable autocapture.
@@ -1 +1 @@
1
- {"version":3,"file":"PostHogProvider.js","names":["_react","_interopRequireWildcard","require","_reactNative","_posthogRn","_autocapture","_useNavigationTracker","_PostHogContext","_utils","_jsxRuntime","_this","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","webClickListeners","PostHogNavigationHook","_ref","options","client","useNavigationTracker","navigation","navigationRef","PostHogProvider","exports","_ref2","children","projectToken","apiKey","autocapture","style","_ref2$debug","debug","captureAll","captureNone","token","posthog","useMemo","console","warn","parsedOptions","captureAppLifecycleEvents","undefined","PostHog","autocaptureOptions","captureTouches","captureScreens","_a","phLabelProp","customLabelProp","defaultPostHogLabelProp","useEffect","onTouch","useCallback","type","autocaptureFromTouchEvent","hostRef","useRef","optionsRef","current","doc","globalThis","document","isWeb","addEventListener","ownerNode","existing","owners","Map","handler","owner","findOwningNode","target","nativeEvent","remove","removeEventListener","entry","size","captureProps","onTouchEndCapture","jsx","View","ref","flex","jsxs","PostHogContext","Provider","value"],"sources":["../src/PostHogProvider.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { GestureResponderEvent, StyleProp, View, ViewStyle } from 'react-native'\nimport { PostHog, PostHogOptions } from './posthog-rn'\nimport { autocaptureFromTouchEvent, findOwningNode } from './autocapture'\nimport { useNavigationTracker } from './hooks/useNavigationTracker'\nimport { PostHogContext } from './PostHogContext'\nimport { PostHogAutocaptureOptions } from './types'\nimport { isWeb } from './utils'\nimport { defaultPostHogLabelProp } from './autocapture'\n\n/**\n * Props for the PostHogProvider component.\n *\n * @public\n */\nexport interface PostHogProviderProps {\n /** The child components to render within the PostHog context */\n children: React.ReactNode\n /** PostHog configuration options */\n options?: PostHogOptions\n /**\n * Your PostHog project token, which starts with `phc_`. Find it in your project settings:\n * https://us.posthog.com/settings/project-details#variables\n */\n projectToken?: string\n /**\n * Your PostHog project token. Ignored when `projectToken` is set.\n *\n * @deprecated Use `projectToken` instead. This will be removed in the next major version.\n */\n apiKey?: string\n /** An existing PostHog client instance */\n client?: PostHog\n /**\n * Autocapture configuration - can be a boolean or detailed options.\n *\n * When not set, the default behavior is:\n * - `captureScreens`: true\n * - `captureTouches`: false\n * - `captureAppLifecycleEvents`: true\n *\n * Set to `true` to enable all autocapture features (including touches).\n * Set to `false` to disable all autocapture features.\n */\n autocapture?: boolean | PostHogAutocaptureOptions\n /**\n * Enable debug mode for additional logging\n *\n * @default false\n */\n debug?: boolean\n /** Custom styles for the provider wrapper View */\n style?: StyleProp<ViewStyle>\n}\n\n// One document click listener per client, shared across sibling providers, so one interaction\n// enqueues exactly one $autocapture event (sdk-specs autocapture). `owners` maps each mounted\n// provider's host node to its own options, so a click is scoped to the owning subtree AND\n// captured with that provider's config; its size doubles as the refcount.\ntype WebClickOwners = Map<unknown, React.MutableRefObject<PostHogAutocaptureOptions>>\nconst webClickListeners = new WeakMap<PostHog, { owners: WebClickOwners; remove: () => void }>()\n\nfunction PostHogNavigationHook({\n options,\n client,\n}: {\n options?: PostHogAutocaptureOptions\n client?: PostHog\n}): JSX.Element | null {\n useNavigationTracker(options?.navigation, options?.navigationRef, client)\n return null\n}\n\n/**\n * PostHogProvider is a React component that provides PostHog functionality to your React Native app. You can find all configuration options in the [React Native SDK docs](https://posthog.com/docs/libraries/react-native#configuration-options).\n *\n * Autocapturing navigation requires further configuration. See the [React Native SDK navigation docs](https://posthog.com/docs/libraries/react-native#capturing-screen-views)\n * for more information about autocapturing navigation.\n *\n * This is the recommended way to set up PostHog for React Native. This utilizes the Context API to pass the PostHog client around, enable autocapture.\n *\n * {@label Initialization}\n *\n * @example\n * ```jsx\n * // Add to App.(js|ts)\n * import { usePostHog, PostHogProvider } from 'posthog-react-native'\n *\n * export function MyApp() {\n * return (\n * <PostHogProvider projectToken=\"<ph_project_token>\" options={{\n * host: '<ph_client_api_host>',\n * }}>\n * <MyComponent />\n * </PostHogProvider>\n * )\n * }\n *\n * // And access the PostHog client via the usePostHog hook\n * import { usePostHog } from 'posthog-react-native'\n *\n * const MyComponent = () => {\n * const posthog = usePostHog()\n *\n * useEffect(() => {\n * posthog.capture(\"event_name\")\n * }, [posthog])\n * }\n *\n * ```\n *\n * @example\n * ```jsx\n * // Using with existing client\n * import { PostHog } from 'posthog-react-native'\n *\n * const posthog = new PostHog('<ph_project_token>', {\n * host: '<ph_client_api_host>'\n * })\n *\n * export function MyApp() {\n * return (\n * <PostHogProvider client={posthog}>\n * <MyComponent />\n * </PostHogProvider>\n * )\n * }\n * ```\n *\n * @public\n *\n * @param props - The PostHogProvider props\n */\nexport const PostHogProvider = ({\n children,\n client,\n options,\n projectToken,\n apiKey,\n autocapture,\n style,\n debug = false,\n}: PostHogProviderProps): JSX.Element | null => {\n const captureAll = autocapture === true\n const captureNone = autocapture === false\n\n const token = projectToken ?? apiKey\n\n const posthog = useMemo(() => {\n if (client && token) {\n console.warn(\n 'You have provided both a client and a projectToken to PostHogProvider. The projectToken will be ignored in favour of the client.'\n )\n }\n\n if (client) {\n return client\n }\n\n const parsedOptions = {\n ...options,\n captureAppLifecycleEvents:\n options?.captureAppLifecycleEvents !== undefined ? options.captureAppLifecycleEvents : !captureNone,\n }\n\n return new PostHog(token ?? '', parsedOptions)\n }, [client, token]) // oxlint-disable-line react/exhaustive-deps\n\n const autocaptureOptions = useMemo(\n () => (autocapture && typeof autocapture !== 'boolean' ? autocapture : {}),\n [autocapture]\n )\n\n const captureTouches = !captureNone && posthog && (captureAll || autocaptureOptions?.captureTouches)\n const captureScreens = !captureNone && posthog && (captureAll || (autocaptureOptions?.captureScreens ?? true)) // Default to true if not set\n const phLabelProp = autocaptureOptions?.customLabelProp || defaultPostHogLabelProp\n\n useEffect(() => {\n posthog.debug(debug)\n }, [debug, posthog])\n\n const onTouch = useCallback(\n (type: 'start' | 'move' | 'end', e: GestureResponderEvent) => {\n // TODO: Improve this to ensure we only capture presses and not just ends of a drag for example\n if (!captureTouches) {\n return\n }\n\n if (type === 'end') {\n autocaptureFromTouchEvent(e, posthog, autocaptureOptions)\n }\n },\n [captureTouches, posthog, autocaptureOptions]\n )\n\n // Browsers fire touchend only for touch input, so a mouse never reaches onTouchEndCapture.\n // Listen on the document in the CAPTURE phase: RNW forwards `onClick` but not `onClickCapture`,\n // and its Pressable stops propagation before any bubble-phase handler runs. Document-wide so it\n // still sees Modal; subtree scoping happens in autocapture.tsx. Read options through a ref so an\n // inline `autocapture` prop doesn't re-attach every render.\n const hostRef = useRef<unknown>(null)\n const optionsRef = useRef(autocaptureOptions)\n useEffect(() => {\n optionsRef.current = autocaptureOptions\n }, [autocaptureOptions])\n\n useEffect(() => {\n // The package targets ESNext without the DOM lib, so reach the document off the global.\n const doc = (globalThis as any)?.document\n if (!isWeb() || !captureTouches || !doc?.addEventListener) {\n return\n }\n\n const ownerNode = hostRef.current\n if (!ownerNode) {\n // Without a host node nothing can be scoped to this provider, and a null key would collide\n // with any sibling in the same state.\n return\n }\n\n const existing = webClickListeners.get(posthog)\n if (existing) {\n existing.owners.set(ownerNode, optionsRef)\n } else {\n const owners: WebClickOwners = new Map([[ownerNode, optionsRef]])\n const handler = (e: any): void => {\n const owner = findOwningNode(e, owners)\n if (!owner) {\n return\n }\n const options = owners.get(owner)?.current\n if (!options) {\n return\n }\n autocaptureFromTouchEvent({ target: e.target, nativeEvent: e }, posthog, options, 'click')\n }\n doc.addEventListener('click', handler, true)\n webClickListeners.set(posthog, {\n owners,\n remove: () => doc.removeEventListener('click', handler, true),\n })\n }\n\n return () => {\n const entry = webClickListeners.get(posthog)\n if (!entry) {\n return\n }\n entry.owners.delete(ownerNode)\n if (entry.owners.size === 0) {\n entry.remove()\n webClickListeners.delete(posthog)\n }\n }\n }, [captureTouches, posthog])\n\n const captureProps = isWeb()\n ? {}\n : { onTouchEndCapture: captureTouches ? (e: GestureResponderEvent) => onTouch('end', e) : undefined }\n\n return (\n <View\n ref={hostRef as any}\n {...{ [phLabelProp]: 'PostHogProvider' }} // Dynamically setting customLabelProp (default: ph-label)\n style={style || { flex: 1 }}\n {...captureProps}\n >\n <PostHogContext.Provider value={{ client: posthog }}>\n {captureScreens && <PostHogNavigationHook options={autocaptureOptions} client={posthog} />}\n {children}\n </PostHogContext.Provider>\n </View>\n )\n}\n"],"mappings":"2UAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBACA,IAAAE,UAAA,CAAAF,OAAA,iBACA,IAAAG,YAAA,CAAAH,OAAA,kBACA,IAAAI,qBAAA,CAAAJ,OAAA,iCACA,IAAAK,eAAA,CAAAL,OAAA,qBAEA,IAAAM,MAAA,CAAAN,OAAA,YAA+B,IAAAO,WAAA,CAAAP,OAAA,0BAAAQ,KAAA,QAAAC,YAAA,kGAAAV,wBAAAW,CAAA,CAAAC,CAAA,wBAAAC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,CAAE0B,kBAAmB,CAACzB,MAAM,CAAEiB,OAAQ,EAAG,CACzFV,QAAQ,EACc,CAC3B,EAAM,CAAC,CAEX,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"PostHogProvider.js","names":["_react","_interopRequireWildcard","require","_reactNative","_posthogRn","_autocapture","_useNavigationTracker","_PostHogContext","_utils","_jsxRuntime","_this","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","webClickListeners","PostHogNavigationHook","_ref","options","client","useNavigationTracker","navigation","navigationRef","PostHogProvider","exports","_ref2","children","projectToken","apiKey","autocapture","style","_ref2$debug","debug","captureAll","captureNone","token","posthog","useMemo","console","warn","parsedOptions","captureAppLifecycleEvents","undefined","PostHog","autocaptureOptions","captureTouches","captureScreens","_a","phLabelProp","customLabelProp","defaultPostHogLabelProp","useEffect","onTouch","useCallback","type","autocaptureFromTouchEvent","hostRef","useRef","optionsRef","current","doc","globalThis","document","isWeb","addEventListener","ownerNode","existing","owners","Map","handler","owner","findOwningNode","target","nativeEvent","remove","removeEventListener","entry","size","captureProps","onTouchEndCapture","jsx","View","ref","flex","jsxs","PostHogContext","Provider","value"],"sources":["../src/PostHogProvider.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { GestureResponderEvent, StyleProp, View, ViewStyle } from 'react-native'\nimport { PostHog, PostHogOptions } from './posthog-rn'\nimport { autocaptureFromTouchEvent, findOwningNode } from './autocapture'\nimport { useNavigationTracker } from './hooks/useNavigationTracker'\nimport { PostHogContext } from './PostHogContext'\nimport { PostHogAutocaptureOptions } from './types'\nimport { isWeb } from './utils'\nimport { defaultPostHogLabelProp } from './autocapture'\n\n/**\n * Props for the PostHogProvider component.\n *\n * @public\n */\nexport interface PostHogProviderProps {\n /** The child components to render within the PostHog context */\n children: React.ReactNode\n /** PostHog configuration options */\n options?: PostHogOptions\n /**\n * Your PostHog project token, which starts with `phc_`. Find it in your project settings:\n * https://us.posthog.com/settings/project-details#variables\n */\n projectToken?: string\n /**\n * Your PostHog project token. Ignored when `projectToken` is set.\n *\n * @deprecated Use `projectToken` instead. This will be removed in the next major version.\n */\n apiKey?: string\n /** An existing PostHog client instance */\n client?: PostHog\n /**\n * Autocapture configuration - can be a boolean or detailed options.\n *\n * When not set, the default behavior is:\n * - `captureScreens`: true\n * - `captureTouches`: false\n * - `captureAppLifecycleEvents`: true\n *\n * Set to `true` to enable all autocapture features (including touches).\n * Set to `false` to disable all autocapture features.\n */\n autocapture?: boolean | PostHogAutocaptureOptions\n /**\n * Enable debug mode for additional logging\n *\n * @default false\n */\n debug?: boolean\n /** Custom styles for the provider wrapper View */\n style?: StyleProp<ViewStyle>\n}\n\n// One document click listener per client, shared across sibling providers, so one interaction\n// enqueues exactly one $autocapture event (sdk-specs autocapture). `owners` maps each mounted\n// provider's host node to its own options, so a click is scoped to the owning subtree AND\n// captured with that provider's config; its size doubles as the refcount.\ntype WebClickOwners = Map<unknown, React.MutableRefObject<PostHogAutocaptureOptions>>\nconst webClickListeners = new WeakMap<PostHog, { owners: WebClickOwners; remove: () => void }>()\n\nfunction PostHogNavigationHook({\n options,\n client,\n}: {\n options?: PostHogAutocaptureOptions\n client?: PostHog\n}): JSX.Element | null {\n useNavigationTracker(options?.navigation, options?.navigationRef, client)\n return null\n}\n\n/**\n * PostHogProvider is a React component that provides PostHog functionality to your React Native app. See [`PostHogOptions`](#posthogoptions) for all configuration options.\n *\n * Autocapturing navigation requires further configuration. See [`PostHogAutocaptureOptions`](#posthogautocaptureoptions)\n * for more information about autocapturing navigation.\n *\n * This is the recommended way to set up PostHog for React Native. This utilizes the Context API to pass the PostHog client around, enable autocapture.\n *\n * {@label Initialization}\n *\n * @example\n * ```jsx\n * // Add to App.(js|ts)\n * import { usePostHog, PostHogProvider } from 'posthog-react-native'\n *\n * export function MyApp() {\n * return (\n * <PostHogProvider projectToken=\"<ph_project_token>\" options={{\n * host: '<ph_client_api_host>',\n * }}>\n * <MyComponent />\n * </PostHogProvider>\n * )\n * }\n *\n * // And access the PostHog client via the usePostHog hook\n * import { usePostHog } from 'posthog-react-native'\n *\n * const MyComponent = () => {\n * const posthog = usePostHog()\n *\n * useEffect(() => {\n * posthog.capture(\"event_name\")\n * }, [posthog])\n * }\n *\n * ```\n *\n * @example\n * ```jsx\n * // Using with existing client\n * import { PostHog } from 'posthog-react-native'\n *\n * const posthog = new PostHog('<ph_project_token>', {\n * host: '<ph_client_api_host>'\n * })\n *\n * export function MyApp() {\n * return (\n * <PostHogProvider client={posthog}>\n * <MyComponent />\n * </PostHogProvider>\n * )\n * }\n * ```\n *\n * @public\n *\n * @param props - The PostHogProvider props\n */\nexport const PostHogProvider = ({\n children,\n client,\n options,\n projectToken,\n apiKey,\n autocapture,\n style,\n debug = false,\n}: PostHogProviderProps): JSX.Element | null => {\n const captureAll = autocapture === true\n const captureNone = autocapture === false\n\n const token = projectToken ?? apiKey\n\n const posthog = useMemo(() => {\n if (client && token) {\n console.warn(\n 'You have provided both a client and a projectToken to PostHogProvider. The projectToken will be ignored in favour of the client.'\n )\n }\n\n if (client) {\n return client\n }\n\n const parsedOptions = {\n ...options,\n captureAppLifecycleEvents:\n options?.captureAppLifecycleEvents !== undefined ? options.captureAppLifecycleEvents : !captureNone,\n }\n\n return new PostHog(token ?? '', parsedOptions)\n }, [client, token]) // oxlint-disable-line react/exhaustive-deps\n\n const autocaptureOptions = useMemo(\n () => (autocapture && typeof autocapture !== 'boolean' ? autocapture : {}),\n [autocapture]\n )\n\n const captureTouches = !captureNone && posthog && (captureAll || autocaptureOptions?.captureTouches)\n const captureScreens = !captureNone && posthog && (captureAll || (autocaptureOptions?.captureScreens ?? true)) // Default to true if not set\n const phLabelProp = autocaptureOptions?.customLabelProp || defaultPostHogLabelProp\n\n useEffect(() => {\n posthog.debug(debug)\n }, [debug, posthog])\n\n const onTouch = useCallback(\n (type: 'start' | 'move' | 'end', e: GestureResponderEvent) => {\n // TODO: Improve this to ensure we only capture presses and not just ends of a drag for example\n if (!captureTouches) {\n return\n }\n\n if (type === 'end') {\n autocaptureFromTouchEvent(e, posthog, autocaptureOptions)\n }\n },\n [captureTouches, posthog, autocaptureOptions]\n )\n\n // Browsers fire touchend only for touch input, so a mouse never reaches onTouchEndCapture.\n // Listen on the document in the CAPTURE phase: RNW forwards `onClick` but not `onClickCapture`,\n // and its Pressable stops propagation before any bubble-phase handler runs. Document-wide so it\n // still sees Modal; subtree scoping happens in autocapture.tsx. Read options through a ref so an\n // inline `autocapture` prop doesn't re-attach every render.\n const hostRef = useRef<unknown>(null)\n const optionsRef = useRef(autocaptureOptions)\n useEffect(() => {\n optionsRef.current = autocaptureOptions\n }, [autocaptureOptions])\n\n useEffect(() => {\n // The package targets ESNext without the DOM lib, so reach the document off the global.\n const doc = (globalThis as any)?.document\n if (!isWeb() || !captureTouches || !doc?.addEventListener) {\n return\n }\n\n const ownerNode = hostRef.current\n if (!ownerNode) {\n // Without a host node nothing can be scoped to this provider, and a null key would collide\n // with any sibling in the same state.\n return\n }\n\n const existing = webClickListeners.get(posthog)\n if (existing) {\n existing.owners.set(ownerNode, optionsRef)\n } else {\n const owners: WebClickOwners = new Map([[ownerNode, optionsRef]])\n const handler = (e: any): void => {\n const owner = findOwningNode(e, owners)\n if (!owner) {\n return\n }\n const options = owners.get(owner)?.current\n if (!options) {\n return\n }\n autocaptureFromTouchEvent({ target: e.target, nativeEvent: e }, posthog, options, 'click')\n }\n doc.addEventListener('click', handler, true)\n webClickListeners.set(posthog, {\n owners,\n remove: () => doc.removeEventListener('click', handler, true),\n })\n }\n\n return () => {\n const entry = webClickListeners.get(posthog)\n if (!entry) {\n return\n }\n entry.owners.delete(ownerNode)\n if (entry.owners.size === 0) {\n entry.remove()\n webClickListeners.delete(posthog)\n }\n }\n }, [captureTouches, posthog])\n\n const captureProps = isWeb()\n ? {}\n : { onTouchEndCapture: captureTouches ? (e: GestureResponderEvent) => onTouch('end', e) : undefined }\n\n return (\n <View\n ref={hostRef as any}\n {...{ [phLabelProp]: 'PostHogProvider' }} // Dynamically setting customLabelProp (default: ph-label)\n style={style || { flex: 1 }}\n {...captureProps}\n >\n <PostHogContext.Provider value={{ client: posthog }}>\n {captureScreens && <PostHogNavigationHook options={autocaptureOptions} client={posthog} />}\n {children}\n </PostHogContext.Provider>\n </View>\n )\n}\n"],"mappings":"2UAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBACA,IAAAE,UAAA,CAAAF,OAAA,iBACA,IAAAG,YAAA,CAAAH,OAAA,kBACA,IAAAI,qBAAA,CAAAJ,OAAA,iCACA,IAAAK,eAAA,CAAAL,OAAA,qBAEA,IAAAM,MAAA,CAAAN,OAAA,YAA+B,IAAAO,WAAA,CAAAP,OAAA,0BAAAQ,KAAA,QAAAC,YAAA,kGAAAV,wBAAAW,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAb,uBAAA,UAAAA,wBAAAW,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,gBAAAT,CAAA,YAAAA,CAAA,YAAAU,OAAA,CAAAV,CAAA,sBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,CAAAM,CAAA,EAAAO,GAAA,CAAAb,CAAA,CAAAQ,CAAA,WAAAM,GAAA,IAAAd,CAAA,aAAAc,GAAA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C,CAAC,CAE7B,GAAM,CAAA0C,YAAY,CAAG,GAAAf,YAAK,GAAE,CACxB,EAAE,CACF,CAAEgB,iBAAiB,CAAElC,cAAc,CAAG,SAAChE,CAAwB,QAAK,CAAAuE,OAAO,CAAC,KAAK,CAAEvE,CAAC,CAAC,GAAG6D,SAAS,CAAE,CAEvG,MACE,GAAAhE,WAAA,CAAAsG,GAAA,EAAC5G,YAAA,CAAA6G,IAAI,CAAAzE,aAAA,CAAAA,aAAA,CAAAA,aAAA,EACH0E,GAAG,CAAE1B,OAAe,KAAA5C,gBAAA,gBACboC,WAAW,CAAG,iBAAiB,OACtClB,KAAK,CAAEA,KAAK,EAAI,CAAEqD,IAAI,CAAE,CAAC,CAAG,EACxBL,YAAY,MAAApD,QAAA,CAEhB,GAAAhD,WAAA,CAAA0G,IAAA,EAAC5G,eAAA,CAAA6G,cAAc,CAACC,QAAQ,EAACC,KAAK,CAAE,CAAEpE,MAAM,CAAEiB,OAAO,CAAG,CAAAV,QAAA,EACjDoB,cAAc,EAAI,GAAApE,WAAA,CAAAsG,GAAA,EAAChE,qBAAqB,EAACE,OAAO,CAAE0B,kBAAmB,CAACzB,MAAM,CAAEiB,OAAQ,EAAG,CACzFV,QAAQ,EACc,CAC3B,EAAM,CAAC,CAEX,CAAC","ignoreList":[]}
@@ -241,7 +241,7 @@ export declare class PostHog extends PostHogCore {
241
241
  */
242
242
  get apiKey(): string;
243
243
  /**
244
- * Creates a new PostHog instance for React Native. You can find all configuration options in the [React Native SDK docs](https://posthog.com/docs/libraries/react-native#configuration-options).
244
+ * Creates a new PostHog instance for React Native. See [`PostHogOptions`](#posthogoptions) for all configuration options.
245
245
  *
246
246
  * If you prefer not to use the PostHogProvider, you can initialize PostHog in its own file and import the instance from there.
247
247
  *
@@ -965,6 +965,8 @@ export declare class PostHog extends PostHogCore {
965
965
  */
966
966
  screen(name: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): Promise<void>;
967
967
  _isEnableSessionReplay(): boolean;
968
+ private _isSessionReplayOff;
969
+ private _isNativeRecorderRunning;
968
970
  private _isNativeSessionOwner;
969
971
  private _isSameProjectAs;
970
972
  private _canTakeOverNativeSession;