posthog-react-native 4.79.1 → 4.80.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.
@@ -12,7 +12,10 @@ export interface PostHogProviderProps {
12
12
  children: React.ReactNode;
13
13
  /** PostHog configuration options */
14
14
  options?: PostHogOptions;
15
- /** Your PostHog API key */
15
+ /**
16
+ * Your PostHog project token, which starts with `phc_`. Find it in your project settings:
17
+ * https://us.posthog.com/settings/project-details#variables
18
+ */
16
19
  apiKey?: string;
17
20
  /** An existing PostHog client instance */
18
21
  client?: PostHog;
@@ -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","apiKey","autocapture","style","_ref2$debug","debug","captureAll","captureNone","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 /** Your PostHog API key */\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 apiKey=\"<ph_project_api_key>\" 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_api_key>', {\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 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 posthog = useMemo(() => {\n if (client && apiKey) {\n console.warn(\n 'You have provided both a client and an apiKey to PostHogProvider. The apiKey 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(apiKey ?? '', parsedOptions)\n }, [client, apiKey]) // 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,SA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CAAC,CAAC,CAE7B,GAAM,CAAA0C,YAAY,CAAG,GAAAf,YAAK,GAAE,CACxB,EAAE,CACF,CAAEgB,iBAAiB,CAAElC,cAAc,CAAG,SAAC9D,CAAwB,QAAK,CAAAqE,OAAO,CAAC,KAAK,CAAErE,CAAC,CAAC,GAAG2D,SAAS,CAAE,CAEvG,MACE,GAAA9D,WAAA,CAAAoG,GAAA,EAAC1G,YAAA,CAAA2G,IAAI,CAAAvE,aAAA,CAAAA,aAAA,CAAAA,aAAA,EACHwE,GAAG,CAAE1B,OAAe,KAAA1C,gBAAA,gBACbkC,WAAW,CAAG,iBAAiB,OACtCjB,KAAK,CAAEA,KAAK,EAAI,CAAEoD,IAAI,CAAE,CAAC,CAAG,EACxBL,YAAY,MAAAlD,QAAA,CAEhB,GAAAhD,WAAA,CAAAwG,IAAA,EAAC1G,eAAA,CAAA2G,cAAc,CAACC,QAAQ,EAACC,KAAK,CAAE,CAAElE,MAAM,CAAEe,OAAO,CAAG,CAAAR,QAAA,EACjDkB,cAAc,EAAI,GAAAlE,WAAA,CAAAoG,GAAA,EAAC9D,qBAAqB,EAACE,OAAO,CAAEwB,kBAAmB,CAACvB,MAAM,CAAEe,OAAQ,EAAG,CACzFR,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","apiKey","autocapture","style","_ref2$debug","debug","captureAll","captureNone","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 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 apiKey=\"<ph_project_api_key>\" 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_api_key>', {\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 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 posthog = useMemo(() => {\n if (client && apiKey) {\n console.warn(\n 'You have provided both a client and an apiKey to PostHogProvider. The apiKey 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(apiKey ?? '', parsedOptions)\n }, [client, apiKey]) // 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,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OAAQ,EAAG,CACzFR,QAAQ,EACc,CAC3B,EAAM,CAAC,CAEX,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getAppProperties=exports.currentDeviceType=exports.buildOptimisticAsyncStorage=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _OptionalAsyncStorage=require("./optional/OptionalAsyncStorage");var _utils=require("./utils");var _OptionalExpoApplication=require("./optional/OptionalExpoApplication");var _OptionalExpoDevice=require("./optional/OptionalExpoDevice");var _OptionalExpoFileSystem=require("./optional/OptionalExpoFileSystem");var _OptionalExpoLocalization=require("./optional/OptionalExpoLocalization");var _OptionalReactNativeDeviceInfo=require("./optional/OptionalReactNativeDeviceInfo");var _OptionalReactNativeLocalize=require("./optional/OptionalReactNativeLocalize");var _OptionalExpoFileSystemLegacy=require("./optional/OptionalExpoFileSystemLegacy");var _core=require("@posthog/core");var getDeviceType=function getDeviceType(){var _a,_b,_c;var deviceType='Mobile';if((0,_utils.isMacOS)()||(0,_utils.isWindows)()){deviceType='Desktop';}else if((0,_utils.isWeb)()){var ua=typeof navigator!=='undefined'&&navigator.userAgent?navigator.userAgent:'';var nav=typeof navigator!=='undefined'?navigator:undefined;var win=typeof globalThis.window!=='undefined'?globalThis.window:undefined;deviceType=(0,_core.detectDeviceType)(ua,{userAgentDataPlatform:(_a=nav===null||nav===void 0?void 0:nav.userAgentData)===null||_a===void 0?void 0:_a.platform,maxTouchPoints:nav===null||nav===void 0?void 0:nav.maxTouchPoints,screenWidth:(_b=win===null||win===void 0?void 0:win.screen)===null||_b===void 0?void 0:_b.width,screenHeight:(_c=win===null||win===void 0?void 0:win.screen)===null||_c===void 0?void 0:_c.height,devicePixelRatio:win===null||win===void 0?void 0:win.devicePixelRatio});}return deviceType;};var currentDeviceType=exports.currentDeviceType=getDeviceType();var getAppProperties=exports.getAppProperties=function getAppProperties(){var _a,_b;var properties={$device_type:currentDeviceType};var reactNativeVersion=(0,_utils.getReactNativeVersion)();if(reactNativeVersion){properties.$react_native_version=reactNativeVersion;}if(_OptionalExpoApplication.OptionalExpoApplication){properties.$app_build=_OptionalExpoApplication.OptionalExpoApplication.nativeBuildVersion;properties.$app_name=_OptionalExpoApplication.OptionalExpoApplication.applicationName;properties.$app_namespace=_OptionalExpoApplication.OptionalExpoApplication.applicationId;properties.$app_version=_OptionalExpoApplication.OptionalExpoApplication.nativeApplicationVersion;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$app_build=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBuildNumber());properties.$app_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getApplicationName());properties.$app_namespace=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBundleId());properties.$app_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getVersion());}if(_OptionalExpoDevice.OptionalExpoDevice){properties.$device_manufacturer=_OptionalExpoDevice.OptionalExpoDevice.manufacturer;properties.$device_name=_OptionalExpoDevice.OptionalExpoDevice.modelName;if((0,_utils.getPlatformOS)()==='android'){properties.$os_name='Android';}else{properties.$os_name=_OptionalExpoDevice.OptionalExpoDevice.osName;}properties.$os_version=_OptionalExpoDevice.OptionalExpoDevice.osVersion;properties.$is_emulator=!_OptionalExpoDevice.OptionalExpoDevice.isDevice;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$device_manufacturer=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getManufacturerSync());properties.$device_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getModel());properties.$os_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemName());properties.$os_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemVersion());properties.$is_emulator=_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.isEmulatorSync();}if(_OptionalExpoLocalization.OptionalExpoLocalization){var optionalExpoLocalization=_OptionalExpoLocalization.OptionalExpoLocalization;var locale=optionalExpoLocalization.locale;if(!locale&&optionalExpoLocalization.getLocales){locale=(_a=optionalExpoLocalization.getLocales()[0])===null||_a===void 0?void 0:_a.languageTag;}if(locale){properties.$locale=locale;}var timezone=optionalExpoLocalization.timezone;if(!timezone&&optionalExpoLocalization.getCalendars){timezone=(_b=optionalExpoLocalization.getCalendars()[0])===null||_b===void 0?void 0:_b.timeZone;}if(timezone){properties.$timezone=timezone;}}else if(_OptionalReactNativeLocalize.OptionalReactNativeLocalize){var localesFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getLocales;if(localesFn){var locales=localesFn();if(locales&&locales.length>0){var languageTag=locales[0].languageTag;if(languageTag){properties.$locale=languageTag;}}}var timezoneFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getTimeZone;if(timezoneFn){var _timezone=timezoneFn();if(_timezone){properties.$timezone=_timezone;}}}return properties;};var returnPropertyIfNotUnknown=function returnPropertyIfNotUnknown(value){if(value!=='unknown'){return value;}return null;};var buildLegacyStorage=function buildLegacyStorage(filesystem){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){var uri,stringContent,_t;return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;uri=(filesystem.documentDirectory||'')+key;_context.next=1;return filesystem.readAsStringAsync(uri);case 1:stringContent=_context.sent;return _context.abrupt("return",stringContent);case 2:_context.prev=2;_t=_context["catch"](0);return _context.abrupt("return",null);case 3:case"end":return _context.stop();}},_callee,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(){var uri;return _regenerator["default"].wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:uri=(filesystem.documentDirectory||'')+key;_context2.next=1;return filesystem.writeAsStringAsync(uri,value);case 1:case"end":return _context2.stop();}},_callee2);}))();}};};var buildOptimisticAsyncStorage=exports.buildOptimisticAsyncStorage=function buildOptimisticAsyncStorage(){if((0,_utils.isWeb)()&&typeof(_utils.GLOBAL_OBJ===null||_utils.GLOBAL_OBJ===void 0?void 0:_utils.GLOBAL_OBJ.window)==='undefined'){return undefined;}var supportedPlatform=!(0,_utils.isWeb)()&&!(0,_utils.isMacOS)();if(supportedPlatform){if(_OptionalExpoFileSystem.OptionalExpoFileSystem){var filesystem=_OptionalExpoFileSystem.OptionalExpoFileSystem;if(filesystem.Paths&&filesystem.File){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(){var file,stringContent,_t2;return _regenerator["default"].wrap(function(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;file=new filesystem.File(filesystem.Paths.document,key);_context3.next=1;return file.text();case 1:stringContent=_context3.sent;return _context3.abrupt("return",stringContent);case 2:_context3.prev=2;_t2=_context3["catch"](0);return _context3.abrupt("return",null);case 3:case"end":return _context3.stop();}},_callee3,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){var file;return _regenerator["default"].wrap(function(_context4){while(1)switch(_context4.prev=_context4.next){case 0:file=new filesystem.File(filesystem.Paths.document,key);_context4.next=1;return file.write(value);case 1:case"end":return _context4.stop();}},_callee4);}))();}};}}var legacyModule=_OptionalExpoFileSystemLegacy.OptionalExpoFileSystemLegacy||_OptionalExpoFileSystem.OptionalExpoFileSystem;try{if(legacyModule&&typeof legacyModule.readAsStringAsync==='function'){return buildLegacyStorage(legacyModule);}}catch(e){}}if(_OptionalAsyncStorage.OptionalAsyncStorage){return _OptionalAsyncStorage.OptionalAsyncStorage;}throw new Error('PostHog: No storage available. Please install expo-file-system or react-native-async-storage OR implement a custom storage provider.');};
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getAppProperties=exports.currentDeviceType=exports.buildOptimisticAsyncStorage=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _OptionalAsyncStorage=require("./optional/OptionalAsyncStorage");var _utils=require("./utils");var _OptionalExpoApplication=require("./optional/OptionalExpoApplication");var _OptionalExpoDevice=require("./optional/OptionalExpoDevice");var _OptionalExpoFileSystem=require("./optional/OptionalExpoFileSystem");var _OptionalExpoLocalization=require("./optional/OptionalExpoLocalization");var _OptionalReactNativeDeviceInfo=require("./optional/OptionalReactNativeDeviceInfo");var _OptionalReactNativeLocalize=require("./optional/OptionalReactNativeLocalize");var _OptionalExpoFileSystemLegacy=require("./optional/OptionalExpoFileSystemLegacy");var _core=require("@posthog/core");var getDeviceType=function getDeviceType(){var _a,_b,_c;var deviceType='Mobile';if((0,_utils.isMacOS)()||(0,_utils.isWindows)()){deviceType='Desktop';}else if((0,_utils.isWeb)()){var ua=typeof navigator!=='undefined'&&navigator.userAgent?navigator.userAgent:'';var nav=typeof navigator!=='undefined'?navigator:undefined;var win=typeof globalThis.window!=='undefined'?globalThis.window:undefined;deviceType=(0,_core.detectDeviceType)(ua,{userAgentDataPlatform:(_a=nav===null||nav===void 0?void 0:nav.userAgentData)===null||_a===void 0?void 0:_a.platform,maxTouchPoints:nav===null||nav===void 0?void 0:nav.maxTouchPoints,screenWidth:(_b=win===null||win===void 0?void 0:win.screen)===null||_b===void 0?void 0:_b.width,screenHeight:(_c=win===null||win===void 0?void 0:win.screen)===null||_c===void 0?void 0:_c.height,devicePixelRatio:win===null||win===void 0?void 0:win.devicePixelRatio});}return deviceType;};var currentDeviceType=exports.currentDeviceType=getDeviceType();var getAppProperties=exports.getAppProperties=function getAppProperties(){var _a,_b;var properties={$device_type:currentDeviceType};if(_OptionalExpoApplication.OptionalExpoApplication){properties.$app_build=_OptionalExpoApplication.OptionalExpoApplication.nativeBuildVersion;properties.$app_name=_OptionalExpoApplication.OptionalExpoApplication.applicationName;properties.$app_namespace=_OptionalExpoApplication.OptionalExpoApplication.applicationId;properties.$app_version=_OptionalExpoApplication.OptionalExpoApplication.nativeApplicationVersion;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$app_build=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBuildNumber());properties.$app_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getApplicationName());properties.$app_namespace=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getBundleId());properties.$app_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getVersion());}if(_OptionalExpoDevice.OptionalExpoDevice){properties.$device_manufacturer=_OptionalExpoDevice.OptionalExpoDevice.manufacturer;properties.$device_name=_OptionalExpoDevice.OptionalExpoDevice.modelName;if((0,_utils.getPlatformOS)()==='android'){properties.$os_name='Android';}else{properties.$os_name=_OptionalExpoDevice.OptionalExpoDevice.osName;}properties.$os_version=_OptionalExpoDevice.OptionalExpoDevice.osVersion;properties.$is_emulator=!_OptionalExpoDevice.OptionalExpoDevice.isDevice;}else if(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo){properties.$device_manufacturer=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getManufacturerSync());properties.$device_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getModel());properties.$os_name=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemName());properties.$os_version=returnPropertyIfNotUnknown(_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.getSystemVersion());properties.$is_emulator=_OptionalReactNativeDeviceInfo.OptionalReactNativeDeviceInfo.isEmulatorSync();}if(_OptionalExpoLocalization.OptionalExpoLocalization){var optionalExpoLocalization=_OptionalExpoLocalization.OptionalExpoLocalization;var locale=optionalExpoLocalization.locale;if(!locale&&optionalExpoLocalization.getLocales){locale=(_a=optionalExpoLocalization.getLocales()[0])===null||_a===void 0?void 0:_a.languageTag;}if(locale){properties.$locale=locale;}var timezone=optionalExpoLocalization.timezone;if(!timezone&&optionalExpoLocalization.getCalendars){timezone=(_b=optionalExpoLocalization.getCalendars()[0])===null||_b===void 0?void 0:_b.timeZone;}if(timezone){properties.$timezone=timezone;}}else if(_OptionalReactNativeLocalize.OptionalReactNativeLocalize){var localesFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getLocales;if(localesFn){var locales=localesFn();if(locales&&locales.length>0){var languageTag=locales[0].languageTag;if(languageTag){properties.$locale=languageTag;}}}var timezoneFn=_OptionalReactNativeLocalize.OptionalReactNativeLocalize.getTimeZone;if(timezoneFn){var _timezone=timezoneFn();if(_timezone){properties.$timezone=_timezone;}}}return properties;};var returnPropertyIfNotUnknown=function returnPropertyIfNotUnknown(value){if(value!=='unknown'){return value;}return null;};var buildLegacyStorage=function buildLegacyStorage(filesystem){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(){var uri,stringContent,_t;return _regenerator["default"].wrap(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;uri=(filesystem.documentDirectory||'')+key;_context.next=1;return filesystem.readAsStringAsync(uri);case 1:stringContent=_context.sent;return _context.abrupt("return",stringContent);case 2:_context.prev=2;_t=_context["catch"](0);return _context.abrupt("return",null);case 3:case"end":return _context.stop();}},_callee,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(){var uri;return _regenerator["default"].wrap(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:uri=(filesystem.documentDirectory||'')+key;_context2.next=1;return filesystem.writeAsStringAsync(uri,value);case 1:case"end":return _context2.stop();}},_callee2);}))();}};};var buildOptimisticAsyncStorage=exports.buildOptimisticAsyncStorage=function buildOptimisticAsyncStorage(){if((0,_utils.isWeb)()&&typeof(_utils.GLOBAL_OBJ===null||_utils.GLOBAL_OBJ===void 0?void 0:_utils.GLOBAL_OBJ.window)==='undefined'){return undefined;}var supportedPlatform=!(0,_utils.isWeb)()&&!(0,_utils.isMacOS)();if(supportedPlatform){if(_OptionalExpoFileSystem.OptionalExpoFileSystem){var filesystem=_OptionalExpoFileSystem.OptionalExpoFileSystem;if(filesystem.Paths&&filesystem.File){return{getItem:function getItem(key){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(){var file,stringContent,_t2;return _regenerator["default"].wrap(function(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;file=new filesystem.File(filesystem.Paths.document,key);_context3.next=1;return file.text();case 1:stringContent=_context3.sent;return _context3.abrupt("return",stringContent);case 2:_context3.prev=2;_t2=_context3["catch"](0);return _context3.abrupt("return",null);case 3:case"end":return _context3.stop();}},_callee3,null,[[0,2]]);}))();},setItem:function setItem(key,value){return(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(){var file;return _regenerator["default"].wrap(function(_context4){while(1)switch(_context4.prev=_context4.next){case 0:file=new filesystem.File(filesystem.Paths.document,key);_context4.next=1;return file.write(value);case 1:case"end":return _context4.stop();}},_callee4);}))();}};}}var legacyModule=_OptionalExpoFileSystemLegacy.OptionalExpoFileSystemLegacy||_OptionalExpoFileSystem.OptionalExpoFileSystem;try{if(legacyModule&&typeof legacyModule.readAsStringAsync==='function'){return buildLegacyStorage(legacyModule);}}catch(e){}}if(_OptionalAsyncStorage.OptionalAsyncStorage){return _OptionalAsyncStorage.OptionalAsyncStorage;}throw new Error('PostHog: No storage available. Please install expo-file-system or react-native-async-storage OR implement a custom storage provider.');};
2
2
  //# sourceMappingURL=native-deps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-deps.js","names":["_OptionalAsyncStorage","require","_utils","_OptionalExpoApplication","_OptionalExpoDevice","_OptionalExpoFileSystem","_OptionalExpoLocalization","_OptionalReactNativeDeviceInfo","_OptionalReactNativeLocalize","_OptionalExpoFileSystemLegacy","_core","getDeviceType","deviceType","isMacOS","isWindows","isWeb","ua","navigator","userAgent","nav","undefined","win","globalThis","window","detectDeviceType","userAgentDataPlatform","_a","userAgentData","platform","maxTouchPoints","screenWidth","_b","screen","width","screenHeight","_c","height","devicePixelRatio","currentDeviceType","exports","getAppProperties","properties","$device_type","reactNativeVersion","getReactNativeVersion","$react_native_version","OptionalExpoApplication","$app_build","nativeBuildVersion","$app_name","applicationName","$app_namespace","applicationId","$app_version","nativeApplicationVersion","OptionalReactNativeDeviceInfo","returnPropertyIfNotUnknown","getBuildNumber","getApplicationName","getBundleId","getVersion","OptionalExpoDevice","$device_manufacturer","manufacturer","$device_name","modelName","getPlatformOS","$os_name","osName","$os_version","osVersion","$is_emulator","isDevice","getManufacturerSync","getModel","getSystemName","getSystemVersion","isEmulatorSync","OptionalExpoLocalization","optionalExpoLocalization","locale","getLocales","languageTag","$locale","timezone","getCalendars","timeZone","$timezone","OptionalReactNativeLocalize","localesFn","locales","length","timezoneFn","getTimeZone","value","buildLegacyStorage","filesystem","getItem","key","_asyncToGenerator2","_regenerator","mark","_callee","uri","stringContent","_t","wrap","_context","prev","next","documentDirectory","readAsStringAsync","sent","abrupt","stop","setItem","_callee2","_context2","writeAsStringAsync","buildOptimisticAsyncStorage","GLOBAL_OBJ","supportedPlatform","OptionalExpoFileSystem","Paths","File","_callee3","file","_t2","_context3","document","text","_callee4","_context4","write","legacyModule","OptionalExpoFileSystemLegacy","e","OptionalAsyncStorage","Error"],"sources":["../src/native-deps.tsx"],"sourcesContent":["import { OptionalAsyncStorage } from './optional/OptionalAsyncStorage'\nimport { GLOBAL_OBJ, getPlatformOS, getReactNativeVersion, isMacOS, isWeb, isWindows } from './utils'\nimport { OptionalExpoApplication } from './optional/OptionalExpoApplication'\nimport { OptionalExpoDevice } from './optional/OptionalExpoDevice'\nimport { OptionalExpoFileSystem } from './optional/OptionalExpoFileSystem'\nimport { OptionalExpoLocalization } from './optional/OptionalExpoLocalization'\nimport { OptionalReactNativeDeviceInfo } from './optional/OptionalReactNativeDeviceInfo'\nimport { PostHogCustomAppProperties, PostHogCustomStorage } from './types'\nimport { OptionalReactNativeLocalize } from './optional/OptionalReactNativeLocalize'\nimport { OptionalExpoFileSystemLegacy } from './optional/OptionalExpoFileSystemLegacy'\nimport { detectDeviceType } from '@posthog/core'\n\nconst getDeviceType = (): string => {\n let deviceType = 'Mobile'\n\n if (isMacOS() || isWindows()) {\n deviceType = 'Desktop'\n } else if (isWeb()) {\n // Check user agent to determine if it's desktop or mobile\n const ua = typeof navigator !== 'undefined' && navigator.userAgent ? navigator.userAgent : ''\n\n const nav = typeof navigator !== 'undefined' ? (navigator as any) : undefined\n const win = typeof (globalThis as any).window !== 'undefined' ? (globalThis as any).window : undefined\n deviceType = detectDeviceType(ua, {\n userAgentDataPlatform: nav?.userAgentData?.platform,\n maxTouchPoints: nav?.maxTouchPoints,\n screenWidth: win?.screen?.width,\n screenHeight: win?.screen?.height,\n devicePixelRatio: win?.devicePixelRatio,\n })\n }\n return deviceType\n}\n\nexport const currentDeviceType = getDeviceType()\n\nexport const getAppProperties = (): PostHogCustomAppProperties => {\n const properties: PostHogCustomAppProperties = {\n $device_type: currentDeviceType,\n }\n\n const reactNativeVersion = getReactNativeVersion()\n if (reactNativeVersion) {\n properties.$react_native_version = reactNativeVersion\n }\n\n if (OptionalExpoApplication) {\n properties.$app_build = OptionalExpoApplication.nativeBuildVersion\n properties.$app_name = OptionalExpoApplication.applicationName\n properties.$app_namespace = OptionalExpoApplication.applicationId\n properties.$app_version = OptionalExpoApplication.nativeApplicationVersion\n } else if (OptionalReactNativeDeviceInfo) {\n properties.$app_build = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getBuildNumber())\n properties.$app_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getApplicationName())\n properties.$app_namespace = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getBundleId())\n properties.$app_version = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getVersion())\n }\n\n if (OptionalExpoDevice) {\n properties.$device_manufacturer = OptionalExpoDevice.manufacturer\n // expo-device already maps the device model identifier to a human readable name\n properties.$device_name = OptionalExpoDevice.modelName\n\n // https://github.com/expo/expo/issues/6990\n // some devices return a value similar to:\n // HUAWEI/SNE-LX1/HWSNE:8.1.0/HUAWEISNE-LX1/131(C432):user/release-keys\n if (getPlatformOS() === 'android') {\n properties.$os_name = 'Android'\n } else {\n properties.$os_name = OptionalExpoDevice.osName\n }\n\n properties.$os_version = OptionalExpoDevice.osVersion\n properties.$is_emulator = !OptionalExpoDevice.isDevice\n } else if (OptionalReactNativeDeviceInfo) {\n properties.$device_manufacturer = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getManufacturerSync())\n // react-native-device-info already maps the device model identifier to a human readable name\n properties.$device_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getModel())\n properties.$os_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getSystemName())\n properties.$os_version = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getSystemVersion())\n properties.$is_emulator = OptionalReactNativeDeviceInfo.isEmulatorSync()\n }\n\n if (OptionalExpoLocalization) {\n // expo-localization >= 14 use functions to get these results, older versions use JS getters\n // https://github.com/expo/expo/blob/sdk-54/packages/expo-localization/CHANGELOG.md#1400--2022-10-25\n // this type below supports both variants, and type-checks with older and newer versions of expo-localization\n const optionalExpoLocalization: {\n locale?: string\n getLocales?: () => {\n languageTag: string\n }[]\n timezone?: string\n getCalendars?: () => {\n timeZone: string | null\n }[]\n } = OptionalExpoLocalization\n\n let locale = optionalExpoLocalization.locale\n if (!locale && optionalExpoLocalization.getLocales) {\n locale = optionalExpoLocalization.getLocales()[0]?.languageTag\n }\n if (locale) {\n properties.$locale = locale\n }\n let timezone: string | undefined | null = optionalExpoLocalization.timezone\n if (!timezone && optionalExpoLocalization.getCalendars) {\n timezone = optionalExpoLocalization.getCalendars()[0]?.timeZone\n }\n if (timezone) {\n properties.$timezone = timezone\n }\n } else if (OptionalReactNativeLocalize) {\n const localesFn = OptionalReactNativeLocalize.getLocales\n if (localesFn) {\n const locales = localesFn()\n\n if (locales && locales.length > 0) {\n const languageTag = locales[0].languageTag\n if (languageTag) {\n properties.$locale = languageTag\n }\n }\n }\n\n const timezoneFn = OptionalReactNativeLocalize.getTimeZone\n if (timezoneFn) {\n const timezone = timezoneFn()\n\n if (timezone) {\n properties.$timezone = timezone\n }\n }\n }\n\n return properties\n}\n\n// react-native-device-info returns 'unknown' if the property is not available (Web target)\nconst returnPropertyIfNotUnknown = (value: string | null): string | null => {\n if (value !== 'unknown') {\n return value\n }\n return null\n}\n\nconst buildLegacyStorage = (filesystem: any): PostHogCustomStorage => {\n return {\n async getItem(key: string) {\n try {\n const uri = (filesystem.documentDirectory || '') + key\n const stringContent = await filesystem.readAsStringAsync(uri)\n return stringContent\n } catch (e) {\n return null\n }\n },\n\n async setItem(key: string, value: string) {\n const uri = (filesystem.documentDirectory || '') + key\n await filesystem.writeAsStringAsync(uri, value)\n },\n }\n}\n\nexport const buildOptimisticAsyncStorage = (): PostHogCustomStorage | undefined => {\n // On web platform during SSR (no window), skip file storage\n // The caller will fall back to memory storage\n if (isWeb() && typeof (GLOBAL_OBJ as any)?.window === 'undefined') {\n return undefined\n }\n\n // expo-file-system is not supported on web and macos, so we need to use the react-native-async-storage package instead\n // see https://github.com/PostHog/posthog-js-lite/blob/5fb7bee96f739b243dfea5589e2027f16629e8cd/posthog-react-native/src/optional/OptionalExpoFileSystem.ts#L7-L11\n const supportedPlatform = !isWeb() && !isMacOS()\n\n // expo-file-system is only supported on native platforms (not web/macOS).\n // See https://github.com/PostHog/posthog-js-lite/issues/140\n if (supportedPlatform) {\n // expo >= 54 and expo-file-system >= 19: prefer the new File/Paths API.\n // We always check for the new API first because:\n // - SDK 54 stable exports legacy methods (readAsStringAsync, writeAsStringAsync) that throw\n // a deprecation error when called, so existence checks alone are unreliable.\n // - SDK 55+ has a working legacy subpath, but the new API is the recommended approach.\n // See https://github.com/PostHog/posthog-js/issues/3151\n if (OptionalExpoFileSystem) {\n const filesystem = OptionalExpoFileSystem as any\n\n if (filesystem.Paths && filesystem.File) {\n return {\n async getItem(key: string) {\n try {\n // File constructor accepts Directory instances and joins path segments\n // See https://docs.expo.dev/versions/latest/sdk/filesystem/\n const file = new filesystem.File(filesystem.Paths.document, key)\n const stringContent = await file.text()\n return stringContent\n } catch (e) {\n return null\n }\n },\n\n async setItem(key: string, value: string) {\n const file = new filesystem.File(filesystem.Paths.document, key)\n await file.write(value)\n },\n }\n }\n }\n\n // Fallback to legacy APIs for older Expo versions (expo <= 53, expo-file-system <= 18).\n // Try the legacy subpath first (available in SDK 55+), then the main module.\n // We validate that readAsStringAsync is a real function before using it,\n // to avoid calling deprecated stubs that throw at runtime (SDK 54 stable).\n const legacyModule = (OptionalExpoFileSystemLegacy || OptionalExpoFileSystem) as any\n try {\n if (legacyModule && typeof legacyModule.readAsStringAsync === 'function') {\n return buildLegacyStorage(legacyModule)\n }\n } catch (e) {}\n }\n\n if (OptionalAsyncStorage) {\n return OptionalAsyncStorage\n }\n\n throw new Error(\n 'PostHog: No storage available. Please install expo-file-system or react-native-async-storage OR implement a custom storage provider.'\n )\n}\n"],"mappings":"waAAA,IAAAA,qBAAA,CAAAC,OAAA,oCACA,IAAAC,MAAA,CAAAD,OAAA,YACA,IAAAE,wBAAA,CAAAF,OAAA,uCACA,IAAAG,mBAA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AA0B,SAAA,iBAAAA,SAAA,CAAAxB,IAAA,CAAAwB,SAAA,CAAAvB,IAAA,SAChCiB,IAAI,CAAG,GAAI,CAAA9B,UAAU,CAAC4B,IAAI,CAAC5B,UAAU,CAAC2B,KAAK,CAACM,QAAQ,CAAE/B,GAAG,CAACkC,CAAA,UAAAvB,IAAA,SAC1D,CAAAiB,IAAI,CAACO,KAAK,CAACvC,KAAK,CAAC,yBAAAsC,SAAA,CAAAlB,IAAA,MAAAiB,QAAA,QACzB,C,CACD,CACH,CACF,CAMA,GAAM,CAAAG,YAAY,CAAIC,0DAA4B,EAAIb,8CAA8B,CACpF,GAAI,CACF,GAAIY,YAAY,EAAI,MAAO,CAAAA,YAAY,CAACvB,iBAAiB,GAAK,UAAU,CAAE,CACxE,MAAO,CAAAhB,kBAAkB,CAACuC,YAAY,CAAC,CACzC,CACF,CAAE,MAAOE,CAAC,CAAE,CAAC,CACf,CAEA,GAAIC,0CAAoB,CAAE,CACxB,MAAO,CAAAA,0CAAoB,CAC7B,CAEA,KAAM,IAAI,CAAAC,KAAK,CACb,sIAAsI,CACvI,CACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"native-deps.js","names":["_OptionalAsyncStorage","require","_utils","_OptionalExpoApplication","_OptionalExpoDevice","_OptionalExpoFileSystem","_OptionalExpoLocalization","_OptionalReactNativeDeviceInfo","_OptionalReactNativeLocalize","_OptionalExpoFileSystemLegacy","_core","getDeviceType","deviceType","isMacOS","isWindows","isWeb","ua","navigator","userAgent","nav","undefined","win","globalThis","window","detectDeviceType","userAgentDataPlatform","_a","userAgentData","platform","maxTouchPoints","screenWidth","_b","screen","width","screenHeight","_c","height","devicePixelRatio","currentDeviceType","exports","getAppProperties","properties","$device_type","OptionalExpoApplication","$app_build","nativeBuildVersion","$app_name","applicationName","$app_namespace","applicationId","$app_version","nativeApplicationVersion","OptionalReactNativeDeviceInfo","returnPropertyIfNotUnknown","getBuildNumber","getApplicationName","getBundleId","getVersion","OptionalExpoDevice","$device_manufacturer","manufacturer","$device_name","modelName","getPlatformOS","$os_name","osName","$os_version","osVersion","$is_emulator","isDevice","getManufacturerSync","getModel","getSystemName","getSystemVersion","isEmulatorSync","OptionalExpoLocalization","optionalExpoLocalization","locale","getLocales","languageTag","$locale","timezone","getCalendars","timeZone","$timezone","OptionalReactNativeLocalize","localesFn","locales","length","timezoneFn","getTimeZone","value","buildLegacyStorage","filesystem","getItem","key","_asyncToGenerator2","_regenerator","mark","_callee","uri","stringContent","_t","wrap","_context","prev","next","documentDirectory","readAsStringAsync","sent","abrupt","stop","setItem","_callee2","_context2","writeAsStringAsync","buildOptimisticAsyncStorage","GLOBAL_OBJ","supportedPlatform","OptionalExpoFileSystem","Paths","File","_callee3","file","_t2","_context3","document","text","_callee4","_context4","write","legacyModule","OptionalExpoFileSystemLegacy","e","OptionalAsyncStorage","Error"],"sources":["../src/native-deps.tsx"],"sourcesContent":["import { OptionalAsyncStorage } from './optional/OptionalAsyncStorage'\nimport { GLOBAL_OBJ, getPlatformOS, isMacOS, isWeb, isWindows } from './utils'\nimport { OptionalExpoApplication } from './optional/OptionalExpoApplication'\nimport { OptionalExpoDevice } from './optional/OptionalExpoDevice'\nimport { OptionalExpoFileSystem } from './optional/OptionalExpoFileSystem'\nimport { OptionalExpoLocalization } from './optional/OptionalExpoLocalization'\nimport { OptionalReactNativeDeviceInfo } from './optional/OptionalReactNativeDeviceInfo'\nimport { PostHogCustomAppProperties, PostHogCustomStorage } from './types'\nimport { OptionalReactNativeLocalize } from './optional/OptionalReactNativeLocalize'\nimport { OptionalExpoFileSystemLegacy } from './optional/OptionalExpoFileSystemLegacy'\nimport { detectDeviceType } from '@posthog/core'\n\nconst getDeviceType = (): string => {\n let deviceType = 'Mobile'\n\n if (isMacOS() || isWindows()) {\n deviceType = 'Desktop'\n } else if (isWeb()) {\n // Check user agent to determine if it's desktop or mobile\n const ua = typeof navigator !== 'undefined' && navigator.userAgent ? navigator.userAgent : ''\n\n const nav = typeof navigator !== 'undefined' ? (navigator as any) : undefined\n const win = typeof (globalThis as any).window !== 'undefined' ? (globalThis as any).window : undefined\n deviceType = detectDeviceType(ua, {\n userAgentDataPlatform: nav?.userAgentData?.platform,\n maxTouchPoints: nav?.maxTouchPoints,\n screenWidth: win?.screen?.width,\n screenHeight: win?.screen?.height,\n devicePixelRatio: win?.devicePixelRatio,\n })\n }\n return deviceType\n}\n\nexport const currentDeviceType = getDeviceType()\n\nexport const getAppProperties = (): PostHogCustomAppProperties => {\n const properties: PostHogCustomAppProperties = {\n $device_type: currentDeviceType,\n }\n\n if (OptionalExpoApplication) {\n properties.$app_build = OptionalExpoApplication.nativeBuildVersion\n properties.$app_name = OptionalExpoApplication.applicationName\n properties.$app_namespace = OptionalExpoApplication.applicationId\n properties.$app_version = OptionalExpoApplication.nativeApplicationVersion\n } else if (OptionalReactNativeDeviceInfo) {\n properties.$app_build = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getBuildNumber())\n properties.$app_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getApplicationName())\n properties.$app_namespace = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getBundleId())\n properties.$app_version = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getVersion())\n }\n\n if (OptionalExpoDevice) {\n properties.$device_manufacturer = OptionalExpoDevice.manufacturer\n // expo-device already maps the device model identifier to a human readable name\n properties.$device_name = OptionalExpoDevice.modelName\n\n // https://github.com/expo/expo/issues/6990\n // some devices return a value similar to:\n // HUAWEI/SNE-LX1/HWSNE:8.1.0/HUAWEISNE-LX1/131(C432):user/release-keys\n if (getPlatformOS() === 'android') {\n properties.$os_name = 'Android'\n } else {\n properties.$os_name = OptionalExpoDevice.osName\n }\n\n properties.$os_version = OptionalExpoDevice.osVersion\n properties.$is_emulator = !OptionalExpoDevice.isDevice\n } else if (OptionalReactNativeDeviceInfo) {\n properties.$device_manufacturer = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getManufacturerSync())\n // react-native-device-info already maps the device model identifier to a human readable name\n properties.$device_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getModel())\n properties.$os_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getSystemName())\n properties.$os_version = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getSystemVersion())\n properties.$is_emulator = OptionalReactNativeDeviceInfo.isEmulatorSync()\n }\n\n if (OptionalExpoLocalization) {\n // expo-localization >= 14 use functions to get these results, older versions use JS getters\n // https://github.com/expo/expo/blob/sdk-54/packages/expo-localization/CHANGELOG.md#1400--2022-10-25\n // this type below supports both variants, and type-checks with older and newer versions of expo-localization\n const optionalExpoLocalization: {\n locale?: string\n getLocales?: () => {\n languageTag: string\n }[]\n timezone?: string\n getCalendars?: () => {\n timeZone: string | null\n }[]\n } = OptionalExpoLocalization\n\n let locale = optionalExpoLocalization.locale\n if (!locale && optionalExpoLocalization.getLocales) {\n locale = optionalExpoLocalization.getLocales()[0]?.languageTag\n }\n if (locale) {\n properties.$locale = locale\n }\n let timezone: string | undefined | null = optionalExpoLocalization.timezone\n if (!timezone && optionalExpoLocalization.getCalendars) {\n timezone = optionalExpoLocalization.getCalendars()[0]?.timeZone\n }\n if (timezone) {\n properties.$timezone = timezone\n }\n } else if (OptionalReactNativeLocalize) {\n const localesFn = OptionalReactNativeLocalize.getLocales\n if (localesFn) {\n const locales = localesFn()\n\n if (locales && locales.length > 0) {\n const languageTag = locales[0].languageTag\n if (languageTag) {\n properties.$locale = languageTag\n }\n }\n }\n\n const timezoneFn = OptionalReactNativeLocalize.getTimeZone\n if (timezoneFn) {\n const timezone = timezoneFn()\n\n if (timezone) {\n properties.$timezone = timezone\n }\n }\n }\n\n return properties\n}\n\n// react-native-device-info returns 'unknown' if the property is not available (Web target)\nconst returnPropertyIfNotUnknown = (value: string | null): string | null => {\n if (value !== 'unknown') {\n return value\n }\n return null\n}\n\nconst buildLegacyStorage = (filesystem: any): PostHogCustomStorage => {\n return {\n async getItem(key: string) {\n try {\n const uri = (filesystem.documentDirectory || '') + key\n const stringContent = await filesystem.readAsStringAsync(uri)\n return stringContent\n } catch (e) {\n return null\n }\n },\n\n async setItem(key: string, value: string) {\n const uri = (filesystem.documentDirectory || '') + key\n await filesystem.writeAsStringAsync(uri, value)\n },\n }\n}\n\nexport const buildOptimisticAsyncStorage = (): PostHogCustomStorage | undefined => {\n // On web platform during SSR (no window), skip file storage\n // The caller will fall back to memory storage\n if (isWeb() && typeof (GLOBAL_OBJ as any)?.window === 'undefined') {\n return undefined\n }\n\n // expo-file-system is not supported on web and macos, so we need to use the react-native-async-storage package instead\n // see https://github.com/PostHog/posthog-js-lite/blob/5fb7bee96f739b243dfea5589e2027f16629e8cd/posthog-react-native/src/optional/OptionalExpoFileSystem.ts#L7-L11\n const supportedPlatform = !isWeb() && !isMacOS()\n\n // expo-file-system is only supported on native platforms (not web/macOS).\n // See https://github.com/PostHog/posthog-js-lite/issues/140\n if (supportedPlatform) {\n // expo >= 54 and expo-file-system >= 19: prefer the new File/Paths API.\n // We always check for the new API first because:\n // - SDK 54 stable exports legacy methods (readAsStringAsync, writeAsStringAsync) that throw\n // a deprecation error when called, so existence checks alone are unreliable.\n // - SDK 55+ has a working legacy subpath, but the new API is the recommended approach.\n // See https://github.com/PostHog/posthog-js/issues/3151\n if (OptionalExpoFileSystem) {\n const filesystem = OptionalExpoFileSystem as any\n\n if (filesystem.Paths && filesystem.File) {\n return {\n async getItem(key: string) {\n try {\n // File constructor accepts Directory instances and joins path segments\n // See https://docs.expo.dev/versions/latest/sdk/filesystem/\n const file = new filesystem.File(filesystem.Paths.document, key)\n const stringContent = await file.text()\n return stringContent\n } catch (e) {\n return null\n }\n },\n\n async setItem(key: string, value: string) {\n const file = new filesystem.File(filesystem.Paths.document, key)\n await file.write(value)\n },\n }\n }\n }\n\n // Fallback to legacy APIs for older Expo versions (expo <= 53, expo-file-system <= 18).\n // Try the legacy subpath first (available in SDK 55+), then the main module.\n // We validate that readAsStringAsync is a real function before using it,\n // to avoid calling deprecated stubs that throw at runtime (SDK 54 stable).\n const legacyModule = (OptionalExpoFileSystemLegacy || OptionalExpoFileSystem) as any\n try {\n if (legacyModule && typeof legacyModule.readAsStringAsync === 'function') {\n return buildLegacyStorage(legacyModule)\n }\n } catch (e) {}\n }\n\n if (OptionalAsyncStorage) {\n return OptionalAsyncStorage\n }\n\n throw new Error(\n 'PostHog: No storage available. Please install expo-file-system or react-native-async-storage OR implement a custom storage provider.'\n )\n}\n"],"mappings":"waAAA,IAAAA,qBAAA,CAAAC,OAAA,oCACA,IAAAC,MAAA,CAAAD,OAAA,YACA,IAAAE,wBAAA,CAAAF,OAAA,uCACA,IAAAG,mBAAA,CAAAH,OAAA,kCACA,IAAAI,uBAAA,CAAAJ,OAAA,sCACA,IAAAK,yBAAA,CAAAL,OAAA,wCACA,IAAAM,8BAAA,CAAAN,OAAA,6CAEA,IAAAO,4BAAA,CAAAP,OAAA,2CACA,IAAAQ,6BAAA,CAAAR,OAAA,4CACA,IAAAS,KAAA,CAAAT,OAAA,kBAEA,GAAM,CAAAU,aAAa,CAAG,QAAhB,CAAAA,aAAaA,CAAA,CAAgB,C,aACjC,GAAI,CAAAC,UAAU,CAAG,QAAQ,CAEzB,GAAI,GAAAC,cAAO,GAAE,EAAI,GAAAC,gBAAS,GAAE,CAAE,CAC5BF,UAAU,CAAG,SAAS,CACxB,CAAC,IAAM,IAAI,GAAAG,YAAK,GAAE,CAAE,CAElB,GAAM,CAAAC,EAAE,CAAG,MAAO,CAAAC,SAAS,GAAK,WAAW,EAAIA,SAAS,CAACC,SAAS,CAAGD,SAAS,CAACC,SAAS,CAAG,EAAE,CAE7F,GAAM,CAAAC,GAAG,CAAG,MAAO,CAAAF,SAAS,GAAK,WAAW,CAAIA,SAAiB,CAAGG,SAAS,CAC7E,GAAM,CAAAC,GAAG,CAAG,MAAQ,CAAAC,UAAkB,CAACC,MAAM,GAAK,WAAW,CAAID,UAAkB,CAACC,MAAM,CAAGH,SAAS,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AAmB,CAAA,IAAAC,SAAA,oBAAAA,SAAA,CAAAf,MAAA,UAEb,IAAI,0BAAAe,SAAA,CAAAd,IAAA,MAAAW,QAAA,qBAEf,CAAC,CAEKV,OAAO,SAAP,CAAAA,OAAOA,CAACjB,GAAW,CAAEJ,KAAa,WAAAK,kBAAA,aAAAC,YAAA,YAAAC,IAAA,UAAA8B,SAAA,MAAAL,IAAA,QAAA1B,YAAA,YAAAM,IAAA,UAAA0B,SAAA,iBAAAA,SAAA,CAAAxB,IAAA,CAAAwB,SAAA,CAAAvB,IAAA,SAChCiB,IAAI,CAAG,GAAI,CAAA9B,UAAU,CAAC4B,IAAI,CAAC5B,UAAU,CAAC2B,KAAK,CAACM,QAAQ,CAAE/B,GAAG,CAACkC,CAAA,UAAAvB,IAAA,SAC1D,CAAAiB,IAAI,CAACO,KAAK,CAACvC,KAAK,CAAC,yBAAAsC,SAAA,CAAAlB,IAAA,MAAAiB,QAAA,QACzB,C,CACD,CACH,CACF,CAMA,GAAM,CAAAG,YAAY,CAAIC,0DAA4B,EAAIb,8CAA8B,CACpF,GAAI,CACF,GAAIY,YAAY,EAAI,MAAO,CAAAA,YAAY,CAACvB,iBAAiB,GAAK,UAAU,CAAE,CACxE,MAAO,CAAAhB,kBAAkB,CAACuC,YAAY,CAAC,CACzC,CACF,CAAE,MAAOE,CAAC,CAAE,CAAC,CACf,CAEA,GAAIC,0CAAoB,CAAE,CACxB,MAAO,CAAAA,0CAAoB,CAC7B,CAEA,KAAM,IAAI,CAAAC,KAAK,CACb,sIAAsI,CACvI,CACH,CAAC","ignoreList":[]}
@@ -12,10 +12,7 @@ export interface PostHogOptions extends PostHogCoreOptions {
12
12
  * @default 'file'
13
13
  */
14
14
  persistence?: 'memory' | 'file';
15
- /**
16
- * Allows you to provide your own implementation of the common information about your App or a function to modify the default App properties generated.
17
- * An object replaces the default App properties except `$react_native_version`, which is kept unless the object sets it (set it to `undefined` to remove it).
18
- */
15
+ /** Allows you to provide your own implementation of the common information about your App or a function to modify the default App properties generated */
19
16
  customAppProperties?: PostHogCustomAppProperties | ((properties: PostHogCustomAppProperties) => PostHogCustomAppProperties);
20
17
  /**
21
18
  * Allows you to provide a custom asynchronous storage such as async-storage, expo-file-system or a synchronous storage such as mmkv.
@@ -255,7 +252,8 @@ export declare class PostHog extends PostHogCore {
255
252
  *
256
253
  * @public
257
254
  *
258
- * @param apiKey - Your PostHog API key
255
+ * @param apiKey - Your PostHog project token, which starts with `phc_`. Find it in your project
256
+ * settings: https://us.posthog.com/settings/project-details#variables
259
257
  * @param options - PostHog configuration options
260
258
  */
261
259
  constructor(apiKey: string, options?: PostHogOptions);