import { LogChannel, LogLevel } from '@heap/heap-javascript-bridge-support'; import { logToConsole, registerAutocapture, setLogChannel, setLogLevel as setPALogLevel, startWithAutocapture } from './autocapture/csqAutocapture'; import { handleUrl, start as legacyStart } from './core/core'; import { csEventSubscriber } from './core/csEventSubscriber'; import { configureProductAnalytics } from './core/csqCore'; import { handleFeatureFlags } from './core/featureFlags/featureFlagHandler'; import { getLogLevel, setLogLevel } from './core/logging/logUtils'; import CSQMethodFilter from './csq/CSQMethodFilter'; import { ErrorAnalysis } from './error/ErrorAnalysis'; import { identify, optIn, optOut, resetIdentity, sendUserIdentifier, } from './privacy/csqPrivacy'; import { getUserId, optIn as legacyOptIn, optOut as legacyOptOut, sendUserIdentifier as legacySendUserIdentifier, } from './privacy/user'; import { setDefaultMasking } from './replay/csqSessionReplay'; import { CSMask } from './replay/masking/CSMask'; import { setDefaultMasking as legacySetDefaultMasking, onSessionReplayLinkChange, } from './replay/sessionReplay'; import { setUrlMaskingPatterns, triggerNativeCrash, } from './error/csqErrorTracking'; import { onMetadataChange } from './metadata/csqMetadata'; import { CSQMask } from './replay/csqMasking/CSQMask'; import { withCSQMask } from './replay/csqMasking/withCSQMask'; import { Currency } from './tracking/constants'; import { trackEvent, trackScreenview, trackTransaction, } from './tracking/csqEventTracking'; import { addEventProperties, addUserProperties, clearEventProperties, removeEventProperty, } from './tracking/csqPropertyTracking'; import { addDynamicVar, pauseTracking, resumeTracking, stop, } from './tracking/csqTracking'; import { CSReliableTarget } from './tracking/CSReliableTarget'; import { resumeTracking as legacyResumeTracking, send, sendDynamicVar, sendTransaction, stopTracking, } from './tracking/tracking'; import { CustomVar, EventSubscriberType } from './types/types'; import { CSQWebView } from './webview/CSQWebView'; import { CSWebView } from './webview/CSWebView'; // Listen for remote feature flags using an event emitter csEventSubscriber(EventSubscriberType.GET_FEATURE_FLAG, handleFeatureFlags); /** * While we are in the transition face, overriding the method call allow us to test the new implementation * turn of overriding when the new implementation is stable */ const ContensquareSDK = { start: () => { CSQMethodFilter.callStartMethod(legacyStart, 'default'); }, handleUrl: CSQMethodFilter.executeMethodIfAllowed(handleUrl, 'default'), getUserId: CSQMethodFilter.executeMethodIfAllowed(getUserId, 'default'), optIn: CSQMethodFilter.executeMethodIfAllowed(legacyOptIn, 'default'), optOut: CSQMethodFilter.executeMethodIfAllowed(legacyOptOut, 'default'), resumeTracking: CSQMethodFilter.executeMethodIfAllowed( legacyResumeTracking, 'default' ), stopTracking: CSQMethodFilter.executeMethodIfAllowed(stopTracking, 'default'), send: CSQMethodFilter.executeMethodIfAllowed(send, 'default'), sendTransaction: CSQMethodFilter.executeMethodIfAllowed( sendTransaction, 'default' ), sendDynamicVar: CSQMethodFilter.executeMethodIfAllowed( sendDynamicVar, 'default' ), setDefaultMasking: CSQMethodFilter.executeMethodIfAllowed( legacySetDefaultMasking, 'default' ), onSessionReplayLinkChange: CSQMethodFilter.executeMethodIfAllowed( onSessionReplayLinkChange, 'default' ), sendUserIdentifier: CSQMethodFilter.executeMethodIfAllowed( legacySendUserIdentifier, 'default' ), }; /** * Contentsquare * exports public functions */ export default ContensquareSDK; /** * CSMask, CSReliableTarget, CSWebView, Currency, CustomVar, ErrorAnalysis, CSQMask, withCSQMask, CSQWebView * @exports CSMask * @exports CSReliableTarget * @exports CSWebView * @exports Currency * @exports CustomVar * @exports ErrorAnalysis * @exports CSQMask * @exports withCSQMask * @exports CSQWebView */ export { CSMask, CSQMask, CSQWebView, CSReliableTarget, CSWebView, Currency, CustomVar, ErrorAnalysis, withCSQMask }; /** * @internal * Internal API object that will not appear in the .d.ts file */ export const ContentsquareInternals = { getLogLevel, setLogLevel, }; export const CSQ = { start: () => { CSQMethodFilter.callStartMethod(startWithAutocapture, 'CSQ'); }, handleUrl: CSQMethodFilter.executeMethodIfAllowed(handleUrl, 'CSQ'), optIn: CSQMethodFilter.executeMethodIfAllowed(optIn, 'CSQ'), optOut: CSQMethodFilter.executeMethodIfAllowed(optOut, 'CSQ'), resumeTracking: CSQMethodFilter.executeMethodIfAllowed(resumeTracking, 'CSQ'), setDefaultMasking: CSQMethodFilter.executeMethodIfAllowed( setDefaultMasking, 'CSQ' ), onSessionReplayLinkChange: CSQMethodFilter.executeMethodIfAllowed( onSessionReplayLinkChange, 'CSQ' ), sendUserIdentifier: CSQMethodFilter.executeMethodIfAllowed( sendUserIdentifier, 'CSQ' ), configureProductAnalytics: CSQMethodFilter.executeMethodIfAllowed( configureProductAnalytics, 'CSQ', true ), stop: CSQMethodFilter.executeMethodIfAllowed(stop, 'CSQ'), pauseTracking: CSQMethodFilter.executeMethodIfAllowed(pauseTracking, 'CSQ'), addDynamicVar: CSQMethodFilter.executeMethodIfAllowed(addDynamicVar, 'CSQ'), identify: CSQMethodFilter.executeMethodIfAllowed(identify, 'CSQ'), resetIdentity: CSQMethodFilter.executeMethodIfAllowed(resetIdentity, 'CSQ'), trackScreenview: CSQMethodFilter.executeMethodIfAllowed( trackScreenview, 'CSQ' ), trackTransaction: CSQMethodFilter.executeMethodIfAllowed( trackTransaction, 'CSQ' ), trackEvent: CSQMethodFilter.executeMethodIfAllowed(trackEvent, 'CSQ'), addEventProperties: CSQMethodFilter.executeMethodIfAllowed( addEventProperties, 'CSQ' ), removeEventProperty: CSQMethodFilter.executeMethodIfAllowed( removeEventProperty, 'CSQ' ), clearEventProperties: CSQMethodFilter.executeMethodIfAllowed( clearEventProperties, 'CSQ' ), registerAutocapture: CSQMethodFilter.executeMethodIfAllowed( registerAutocapture, 'CSQ' ), logToConsole: CSQMethodFilter.executeMethodIfAllowed(logToConsole, 'CSQ'), addUserProperties: CSQMethodFilter.executeMethodIfAllowed( addUserProperties, 'CSQ' ), setUrlMaskingPatterns: CSQMethodFilter.executeMethodIfAllowed( setUrlMaskingPatterns, 'CSQ' ), triggerNativeCrash: CSQMethodFilter.executeMethodIfAllowed( triggerNativeCrash, 'CSQ' ), onMetadataChange: CSQMethodFilter.executeMethodIfAllowed( onMetadataChange, 'CSQ' ), setLogChannel: CSQMethodFilter.executeMethodIfAllowed( setLogChannel, 'CSQ' ), setLogLevel: CSQMethodFilter.executeMethodIfAllowed( setPALogLevel, 'CSQ' ), }; export { LogChannel, LogLevel }; export * from '@contentsquare/react-native-autocapture';