'use strict' ; import * as api from './api' ; import { safeWait , safeWaitCallback , errorHandler } from './utils' ; import type { NetworkConfiguration , TrackerControllerConfiguration , ReactNativeTracker } from './types' ; param namespace { string } param networkConfig { Object } param control { Array } returns function createTracker ( namespace , networkConfig , controllerConfig = { } ) { const initTrackerPromise = Promise . resolve ( api . createTracker ( { namespace , networkConfig , ... controllerConfig } ) ) ; const mkMethod = safeWait ( initTrackerPromise , errorHandler ) ; const mkCallback = safeWaitCallback ( initTrackerPromise , errorHandler ) ; const trackSelfDescribingEvent = mkMethod ( api . trackSelfDescribingEvent ( namespace ) ) ; const trackScreenViewEvent = mkMethod ( api . trackScreenViewEvent ( namespace ) ) ; const trackStructuredEvent = mkMethod ( api . trackStructuredEvent ( namespace ) ) ; const trackPageViewEvent = mkMethod ( api . trackPageViewEvent ( namespace ) ) ; const trackTimingEvent = mkMethod ( api . trackTimingEvent ( namespace ) ) ; const trackConsentGrantedEvent = mkMethod ( api . trackConsentGrantedEvent ( namespace ) ) ; const trackConsentWithdrawnEvent = mkMethod ( api . trackConsentWithdrawnEvent ( namespace ) ) ; const trackEcommerceTransactionEvent = mkMethod ( api . trackEcommerceTransactionEvent ( namespace ) ) ; const removeGlobalContexts = mkMethod ( api . removeGlobalContexts ( namespace ) ) ; const addGlobalContexts = mkMethod ( api . addGlobalContexts ( namespace ) ) ; const setUserId = mkMethod ( api . setUserId ( namespace ) ) ; const setNetworkUserId = mkMethod ( api . setNetworkUserId ( namespace ) ) ; const setDomainUserId = mkMethod ( api . setDomainUserId ( namespace ) ) ; const setIpAddress = mkMethod ( api . setIpAddress ( namespace ) ) ; const setUseragent = mkMethod ( api . setUseragent ( namespace ) ) ; const setTimezone = mkMethod ( api . setTimezone ( namespace ) ) ; const setLanguage = mkMethod ( api . setLanguage ( namespace ) ) ; const setScreenResolution = mkMethod ( api . setScreenResolution ( namespace ) ) ; const setScreenViewport = mkMethod ( api . setScreenViewport ( namespace ) ) ; const setColorDepth = mkMethod ( api . setColorDepth ( namespace ) ) ; const setSubjectData = mkMethod ( api . setSubjectData ( namespace ) ) ; const getSessionUserId = mkCallback ( api . getSessionUserId ( namespace ) ) ; const getSessionId = mkCallback ( api . getSessionId ( namespace ) ) ; const getSessionIndex = mkCallback ( api . getSessionIndex ( namespace ) ) ; const getIsInBackground = mkCallback ( api . getIsInBackground ( namespace ) ) ; const getBackgroundIndex = mkCallback ( api . getBackgroundIndex ( namespace ) ) ; const getForegroundIndex = mkCallback ( api . getForegroundIndex ( namespace ) ) ; return Object . freeze ( { trackSelfDescribingEvent , trackScreenViewEvent , trackStructuredEvent , trackPageViewEvent , trackTimingEvent , trackConsentGrantedEvent , trackConsentWithdrawnEvent , trackEcommerceTransactionEvent , removeGlobalContexts , addGlobalContexts , setUserId , setNetworkUserId , setDomainUserId , setIpAddress , setUseragent , setTimezone , setLanguage , setScreenResolution , setScreenViewport , setColorDepth , setSubjectData , getSessionUserId , getSessionId , getSessionIndex , getIsInBackground , getBackgroundIndex , getForegroundIndex , } ) ; } param trackerNamespace { string } returns function removeTracker ( trackerNamespace ) { return < Promise < boolean > > api . removeTracker ( trackerNamespace ) . catch ( ( e ) => errorHandler ( e ) ) ; } returns function removeAllTrackers ( ) { return < Promise < boolean > > api . removeAllTrackers ( ) . catch ( ( e ) => errorHandler ( e ) ) ; } export { createTracker , removeTracker , removeAllTrackers , } ; export type { ReactNativeTracker , TrackerControllerConfiguration , NetworkConfiguration , TrackerConfiguration , SessionConfiguration , EmitterConfiguration , SubjectConfiguration , GdprConfiguration , GCConfiguration , SelfDescribing , EventContext , ScreenViewProps , StructuredProps , PageViewProps , TimingProps , ConsentGrantedProps , ConsentWithdrawnProps , EcommerceTransactionProps , EcommerceItem , ConsentDocument , GlobalContext , HttpMethod , DevicePlatform , LogLevel , Basis , BufferOption , ScreenSize , } from './types' ;