declare module 'apps-sdk' { import { Component } from 'react'; import { SpeechResultsEvent } from "@react-native-voice/voice"; export interface SessionData { app: { shortVersion: string; package: string; languageCode: string; regionCode: string; buildVersionNumber: string; }; device: { name: string; systemName: string; systemVersion: string; model: string; }; sandbox: { "domains": string; }; adjust: any; dev: boolean; lowPower: boolean; lang: string; package: string; } export class Session { sessionData: any; sessionID: string | null; isFirstOpen: boolean; isSubscribed: boolean; subscriptionData: any; isDevUser: boolean; forcedUpdate: boolean; init(): Promise; setDebugMode(debugMode: boolean): void; setConfigEndpoint(endpoint: string): void; setUserCreateEndpoint(endpoint: string): void; setBaseUrl(baseUrl: string): void; getCredits(webappUrl: string, websiteId: string): Promise; checkSubscriptionWebapp(webappUrl: string, websiteId: string): Promise; getWebappBasePayload(websiteId: string, additionalData?: any): any; initSession(): Promise; storeSessionStructure(): Promise; checkFirstOpen(): Promise; generateSessionID(): string; checkUserID(): Promise; getSessionData(): any; getSessionID(): string | null; getIsFirstOpen(): boolean; getIsSubscribed(): boolean; getIsDevUser(): boolean; setIsSubscribed(isSubscribed: boolean): void; setSubscriptionData(subscriptionData: any): void; setSubscriptionID(subscriptionID: string): void; setIsDevUser(isDevUser: boolean): void; setUserID(userID: string): void; getUserID(): string | null; setAdjustIDFA(idfa: string): void; getAdjustIDFA(): string; setAdjustGoogleAdid(googleAdid: string): void; getAdjustGoogleAdid(): string; setAdjustAttributionID(attributionID: string): void; getAdjustAttributionID(): string; setAdjustAttribution(attribution: any): void; sendFirstOpen(): Promise; checkSubscription(): Promise; checkSubscription24h(): Promise; isForcedUpdate(): boolean; getDeviceLanguage(): string; getDeviceLanguageAndRegion(): string; getAppVersion(): string; } export class Networking { executeInit(): Promise; setToken(token: string): Promise; request(url: string, data?: any): Promise; setEndpoints(endpoints: any): void; getEndpoints(): any; setEvents(events: any): void; sendEvent(eventType: string, eventKeyword:string, eventData?: object, forceSend?: boolean): Promise; createSubscription(data: any): Promise; checkConnection(): Promise; setImageCompression(compression: any): void; addPendingEvent(event: any): void; sendPendingEvents(): Promise; clearPendingEvents(): void; setPayWallData(payWallData: any): void; getPayWallData(): any; getConfigExtra(): any; getQuickActions(): any; } export class Storage { storeData(key: string, value: any): Promise; getData(key: string): Promise; printAllKeys(): Promise; removeData(key: string): Promise; handleDownloadImage(url: string, filename: string): Promise; handleShareFile(filename: string): Promise; createDir(dirName: string): Promise; handleDownloadImageToCreations(base64Image: string, fileName: string, data: object): Promise<{ directoryUri: string, fileUri: string, fileData: any }>; handleDownloadImageToTMP(base64Image: string, fileName: string): Promise; getCreations(): Promise; deleteCreation(dirName: string): Promise; deleteAllCreations(): Promise; handleDownloadImageToGallery(imageURI: string): Promise; // handleRequestCameraPermission(): Promise; handleRequestGalleryPermission(): Promise; setTrackingPermissionGranted(value: boolean): Promise; setTrackingPermissionFromStorage(): Promise; selectImageFromGallery(galleryNotGrantedTitle: string, galleryNotGrantedMessage: string, cancelText:string, openSettingsText:string, maxPerPick?: number): Promise; removeAllKeys(): Promise; deleteTempFiles(): Promise; compressImage(imageURI: string, maxSizeMB: number): Promise; } export class Utils { isBase64(str: string): boolean; isBase64Image(str: string): boolean; isSpecialEvent(eventKeyword: string): boolean; } export interface RatingConfigOptions { /** Called when the sentiment prompt ("Are you enjoying the app?") should be shown. */ onShowSentimentPrompt: (source: string) => void; /** Called when the feedback form should be shown (user said NO). */ onShowFeedbackForm: () => void; /** Called to track analytics events. */ onTrackEvent: (eventName: string, properties: Record) => void; /** Optional: called after feedback text is submitted. */ onSubmitFeedback?: (feedbackText: string) => Promise; } export class Rating { /** Register UI callbacks. Call once on app startup after initialize(). */ configure(options: RatingConfigOptions): void; /** Load persisted state from storage. Call on app startup. */ initialize(): Promise; /** Trigger rating flow after a successful AI interaction. */ onAIInteractionSuccess(isUserInitiated?: boolean): Promise; /** Trigger rating flow when credits are running low. */ onCreditsRunningLow(currentCredits: number): Promise; /** Trigger rating flow after user downloads or shares a result. */ onResultDownloadedOrShared(actionType: 'download' | 'share'): Promise; /** Directly call StoreReview.requestReview(). */ triggerNativeRating(): Promise; /** Call this when the user taps YES on the sentiment prompt. */ onUserRespondedYes(): Promise; /** Call this when the user taps NO on the sentiment prompt. */ onUserRespondedNo(): void; /** Submit written feedback text. */ submitFeedback(feedbackText: string): Promise; /** Call when the user dismisses the feedback form without submitting. */ onFeedbackCanceled(): void; /** Reset all persisted rating state (for debugging/testing). */ reset(): Promise; /** @deprecated Legacy method — use the new flow methods instead. */ showRatingDialog(force?: boolean): Promise<{ success: boolean; shown: boolean; [key: string]: any }>; } export class NotificationsPush { initialize(): Promise; registerForPushNotificationsAsync(): Promise; getPushNotificationsStatus(): Promise; } export class Voice { startRecognizing( onSpeechStart: () => void, onSpeechRecognized: () => void, onSpeechResults: (results: string[]) => void, onInactivityTimeout: () => void, inactivitySeconds?: number, onVolumeChange?: ((volumeValue: number) => void) | null, onNoSpeech?: (() => void) | null ): Promise; stopRecognizing(): Promise; destroyVoice(): Promise; speak( message: string, language?: string | null, voice?: string | null, onStart?: () => void, onDone?: () => void, onError?: (error: any) => void ): void; stopSpeaking(onStop?: () => void): Promise; } export interface PayWallProps { visible: boolean; onClose: () => void; type: string; keyword: string; } export class PayWall extends Component {} export class PayWallLogic { initializePayWall(): Promise; executePurchase(productID: string): Promise; restorePurchase(): Promise; } export class AdJust { sdkVersion: string | null; attribution: object; initialize(adjustToken?: string, sendAttributionToAdapty?: boolean): Promise; updateAttributionInfo(): void; getAttributionData(): Promise; sendAttributionData(attribution: any): Promise; trackEventIfExist(eventKeyword: string, eventValue?: number): void; storeSubscription(subscriptionData: any): void; getAttribution(): Promise; getAdid(): Promise; getIdfa(): Promise; getGoogleAdId(): Promise; getSDKVersion(): void; } export class MixPanel { initialize(token?: string, trackAutomaticEvents?: boolean, useNative?: boolean, devMode?: boolean): Promise; getDistinctID(): Promise; trackEvent(event: string, properties?: object, forceSend?: boolean): Promise; trackEventIfExist(eventKeyword: string, eventData?: object): Promise; isMixpanelInitialized(): boolean; superProperties(properties: object): Promise; superPropertiesAppend(properties: object): Promise; identifyUser(userID: string): Promise; resetUserID(): Promise; setUserProperties(properties: any): Promise; disableTracking(): Promise; enableTracking(): Promise; } type PaywallEventHandlers = { onCloseButtonPress?: () => void; onAndroidSystemBack?: () => void; onPurchaseStarted?: (product: any) => void; onPurchaseCompleted?: (purchaseResult: any, product: any) => void; onPurchaseFailed?: (error: any) => void; onRestoreStarted?: () => void; onRestoreCompleted?: (profile: any) => void; onRestoreFailed?: (error: any, product: any) => void; onProductSelected?: (productId: string) => void; onRenderingFailed?: (error: any) => void; onLoadingProductsFailed?: (error: any) => void; onUrlPress?: (url: string) => void; onCustomAction?: (action: string, data: any) => void; }; type OnboardingEventHandlers = { onAnalytics?: (event: any, meta: any, remoteConfig?: any) => void; onClose?: (actionId: string, meta: any, remoteConfig?: any) => Promise | boolean; onCustom?: (actionId: string, meta: any, remoteConfig?: any) => void; onPaywall?: (actionId: string, meta: any, remoteConfig?: any) => void; onStateUpdated?: (action: any, meta: any, remoteConfig?: any) => void; onFinishedLoading?: (meta: any, remoteConfig?: any) => void; onError?: (error: any, remoteConfig?: any) => void; onRemoteConfigLoaded?: (remoteConfig: any) => void; onModalDismissed?: () => void; }; export interface AdaptyOnboardingProps { visible: boolean; placementID: string; lang: string; preloadedOnboarding?: any; loaderMaskColor?: string; // Color of the mask that hides WebView loader (default: '#121212') loaderMaskDelay?: number; // Delay in ms before showing content (default: 300ms) onAnalytics?: (event: any, meta: any, remoteConfig?: any) => void; onClose?: (actionId: string, meta: any, remoteConfig?: any) => Promise | boolean; onCustom?: (actionId: string, meta: any, remoteConfig?: any) => void; onPaywall?: (actionId: string, meta: any, remoteConfig?: any) => void; onStateUpdated?: (action: any, meta: any, remoteConfig?: any) => void; onFinishedLoading?: (meta: any, remoteConfig?: any) => void; onError?: (error: any, remoteConfig?: any) => boolean | void; onRemoteConfigLoaded?: (remoteConfig: any) => void; onModalDismissed?: () => void; } export class AdaptyOnboarding extends Component { } export class Adapty { initialize(apiKey: string): Promise; getPaywallForPlacement(placementID: string, lang: string): Promise; isActivated(): Promise; createPaywallView(paywall: any): Promise; showPaywall(placementID: any, lang: any, eventHandlers?: PaywallEventHandlers): Promise; preloadPaywall(placementID: any, lang: any): Promise showPaywallPreloaded(paywallView: any, eventHandlers?: PaywallEventHandlers): Promise; checkPlacementExists(placementID: any, lang: any): Promise; getProfile(): Promise; updateAdjustAttributionData(attribution: any): Promise; setAdjustIntegrationIdentifier(adjustIntegrationIdentifier: string): Promise; setMixpanelIntegrationIdentifier(mixpanelIntegrationIdentifier: string): Promise; setFirebaseIntegrationIdentifier(firebaseIntegrationIdentifier: string): Promise; closePaywall(): Promise; getOnboardingForPlacement(placementID: string, lang: string): Promise; createOnboardingView(onboarding: any): Promise; showOnboarding(placementID: string, lang: string, eventHandlers?: OnboardingEventHandlers): Promise; checkOnboardingExists(placementID: string, lang: string): Promise; closeOnboarding(): Promise; showOnboardingPreloaded(onboardingView: any, eventHandlers?: OnboardingEventHandlers): Promise; closePaywallFromView(paywallView: any): Promise; } export class TrackingTransparency { requestTrackingTransparencyPermission(): Promise; getAdvertisingIdentifier(): Promise; getTrackingTransparencyPermission(): Promise; } export class HomeActions { setItems(items: any): Promise; itemCallback(itemCallbackFunction: any): Promise; } export class Facebook { initialize(appId?: string, clientToken?: string, debugMode?: boolean, devMode?: boolean): Promise; trackEvent(eventName: string, properties?: object): Promise; trackEventIfExist(eventKeyword: string, eventData?: object): Promise; trackPurchase(valueToSum: number, currency: string, parameters?: object): Promise; trackStartTrial(parameters?: object): Promise; trackPushNotificationOpen(payload?: object): Promise; isFacebookInitialized(): boolean; getApplicationId(): string | null; } export class Legal { getLegalText(web_id: string, type: 'tc' | 'contact' | 'privacy_policy' | 'refund_policy' | 'faqs', lang: string): Promise; } export class Firebase { initialize(): Promise; getAppInstanceId(): Promise; logEvent(eventName: string, params?: object): Promise; setUserId(userId: string): Promise; setUserProperty(name: string, value: string): Promise; } // ─── Authentication ──────────────────────────────────────────────────────── export interface AuthApiResult { success: boolean; data?: T; error?: string; code?: number; message?: string; raw?: any; } export interface AuthLoginPayload { /** Email or username */ login?: string; /** Credential (alias for login) */ credential?: string; /** Password */ password: string; /** Optional website ID (defaults to config value) */ websiteid?: string; } export interface AuthRegisterPayload { /** Email or username */ login?: string; /** Email (alias for login) */ email?: string; /** Password */ password: string; /** Optional website ID (defaults to config value) */ websiteid?: string; } export interface AuthRegisterAndLinkPayload { email: string; password: string; } export interface AuthLinkUserPayload { /** Web user ID */ user_id: string; /** Mobile app user ID */ app_user_id: string; } export interface AuthCheckLinkPayload { user_id: string; app_user_id: string; } export interface AuthCheckSubscriptionPayload { user_id: string; app_user_id: string; } export interface AuthValidatePhonePayload { phoneNumber: string; countryCode: string; } export interface AuthRequestPasswordResetPayload { credential: string; } export interface AuthVerifyResetCodePayload { code: string; } export interface AuthResetPasswordPayload { resetToken: string; newPassword: string; } export interface AuthResendCodePayload { credential: string; } export interface AuthValidateQrCodePayload { qrData: string; } export interface AuthLinkWithQrCodePayload { user_id: string; } export interface AuthUserData { us_id: string | number; us_login?: string; login?: string; metadata?: Record | any[]; subscription_data?: AuthSubscriptionData; success?: number; } export interface AuthSubscriptionData { subscription_active?: boolean; [key: string]: any; } export interface AuthLinkedUserData { success: number; linked: boolean; items?: AuthUserData[]; } export interface AuthRegisterAndLinkResult { success: boolean; user?: AuthUserData; linked?: boolean; error?: string; code?: number; } export interface AuthQrValidationData { valid: boolean; user_id?: string; } export interface AuthQrLinkData { linked: boolean; message?: string; subscriptionActive?: boolean; } export interface AuthCallApiOptions { retries?: number; timeoutMs?: number; silent?: boolean; } export class Authentication { AUTH_API_BASE_URL: string; USER_API_BASE_URL: string; CHATCONNECT_API_BASE_URL: string; /** Get website ID from config */ getWebsiteId(): string; /** Get app user ID from session */ getAppUserId(): string; /** * Generic API call helper with retry logic. */ callApi(url: string, payload: object, opts?: AuthCallApiOptions): Promise; /** * Login with credentials. * POST /auth/auth-user */ login(payload: AuthLoginPayload): Promise>; /** * Register a new user account. * POST /chatconnect/create-user */ register(payload: AuthRegisterPayload): Promise>; /** * Complete registration flow: create-user → link-user. */ registerAndLinkAccount(payload: AuthRegisterAndLinkPayload): Promise; /** * Link a user account. * POST /user/link */ linkUser(payload: AuthLinkUserPayload): Promise>; /** * Fetch authenticated user profile using stored credentials. */ fetchUserProfile(): Promise>; /** * Check if user account is linked (using stored data). */ isAccountLinked(): Promise; /** * Get stored auth user login (email). */ getStoredUserLogin(): Promise; /** * Check if user is linked. * POST /user/check-link */ checkLink(payload: AuthCheckLinkPayload): Promise; /** * Check user subscription status. * POST /user/check-subs */ checkSubscription(payload: AuthCheckSubscriptionPayload): Promise; /** * Check if a credential exists (stub for backward compatibility). */ checkCredential(payload: { credentialType: string; [key: string]: any }): Promise>; /** * Validate phone number (client-side). */ validatePhone(payload: AuthValidatePhonePayload): Promise>; /** * Request password reset (stub). */ requestPasswordReset(payload: AuthRequestPasswordResetPayload): Promise>; /** * Verify reset code (stub). */ verifyResetCode(payload: AuthVerifyResetCodePayload): Promise>; /** * Reset password (stub). */ resetPassword(payload: AuthResetPasswordPayload): Promise>; /** * Resend verification code (stub). */ resendCode(payload: AuthResendCodePayload): Promise>; /** * Validate QR code data. */ validateQrCode(payload: AuthValidateQrCodePayload): Promise>; /** * Link account using QR code. * POST /user/link */ linkWithQrCode(payload: AuthLinkWithQrCodePayload): Promise>; /** * Logout current user (clears stored auth data). */ logout(): Promise>; /** * Check if user is currently authenticated (has stored user ID). */ isAuthenticated(): Promise; /** * Get stored user ID. */ getStoredUserId(): Promise; /** * Get stored user metadata. */ getStoredUserMetadata(): Promise | null>; /** * Get stored subscription data. */ getStoredSubscription(): Promise; } export class AppsSDK { initializePushNotifications(): Promise; } export interface AppsSDK { initializePushNotifications(): Promise; getPushNotificationsStatus(): Promise; networking : Networking; storage : Storage; session : Session; utils : Utils; paywall : PayWall; adaptyOnboarding : typeof AdaptyOnboarding; rating : Rating; adjust : AdJust; mixpanel : MixPanel; tracking : TrackingTransparency; paywallLogic : PayWallLogic; /** @deprecated Use `notifications` instead */ notificationsPush : NotificationsPush; notifications : NotificationsPush; voice : Voice; adapty : Adapty; homeActions : HomeActions; facebook : Facebook; firebase : Firebase; legal : Legal; authentication : Authentication; } const Core: AppsSDK; export default Core; }