diff --git a/packages/core/src/posthog-core-stateless.ts b/packages/core/src/posthog-core-stateless.ts index e15e796ee6..99d886c937 100644 --- a/packages/core/src/posthog-core-stateless.ts +++ b/packages/core/src/posthog-core-stateless.ts @@ -290,6 +290,9 @@ export abstract class PostHogCoreStateless { } } + /** + * @internal + */ public addPendingPromise(promise: Promise): Promise { return this.promiseQueue.add(promise) } diff --git a/packages/node/api-extractor.jsonc b/packages/node/api-extractor.jsonc index d2eaa11607..0e071b0291 100644 --- a/packages/node/api-extractor.jsonc +++ b/packages/node/api-extractor.jsonc @@ -67,7 +67,7 @@ * * "bundledPackages": [ "@my-company/*" ], */ - "bundledPackages": [], + "bundledPackages": ["@posthog/core"], /** * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files @@ -111,6 +111,14 @@ * DEFAULT VALUE: "/tsconfig.json" */ "tsconfigFilePath": "/tsconfig.build.json", + /** + * Include DOM lib so bundled @posthog/core types (e.g. ErrorEvent) resolve when inlining. + */ + "overrideTsconfig": { + "compilerOptions": { + "lib": ["ES2023", "DOM"] + } + }, /** * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. * The object must conform to the TypeScript tsconfig schema: diff --git a/packages/node/references/posthog-node-references-5.25.0.json b/packages/node/references/posthog-node-references-5.25.0.json index 491cd312a2..96cf299e25 100644 --- a/packages/node/references/posthog-node-references-5.25.0.json +++ b/packages/node/references/posthog-node-references-5.25.0.json @@ -35,27 +35,6 @@ }, "path": "src/entrypoints/index.node.ts" }, - { - "category": "", - "details": null, - "id": "initializeContext", - "showDocs": true, - "title": "initializeContext", - "examples": [ - { - "id": "initializecontext", - "name": "Generated example for initializeContext", - "code": "// Generated example for initializeContext\nposthog.initializeContext();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "PostHogContext", - "name": "PostHogContext" - }, - "path": "src/entrypoints/index.node.ts" - }, { "category": "Initialization", "description": "Initialize a new PostHog client instance.", @@ -1134,6 +1113,245 @@ "name": "T" }, "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "fetch", + "showDocs": true, + "title": "fetch", + "examples": [ + { + "id": "fetch", + "name": "Generated example for fetch", + "code": "// Generated example for fetch\nposthog.fetch();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "string", + "name": "url" + }, + { + "description": "", + "isOptional": false, + "type": "PostHogFetchOptions", + "name": "options" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "Initialization", + "description": "Flushes the queue of pending events.\nThis function will return a promise that will resolve when the flush is complete, or reject if there was an error (for example if the server or network is down).\nIf there is already a flush in progress, this function will wait for that flush to complete.\nIt's recommended to do error handling in the callback of the promise.", + "details": null, + "id": "flush", + "showDocs": true, + "title": "flush", + "examples": [ + { + "id": "flush_with_error_handling", + "name": "flush with error handling", + "code": "\n\n// flush with error handling\nposthog.flush().then(() => {\n console.log('Flush complete')\n}).catch((err) => {\n console.error('Flush failed', err)\n})\n\n\n" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "description": "* ** SURVEYS *", + "details": null, + "id": "getSurveysStateless", + "showDocs": true, + "title": "getSurveysStateless", + "examples": [ + { + "id": "getsurveysstateless", + "name": "Generated example for getSurveysStateless", + "code": "// Generated example for getSurveysStateless\nposthog.getSurveysStateless();" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "on", + "showDocs": true, + "title": "on", + "examples": [ + { + "id": "on", + "name": "Generated example for on", + "code": "// Generated example for on\nposthog.on();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "string", + "name": "event" + }, + { + "description": "", + "isOptional": false, + "type": "(...args: any[]) => void", + "name": "cb" + } + ], + "returnType": { + "id": "() => void", + "name": "() => void" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "optIn", + "showDocs": true, + "title": "optIn", + "examples": [ + { + "id": "optin", + "name": "Generated example for optIn", + "code": "// Generated example for optIn\nposthog.optIn();" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "optOut", + "showDocs": true, + "title": "optOut", + "examples": [ + { + "id": "optout", + "name": "Generated example for optOut", + "code": "// Generated example for optOut\nposthog.optOut();" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "register", + "showDocs": true, + "title": "register", + "examples": [ + { + "id": "register", + "name": "Generated example for register", + "code": "// Generated example for register\nposthog.register();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "PostHogEventProperties", + "name": "properties" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "Initialization", + "description": "Shuts down the PostHog instance and ensures all events are sent.\nCall shutdown() once before the process exits to ensure that all events have been sent and all promises have resolved. Do not use this function if you intend to keep using this PostHog instance after calling it. Use flush() for per-request cleanup instead.", + "details": null, + "id": "shutdown", + "showDocs": true, + "title": "shutdown", + "examples": [ + { + "id": "shutdown_before_process_exit", + "name": "shutdown before process exit", + "code": "\n\n// shutdown before process exit\nprocess.on('SIGINT', async () => {\n await posthog.shutdown()\n process.exit(0)\n})\n\n\n\n" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "Maximum time to wait for shutdown in milliseconds", + "isOptional": true, + "type": "number", + "name": "shutdownTimeoutMs" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "unregister", + "showDocs": true, + "title": "unregister", + "examples": [ + { + "id": "unregister", + "name": "Generated example for unregister", + "code": "// Generated example for unregister\nposthog.unregister();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "string", + "name": "property" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" } ] } @@ -1179,6 +1397,65 @@ ], "path": "src/extensions/sentry-integration.ts" }, + { + "id": "ActionStepStringMatching", + "name": "ActionStepStringMatching", + "properties": [ + { + "type": "\"contains\"", + "name": "Contains" + }, + { + "type": "\"exact\"", + "name": "Exact" + }, + { + "type": "\"regex\"", + "name": "Regex" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "ActionStepType", + "name": "ActionStepType", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n event?: string;\n selector?: string;\n text?: string;\n text_matching?: ActionStepStringMatching;\n href?: string;\n href_matching?: ActionStepStringMatching;\n url?: string;\n url_matching?: ActionStepStringMatching;\n}" + }, + { + "id": "BaseException", + "name": "BaseException", + "properties": [ + { + "type": "boolean", + "name": "synthetic" + }, + { + "type": "string", + "name": "type" + }, + { + "type": "string", + "name": "value" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "BasicSurveyQuestion", + "name": "BasicSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.Open;\n}" + }, + { + "id": "BeforeSendFn_2", + "name": "BeforeSendFn_2", + "properties": [], + "path": "../core/src/types.ts", + "example": "(event: CaptureEvent | null) => CaptureEvent | null" + }, { "id": "BeforeSendFn", "name": "BeforeSendFn", @@ -1186,6 +1463,56 @@ "path": "src/types.ts", "example": "(event: EventMessage | null) => EventMessage | null" }, + { + "id": "CaptureEvent", + "name": "CaptureEvent", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n uuid?: string;\n event: string;\n properties?: PostHogEventProperties;\n $set?: PostHogEventProperties;\n $set_once?: PostHogEventProperties;\n timestamp?: Date;\n}" + }, + { + "id": "ChunkIdMapType", + "name": "ChunkIdMapType", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "Record" + }, + { + "id": "Coercer", + "name": "Coercer", + "properties": [], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "CoercingContext", + "name": "CoercingContext", + "properties": [ + { + "type": "(input: unknown) => ExceptionLike", + "name": "apply" + }, + { + "type": "(input: unknown) => ExceptionLike | undefined", + "name": "next" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "Compression", + "name": "Compression", + "properties": [ + { + "type": "\"base64\"", + "name": "Base64" + }, + { + "type": "\"gzip-js\"", + "name": "GZipJS" + } + ], + "path": "../core/src/types.ts" + }, { "id": "ContextData", "name": "ContextData", @@ -1218,19 +1545,130 @@ "path": "src/extensions/context/types.ts" }, { - "id": "EventMessage", - "name": "EventMessage", + "id": "EndBranching", + "name": "EndBranching", "properties": [], - "path": "src/types.ts", - "example": "Omit & {\n distinctId?: string;\n event: string;\n groups?: Record;\n sendFeatureFlags?: boolean | SendFeatureFlagsOptions;\n timestamp?: Date;\n uuid?: string;\n _originatedFromCaptureException?: boolean;\n}" + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.End;\n}" }, { - "id": "ExpressErrorMiddleware", - "name": "ExpressErrorMiddleware", - "properties": [], - "path": "src/extensions/express.ts", - "example": "(error: MiddlewareError, req: Request, res: Response, next: (error: MiddlewareError) => void) => void" - }, + "id": "ErrorProperties", + "name": "ErrorProperties", + "properties": [ + { + "type": "SeverityLevel", + "name": "$exception_level" + }, + { + "type": "Exception[]", + "name": "$exception_list" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ErrorTrackingCoercer", + "name": "ErrorTrackingCoercer", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "Coercer" + }, + { + "id": "EvaluationReason", + "name": "EvaluationReason", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n code: string | undefined;\n condition_index: number | undefined;\n description: string | undefined;\n}" + }, + { + "id": "EventHint", + "name": "EventHint", + "properties": [ + { + "type": "Partial", + "name": "mechanism" + }, + { + "type": "number", + "name": "skipFirstLines" + }, + { + "type": "Error | null", + "name": "syntheticException" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "EventMessage", + "name": "EventMessage", + "properties": [], + "path": "src/types.ts", + "example": "Omit & {\n distinctId?: string;\n event: string;\n groups?: Record;\n sendFeatureFlags?: boolean | SendFeatureFlagsOptions;\n timestamp?: Date;\n uuid?: string;\n _originatedFromCaptureException?: boolean;\n}" + }, + { + "id": "Exception", + "name": "Exception", + "properties": [ + { + "type": "Mechanism", + "name": "mechanism" + }, + { + "type": "string", + "name": "module" + }, + { + "type": "{\n frames?: StackFrame[];\n type: 'raw';\n }", + "name": "stacktrace" + }, + { + "type": "number", + "name": "thread_id" + }, + { + "type": "string", + "name": "type" + }, + { + "type": "string", + "name": "value" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ExceptionLike", + "name": "ExceptionLike", + "properties": [ + { + "type": "ExceptionLike", + "name": "cause" + }, + { + "type": "SeverityLevel", + "name": "level" + }, + { + "type": "string", + "name": "stack" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ExceptionList", + "name": "ExceptionList", + "properties": [], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ExpressErrorMiddleware", + "name": "ExpressErrorMiddleware", + "properties": [], + "path": "src/extensions/express.ts", + "example": "(error: MiddlewareError, req: Request, res: Response, next: (error: MiddlewareError) => void) => void" + }, { "id": "ExpressMiddleware", "name": "ExpressMiddleware", @@ -1252,6 +1690,27 @@ "path": "src/types.ts", "example": "{\n properties: FlagProperty[];\n rollout_percentage?: number;\n variant?: string;\n}" }, + { + "id": "FeatureFlagDetail", + "name": "FeatureFlagDetail", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n key: string;\n enabled: boolean;\n variant: string | undefined;\n reason: EvaluationReason | undefined;\n metadata: FeatureFlagMetadata | undefined;\n failed?: boolean;\n}" + }, + { + "id": "FeatureFlagErrorType", + "name": "FeatureFlagErrorType", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"apiError\"" + }, + { + "id": "FeatureFlagMetadata", + "name": "FeatureFlagMetadata", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n id: number | undefined;\n version: number | undefined;\n description: string | undefined;\n payload: string | undefined;\n}" + }, { "id": "FeatureFlagOverrideOptions", "name": "FeatureFlagOverrideOptions", @@ -1259,6 +1718,13 @@ "path": "src/types.ts", "example": "{\n flags?: false | string[] | Record;\n payloads?: false | Record;\n}" }, + { + "id": "FeatureFlagRequestError", + "name": "FeatureFlagRequestError", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: 'timeout' | 'connection_error' | 'api_error' | 'unknown_error';\n statusCode?: number;\n}" + }, { "id": "FeatureFlagResult", "name": "FeatureFlagResult", @@ -1266,6 +1732,13 @@ "path": "src/types.ts", "example": "{\n key: string;\n enabled: boolean;\n variant: string | undefined;\n payload: JsonType | undefined;\n}" }, + { + "id": "FeatureFlagValue", + "name": "FeatureFlagValue", + "properties": [], + "path": "../core/src/types.ts", + "example": "string | boolean" + }, { "id": "FlagDefinitionCacheData", "name": "FlagDefinitionCacheData", @@ -1308,6 +1781,20 @@ "path": "src/types.ts", "example": "string | number | (string | number)[] | boolean" }, + { + "id": "GetFlagsResult", + "name": "GetFlagsResult", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n success: true;\n response: PostHogFeatureFlagsResponse;\n} | {\n success: false;\n error: FeatureFlagRequestError;\n}" + }, + { + "id": "GetModuleFn", + "name": "GetModuleFn", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(filename: string | undefined) => string | undefined" + }, { "id": "GroupIdentifyMessage", "name": "GroupIdentifyMessage", @@ -1334,6 +1821,50 @@ "properties": [], "path": "src/extensions/context/types.ts" }, + { + "id": "JsonType", + "name": "JsonType", + "properties": [], + "path": "../core/src/types.ts", + "example": "string | number | boolean | null | {\n [key: string]: JsonType;\n} | Array | JsonType[]" + }, + { + "id": "LinkSurveyQuestion", + "name": "LinkSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.Link;\n link?: string;\n}" + }, + { + "id": "Logger", + "name": "Logger", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n info: (...args: any[]) => void;\n warn: (...args: any[]) => void;\n error: (...args: any[]) => void;\n critical: (...args: any[]) => void;\n createLogger: (prefix: string) => Logger;\n}" + }, + { + "id": "Mechanism", + "name": "Mechanism", + "properties": [ + { + "type": "boolean", + "name": "handled" + }, + { + "type": "string", + "name": "source" + }, + { + "type": "boolean", + "name": "synthetic" + }, + { + "type": "'generic' | 'onunhandledrejection' | 'onuncaughtexception' | 'onconsole' | 'middleware'", + "name": "type" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, { "id": "MiddlewareError", "name": "MiddlewareError", @@ -1357,6 +1888,27 @@ ], "path": "src/extensions/express.ts" }, + { + "id": "MultipleSurveyQuestion", + "name": "MultipleSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice;\n choices: string[];\n hasOpenChoice?: boolean;\n shuffleOptions?: boolean;\n skipSubmitButton?: boolean;\n}" + }, + { + "id": "NextQuestionBranching", + "name": "NextQuestionBranching", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.NextQuestion;\n}" + }, + { + "id": "ObjectLike", + "name": "ObjectLike", + "properties": [], + "path": "../core/src/error-tracking/coercers/object-coercer.ts", + "example": "Record" + }, { "id": "OverrideFeatureFlagsOptions", "name": "OverrideFeatureFlagsOptions", @@ -1364,6 +1916,90 @@ "path": "src/types.ts", "example": "false | string[] | Record | FeatureFlagOverrideOptions" }, + { + "id": "ParsedException", + "name": "ParsedException", + "properties": [ + { + "type": "ParsedException", + "name": "cause" + }, + { + "type": "StackFrame[]", + "name": "stack" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ParsingContext", + "name": "ParsingContext", + "properties": [ + { + "type": "ChunkIdMapType", + "name": "chunkIdMap" + }, + { + "type": "number", + "name": "skipFirstLines" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "PartialWithRequired", + "name": "PartialWithRequired", + "properties": [], + "path": "../core/src/types.ts", + "example": "keyof T> = {\n [P in K]: T[P];\n} & {\n [P in Exclude]?: T[P];\n}" + }, + { + "id": "Platform", + "name": "Platform", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "\"node:javascript\" | \"web:javascript\" | \"hermes\"" + }, + { + "id": "PolymorphicEvent", + "name": "PolymorphicEvent", + "properties": [ + { + "type": "unknown", + "name": "currentTarget" + }, + { + "type": "unknown", + "name": "target" + }, + { + "type": "string", + "name": "type" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "PostHogCaptureOptions", + "name": "PostHogCaptureOptions", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n uuid?: string;\n timestamp?: Date;\n disableGeoip?: boolean;\n _originatedFromCaptureException?: boolean;\n}" + }, + { + "id": "PostHogCoreOptions", + "name": "PostHogCoreOptions", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n host?: string;\n flushAt?: number;\n flushInterval?: number;\n maxBatchSize?: number;\n maxQueueSize?: number;\n disabled?: boolean;\n defaultOptIn?: boolean;\n sendFeatureFlagEvent?: boolean;\n preloadFeatureFlags?: boolean;\n disableRemoteConfig?: boolean;\n disableSurveys?: boolean;\n bootstrap?: {\n distinctId?: string;\n isIdentifiedId?: boolean;\n featureFlags?: Record;\n featureFlagPayloads?: Record;\n };\n fetchRetryCount?: number;\n fetchRetryDelay?: number;\n requestTimeout?: number;\n featureFlagsRequestTimeoutMs?: number;\n remoteConfigRequestTimeoutMs?: number;\n sessionExpirationTimeSeconds?: number;\n disableCompression?: boolean;\n disableGeoip?: boolean;\n historicalMigration?: boolean;\n evaluationContexts?: readonly string[];\n evaluationEnvironments?: readonly string[];\n personProfiles?: 'always' | 'identified_only' | 'never';\n before_send?: BeforeSendFn | BeforeSendFn[];\n}" + }, + { + "id": "PostHogEventProperties", + "name": "PostHogEventProperties", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n [key: string]: JsonType;\n}" + }, { "id": "PostHogFeatureFlag", "name": "PostHogFeatureFlag", @@ -1371,6 +2007,48 @@ "path": "src/types.ts", "example": "{\n id: number;\n name: string;\n key: string;\n bucketing_identifier?: FeatureFlagBucketingIdentifier;\n filters?: {\n aggregation_group_type_index?: number;\n groups?: FeatureFlagCondition[];\n multivariate?: {\n variants: {\n key: string;\n rollout_percentage: number;\n }[];\n };\n payloads?: Record;\n };\n deleted: boolean;\n active: boolean;\n rollout_percentage: null | number;\n ensure_experience_continuity: boolean;\n experiment_set: number[];\n}" }, + { + "id": "PostHogFeatureFlagDetails", + "name": "PostHogFeatureFlagDetails", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"flags\" | \"featureFlags\" | \"featureFlagPayloads\" | \"requestId\"" + }, + { + "id": "PostHogFeatureFlagsResponse", + "name": "PostHogFeatureFlagsResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"flags\" | \"featureFlags\" | \"featureFlagPayloads\" | \"requestId\"" + }, + { + "id": "PostHogFetchOptions", + "name": "PostHogFetchOptions", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n method: 'GET' | 'POST' | 'PUT' | 'PATCH';\n mode?: 'no-cors';\n credentials?: 'omit';\n headers: {\n [key: string]: string;\n };\n body?: string | Blob;\n signal?: AbortSignal;\n}" + }, + { + "id": "PostHogFetchResponse", + "name": "PostHogFetchResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n status: number;\n text: () => Promise;\n json: () => Promise;\n headers?: {\n get(name: string): string | null;\n };\n}" + }, + { + "id": "PostHogFlagsAndPayloadsResponse", + "name": "PostHogFlagsAndPayloadsResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"featureFlags\" | \"featureFlagPayloads\"" + }, + { + "id": "PostHogFlagsResponse", + "name": "PostHogFlagsResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "Omit & {\n featureFlags: {\n [key: string]: FeatureFlagValue;\n };\n featureFlagPayloads: {\n [key: string]: JsonType;\n };\n flags: {\n [key: string]: FeatureFlagDetail;\n };\n errorsWhileComputingFlags: boolean;\n sessionRecording?: boolean | {\n [key: string]: JsonType;\n };\n quotaLimited?: string[];\n requestId?: string;\n evaluatedAt?: number;\n}" + }, { "id": "PostHogOptions", "name": "PostHogOptions", @@ -1378,6 +2056,146 @@ "path": "src/types.ts", "example": "Omit & {\n persistence?: 'memory';\n personalApiKey?: string;\n privacyMode?: boolean;\n enableExceptionAutocapture?: boolean;\n featureFlagsPollingInterval?: number;\n maxCacheSize?: number;\n fetch?: (url: string, options: PostHogFetchOptions) => Promise;\n enableLocalEvaluation?: boolean;\n flagDefinitionCacheProvider?: FlagDefinitionCacheProvider;\n before_send?: BeforeSendFn | BeforeSendFn[];\n evaluationContexts?: readonly string[];\n evaluationEnvironments?: readonly string[];\n custom_blocked_useragents?: string[];\n __preview_capture_bot_pageviews?: boolean;\n strictLocalEvaluation?: boolean;\n}" }, + { + "id": "PostHogPersistedProperty", + "name": "PostHogPersistedProperty", + "properties": [ + { + "type": "\"anonymous_id\"", + "name": "AnonymousId" + }, + { + "type": "\"bootstrap_feature_flag_details\"", + "name": "BootstrapFeatureFlagDetails" + }, + { + "type": "\"bootstrap_feature_flag_payloads\"", + "name": "BootstrapFeatureFlagPayloads" + }, + { + "type": "\"bootstrap_feature_flags\"", + "name": "BootstrapFeatureFlags" + }, + { + "type": "\"distinct_id\"", + "name": "DistinctId" + }, + { + "type": "\"enable_person_processing\"", + "name": "EnablePersonProcessing" + }, + { + "type": "\"feature_flag_details\"", + "name": "FeatureFlagDetails" + }, + { + "type": "\"feature_flag_payloads\"", + "name": "FeatureFlagPayloads" + }, + { + "type": "\"feature_flags\"", + "name": "FeatureFlags" + }, + { + "type": "\"flags_endpoint_was_hit\"", + "name": "FlagsEndpointWasHit" + }, + { + "type": "\"group_properties\"", + "name": "GroupProperties" + }, + { + "type": "\"installed_app_build\"", + "name": "InstalledAppBuild" + }, + { + "type": "\"installed_app_version\"", + "name": "InstalledAppVersion" + }, + { + "type": "\"opted_out\"", + "name": "OptedOut" + }, + { + "type": "\"override_feature_flags\"", + "name": "OverrideFeatureFlags" + }, + { + "type": "\"person_mode\"", + "name": "PersonMode" + }, + { + "type": "\"person_properties\"", + "name": "PersonProperties" + }, + { + "type": "\"props\"", + "name": "Props" + }, + { + "type": "\"queue\"", + "name": "Queue" + }, + { + "type": "\"remote_config\"", + "name": "RemoteConfig" + }, + { + "type": "\"session_id\"", + "name": "SessionId" + }, + { + "type": "\"session_timestamp\"", + "name": "SessionLastTimestamp" + }, + { + "type": "\"session_replay\"", + "name": "SessionReplay" + }, + { + "type": "\"session_start_timestamp\"", + "name": "SessionStartTimestamp" + }, + { + "type": "\"survey_last_seen_date\"", + "name": "SurveyLastSeenDate" + }, + { + "type": "\"surveys\"", + "name": "Surveys" + }, + { + "type": "\"surveys_seen\"", + "name": "SurveysSeen" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "PostHogRemoteConfig", + "name": "PostHogRemoteConfig", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n sessionRecording?: boolean | {\n [key: string]: JsonType;\n };\n supportedCompression?: Compression[];\n surveys?: boolean | Survey[];\n hasFeatureFlags?: boolean;\n errorTracking?: boolean | {\n [key: string]: JsonType;\n };\n capturePerformance?: boolean | {\n [key: string]: JsonType;\n };\n}" + }, + { + "id": "PreviouslyCapturedError", + "name": "PreviouslyCapturedError", + "properties": [ + { + "type": "boolean", + "name": "__posthog_previously_captured_error" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "PrimitiveType", + "name": "PrimitiveType", + "properties": [], + "path": "../core/src/error-tracking/coercers/primitive-coercer.ts", + "example": "null | undefined | boolean | number | string | symbol | bigint" + }, { "id": "PropertyGroup", "name": "PropertyGroup", @@ -1385,6 +2203,39 @@ "path": "src/types.ts", "example": "{\n type: 'AND' | 'OR';\n values: PropertyGroup[] | FlagProperty[];\n}" }, + { + "id": "RatingSurveyQuestion", + "name": "RatingSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.Rating;\n display: SurveyRatingDisplay;\n scale: 2 | 3 | 5 | 7 | 10;\n lowerBoundLabel: string;\n upperBoundLabel: string;\n skipSubmitButton?: boolean;\n}" + }, + { + "id": "ResponseBasedBranching", + "name": "ResponseBasedBranching", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.ResponseBased;\n responseValues: Record;\n}" + }, + { + "id": "RetriableOptions", + "name": "RetriableOptions", + "properties": [ + { + "type": "(err: unknown) => boolean", + "name": "retryCheck" + }, + { + "type": "number", + "name": "retryCount" + }, + { + "type": "number", + "name": "retryDelay" + } + ], + "path": "../core/src/utils/index.ts" + }, { "id": "SendFeatureFlagsOptions", "name": "SendFeatureFlagsOptions", @@ -1398,6 +2249,399 @@ "properties": [], "path": "src/extensions/sentry-integration.ts", "example": "{\n organization?: string;\n projectId?: number;\n prefix?: string;\n severityAllowList?: CoreErrorTracking.SeverityLevel[] | '*';\n sendExceptionsToPostHog?: boolean;\n}" + }, + { + "id": "SeverityLevel", + "name": "SeverityLevel", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(typeof severityLevels)[number]" + }, + { + "id": "SpecificQuestionBranching", + "name": "SpecificQuestionBranching", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.SpecificQuestion;\n index: number;\n}" + }, + { + "id": "StackFrame", + "name": "StackFrame", + "properties": [ + { + "type": "string", + "name": "abs_path" + }, + { + "type": "string", + "name": "addr_mode" + }, + { + "type": "string", + "name": "chunk_id" + }, + { + "type": "number", + "name": "colno" + }, + { + "type": "string", + "name": "context_line" + }, + { + "type": "string", + "name": "filename" + }, + { + "type": "string", + "name": "function" + }, + { + "type": "boolean", + "name": "in_app" + }, + { + "type": "string", + "name": "instruction_addr" + }, + { + "type": "number", + "name": "lineno" + }, + { + "type": "string", + "name": "module" + }, + { + "type": "Platform", + "name": "platform" + }, + { + "type": "string[]", + "name": "post_context" + }, + { + "type": "string[]", + "name": "pre_context" + }, + { + "type": "{\n [key: string]: JsonType;\n }", + "name": "vars" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "StackFrameModifierFn", + "name": "StackFrameModifierFn", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(frames: StackFrame[]) => Promise" + }, + { + "id": "StackLineParser", + "name": "StackLineParser", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(line: string, platform: Platform) => StackFrame | undefined" + }, + { + "id": "StackParser", + "name": "StackParser", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(stack: string, skipFirstLines?: number) => StackFrame[]" + }, + { + "id": "Survey", + "name": "Survey", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n id: string;\n name: string;\n description?: string;\n type: SurveyType;\n feature_flag_keys?: {\n key: string;\n value?: string;\n }[];\n linked_flag_key?: string;\n targeting_flag_key?: string;\n internal_targeting_flag_key?: string;\n questions: SurveyQuestion[];\n appearance?: SurveyAppearance;\n conditions?: {\n url?: string;\n selector?: string;\n seenSurveyWaitPeriodInDays?: number;\n urlMatchType?: SurveyMatchType;\n events?: {\n repeatedActivation?: boolean;\n values?: {\n name: string;\n }[];\n };\n actions?: {\n values: SurveyActionType[];\n };\n deviceTypes?: string[];\n deviceTypesMatchType?: SurveyMatchType;\n linkedFlagVariant?: string;\n };\n start_date?: string;\n end_date?: string;\n current_iteration?: number;\n current_iteration_start_date?: string;\n schedule?: SurveySchedule;\n}" + }, + { + "id": "SurveyActionType", + "name": "SurveyActionType", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n id: number;\n name?: string;\n steps?: ActionStepType[];\n}" + }, + { + "id": "SurveyAppearance", + "name": "SurveyAppearance", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n backgroundColor?: string;\n textColor?: string;\n submitButtonColor?: string;\n submitButtonText?: string;\n submitButtonTextColor?: string;\n ratingButtonColor?: string;\n ratingButtonActiveColor?: string;\n inputBackground?: string;\n inputTextColor?: string;\n autoDisappear?: boolean;\n displayThankYouMessage?: boolean;\n thankYouMessageHeader?: string;\n thankYouMessageDescription?: string;\n thankYouMessageDescriptionContentType?: SurveyQuestionDescriptionContentType;\n thankYouMessageCloseButtonText?: string;\n borderColor?: string;\n position?: SurveyPosition;\n placeholder?: string;\n shuffleQuestions?: boolean;\n surveyPopupDelaySeconds?: number;\n widgetType?: SurveyWidgetType;\n widgetSelector?: string;\n widgetLabel?: string;\n widgetColor?: string;\n}" + }, + { + "id": "SurveyMatchType", + "name": "SurveyMatchType", + "properties": [ + { + "type": "\"exact\"", + "name": "Exact" + }, + { + "type": "\"icontains\"", + "name": "Icontains" + }, + { + "type": "\"is_not\"", + "name": "IsNot" + }, + { + "type": "\"not_icontains\"", + "name": "NotIcontains" + }, + { + "type": "\"not_regex\"", + "name": "NotRegex" + }, + { + "type": "\"regex\"", + "name": "Regex" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyPosition", + "name": "SurveyPosition", + "properties": [ + { + "type": "\"center\"", + "name": "Center" + }, + { + "type": "\"left\"", + "name": "Left" + }, + { + "type": "\"middle_center\"", + "name": "MiddleCenter" + }, + { + "type": "\"middle_left\"", + "name": "MiddleLeft" + }, + { + "type": "\"middle_right\"", + "name": "MiddleRight" + }, + { + "type": "\"right\"", + "name": "Right" + }, + { + "type": "\"top_center\"", + "name": "TopCenter" + }, + { + "type": "\"top_left\"", + "name": "TopLeft" + }, + { + "type": "\"top_right\"", + "name": "TopRight" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyQuestion", + "name": "SurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion" + }, + { + "id": "SurveyQuestionBase", + "name": "SurveyQuestionBase", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n question: string;\n id: string;\n description?: string;\n descriptionContentType?: SurveyQuestionDescriptionContentType;\n optional?: boolean;\n buttonText?: string;\n originalQuestionIndex: number;\n branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching;\n validation?: SurveyValidationRule[];\n}" + }, + { + "id": "SurveyQuestionBranchingType", + "name": "SurveyQuestionBranchingType", + "properties": [ + { + "type": "\"end\"", + "name": "End" + }, + { + "type": "\"next_question\"", + "name": "NextQuestion" + }, + { + "type": "\"response_based\"", + "name": "ResponseBased" + }, + { + "type": "\"specific_question\"", + "name": "SpecificQuestion" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyQuestionDescriptionContentType", + "name": "SurveyQuestionDescriptionContentType", + "properties": [ + { + "type": "\"html\"", + "name": "Html" + }, + { + "type": "\"text\"", + "name": "Text" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyQuestionType", + "name": "SurveyQuestionType", + "properties": [ + { + "type": "\"link\"", + "name": "Link" + }, + { + "type": "\"multiple_choice\"", + "name": "MultipleChoice" + }, + { + "type": "\"open\"", + "name": "Open" + }, + { + "type": "\"rating\"", + "name": "Rating" + }, + { + "type": "\"single_choice\"", + "name": "SingleChoice" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyRatingDisplay", + "name": "SurveyRatingDisplay", + "properties": [ + { + "type": "\"emoji\"", + "name": "Emoji" + }, + { + "type": "\"number\"", + "name": "Number" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyResponse", + "name": "SurveyResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n surveys: Survey[];\n}" + }, + { + "id": "SurveySchedule", + "name": "SurveySchedule", + "properties": [ + { + "type": "\"always\"", + "name": "Always" + }, + { + "type": "\"once\"", + "name": "Once" + }, + { + "type": "\"recurring\"", + "name": "Recurring" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyType", + "name": "SurveyType", + "properties": [ + { + "type": "\"api\"", + "name": "API" + }, + { + "type": "\"external_survey\"", + "name": "ExternalSurvey" + }, + { + "type": "\"popover\"", + "name": "Popover" + }, + { + "type": "\"widget\"", + "name": "Widget" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyValidationRule", + "name": "SurveyValidationRule", + "properties": [ + { + "type": "string", + "name": "errorMessage" + }, + { + "type": "SurveyValidationType", + "name": "type" + }, + { + "type": "number", + "name": "value" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyValidationType", + "name": "SurveyValidationType", + "properties": [ + { + "type": "\"max_length\"", + "name": "MaxLength" + }, + { + "type": "\"min_length\"", + "name": "MinLength" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyWidgetType", + "name": "SurveyWidgetType", + "properties": [ + { + "type": "\"button\"", + "name": "Button" + }, + { + "type": "\"selector\"", + "name": "Selector" + }, + { + "type": "\"tab\"", + "name": "Tab" + } + ], + "path": "../core/src/types.ts" } ], "categories": [ diff --git a/packages/node/references/posthog-node-references-latest.json b/packages/node/references/posthog-node-references-latest.json index 55a4ee8a93..d341edaa92 100644 --- a/packages/node/references/posthog-node-references-latest.json +++ b/packages/node/references/posthog-node-references-latest.json @@ -35,27 +35,6 @@ }, "path": "src/entrypoints/index.node.ts" }, - { - "category": "", - "details": null, - "id": "initializeContext", - "showDocs": true, - "title": "initializeContext", - "examples": [ - { - "id": "initializecontext", - "name": "Generated example for initializeContext", - "code": "// Generated example for initializeContext\nposthog.initializeContext();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "PostHogContext", - "name": "PostHogContext" - }, - "path": "src/entrypoints/index.node.ts" - }, { "category": "Initialization", "description": "Initialize a new PostHog client instance.", @@ -1151,6 +1130,245 @@ "name": "T" }, "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "fetch", + "showDocs": true, + "title": "fetch", + "examples": [ + { + "id": "fetch", + "name": "Generated example for fetch", + "code": "// Generated example for fetch\nposthog.fetch();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "string", + "name": "url" + }, + { + "description": "", + "isOptional": false, + "type": "PostHogFetchOptions", + "name": "options" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "Initialization", + "description": "Flushes the queue of pending events.\nThis function will return a promise that will resolve when the flush is complete, or reject if there was an error (for example if the server or network is down).\nIf there is already a flush in progress, this function will wait for that flush to complete.\nIt's recommended to do error handling in the callback of the promise.", + "details": null, + "id": "flush", + "showDocs": true, + "title": "flush", + "examples": [ + { + "id": "flush_with_error_handling", + "name": "flush with error handling", + "code": "\n\n// flush with error handling\nposthog.flush().then(() => {\n console.log('Flush complete')\n}).catch((err) => {\n console.error('Flush failed', err)\n})\n\n\n" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "description": "* ** SURVEYS *", + "details": null, + "id": "getSurveysStateless", + "showDocs": true, + "title": "getSurveysStateless", + "examples": [ + { + "id": "getsurveysstateless", + "name": "Generated example for getSurveysStateless", + "code": "// Generated example for getSurveysStateless\nposthog.getSurveysStateless();" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "on", + "showDocs": true, + "title": "on", + "examples": [ + { + "id": "on", + "name": "Generated example for on", + "code": "// Generated example for on\nposthog.on();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "string", + "name": "event" + }, + { + "description": "", + "isOptional": false, + "type": "(...args: any[]) => void", + "name": "cb" + } + ], + "returnType": { + "id": "() => void", + "name": "() => void" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "optIn", + "showDocs": true, + "title": "optIn", + "examples": [ + { + "id": "optin", + "name": "Generated example for optIn", + "code": "// Generated example for optIn\nposthog.optIn();" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "optOut", + "showDocs": true, + "title": "optOut", + "examples": [ + { + "id": "optout", + "name": "Generated example for optOut", + "code": "// Generated example for optOut\nposthog.optOut();" + } + ], + "releaseTag": "public", + "params": [], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "register", + "showDocs": true, + "title": "register", + "examples": [ + { + "id": "register", + "name": "Generated example for register", + "code": "// Generated example for register\nposthog.register();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "PostHogEventProperties", + "name": "properties" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "Initialization", + "description": "Shuts down the PostHog instance and ensures all events are sent.\nCall shutdown() once before the process exits to ensure that all events have been sent and all promises have resolved. Do not use this function if you intend to keep using this PostHog instance after calling it. Use flush() for per-request cleanup instead.", + "details": null, + "id": "shutdown", + "showDocs": true, + "title": "shutdown", + "examples": [ + { + "id": "shutdown_before_process_exit", + "name": "shutdown before process exit", + "code": "\n\n// shutdown before process exit\nprocess.on('SIGINT', async () => {\n await posthog.shutdown()\n process.exit(0)\n})\n\n\n\n" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "Maximum time to wait for shutdown in milliseconds", + "isOptional": true, + "type": "number", + "name": "shutdownTimeoutMs" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" + }, + { + "category": "", + "details": null, + "id": "unregister", + "showDocs": true, + "title": "unregister", + "examples": [ + { + "id": "unregister", + "name": "Generated example for unregister", + "code": "// Generated example for unregister\nposthog.unregister();" + } + ], + "releaseTag": "public", + "params": [ + { + "description": "", + "isOptional": false, + "type": "string", + "name": "property" + } + ], + "returnType": { + "id": "Promise", + "name": "Promise" + }, + "path": "src/entrypoints/index.node.ts" } ] } @@ -1197,6 +1415,63 @@ "path": "src/extensions/sentry-integration.ts" }, { + "id": "ActionStepStringMatching", + "name": "ActionStepStringMatching", + "properties": [ + { + "type": "\"contains\"", + "name": "Contains" + }, + { + "type": "\"exact\"", + "name": "Exact" + }, + { + "type": "\"regex\"", + "name": "Regex" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "ActionStepType", + "name": "ActionStepType", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n event?: string;\n selector?: string;\n text?: string;\n text_matching?: ActionStepStringMatching;\n href?: string;\n href_matching?: ActionStepStringMatching;\n url?: string;\n url_matching?: ActionStepStringMatching;\n}" + }, + { + "id": "BaseException", + "name": "BaseException", + "properties": [ + { + "type": "boolean", + "name": "synthetic" + }, + { + "type": "string", + "name": "type" + }, + { + "type": "string", + "name": "value" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "BasicSurveyQuestion", + "name": "BasicSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.Open;\n}" + }, + { + "id": "BeforeSendFn_2", + "name": "BeforeSendFn_2", + "properties": [], + "path": "../core/src/types.ts", + "example": "(event: CaptureEvent | null) => CaptureEvent | null" "id": "AllFlagsOptions", "name": "AllFlagsOptions", "properties": [], @@ -1217,6 +1492,56 @@ "path": "src/types.ts", "example": "(event: EventMessage | null) => EventMessage | null" }, + { + "id": "CaptureEvent", + "name": "CaptureEvent", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n uuid?: string;\n event: string;\n properties?: PostHogEventProperties;\n $set?: PostHogEventProperties;\n $set_once?: PostHogEventProperties;\n timestamp?: Date;\n}" + }, + { + "id": "ChunkIdMapType", + "name": "ChunkIdMapType", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "Record" + }, + { + "id": "Coercer", + "name": "Coercer", + "properties": [], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "CoercingContext", + "name": "CoercingContext", + "properties": [ + { + "type": "(input: unknown) => ExceptionLike", + "name": "apply" + }, + { + "type": "(input: unknown) => ExceptionLike | undefined", + "name": "next" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "Compression", + "name": "Compression", + "properties": [ + { + "type": "\"base64\"", + "name": "Base64" + }, + { + "type": "\"gzip-js\"", + "name": "GZipJS" + } + ], + "path": "../core/src/types.ts" + }, { "id": "ContextData", "name": "ContextData", @@ -1249,21 +1574,132 @@ "path": "src/extensions/context/types.ts" }, { - "id": "EventMessage", - "name": "EventMessage", - "properties": [], - "path": "src/types.ts", - "example": "Omit & {\n distinctId?: string;\n event: string;\n groups?: Record;\n sendFeatureFlags?: boolean | SendFeatureFlagsOptions;\n timestamp?: Date;\n uuid?: string;\n _originatedFromCaptureException?: boolean;\n}" - }, - { - "id": "ExpressErrorMiddleware", - "name": "ExpressErrorMiddleware", + "id": "EndBranching", + "name": "EndBranching", "properties": [], - "path": "src/extensions/express.ts", - "example": "(error: MiddlewareError, req: Request, res: Response, next: (error: MiddlewareError) => void) => void" + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.End;\n}" }, { - "id": "ExpressMiddleware", + "id": "ErrorProperties", + "name": "ErrorProperties", + "properties": [ + { + "type": "SeverityLevel", + "name": "$exception_level" + }, + { + "type": "Exception[]", + "name": "$exception_list" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ErrorTrackingCoercer", + "name": "ErrorTrackingCoercer", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "Coercer" + }, + { + "id": "EvaluationReason", + "name": "EvaluationReason", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n code: string | undefined;\n condition_index: number | undefined;\n description: string | undefined;\n}" + }, + { + "id": "EventHint", + "name": "EventHint", + "properties": [ + { + "type": "Partial", + "name": "mechanism" + }, + { + "type": "number", + "name": "skipFirstLines" + }, + { + "type": "Error | null", + "name": "syntheticException" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "EventMessage", + "name": "EventMessage", + "properties": [], + "path": "src/types.ts", + "example": "Omit & {\n distinctId?: string;\n event: string;\n groups?: Record;\n sendFeatureFlags?: boolean | SendFeatureFlagsOptions;\n timestamp?: Date;\n uuid?: string;\n _originatedFromCaptureException?: boolean;\n}" + }, + { + "id": "Exception", + "name": "Exception", + "properties": [ + { + "type": "Mechanism", + "name": "mechanism" + }, + { + "type": "string", + "name": "module" + }, + { + "type": "{\n frames?: StackFrame[];\n type: 'raw';\n }", + "name": "stacktrace" + }, + { + "type": "number", + "name": "thread_id" + }, + { + "type": "string", + "name": "type" + }, + { + "type": "string", + "name": "value" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ExceptionLike", + "name": "ExceptionLike", + "properties": [ + { + "type": "ExceptionLike", + "name": "cause" + }, + { + "type": "SeverityLevel", + "name": "level" + }, + { + "type": "string", + "name": "stack" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ExceptionList", + "name": "ExceptionList", + "properties": [], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ExpressErrorMiddleware", + "name": "ExpressErrorMiddleware", + "properties": [], + "path": "src/extensions/express.ts", + "example": "(error: MiddlewareError, req: Request, res: Response, next: (error: MiddlewareError) => void) => void" + }, + { + "id": "ExpressMiddleware", "name": "ExpressMiddleware", "properties": [], "path": "src/extensions/express.ts", @@ -1283,6 +1719,27 @@ "path": "src/types.ts", "example": "{\n properties: FlagProperty[];\n rollout_percentage?: number;\n variant?: string;\n}" }, + { + "id": "FeatureFlagDetail", + "name": "FeatureFlagDetail", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n key: string;\n enabled: boolean;\n variant: string | undefined;\n reason: EvaluationReason | undefined;\n metadata: FeatureFlagMetadata | undefined;\n failed?: boolean;\n}" + }, + { + "id": "FeatureFlagErrorType", + "name": "FeatureFlagErrorType", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"apiError\"" + }, + { + "id": "FeatureFlagMetadata", + "name": "FeatureFlagMetadata", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n id: number | undefined;\n version: number | undefined;\n description: string | undefined;\n payload: string | undefined;\n}" + }, { "id": "FeatureFlagOverrideOptions", "name": "FeatureFlagOverrideOptions", @@ -1290,6 +1747,13 @@ "path": "src/types.ts", "example": "{\n flags?: false | string[] | Record;\n payloads?: false | Record;\n}" }, + { + "id": "FeatureFlagRequestError", + "name": "FeatureFlagRequestError", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: 'timeout' | 'connection_error' | 'api_error' | 'unknown_error';\n statusCode?: number;\n}" + }, { "id": "FeatureFlagResult", "name": "FeatureFlagResult", @@ -1297,6 +1761,13 @@ "path": "src/types.ts", "example": "{\n key: string;\n enabled: boolean;\n variant: string | undefined;\n payload: JsonType | undefined;\n}" }, + { + "id": "FeatureFlagValue", + "name": "FeatureFlagValue", + "properties": [], + "path": "../core/src/types.ts", + "example": "string | boolean" + }, { "id": "FlagDefinitionCacheData", "name": "FlagDefinitionCacheData", @@ -1346,6 +1817,20 @@ "path": "src/types.ts", "example": "string | number | (string | number)[] | boolean" }, + { + "id": "GetFlagsResult", + "name": "GetFlagsResult", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n success: true;\n response: PostHogFeatureFlagsResponse;\n} | {\n success: false;\n error: FeatureFlagRequestError;\n}" + }, + { + "id": "GetModuleFn", + "name": "GetModuleFn", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(filename: string | undefined) => string | undefined" + }, { "id": "GroupIdentifyMessage", "name": "GroupIdentifyMessage", @@ -1372,6 +1857,50 @@ "properties": [], "path": "src/extensions/context/types.ts" }, + { + "id": "JsonType", + "name": "JsonType", + "properties": [], + "path": "../core/src/types.ts", + "example": "string | number | boolean | null | {\n [key: string]: JsonType;\n} | Array | JsonType[]" + }, + { + "id": "LinkSurveyQuestion", + "name": "LinkSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.Link;\n link?: string;\n}" + }, + { + "id": "Logger", + "name": "Logger", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n info: (...args: any[]) => void;\n warn: (...args: any[]) => void;\n error: (...args: any[]) => void;\n critical: (...args: any[]) => void;\n createLogger: (prefix: string) => Logger;\n}" + }, + { + "id": "Mechanism", + "name": "Mechanism", + "properties": [ + { + "type": "boolean", + "name": "handled" + }, + { + "type": "string", + "name": "source" + }, + { + "type": "boolean", + "name": "synthetic" + }, + { + "type": "'generic' | 'onunhandledrejection' | 'onuncaughtexception' | 'onconsole' | 'middleware'", + "name": "type" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, { "id": "MiddlewareError", "name": "MiddlewareError", @@ -1395,6 +1924,27 @@ ], "path": "src/extensions/express.ts" }, + { + "id": "MultipleSurveyQuestion", + "name": "MultipleSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice;\n choices: string[];\n hasOpenChoice?: boolean;\n shuffleOptions?: boolean;\n skipSubmitButton?: boolean;\n}" + }, + { + "id": "NextQuestionBranching", + "name": "NextQuestionBranching", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.NextQuestion;\n}" + }, + { + "id": "ObjectLike", + "name": "ObjectLike", + "properties": [], + "path": "../core/src/error-tracking/coercers/object-coercer.ts", + "example": "Record" + }, { "id": "OverrideFeatureFlagsOptions", "name": "OverrideFeatureFlagsOptions", @@ -1402,6 +1952,90 @@ "path": "src/types.ts", "example": "false | string[] | Record | FeatureFlagOverrideOptions" }, + { + "id": "ParsedException", + "name": "ParsedException", + "properties": [ + { + "type": "ParsedException", + "name": "cause" + }, + { + "type": "StackFrame[]", + "name": "stack" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "ParsingContext", + "name": "ParsingContext", + "properties": [ + { + "type": "ChunkIdMapType", + "name": "chunkIdMap" + }, + { + "type": "number", + "name": "skipFirstLines" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "PartialWithRequired", + "name": "PartialWithRequired", + "properties": [], + "path": "../core/src/types.ts", + "example": "keyof T> = {\n [P in K]: T[P];\n} & {\n [P in Exclude]?: T[P];\n}" + }, + { + "id": "Platform", + "name": "Platform", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "\"node:javascript\" | \"web:javascript\" | \"hermes\"" + }, + { + "id": "PolymorphicEvent", + "name": "PolymorphicEvent", + "properties": [ + { + "type": "unknown", + "name": "currentTarget" + }, + { + "type": "unknown", + "name": "target" + }, + { + "type": "string", + "name": "type" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "PostHogCaptureOptions", + "name": "PostHogCaptureOptions", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n uuid?: string;\n timestamp?: Date;\n disableGeoip?: boolean;\n _originatedFromCaptureException?: boolean;\n}" + }, + { + "id": "PostHogCoreOptions", + "name": "PostHogCoreOptions", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n host?: string;\n flushAt?: number;\n flushInterval?: number;\n maxBatchSize?: number;\n maxQueueSize?: number;\n disabled?: boolean;\n defaultOptIn?: boolean;\n sendFeatureFlagEvent?: boolean;\n preloadFeatureFlags?: boolean;\n disableRemoteConfig?: boolean;\n disableSurveys?: boolean;\n bootstrap?: {\n distinctId?: string;\n isIdentifiedId?: boolean;\n featureFlags?: Record;\n featureFlagPayloads?: Record;\n };\n fetchRetryCount?: number;\n fetchRetryDelay?: number;\n requestTimeout?: number;\n featureFlagsRequestTimeoutMs?: number;\n remoteConfigRequestTimeoutMs?: number;\n sessionExpirationTimeSeconds?: number;\n disableCompression?: boolean;\n disableGeoip?: boolean;\n historicalMigration?: boolean;\n evaluationContexts?: readonly string[];\n evaluationEnvironments?: readonly string[];\n personProfiles?: 'always' | 'identified_only' | 'never';\n before_send?: BeforeSendFn | BeforeSendFn[];\n}" + }, + { + "id": "PostHogEventProperties", + "name": "PostHogEventProperties", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n [key: string]: JsonType;\n}" + }, { "id": "PostHogFeatureFlag", "name": "PostHogFeatureFlag", @@ -1409,6 +2043,48 @@ "path": "src/types.ts", "example": "{\n id: number;\n name: string;\n key: string;\n bucketing_identifier?: FeatureFlagBucketingIdentifier;\n filters?: {\n aggregation_group_type_index?: number;\n groups?: FeatureFlagCondition[];\n multivariate?: {\n variants: {\n key: string;\n rollout_percentage: number;\n }[];\n };\n payloads?: Record;\n };\n deleted: boolean;\n active: boolean;\n rollout_percentage: null | number;\n ensure_experience_continuity: boolean;\n experiment_set: number[];\n}" }, + { + "id": "PostHogFeatureFlagDetails", + "name": "PostHogFeatureFlagDetails", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"flags\" | \"featureFlags\" | \"featureFlagPayloads\" | \"requestId\"" + }, + { + "id": "PostHogFeatureFlagsResponse", + "name": "PostHogFeatureFlagsResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"flags\" | \"featureFlags\" | \"featureFlagPayloads\" | \"requestId\"" + }, + { + "id": "PostHogFetchOptions", + "name": "PostHogFetchOptions", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n method: 'GET' | 'POST' | 'PUT' | 'PATCH';\n mode?: 'no-cors';\n credentials?: 'omit';\n headers: {\n [key: string]: string;\n };\n body?: string | Blob;\n signal?: AbortSignal;\n}" + }, + { + "id": "PostHogFetchResponse", + "name": "PostHogFetchResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n status: number;\n text: () => Promise;\n json: () => Promise;\n headers?: {\n get(name: string): string | null;\n };\n}" + }, + { + "id": "PostHogFlagsAndPayloadsResponse", + "name": "PostHogFlagsAndPayloadsResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "\"featureFlags\" | \"featureFlagPayloads\"" + }, + { + "id": "PostHogFlagsResponse", + "name": "PostHogFlagsResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "Omit & {\n featureFlags: {\n [key: string]: FeatureFlagValue;\n };\n featureFlagPayloads: {\n [key: string]: JsonType;\n };\n flags: {\n [key: string]: FeatureFlagDetail;\n };\n errorsWhileComputingFlags: boolean;\n sessionRecording?: boolean | {\n [key: string]: JsonType;\n };\n quotaLimited?: string[];\n requestId?: string;\n evaluatedAt?: number;\n}" + }, { "id": "PostHogOptions", "name": "PostHogOptions", @@ -1416,6 +2092,146 @@ "path": "src/types.ts", "example": "Omit & {\n persistence?: 'memory';\n personalApiKey?: string;\n privacyMode?: boolean;\n enableExceptionAutocapture?: boolean;\n featureFlagsPollingInterval?: number;\n maxCacheSize?: number;\n fetch?: (url: string, options: PostHogFetchOptions) => Promise;\n enableLocalEvaluation?: boolean;\n flagDefinitionCacheProvider?: FlagDefinitionCacheProvider;\n before_send?: BeforeSendFn | BeforeSendFn[];\n evaluationContexts?: readonly string[];\n evaluationEnvironments?: readonly string[];\n custom_blocked_useragents?: string[];\n __preview_capture_bot_pageviews?: boolean;\n strictLocalEvaluation?: boolean;\n}" }, + { + "id": "PostHogPersistedProperty", + "name": "PostHogPersistedProperty", + "properties": [ + { + "type": "\"anonymous_id\"", + "name": "AnonymousId" + }, + { + "type": "\"bootstrap_feature_flag_details\"", + "name": "BootstrapFeatureFlagDetails" + }, + { + "type": "\"bootstrap_feature_flag_payloads\"", + "name": "BootstrapFeatureFlagPayloads" + }, + { + "type": "\"bootstrap_feature_flags\"", + "name": "BootstrapFeatureFlags" + }, + { + "type": "\"distinct_id\"", + "name": "DistinctId" + }, + { + "type": "\"enable_person_processing\"", + "name": "EnablePersonProcessing" + }, + { + "type": "\"feature_flag_details\"", + "name": "FeatureFlagDetails" + }, + { + "type": "\"feature_flag_payloads\"", + "name": "FeatureFlagPayloads" + }, + { + "type": "\"feature_flags\"", + "name": "FeatureFlags" + }, + { + "type": "\"flags_endpoint_was_hit\"", + "name": "FlagsEndpointWasHit" + }, + { + "type": "\"group_properties\"", + "name": "GroupProperties" + }, + { + "type": "\"installed_app_build\"", + "name": "InstalledAppBuild" + }, + { + "type": "\"installed_app_version\"", + "name": "InstalledAppVersion" + }, + { + "type": "\"opted_out\"", + "name": "OptedOut" + }, + { + "type": "\"override_feature_flags\"", + "name": "OverrideFeatureFlags" + }, + { + "type": "\"person_mode\"", + "name": "PersonMode" + }, + { + "type": "\"person_properties\"", + "name": "PersonProperties" + }, + { + "type": "\"props\"", + "name": "Props" + }, + { + "type": "\"queue\"", + "name": "Queue" + }, + { + "type": "\"remote_config\"", + "name": "RemoteConfig" + }, + { + "type": "\"session_id\"", + "name": "SessionId" + }, + { + "type": "\"session_timestamp\"", + "name": "SessionLastTimestamp" + }, + { + "type": "\"session_replay\"", + "name": "SessionReplay" + }, + { + "type": "\"session_start_timestamp\"", + "name": "SessionStartTimestamp" + }, + { + "type": "\"survey_last_seen_date\"", + "name": "SurveyLastSeenDate" + }, + { + "type": "\"surveys\"", + "name": "Surveys" + }, + { + "type": "\"surveys_seen\"", + "name": "SurveysSeen" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "PostHogRemoteConfig", + "name": "PostHogRemoteConfig", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n sessionRecording?: boolean | {\n [key: string]: JsonType;\n };\n supportedCompression?: Compression[];\n surveys?: boolean | Survey[];\n hasFeatureFlags?: boolean;\n errorTracking?: boolean | {\n [key: string]: JsonType;\n };\n capturePerformance?: boolean | {\n [key: string]: JsonType;\n };\n}" + }, + { + "id": "PreviouslyCapturedError", + "name": "PreviouslyCapturedError", + "properties": [ + { + "type": "boolean", + "name": "__posthog_previously_captured_error" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "PrimitiveType", + "name": "PrimitiveType", + "properties": [], + "path": "../core/src/error-tracking/coercers/primitive-coercer.ts", + "example": "null | undefined | boolean | number | string | symbol | bigint" + }, { "id": "PropertyGroup", "name": "PropertyGroup", @@ -1423,6 +2239,39 @@ "path": "src/types.ts", "example": "{\n type: 'AND' | 'OR';\n values: PropertyGroup[] | FlagProperty[];\n}" }, + { + "id": "RatingSurveyQuestion", + "name": "RatingSurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "SurveyQuestionBase & {\n type: SurveyQuestionType.Rating;\n display: SurveyRatingDisplay;\n scale: 2 | 3 | 5 | 7 | 10;\n lowerBoundLabel: string;\n upperBoundLabel: string;\n skipSubmitButton?: boolean;\n}" + }, + { + "id": "ResponseBasedBranching", + "name": "ResponseBasedBranching", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.ResponseBased;\n responseValues: Record;\n}" + }, + { + "id": "RetriableOptions", + "name": "RetriableOptions", + "properties": [ + { + "type": "(err: unknown) => boolean", + "name": "retryCheck" + }, + { + "type": "number", + "name": "retryCount" + }, + { + "type": "number", + "name": "retryDelay" + } + ], + "path": "../core/src/utils/index.ts" + }, { "id": "SendFeatureFlagsOptions", "name": "SendFeatureFlagsOptions", @@ -1436,6 +2285,399 @@ "properties": [], "path": "src/extensions/sentry-integration.ts", "example": "{\n organization?: string;\n projectId?: number;\n prefix?: string;\n severityAllowList?: CoreErrorTracking.SeverityLevel[] | '*';\n sendExceptionsToPostHog?: boolean;\n}" + }, + { + "id": "SeverityLevel", + "name": "SeverityLevel", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(typeof severityLevels)[number]" + }, + { + "id": "SpecificQuestionBranching", + "name": "SpecificQuestionBranching", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n type: SurveyQuestionBranchingType.SpecificQuestion;\n index: number;\n}" + }, + { + "id": "StackFrame", + "name": "StackFrame", + "properties": [ + { + "type": "string", + "name": "abs_path" + }, + { + "type": "string", + "name": "addr_mode" + }, + { + "type": "string", + "name": "chunk_id" + }, + { + "type": "number", + "name": "colno" + }, + { + "type": "string", + "name": "context_line" + }, + { + "type": "string", + "name": "filename" + }, + { + "type": "string", + "name": "function" + }, + { + "type": "boolean", + "name": "in_app" + }, + { + "type": "string", + "name": "instruction_addr" + }, + { + "type": "number", + "name": "lineno" + }, + { + "type": "string", + "name": "module" + }, + { + "type": "Platform", + "name": "platform" + }, + { + "type": "string[]", + "name": "post_context" + }, + { + "type": "string[]", + "name": "pre_context" + }, + { + "type": "{\n [key: string]: JsonType;\n }", + "name": "vars" + } + ], + "path": "../core/src/error-tracking/types.ts" + }, + { + "id": "StackFrameModifierFn", + "name": "StackFrameModifierFn", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(frames: StackFrame[]) => Promise" + }, + { + "id": "StackLineParser", + "name": "StackLineParser", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(line: string, platform: Platform) => StackFrame | undefined" + }, + { + "id": "StackParser", + "name": "StackParser", + "properties": [], + "path": "../core/src/error-tracking/types.ts", + "example": "(stack: string, skipFirstLines?: number) => StackFrame[]" + }, + { + "id": "Survey", + "name": "Survey", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n id: string;\n name: string;\n description?: string;\n type: SurveyType;\n feature_flag_keys?: {\n key: string;\n value?: string;\n }[];\n linked_flag_key?: string;\n targeting_flag_key?: string;\n internal_targeting_flag_key?: string;\n questions: SurveyQuestion[];\n appearance?: SurveyAppearance;\n conditions?: {\n url?: string;\n selector?: string;\n seenSurveyWaitPeriodInDays?: number;\n urlMatchType?: SurveyMatchType;\n events?: {\n repeatedActivation?: boolean;\n values?: {\n name: string;\n }[];\n };\n actions?: {\n values: SurveyActionType[];\n };\n deviceTypes?: string[];\n deviceTypesMatchType?: SurveyMatchType;\n linkedFlagVariant?: string;\n };\n start_date?: string;\n end_date?: string;\n current_iteration?: number;\n current_iteration_start_date?: string;\n schedule?: SurveySchedule;\n}" + }, + { + "id": "SurveyActionType", + "name": "SurveyActionType", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n id: number;\n name?: string;\n steps?: ActionStepType[];\n}" + }, + { + "id": "SurveyAppearance", + "name": "SurveyAppearance", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n backgroundColor?: string;\n textColor?: string;\n submitButtonColor?: string;\n submitButtonText?: string;\n submitButtonTextColor?: string;\n ratingButtonColor?: string;\n ratingButtonActiveColor?: string;\n inputBackground?: string;\n inputTextColor?: string;\n autoDisappear?: boolean;\n displayThankYouMessage?: boolean;\n thankYouMessageHeader?: string;\n thankYouMessageDescription?: string;\n thankYouMessageDescriptionContentType?: SurveyQuestionDescriptionContentType;\n thankYouMessageCloseButtonText?: string;\n borderColor?: string;\n position?: SurveyPosition;\n placeholder?: string;\n shuffleQuestions?: boolean;\n surveyPopupDelaySeconds?: number;\n widgetType?: SurveyWidgetType;\n widgetSelector?: string;\n widgetLabel?: string;\n widgetColor?: string;\n}" + }, + { + "id": "SurveyMatchType", + "name": "SurveyMatchType", + "properties": [ + { + "type": "\"exact\"", + "name": "Exact" + }, + { + "type": "\"icontains\"", + "name": "Icontains" + }, + { + "type": "\"is_not\"", + "name": "IsNot" + }, + { + "type": "\"not_icontains\"", + "name": "NotIcontains" + }, + { + "type": "\"not_regex\"", + "name": "NotRegex" + }, + { + "type": "\"regex\"", + "name": "Regex" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyPosition", + "name": "SurveyPosition", + "properties": [ + { + "type": "\"center\"", + "name": "Center" + }, + { + "type": "\"left\"", + "name": "Left" + }, + { + "type": "\"middle_center\"", + "name": "MiddleCenter" + }, + { + "type": "\"middle_left\"", + "name": "MiddleLeft" + }, + { + "type": "\"middle_right\"", + "name": "MiddleRight" + }, + { + "type": "\"right\"", + "name": "Right" + }, + { + "type": "\"top_center\"", + "name": "TopCenter" + }, + { + "type": "\"top_left\"", + "name": "TopLeft" + }, + { + "type": "\"top_right\"", + "name": "TopRight" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyQuestion", + "name": "SurveyQuestion", + "properties": [], + "path": "../core/src/types.ts", + "example": "BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion" + }, + { + "id": "SurveyQuestionBase", + "name": "SurveyQuestionBase", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n question: string;\n id: string;\n description?: string;\n descriptionContentType?: SurveyQuestionDescriptionContentType;\n optional?: boolean;\n buttonText?: string;\n originalQuestionIndex: number;\n branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching;\n validation?: SurveyValidationRule[];\n}" + }, + { + "id": "SurveyQuestionBranchingType", + "name": "SurveyQuestionBranchingType", + "properties": [ + { + "type": "\"end\"", + "name": "End" + }, + { + "type": "\"next_question\"", + "name": "NextQuestion" + }, + { + "type": "\"response_based\"", + "name": "ResponseBased" + }, + { + "type": "\"specific_question\"", + "name": "SpecificQuestion" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyQuestionDescriptionContentType", + "name": "SurveyQuestionDescriptionContentType", + "properties": [ + { + "type": "\"html\"", + "name": "Html" + }, + { + "type": "\"text\"", + "name": "Text" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyQuestionType", + "name": "SurveyQuestionType", + "properties": [ + { + "type": "\"link\"", + "name": "Link" + }, + { + "type": "\"multiple_choice\"", + "name": "MultipleChoice" + }, + { + "type": "\"open\"", + "name": "Open" + }, + { + "type": "\"rating\"", + "name": "Rating" + }, + { + "type": "\"single_choice\"", + "name": "SingleChoice" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyRatingDisplay", + "name": "SurveyRatingDisplay", + "properties": [ + { + "type": "\"emoji\"", + "name": "Emoji" + }, + { + "type": "\"number\"", + "name": "Number" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyResponse", + "name": "SurveyResponse", + "properties": [], + "path": "../core/src/types.ts", + "example": "{\n surveys: Survey[];\n}" + }, + { + "id": "SurveySchedule", + "name": "SurveySchedule", + "properties": [ + { + "type": "\"always\"", + "name": "Always" + }, + { + "type": "\"once\"", + "name": "Once" + }, + { + "type": "\"recurring\"", + "name": "Recurring" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyType", + "name": "SurveyType", + "properties": [ + { + "type": "\"api\"", + "name": "API" + }, + { + "type": "\"external_survey\"", + "name": "ExternalSurvey" + }, + { + "type": "\"popover\"", + "name": "Popover" + }, + { + "type": "\"widget\"", + "name": "Widget" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyValidationRule", + "name": "SurveyValidationRule", + "properties": [ + { + "type": "string", + "name": "errorMessage" + }, + { + "type": "SurveyValidationType", + "name": "type" + }, + { + "type": "number", + "name": "value" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyValidationType", + "name": "SurveyValidationType", + "properties": [ + { + "type": "\"max_length\"", + "name": "MaxLength" + }, + { + "type": "\"min_length\"", + "name": "MinLength" + } + ], + "path": "../core/src/types.ts" + }, + { + "id": "SurveyWidgetType", + "name": "SurveyWidgetType", + "properties": [ + { + "type": "\"button\"", + "name": "Button" + }, + { + "type": "\"selector\"", + "name": "Selector" + }, + { + "type": "\"tab\"", + "name": "Tab" + } + ], + "path": "../core/src/types.ts" } ], "categories": [ diff --git a/packages/node/scripts/generate-docs.mjs b/packages/node/scripts/generate-docs.mjs index 6392bcbb17..780cda225e 100644 --- a/packages/node/scripts/generate-docs.mjs +++ b/packages/node/scripts/generate-docs.mjs @@ -37,9 +37,9 @@ const NODE_TYPE_EXAMPLES = { const __dirname = import.meta.dirname const config = { - packageDir: path.resolve(__dirname, '..'), // packages/node - apiJsonPath: path.resolve(__dirname, '../docs/posthog-node.api.json'), - outputPath: path.resolve(__dirname, `../references/posthog-node-references-${version}.json`), + packageDir: path.resolve(import.meta.dirname, '..'), // packages/node + apiJsonPath: path.resolve(import.meta.dirname, '../docs/posthog-node.api.json'), + outputPath: path.resolve(import.meta.dirname, `../references/posthog-node-references-${version}.json`), version: version, id: NODE_SPEC_INFO.id, hogRef: HOG_REF, diff --git a/packages/react-native/references/posthog-react-native-references-4.36.0.json b/packages/react-native/references/posthog-react-native-references-4.36.0.json index 16064e2248..37debfb88b 100644 --- a/packages/react-native/references/posthog-react-native-references-4.36.0.json +++ b/packages/react-native/references/posthog-react-native-references-4.36.0.json @@ -229,28 +229,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "Waits for any pending storage operations to complete. This ensures data has been safely written to async storage before considering events as sent, preventing duplicate events on app crash/restart.", - "details": null, - "id": "flushStorage", - "showDocs": true, - "title": "flushStorage", - "examples": [ - { - "id": "flushstorage", - "name": "Generated example for flushStorage", - "code": "// Generated example for flushStorage\nposthog.flushStorage();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1334,35 +1312,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "* ** FEATURE FLAGS *", - "details": null, - "id": "flagsAsync", - "showDocs": true, - "title": "flagsAsync", - "examples": [ - { - "id": "flagsasync", - "name": "Generated example for flagsAsync", - "code": "// Generated example for flagsAsync\nposthog.flagsAsync();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": true, - "type": "FlagsAsyncOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "Identification", "description": "Returns the current anonymous ID.\nThis is the ID assigned to users before they are identified. It's used to track anonymous users and link them to identified users when they sign up.", @@ -1503,27 +1452,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "details": null, - "id": "getKnownFeatureFlags", - "showDocs": true, - "title": "getKnownFeatureFlags", - "examples": [ - { - "id": "getknownfeatureflags", - "name": "Generated example for getKnownFeatureFlags", - "code": "// Generated example for getKnownFeatureFlags\nposthog.getKnownFeatureFlags();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "PostHogFlagsResponse['featureFlags'] | undefined", - "name": "PostHogFlagsResponse['featureFlags'] | undefined" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1695,35 +1623,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "Called when remote config has been loaded (from either the remote config endpoint or the flags endpoint). Override in subclasses to react to remote config changes (e.g., gating error tracking, session replay features).\nThe full response is passed so consumers can read whatever fields they need. This is called exactly once per remote config load cycle.", - "details": null, - "id": "onRemoteConfig", - "showDocs": true, - "title": "onRemoteConfig", - "examples": [ - { - "id": "onremoteconfig", - "name": "Generated example for onRemoteConfig", - "code": "// Generated example for onRemoteConfig\nposthog.onRemoteConfig();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "The remote config or flags response containing config fields", - "isOptional": false, - "type": "PostHogRemoteConfig", - "name": "_response" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1752,35 +1651,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "Override processBeforeEnqueue to run before_send hooks. This runs after prepareMessage, giving users full control over the final event.\nThe internal message contains many fields (event, distinct_id, properties, type, library, library_version, timestamp, uuid). CaptureEvent exposes a subset matching the web SDK's CaptureResult: uuid, event, properties, $set, $set_once, timestamp. Note: $set/$set_once are extracted from properties.$set and properties.$set_once.", - "details": null, - "id": "processBeforeEnqueue", - "showDocs": true, - "title": "processBeforeEnqueue", - "examples": [ - { - "id": "processbeforeenqueue", - "name": "Generated example for processBeforeEnqueue", - "code": "// Generated example for processBeforeEnqueue\nposthog.processBeforeEnqueue();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "PostHogEventProperties", - "name": "message" - } - ], - "returnType": { - "id": "PostHogEventProperties | null", - "name": "PostHogEventProperties | null" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1830,34 +1700,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "details": null, - "id": "setupBootstrap", - "showDocs": true, - "title": "setupBootstrap", - "examples": [ - { - "id": "setupbootstrap", - "name": "Generated example for setupBootstrap", - "code": "// Generated example for setupBootstrap\nposthog.setupBootstrap();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": true, - "type": "Partial", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1887,71 +1729,31 @@ "path": "dist/posthog-rn.d.ts" }, { - "category": "", - "details": null, - "id": "addPendingPromise", + "category": "Initialization", + "description": "Enables or disables debug mode for detailed logging.", + "details": "Debug mode logs all PostHog calls to the console for troubleshooting. This is useful during development to understand what data is being sent.", + "id": "debug", "showDocs": true, - "title": "addPendingPromise", + "title": "debug", "examples": [ { - "id": "addpendingpromise", - "name": "Generated example for addPendingPromise", - "code": "// Generated example for addPendingPromise\nposthog.addPendingPromise();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "Promise", - "name": "promise" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "aliasStateless", - "showDocs": true, - "title": "aliasStateless", - "examples": [ + "id": "enable_debug_mode", + "name": "enable debug mode", + "code": "\n\n// enable debug mode\nposthog.debug(true)\n\n\n" + }, { - "id": "aliasstateless", - "name": "Generated example for aliasStateless", - "code": "// Generated example for aliasStateless\nposthog.aliasStateless();" + "id": "disable_debug_mode", + "name": "disable debug mode", + "code": "\n\n// disable debug mode\nposthog.debug(false)\n\n\n\n" } ], "releaseTag": "public", "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "alias" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, { "description": "", "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" + "type": "boolean", + "name": "enabled" } ], "returnType": { @@ -1962,1014 +1764,47 @@ }, { "category": "", + "description": "* ** SURVEYS *", "details": null, - "id": "aliasStatelessImmediate", + "id": "getSurveysStateless", "showDocs": true, - "title": "aliasStatelessImmediate", + "title": "getSurveysStateless", "examples": [ { - "id": "aliasstatelessimmediate", - "name": "Generated example for aliasStatelessImmediate", - "code": "// Generated example for aliasStatelessImmediate\nposthog.aliasStatelessImmediate();" + "id": "getsurveysstateless", + "name": "Generated example for getSurveysStateless", + "code": "// Generated example for getSurveysStateless\nposthog.getSurveysStateless();" } ], "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "alias" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], + "params": [], "returnType": { - "id": "Promise", - "name": "Promise" + "id": "Promise", + "name": "Promise" }, "path": "dist/posthog-rn.d.ts" }, { - "category": "", + "category": "Initialization", + "description": "Shuts down the PostHog instance and ensures all events are sent.\nCall shutdown() once before the process exits to ensure that all events have been sent and all promises have resolved. Do not use this function if you intend to keep using this PostHog instance after calling it. Use flush() for per-request cleanup instead.", "details": null, - "id": "captureStateless", + "id": "shutdown", "showDocs": true, - "title": "captureStateless", + "title": "shutdown", "examples": [ { - "id": "capturestateless", - "name": "Generated example for captureStateless", - "code": "// Generated example for captureStateless\nposthog.captureStateless();" + "id": "shutdown_before_process_exit", + "name": "shutdown before process exit", + "code": "\n\n// shutdown before process exit\nprocess.on('SIGINT', async () => {\n await posthog.shutdown()\n process.exit(0)\n})\n\n\n\n" } ], "releaseTag": "public", "params": [ { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "event" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", + "description": "Maximum time to wait for shutdown in milliseconds", "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "captureStatelessImmediate", - "showDocs": true, - "title": "captureStatelessImmediate", - "examples": [ - { - "id": "capturestatelessimmediate", - "name": "Generated example for captureStatelessImmediate", - "code": "// Generated example for captureStatelessImmediate\nposthog.captureStatelessImmediate();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "event" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "Initialization", - "description": "Enables or disables debug mode for detailed logging.", - "details": "Debug mode logs all PostHog calls to the console for troubleshooting. This is useful during development to understand what data is being sent.", - "id": "debug", - "showDocs": true, - "title": "debug", - "examples": [ - { - "id": "enable_debug_mode", - "name": "enable debug mode", - "code": "\n\n// enable debug mode\nposthog.debug(true)\n\n\n" - }, - { - "id": "disable_debug_mode", - "name": "disable debug mode", - "code": "\n\n// disable debug mode\nposthog.debug(false)\n\n\n\n" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "enabled" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "enqueue", - "showDocs": true, - "title": "enqueue", - "examples": [ - { - "id": "enqueue", - "name": "Generated example for enqueue", - "code": "// Generated example for enqueue\nposthog.enqueue();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "type" - }, - { - "description": "", - "isOptional": false, - "type": "any", - "name": "_message" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getCustomHeaders", - "showDocs": true, - "title": "getCustomHeaders", - "examples": [ - { - "id": "getcustomheaders", - "name": "Generated example for getCustomHeaders", - "code": "// Generated example for getCustomHeaders\nposthog.getCustomHeaders();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "{\n [key: string]: string;\n }", - "name": "{\n [key: string]: string;\n }" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagDetailsStateless", - "showDocs": true, - "title": "getFeatureFlagDetailsStateless", - "examples": [ - { - "id": "getfeatureflagdetailsstateless", - "name": "Generated example for getFeatureFlagDetailsStateless", - "code": "// Generated example for getFeatureFlagDetailsStateless\nposthog.getFeatureFlagDetailsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagDetailStateless", - "showDocs": true, - "title": "getFeatureFlagDetailStateless", - "examples": [ - { - "id": "getfeatureflagdetailstateless", - "name": "Generated example for getFeatureFlagDetailStateless", - "code": "// Generated example for getFeatureFlagDetailStateless\nposthog.getFeatureFlagDetailStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "key" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - } - ], - "returnType": { - "id": "Promise<{\n response: FeatureFlagDetail | undefined;\n requestId: string | undefined;\n evaluatedAt: number | undefined;\n } | undefined>", - "name": "Promise<{\n response: FeatureFlagDetail | undefined;\n requestId: string | undefined;\n evaluatedAt: number | undefined;\n } | undefined>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagPayloadsStateless", - "showDocs": true, - "title": "getFeatureFlagPayloadsStateless", - "examples": [ - { - "id": "getfeatureflagpayloadsstateless", - "name": "Generated example for getFeatureFlagPayloadsStateless", - "code": "// Generated example for getFeatureFlagPayloadsStateless\nposthog.getFeatureFlagPayloadsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagPayloadStateless", - "showDocs": true, - "title": "getFeatureFlagPayloadStateless", - "examples": [ - { - "id": "getfeatureflagpayloadstateless", - "name": "Generated example for getFeatureFlagPayloadStateless", - "code": "// Generated example for getFeatureFlagPayloadStateless\nposthog.getFeatureFlagPayloadStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "key" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagsAndPayloadsStateless", - "showDocs": true, - "title": "getFeatureFlagsAndPayloadsStateless", - "examples": [ - { - "id": "getfeatureflagsandpayloadsstateless", - "name": "Generated example for getFeatureFlagsAndPayloadsStateless", - "code": "// Generated example for getFeatureFlagsAndPayloadsStateless\nposthog.getFeatureFlagsAndPayloadsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>", - "name": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagsStateless", - "showDocs": true, - "title": "getFeatureFlagsStateless", - "examples": [ - { - "id": "getfeatureflagsstateless", - "name": "Generated example for getFeatureFlagsStateless", - "code": "// Generated example for getFeatureFlagsStateless\nposthog.getFeatureFlagsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>", - "name": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagStateless", - "showDocs": true, - "title": "getFeatureFlagStateless", - "examples": [ - { - "id": "getfeatureflagstateless", - "name": "Generated example for getFeatureFlagStateless", - "code": "// Generated example for getFeatureFlagStateless\nposthog.getFeatureFlagStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "key" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - } - ], - "returnType": { - "id": "Promise<{\n response: FeatureFlagValue | undefined;\n requestId: string | undefined;\n }>", - "name": "Promise<{\n response: FeatureFlagValue | undefined;\n requestId: string | undefined;\n }>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** FEATURE FLAGS *", - "details": null, - "id": "getFlags", - "showDocs": true, - "title": "getFlags", - "examples": [ - { - "id": "getflags", - "name": "Generated example for getFlags", - "code": "// Generated example for getFlags\nposthog.getFlags();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "extraPayload" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "fetchConfig" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getRemoteConfig", - "showDocs": true, - "title": "getRemoteConfig", - "examples": [ - { - "id": "getremoteconfig", - "name": "Generated example for getRemoteConfig", - "code": "// Generated example for getRemoteConfig\nposthog.getRemoteConfig();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** SURVEYS *", - "details": null, - "id": "getSurveysStateless", - "showDocs": true, - "title": "getSurveysStateless", - "examples": [ - { - "id": "getsurveysstateless", - "name": "Generated example for getSurveysStateless", - "code": "// Generated example for getSurveysStateless\nposthog.getSurveysStateless();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** GROUPS *", - "details": null, - "id": "groupIdentifyStateless", - "showDocs": true, - "title": "groupIdentifyStateless", - "examples": [ - { - "id": "groupidentifystateless", - "name": "Generated example for groupIdentifyStateless", - "code": "// Generated example for groupIdentifyStateless\nposthog.groupIdentifyStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "groupType" - }, - { - "description": "", - "isOptional": false, - "type": "string | number", - "name": "groupKey" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - }, - { - "description": "", - "isOptional": true, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "eventProperties" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** TRACKING *", - "details": null, - "id": "identifyStateless", - "showDocs": true, - "title": "identifyStateless", - "examples": [ - { - "id": "identifystateless", - "name": "Generated example for identifyStateless", - "code": "// Generated example for identifyStateless\nposthog.identifyStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "identifyStatelessImmediate", - "showDocs": true, - "title": "identifyStatelessImmediate", - "examples": [ - { - "id": "identifystatelessimmediate", - "name": "Generated example for identifyStatelessImmediate", - "code": "// Generated example for identifyStatelessImmediate\nposthog.identifyStatelessImmediate();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "logMsgIfDebug", - "showDocs": true, - "title": "logMsgIfDebug", - "examples": [ - { - "id": "logmsgifdebug", - "name": "Generated example for logMsgIfDebug", - "code": "// Generated example for logMsgIfDebug\nposthog.logMsgIfDebug();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "() => void", - "name": "fn" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "prepareMessage", - "showDocs": true, - "title": "prepareMessage", - "examples": [ - { - "id": "preparemessage", - "name": "Generated example for prepareMessage", - "code": "// Generated example for prepareMessage\nposthog.prepareMessage();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "type" - }, - { - "description": "", - "isOptional": false, - "type": "any", - "name": "_message" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "PostHogEventProperties", - "name": "PostHogEventProperties" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "sendImmediate", - "showDocs": true, - "title": "sendImmediate", - "examples": [ - { - "id": "sendimmediate", - "name": "Generated example for sendImmediate", - "code": "// Generated example for sendImmediate\nposthog.sendImmediate();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "type" - }, - { - "description": "", - "isOptional": false, - "type": "any", - "name": "_message" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "Initialization", - "description": "Shuts down the PostHog instance and ensures all events are sent.\nCall shutdown() once before the process exits to ensure that all events have been sent and all promises have resolved. Do not use this function if you intend to keep using this PostHog instance after calling it. Use flush() for per-request cleanup instead.", - "details": null, - "id": "shutdown", - "showDocs": true, - "title": "shutdown", - "examples": [ - { - "id": "shutdown_before_process_exit", - "name": "shutdown before process exit", - "code": "\n\n// shutdown before process exit\nprocess.on('SIGINT', async () => {\n await posthog.shutdown()\n process.exit(0)\n})\n\n\n\n" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "Maximum time to wait for shutdown in milliseconds", - "isOptional": true, - "type": "number", - "name": "shutdownTimeoutMs" + "type": "number", + "name": "shutdownTimeoutMs" } ], "returnType": { @@ -2977,34 +1812,6 @@ "name": "Promise" }, "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "wrap", - "showDocs": true, - "title": "wrap", - "examples": [ - { - "id": "wrap", - "name": "Generated example for wrap", - "code": "// Generated example for wrap\nposthog.wrap();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "() => void", - "name": "fn" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" } ] } diff --git a/packages/react-native/references/posthog-react-native-references-latest.json b/packages/react-native/references/posthog-react-native-references-latest.json index 16064e2248..37debfb88b 100644 --- a/packages/react-native/references/posthog-react-native-references-latest.json +++ b/packages/react-native/references/posthog-react-native-references-latest.json @@ -229,28 +229,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "Waits for any pending storage operations to complete. This ensures data has been safely written to async storage before considering events as sent, preventing duplicate events on app crash/restart.", - "details": null, - "id": "flushStorage", - "showDocs": true, - "title": "flushStorage", - "examples": [ - { - "id": "flushstorage", - "name": "Generated example for flushStorage", - "code": "// Generated example for flushStorage\nposthog.flushStorage();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1334,35 +1312,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "* ** FEATURE FLAGS *", - "details": null, - "id": "flagsAsync", - "showDocs": true, - "title": "flagsAsync", - "examples": [ - { - "id": "flagsasync", - "name": "Generated example for flagsAsync", - "code": "// Generated example for flagsAsync\nposthog.flagsAsync();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": true, - "type": "FlagsAsyncOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "Identification", "description": "Returns the current anonymous ID.\nThis is the ID assigned to users before they are identified. It's used to track anonymous users and link them to identified users when they sign up.", @@ -1503,27 +1452,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "details": null, - "id": "getKnownFeatureFlags", - "showDocs": true, - "title": "getKnownFeatureFlags", - "examples": [ - { - "id": "getknownfeatureflags", - "name": "Generated example for getKnownFeatureFlags", - "code": "// Generated example for getKnownFeatureFlags\nposthog.getKnownFeatureFlags();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "PostHogFlagsResponse['featureFlags'] | undefined", - "name": "PostHogFlagsResponse['featureFlags'] | undefined" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1695,35 +1623,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "Called when remote config has been loaded (from either the remote config endpoint or the flags endpoint). Override in subclasses to react to remote config changes (e.g., gating error tracking, session replay features).\nThe full response is passed so consumers can read whatever fields they need. This is called exactly once per remote config load cycle.", - "details": null, - "id": "onRemoteConfig", - "showDocs": true, - "title": "onRemoteConfig", - "examples": [ - { - "id": "onremoteconfig", - "name": "Generated example for onRemoteConfig", - "code": "// Generated example for onRemoteConfig\nposthog.onRemoteConfig();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "The remote config or flags response containing config fields", - "isOptional": false, - "type": "PostHogRemoteConfig", - "name": "_response" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1752,35 +1651,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "description": "Override processBeforeEnqueue to run before_send hooks. This runs after prepareMessage, giving users full control over the final event.\nThe internal message contains many fields (event, distinct_id, properties, type, library, library_version, timestamp, uuid). CaptureEvent exposes a subset matching the web SDK's CaptureResult: uuid, event, properties, $set, $set_once, timestamp. Note: $set/$set_once are extracted from properties.$set and properties.$set_once.", - "details": null, - "id": "processBeforeEnqueue", - "showDocs": true, - "title": "processBeforeEnqueue", - "examples": [ - { - "id": "processbeforeenqueue", - "name": "Generated example for processBeforeEnqueue", - "code": "// Generated example for processBeforeEnqueue\nposthog.processBeforeEnqueue();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "PostHogEventProperties", - "name": "message" - } - ], - "returnType": { - "id": "PostHogEventProperties | null", - "name": "PostHogEventProperties | null" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1830,34 +1700,6 @@ }, "path": "dist/posthog-rn.d.ts" }, - { - "category": "", - "details": null, - "id": "setupBootstrap", - "showDocs": true, - "title": "setupBootstrap", - "examples": [ - { - "id": "setupbootstrap", - "name": "Generated example for setupBootstrap", - "code": "// Generated example for setupBootstrap\nposthog.setupBootstrap();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": true, - "type": "Partial", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, { "category": "", "details": null, @@ -1887,71 +1729,31 @@ "path": "dist/posthog-rn.d.ts" }, { - "category": "", - "details": null, - "id": "addPendingPromise", + "category": "Initialization", + "description": "Enables or disables debug mode for detailed logging.", + "details": "Debug mode logs all PostHog calls to the console for troubleshooting. This is useful during development to understand what data is being sent.", + "id": "debug", "showDocs": true, - "title": "addPendingPromise", + "title": "debug", "examples": [ { - "id": "addpendingpromise", - "name": "Generated example for addPendingPromise", - "code": "// Generated example for addPendingPromise\nposthog.addPendingPromise();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "Promise", - "name": "promise" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "aliasStateless", - "showDocs": true, - "title": "aliasStateless", - "examples": [ + "id": "enable_debug_mode", + "name": "enable debug mode", + "code": "\n\n// enable debug mode\nposthog.debug(true)\n\n\n" + }, { - "id": "aliasstateless", - "name": "Generated example for aliasStateless", - "code": "// Generated example for aliasStateless\nposthog.aliasStateless();" + "id": "disable_debug_mode", + "name": "disable debug mode", + "code": "\n\n// disable debug mode\nposthog.debug(false)\n\n\n\n" } ], "releaseTag": "public", "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "alias" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, { "description": "", "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" + "type": "boolean", + "name": "enabled" } ], "returnType": { @@ -1962,1014 +1764,47 @@ }, { "category": "", + "description": "* ** SURVEYS *", "details": null, - "id": "aliasStatelessImmediate", + "id": "getSurveysStateless", "showDocs": true, - "title": "aliasStatelessImmediate", + "title": "getSurveysStateless", "examples": [ { - "id": "aliasstatelessimmediate", - "name": "Generated example for aliasStatelessImmediate", - "code": "// Generated example for aliasStatelessImmediate\nposthog.aliasStatelessImmediate();" + "id": "getsurveysstateless", + "name": "Generated example for getSurveysStateless", + "code": "// Generated example for getSurveysStateless\nposthog.getSurveysStateless();" } ], "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "alias" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], + "params": [], "returnType": { - "id": "Promise", - "name": "Promise" + "id": "Promise", + "name": "Promise" }, "path": "dist/posthog-rn.d.ts" }, { - "category": "", + "category": "Initialization", + "description": "Shuts down the PostHog instance and ensures all events are sent.\nCall shutdown() once before the process exits to ensure that all events have been sent and all promises have resolved. Do not use this function if you intend to keep using this PostHog instance after calling it. Use flush() for per-request cleanup instead.", "details": null, - "id": "captureStateless", + "id": "shutdown", "showDocs": true, - "title": "captureStateless", + "title": "shutdown", "examples": [ { - "id": "capturestateless", - "name": "Generated example for captureStateless", - "code": "// Generated example for captureStateless\nposthog.captureStateless();" + "id": "shutdown_before_process_exit", + "name": "shutdown before process exit", + "code": "\n\n// shutdown before process exit\nprocess.on('SIGINT', async () => {\n await posthog.shutdown()\n process.exit(0)\n})\n\n\n\n" } ], "releaseTag": "public", "params": [ { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "event" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", + "description": "Maximum time to wait for shutdown in milliseconds", "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "captureStatelessImmediate", - "showDocs": true, - "title": "captureStatelessImmediate", - "examples": [ - { - "id": "capturestatelessimmediate", - "name": "Generated example for captureStatelessImmediate", - "code": "// Generated example for captureStatelessImmediate\nposthog.captureStatelessImmediate();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "event" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "Initialization", - "description": "Enables or disables debug mode for detailed logging.", - "details": "Debug mode logs all PostHog calls to the console for troubleshooting. This is useful during development to understand what data is being sent.", - "id": "debug", - "showDocs": true, - "title": "debug", - "examples": [ - { - "id": "enable_debug_mode", - "name": "enable debug mode", - "code": "\n\n// enable debug mode\nposthog.debug(true)\n\n\n" - }, - { - "id": "disable_debug_mode", - "name": "disable debug mode", - "code": "\n\n// disable debug mode\nposthog.debug(false)\n\n\n\n" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "enabled" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "enqueue", - "showDocs": true, - "title": "enqueue", - "examples": [ - { - "id": "enqueue", - "name": "Generated example for enqueue", - "code": "// Generated example for enqueue\nposthog.enqueue();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "type" - }, - { - "description": "", - "isOptional": false, - "type": "any", - "name": "_message" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getCustomHeaders", - "showDocs": true, - "title": "getCustomHeaders", - "examples": [ - { - "id": "getcustomheaders", - "name": "Generated example for getCustomHeaders", - "code": "// Generated example for getCustomHeaders\nposthog.getCustomHeaders();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "{\n [key: string]: string;\n }", - "name": "{\n [key: string]: string;\n }" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagDetailsStateless", - "showDocs": true, - "title": "getFeatureFlagDetailsStateless", - "examples": [ - { - "id": "getfeatureflagdetailsstateless", - "name": "Generated example for getFeatureFlagDetailsStateless", - "code": "// Generated example for getFeatureFlagDetailsStateless\nposthog.getFeatureFlagDetailsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagDetailStateless", - "showDocs": true, - "title": "getFeatureFlagDetailStateless", - "examples": [ - { - "id": "getfeatureflagdetailstateless", - "name": "Generated example for getFeatureFlagDetailStateless", - "code": "// Generated example for getFeatureFlagDetailStateless\nposthog.getFeatureFlagDetailStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "key" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - } - ], - "returnType": { - "id": "Promise<{\n response: FeatureFlagDetail | undefined;\n requestId: string | undefined;\n evaluatedAt: number | undefined;\n } | undefined>", - "name": "Promise<{\n response: FeatureFlagDetail | undefined;\n requestId: string | undefined;\n evaluatedAt: number | undefined;\n } | undefined>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagPayloadsStateless", - "showDocs": true, - "title": "getFeatureFlagPayloadsStateless", - "examples": [ - { - "id": "getfeatureflagpayloadsstateless", - "name": "Generated example for getFeatureFlagPayloadsStateless", - "code": "// Generated example for getFeatureFlagPayloadsStateless\nposthog.getFeatureFlagPayloadsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagPayloadStateless", - "showDocs": true, - "title": "getFeatureFlagPayloadStateless", - "examples": [ - { - "id": "getfeatureflagpayloadstateless", - "name": "Generated example for getFeatureFlagPayloadStateless", - "code": "// Generated example for getFeatureFlagPayloadStateless\nposthog.getFeatureFlagPayloadStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "key" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagsAndPayloadsStateless", - "showDocs": true, - "title": "getFeatureFlagsAndPayloadsStateless", - "examples": [ - { - "id": "getfeatureflagsandpayloadsstateless", - "name": "Generated example for getFeatureFlagsAndPayloadsStateless", - "code": "// Generated example for getFeatureFlagsAndPayloadsStateless\nposthog.getFeatureFlagsAndPayloadsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>", - "name": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagsStateless", - "showDocs": true, - "title": "getFeatureFlagsStateless", - "examples": [ - { - "id": "getfeatureflagsstateless", - "name": "Generated example for getFeatureFlagsStateless", - "code": "// Generated example for getFeatureFlagsStateless\nposthog.getFeatureFlagsStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - }, - { - "description": "", - "isOptional": true, - "type": "string[]", - "name": "flagKeysToEvaluate" - } - ], - "returnType": { - "id": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>", - "name": "Promise<{\n flags: PostHogFlagsResponse['featureFlags'] | undefined;\n payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;\n requestId: PostHogFlagsResponse['requestId'] | undefined;\n }>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getFeatureFlagStateless", - "showDocs": true, - "title": "getFeatureFlagStateless", - "examples": [ - { - "id": "getfeatureflagstateless", - "name": "Generated example for getFeatureFlagStateless", - "code": "// Generated example for getFeatureFlagStateless\nposthog.getFeatureFlagStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "key" - }, - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "disableGeoip" - } - ], - "returnType": { - "id": "Promise<{\n response: FeatureFlagValue | undefined;\n requestId: string | undefined;\n }>", - "name": "Promise<{\n response: FeatureFlagValue | undefined;\n requestId: string | undefined;\n }>" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** FEATURE FLAGS *", - "details": null, - "id": "getFlags", - "showDocs": true, - "title": "getFlags", - "examples": [ - { - "id": "getflags", - "name": "Generated example for getFlags", - "code": "// Generated example for getFlags\nposthog.getFlags();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "groups" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "personProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record>", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "Record", - "name": "extraPayload" - }, - { - "description": "", - "isOptional": true, - "type": "boolean", - "name": "fetchConfig" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "getRemoteConfig", - "showDocs": true, - "title": "getRemoteConfig", - "examples": [ - { - "id": "getremoteconfig", - "name": "Generated example for getRemoteConfig", - "code": "// Generated example for getRemoteConfig\nposthog.getRemoteConfig();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** SURVEYS *", - "details": null, - "id": "getSurveysStateless", - "showDocs": true, - "title": "getSurveysStateless", - "examples": [ - { - "id": "getsurveysstateless", - "name": "Generated example for getSurveysStateless", - "code": "// Generated example for getSurveysStateless\nposthog.getSurveysStateless();" - } - ], - "releaseTag": "public", - "params": [], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** GROUPS *", - "details": null, - "id": "groupIdentifyStateless", - "showDocs": true, - "title": "groupIdentifyStateless", - "examples": [ - { - "id": "groupidentifystateless", - "name": "Generated example for groupIdentifyStateless", - "code": "// Generated example for groupIdentifyStateless\nposthog.groupIdentifyStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "groupType" - }, - { - "description": "", - "isOptional": false, - "type": "string | number", - "name": "groupKey" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "groupProperties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - }, - { - "description": "", - "isOptional": true, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "eventProperties" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "description": "* ** TRACKING *", - "details": null, - "id": "identifyStateless", - "showDocs": true, - "title": "identifyStateless", - "examples": [ - { - "id": "identifystateless", - "name": "Generated example for identifyStateless", - "code": "// Generated example for identifyStateless\nposthog.identifyStateless();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "identifyStatelessImmediate", - "showDocs": true, - "title": "identifyStatelessImmediate", - "examples": [ - { - "id": "identifystatelessimmediate", - "name": "Generated example for identifyStatelessImmediate", - "code": "// Generated example for identifyStatelessImmediate\nposthog.identifyStatelessImmediate();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "distinctId" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogEventProperties", - "name": "properties" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "logMsgIfDebug", - "showDocs": true, - "title": "logMsgIfDebug", - "examples": [ - { - "id": "logmsgifdebug", - "name": "Generated example for logMsgIfDebug", - "code": "// Generated example for logMsgIfDebug\nposthog.logMsgIfDebug();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "() => void", - "name": "fn" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "prepareMessage", - "showDocs": true, - "title": "prepareMessage", - "examples": [ - { - "id": "preparemessage", - "name": "Generated example for prepareMessage", - "code": "// Generated example for prepareMessage\nposthog.prepareMessage();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "type" - }, - { - "description": "", - "isOptional": false, - "type": "any", - "name": "_message" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "PostHogEventProperties", - "name": "PostHogEventProperties" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "sendImmediate", - "showDocs": true, - "title": "sendImmediate", - "examples": [ - { - "id": "sendimmediate", - "name": "Generated example for sendImmediate", - "code": "// Generated example for sendImmediate\nposthog.sendImmediate();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "string", - "name": "type" - }, - { - "description": "", - "isOptional": false, - "type": "any", - "name": "_message" - }, - { - "description": "", - "isOptional": true, - "type": "PostHogCaptureOptions", - "name": "options" - } - ], - "returnType": { - "id": "Promise", - "name": "Promise" - }, - "path": "dist/posthog-rn.d.ts" - }, - { - "category": "Initialization", - "description": "Shuts down the PostHog instance and ensures all events are sent.\nCall shutdown() once before the process exits to ensure that all events have been sent and all promises have resolved. Do not use this function if you intend to keep using this PostHog instance after calling it. Use flush() for per-request cleanup instead.", - "details": null, - "id": "shutdown", - "showDocs": true, - "title": "shutdown", - "examples": [ - { - "id": "shutdown_before_process_exit", - "name": "shutdown before process exit", - "code": "\n\n// shutdown before process exit\nprocess.on('SIGINT', async () => {\n await posthog.shutdown()\n process.exit(0)\n})\n\n\n\n" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "Maximum time to wait for shutdown in milliseconds", - "isOptional": true, - "type": "number", - "name": "shutdownTimeoutMs" + "type": "number", + "name": "shutdownTimeoutMs" } ], "returnType": { @@ -2977,34 +1812,6 @@ "name": "Promise" }, "path": "dist/posthog-rn.d.ts" - }, - { - "category": "", - "details": null, - "id": "wrap", - "showDocs": true, - "title": "wrap", - "examples": [ - { - "id": "wrap", - "name": "Generated example for wrap", - "code": "// Generated example for wrap\nposthog.wrap();" - } - ], - "releaseTag": "public", - "params": [ - { - "description": "", - "isOptional": false, - "type": "() => void", - "name": "fn" - } - ], - "returnType": { - "id": "void", - "name": "void" - }, - "path": "dist/posthog-rn.d.ts" } ] } diff --git a/scripts/docs/methods.js b/scripts/docs/methods.js index 885ff80252..960d1bc371 100644 --- a/scripts/docs/methods.js +++ b/scripts/docs/methods.js @@ -31,11 +31,12 @@ const isMethodDeprecated = hasDeprecatedBlock; /** * Collect all public methods from a class and its inheritance chain * @param {any} posthogClass - Starting class + * @param {string} rootClass - Root class name for constructor display * @returns {any[]} - Array of unique public methods */ const collectMethodsWithInheritance = (posthogClass, rootClass) => { if (!posthogClass) return []; - + const allMethods = new Map(); const apiPackage = posthogClass.getAssociatedPackage(); const inheritanceChain = getInheritanceChain(posthogClass, apiPackage); @@ -45,11 +46,14 @@ const collectMethodsWithInheritance = (posthogClass, rootClass) => { const inheritanceResult = currentClass.findMembersWithInheritance(); const members = inheritanceResult.items || []; - const methods = members.filter(member => - (member.kind === ApiItemKind.Method && - !member.name.startsWith('_') ) || - member.kind === ApiItemKind.Constructor - ); + const methods = members.filter(member => { + if (member.kind === ApiItemKind.Constructor) return true; + if (member.kind !== ApiItemKind.Method) return false; + // Exclude private-by-convention (leading _) and protected methods + if (member.name.startsWith('_')) return false; + if (member.isProtected) return false; + return true; + }); // Add methods to map (child methods take precedence over parent methods) methods.forEach(method => {