import type { AppEventExternalId, PublicCommandPayload } from "@getuserfeedback/protocol"; import type { ActionRegistration, ActionsConfig, CapabilitiesInput, ConfigureOptions, EventOptions, EventProperties, FlagsInput, GraphOperations, InitOptions, LinksConfig, OpenRequestedCallback } from "@getuserfeedback/sdk"; export type { ActionsConfig, CapabilitiesInput, ConfigureOptions, EventOptions, EventProperties, FlagsInput, GraphOperations, GraphRelationship, GraphRelationshipRef, LinkRequest, LinkRouter, LinksConfig, OpenRequestedCallback, OpenRequestedEvent, TrackOptions, } from "@getuserfeedback/sdk"; type IdentifyTraits = Record; type OpenCommand = Extract; type PrerenderCommand = Extract; type IdentifyOptions = { externalIds?: AppEventExternalId[]; }; export type OpenFlowOptions = Pick; export type PrerenderFlowOptions = Pick; type CommandOptions = { /** * @deprecated Omit this option. The SDK owns command identity and transport * correlation. */ idempotencyKey?: string; }; /** A customer-defined action implemented by the React Native host app. */ export type NativeActionRegistration = Extract; /** React Native provider initialization options. */ export type ClientOptions = Omit & { /** Routes authored HTTP(S) links through the native app. */ links?: LinksConfig | undefined; /** * Widget actions implemented by the current app version. Prefer the grouped * configuration; the registration array remains for compatibility. */ actions?: ActionsConfig | NativeActionRegistration[] | undefined; /** Capabilities supported by the current app version. */ capabilities?: CapabilitiesInput | undefined; /** Feature flag evaluations supplied during initialization. */ flags?: FlagsInput | undefined; /** * @deprecated Omit this option. The provider stamps canonical React Native * client metadata. */ clientMeta?: InitOptions["clientMeta"]; /** * @deprecated Internal runtime override. Application code should use the * SDK's pinned runtime. */ runtimeEndpoints?: InitOptions["runtimeEndpoints"]; }; /** Operations for one on-demand flow lifecycle. */ export interface FlowRun { readonly flowId: string; /** Opens the flow. The flow must be published with Widget / On-demand delivery. */ open: (options?: OpenFlowOptions) => Promise; /** Loads the flow's network resources before it opens. */ prefetch: () => Promise; /** Loads the flow and warms its UI before it opens. */ prerender: (options?: PrerenderFlowOptions) => Promise; /** Closes this flow lifecycle. */ close: () => Promise; } /** * Public client exposed by `useGetUserFeedback`. * * @see https://getuserfeedback.com/docs/get-started/react-native-sdk * @see https://getuserfeedback.com/docs/reference/react-native-sdk-reference */ export interface Client { /** * @deprecated Runtime identity is SDK-owned. Do not persist or branch on this * value. */ readonly instanceId: string; /** * Updates authentication, consent, and other client configuration. Await the * returned promise or handle its rejection when applying runtime updates. * * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth */ configure: (opts: ConfigureOptions, options?: CommandOptions) => Promise; /** * Associates the current user with a user ID, traits, and optional external * IDs. Some invalid arguments throw synchronously; other validation or * command-processing failures reject the returned promise. * * @see https://getuserfeedback.com/docs/guides/identity-resolution */ identify: { (userId: string, traits?: IdentifyTraits, options?: IdentifyOptions): Promise; (traits: IdentifyTraits, placeholder: undefined, options?: IdentifyOptions): Promise; (traits: IdentifyTraits, options?: IdentifyOptions): Promise; }; /** * Records a product event for targeting and analysis. Some invalid arguments * throw synchronously; other validation or command-processing failures reject * the returned promise. */ track: (eventName: string, properties?: EventProperties, options?: EventOptions) => Promise; /** * Records a named application screen for targeting and analysis. Some invalid * arguments throw synchronously; other validation or command-processing * failures reject the returned promise. */ screen: (name: string, properties?: EventProperties, options?: EventOptions) => Promise; /** Records directed relationship observations through the analytics pipeline. */ graph: GraphOperations; /** Returns the controller for one on-demand flow lifecycle. */ flow: (flowId: string) => FlowRun; /** Closes every open flow owned by this provider. */ close: () => Promise; /** * Subscribe to explicit SDK and client-side targeting open requests, or * suppress them, for example when the user should not be interrupted. * Prevention applies only to that presentation attempt; it does not create a * public retry schedule. * * @example Suppress open requests while the user is busy * ```ts * client.onOpenRequested((event) => { * if (userIsBusy()) { * event.preventDefault(); * } * }); * ``` */ onOpenRequested: (callback: OpenRequestedCallback) => () => void; /** Closes all open flows, clears JWT authentication, and resets user identity. */ reset: (options?: CommandOptions) => Promise; }