import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, d as ServerTrackOptions } from './shared-B8y8fJCD.cjs'; export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE } from './shared-B8y8fJCD.cjs'; /** * Update a user's person properties from the server - a payment webhook, a * plan change, a cron. Same signature as the browser `setIdentity`; the * `userId` must be the SAME stable internal id the app passes client-side, * that is what joins the two. * * Sends immediately and resolves when ingest answered - `await` it so a * serverless handler cannot freeze mid-send. Never throws: a failure logs * a `[HeyCatch]` console error and resolves, so an analytics hiccup cannot * fail the caller's webhook. */ declare function setIdentity(userId: string, properties?: HeyCatchPersonProperties, propertiesOnce?: HeyCatchPersonProperties): Promise; /** * Server signature exists only for API parity. A server process has no * ambient person to update - say WHO via `setIdentity(userId, properties)` * (or `trackEvent(..., { userId, set })`). */ declare function setPersonProperties(_set?: HeyCatchPersonProperties, _setOnce?: HeyCatchPersonProperties): void; /** * No-op on the server: sessions are a browser concept; there is nothing to * reset in a stateless process. Exists so isomorphic sign-out code that * imports `resetIdentity` resolves under the node condition too. */ declare function resetIdentity(): void; /** * Initialize the server entry. Call once at module scope; idempotent. * Takes the same config shape as the browser `init` - `install` metadata * is accepted for symmetry but not stamped: install facts describe the * client app, and the events they ride on are client events. */ declare function init(config: HeyCatchConfig): void; /** * Record a business event from the server - a completed payment, a * subscription change, anything only the backend knows for sure. Requires * `options.userId` (there is no ambient person in a webhook); `set` / * `setOnce` attach person property updates to the same request. * * Sends immediately, never throws - same contract as `setIdentity`. */ declare function trackEvent(event: string, properties: HeyCatchProperties | undefined, options: ServerTrackOptions): Promise; /** * The server entry. Conditional `exports` route a bare `@heycatch/sdk` * import here on Node and to the browser bundle everywhere else, so the * customer-facing API is ONE surface - same names, environment-appropriate * implementation. `@heycatch/sdk/server` resolves here explicitly. * * Wraps posthog-node (bundled, like posthog-js in the browser entry) in * IMMEDIATE mode only: every send is one awaited request via * `captureImmediate`, never the batching default. Batching is wrong for * our callers - webhooks on serverless, where a buffered event dies with * the frozen function unless someone remembers to flush; an awaited send * has nothing to forget. * * There is no server-side autocapture - a server has no DOM to observe. * This entry carries what only the backend knows: identity and business * events (plan changes, payments, subscriptions), which also makes them * immune to adblockers and client tampering. */ /** * The same-shaped `analytics` namespace as the browser entry - one API * surface under every `exports` condition (see src/web/index.ts). */ declare const analytics: { readonly init: typeof init; readonly resetIdentity: typeof resetIdentity; readonly setIdentity: typeof setIdentity; readonly setPersonProperties: typeof setPersonProperties; readonly trackEvent: typeof trackEvent; }; export { HeyCatchConfig, HeyCatchPersonProperties, HeyCatchProperties, ServerTrackOptions, ServerTrackOptions as TrackOptions, analytics };