import { FirebaseAnalyticsTypes } from '@react-native-firebase/analytics'; import { ConversionData } from 'react-native-appsflyer'; type FacebookSDK = typeof import("react-native-fbsdk-next"); type AmplitudeSDK = typeof import("@amplitude/react-native"); type AppsFlyerSDK = typeof import("react-native-appsflyer"); type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; declare enum APP_EVENT { APP_START = "app_start", VIEW_SCREEN = "view_screen", VIEW_OVERLAY = "view_overlay", VIEW_MODAL = "view_modal", CHANGE_APP_STATE = "change_app_state", CHANGE_STACK_ROOT = "change_stack_root", USER_SIGN_IN = "user_sign_in", USER_SIGN_UP = "user_sign_up", PURCHASE = "purchase", PURCHASE_TRIAL = "purchase_trial", AD_SHOW = "custom_ad_show", AD_CLICK = "custom_ad_click", PUSH_NOTIFICATION_OPEN = "push_notification_open", PUSH_NOTIFICATION_INITIAL = "push_notification_initial", DEEP_LINK_OPEN = "deep_link_opened", DEEP_LINK_INITIAL = "deep_link_initial" } interface IAnalyticsParams { sdk: { facebook?: FacebookSDK; amplitude?: AmplitudeSDK; appsflyer?: AppsFlyerSDK['default']; }; amplitudeToken?: string; appsFlyerToken?: string; appsFlyerId?: string; hasRegisterDeepLinkListeners?: boolean; isEnableCollection?: boolean; isATT?: boolean; onATT?: (isAllow: boolean) => void; onTrackUser?: (user: Record, params: { google: FirebaseAnalyticsTypes.Module; amplitude?: InstanceType; fb?: FacebookSDK['AppEventsLogger']; appsFlyer?: AppsFlyerSDK['default']; }) => boolean; onTrackEvent?: (eventName: string, props: Record, params: { google: FirebaseAnalyticsTypes.Module; amplitude?: ReturnType; appsFlyer?: AppsFlyerSDK['default']; fb?: FacebookSDK['AppEventsLogger']; }) => void; } /** * Application analytics */ declare class Analytics { /** * @protected */ protected static instance: Analytics | null; /** * Analytics available SDK's */ protected sdk: IAnalyticsParams['sdk']; /** * Disable analytics * @protected */ protected isDisabled: boolean | undefined; /** * Production env */ protected isProd: boolean; /** * Amplitude token */ protected amplitudeToken?: string; /** * AppsFlyer token */ protected appsFlyerToken?: string; /** * AppsFlyer app id */ protected appsFlyerId?: string; /** * Registered deep ling listeners */ protected unsubscribeDeepLinkListeners: () => void; /** * @private */ private logger?; /** * Enable check app tracking transparency */ protected isATT: boolean; /** * Enable automatically analytic collection */ protected isEnableCollection: boolean; /** * ATT status * @protected */ protected hasAllowATT: boolean | null; /** * Trigger when ATT resolves * @protected */ protected onATT: IAnalyticsParams['onATT']; /** * Extra user set callback * @protected */ protected onTrackUser: IAnalyticsParams['onTrackUser']; /** * Extra event callback * @protected */ protected onTrackEvent: IAnalyticsParams['onTrackEvent']; /** * @protected */ protected static deepLinkData: ConversionData['data'] | null; /** * @constructor * @private */ /** * @constructor * @private */ private constructor(); /** * Init analytics */ /** * Init analytics */ static init({ hasRegisterDeepLinkListeners, ...params }: IAnalyticsParams): ReturnType; /** * Get instance */ /** * Get instance */ static get(): Analytics; /** * Add deep link listeners */ /** * Add deep link listeners */ protected registerDeepLinkListeners(): () => void; /** * Get ATT status */ /** * Get ATT status */ getATTStatus(): boolean | null; /** * Initialize analytics, show permission modals * @protected */ /** * Initialize analytics, show permission modals * @protected */ protected initialize(): Promise; /** * Initial check ATT * Enable analytic collection only for production */ initialATT: () => Promise; /** * Check APP TRACKING TRANSPARENCY */ /** * Check APP TRACKING TRANSPARENCY */ protected checkATT(): Promise; /** * Set user */ /** * Set user */ protected setUser(user: Record): void; /** * Track event * @protected */ /** * Track event * @protected */ protected setEvent(eventName: string, props?: Record): void; /** * Set user identity to analytics */ /** * Set user identity to analytics */ static trackUser(user: Record): void; /** * Track application event */ /** * Track application event */ static trackEvent(eventName: string, props?: Record): void; } export { APP_EVENT, Analytics };