UNPKG

@overhyped-ai/connect

Version:

Embed Overhyped AI's widget seamlessly for user activation - Activate Every. Single. User.

68 lines (67 loc) 2.3 kB
declare global { interface Window { OverhypedAI?: OverhypedAIMethods; } } export type UserIdentifierType = 'email'; export type UserIdentifier = { type: UserIdentifierType; value: string; }; export declare type CustomMetadata = { subscriptionPlan: string | 'other'; firstName?: string; lastName?: string; role?: string; company?: string; /** * The user's creation date in ISO 8601 format (e.g., "2025-11-15T09:00:00.000Z"). * If provided, users created before the widget integration will not see the Activation modal. */ userCreatedAt?: string; } & Record<string, unknown>; export interface OverhypedAIOptions { /** * Connect by default when user is initialized. * Defaults to true. */ autoConnect?: boolean; } export declare type OverhypedAIWidgetOptions = { /** * Offet to move the widget from its default position on the screen. * Defaults to { x: 0, y: 0 }. */ positionOffset?: { x?: number | string; y?: number | string; }; } & Record<string, unknown>; export interface OverhypedAIMethods { <M extends keyof OverhypedAIMethods>(method: M, ...args: Parameters<OverhypedAIMethods[M]>): void; /** * Initialize the session with your unique Client Key * * @param orgToken Unique key corresponding to the OverhypedAI organization */ initOrg(orgToken: string, options?: OverhypedAIOptions): void; /** * Initialize the user with their details on login. * * @param identifier Object containing the type of identifier ('email' for now) and its value * @param customMetadata Object containing any serializable info of the user */ initUser(identifier: UserIdentifier, customMetadata: CustomMetadata, widgetOptions?: OverhypedAIWidgetOptions): void; /** * Connect the user to the dashboard. * If autoConnect is set to false in initOrg, this method should be called to connect the user. */ connect(widgetOptions?: OverhypedAIWidgetOptions): void; /** * Disconnect the user to the dashboard. * This method should be called to disconnect the user on events like logout. */ disconnect(): void; } declare const _default: OverhypedAIMethods; export default _default;