import { ContentsquareModule } from '../core/nativeModules'; /** * Exports CS userId with which the client is opted in with. * * @param {function} onUserIdObtained - A callback that consumes the userId. */ export const getUserId = (onUserIdObtained: (userId: string) => void): void => { ContentsquareModule.getUserId(onUserIdObtained); }; /** * Opt user IN Contentsquare tracking program. * This allows Contentsquare SDK gather user behaviors while navigating through the app. */ export const optIn = (): void => { ContentsquareModule.optIn(); }; /** * Opt user OUT of the Contentsquare tracking program. * This will stop Contentsquare SDK from gathering any further user behavior while navigating * around the app. */ export const optOut = (): void => { ContentsquareModule.optOut(); }; /** * Sends a User Identifier to Contentsquare tracking services. This identifier is immediately * hashed so no PII can ever be accessed. * * @param {string} userIdentifier The user identifier should be max 100 characters long. */ export const sendUserIdentifier = (userIdentifier: string): void => { if (typeof userIdentifier === 'string') { ContentsquareModule.sendUserIdentifier(userIdentifier); } else { console.error('The User Identifier must be of string data type.'); } };