import React from 'react'; import { type TrainingScreenMode } from './UniversalOnboarding'; /** * What data types the user authorized (from backend) * Matches backend JWT payload structure */ export interface AuthorizedData { basic: boolean; personality?: boolean; preferences?: boolean; rawMemories?: boolean; fastTraits?: boolean; wrappedTraits?: boolean; } /** * Training status from backend */ export interface TrainingStatus { /** If true, traits are ready to fetch immediately. If false, training is in progress. */ ready: boolean; /** URL to poll for training status (when ready=false) */ statusUrl?: string; /** Recommended polling interval in milliseconds */ pollIntervalMs?: number; neverTrained?: boolean; lastPayload?: any; regenerationInFlight?: boolean; traitsComplete?: boolean; } /** * Result object passed to onComplete callback * Matches npm SDK structure */ export interface OnairosResult { /** Auth token for API calls - always included */ token: string; /** API endpoint URL - always included */ apiUrl: string; /** Data types user approved: ['basic', 'preferences', 'personality', 'rawMemories'] */ approved: string[]; /** User data object */ userData: { email?: string; username?: string; connectedAccounts: string[]; skipped?: boolean; }; /** Fetched traits/insights - only present when autoFetch=true and training.ready=true */ apiResponse?: any; /** Raw platform data (e.g. sephora purchases/loves) keyed by platform name */ platformData?: Record; /** What data types the user authorized (from backend) */ authorizedData?: AuthorizedData; /** * Training status - use this to poll if training.ready=false * When backgroundLoadData=true and training.ready=false, SDK returns immediately * and developer should poll training.statusUrl until ready, then fetch from apiUrl */ training?: TrainingStatus; } export interface OnairosButtonProps { AppName: string; buttonType?: 'normal' | 'pill'; buttonWidth?: number; buttonHeight?: number; hasStroke?: boolean; enabled?: boolean; buttonForm?: 'default' | 'login' | 'signup' | 'connect'; /** * Callback when authentication completes successfully. * * When autoFetch=true: result.apiResponse contains the fetched traits/insights. * When autoFetch=false: Use result.apiUrl + result.token to make your own API call. * * @example * // autoFetch=false - make your own API call * onComplete={(result) => { * fetch(result.apiUrl, { * headers: { Authorization: `Bearer ${result.token}` } * }); * }} * * // autoFetch=true - data already fetched * onComplete={(result) => { * console.log(result.apiResponse.traits); * }} */ onComplete?: (result: OnairosResult) => void; /** @deprecated Use onComplete(result) instead. */ onResolved?: (apiUrl: string, token: string, userData: any) => void; onRejection?: (error: any) => void; preCheck?: () => Promise; color?: string; swerv?: boolean; darkMode?: boolean; returnLink?: string; /** @deprecated Use priorityPlatform. Kept as a compatibility alias. */ preferredPlatform?: string | string[]; /** Platform to prioritize in the connector/auth flow. */ priorityPlatform?: string | null; /** If true, SDK automatically fetches approved data before onComplete. Defaults to true. */ autoFetch?: boolean; /** * If true, training runs in background without showing training UI. * - backgroundLoadData=false (default): Shows training progress UI to user * - backgroundLoadData=true: Skips training UI, returns immediately with training.statusUrl * (if autoFetch=true, SDK polls in background then returns apiResponse when ready) */ backgroundLoadData?: boolean; /** Controls the SDK training/loading UI style. Defaults to "fast", or "none" when backgroundLoadData=true. */ trainingScreenMode?: TrainingScreenMode; /** If true, trait generation is capped to a smaller chunk count for faster completion. */ fastTraits?: boolean; /** Close the SDK modal after consent completion. Defaults to true. */ closeOnConsent?: boolean; /** Optional reasoning shown on the insufficient-data training warning. */ insufficientDataReasoning?: string | null; /** Ask backend inference to return MBTI preference output when preferences is approved. */ preferencesMbti?: boolean; inferenceData?: any; textLayout?: 'left' | 'right' | 'center'; textColor?: string; /** @deprecated Internal legacy proof UI flag. */ proofMode?: boolean; webpageName?: string; debug?: boolean; /** @deprecated Internal/test-only flow control. Do not use in normal integrations. */ testMode?: boolean; requestData?: any; onPress?: () => void; primaryAuthOnly?: boolean; useNewWelcomeFlow?: boolean; /** Filter which platforms to show. If not provided, shows all platforms. Order is preserved. */ allowedPlatforms?: string[]; /** Platforms to show "Highly Recommended" badge next to. */ recommendedPlatforms?: string[]; /** Optional custom explainer copy shown before onboarding starts. */ dataUsageDescription?: string; /** Optional signup attribution metadata forwarded to SDK auth endpoints. */ signupAttribution?: Record | string | null; /** Optional explicit developer API key. Enables button-level SDK initialization. */ apiKey?: string; /** Internal test-only bypass for API key initialization. */ skipApiKeyInitialization?: boolean; } export interface OnairosButtonRef { trigger: () => Promise; reset: () => Promise; } export declare const OnairosButton: React.ForwardRefExoticComponent>; export default OnairosButton; //# sourceMappingURL=OnairosButton.d.ts.map