import { NibbanaConfig } from './NibbanaConfig'; export default class Nibbana { private static _shared; private config; private userIdentification; private uploadLock; private entriesLock; private transientSuperProperties; private persistentSuperProperties; private startTimerCalledAtDates; constructor(); /** * Returns the Nibbana instance. You shouldn't have to call this function, in fact you shouldn't even have access to it * * @static * @returns The shared nibbana instance * @memberof Nibbana */ static shared(): Nibbana; private ensureConfig(); /** * Initializes nibbana and starts auto uploads. You have to call this function before you can do pretty much anything else. Don't call it more than once though, it'll throw! * * @param {string} endpoint The endpoint at which you are running the nibbana-koa-middleware, e.g. https://my.server.examle.com/nibbana * @param {string} nibbanaToken Your nibbana token. THIS IS NOT YOUR API SECRET! * @returns {Promise} * @memberof Nibbana */ initialize(endpoint: string, nibbanaToken: string): Promise; /** * Initializes nibbana with a NibbanaConfig. This is meant for testing, you should probably the other overload of initialize * * @param {NibbanaConfig} config An instance of NibbanaConfig * @returns {Promise} * @memberof Nibbana */ initialize(config: NibbanaConfig): Promise; /** * Identifies the current user with a unique string, such as a user id, an email address, a phone number or whatever you use to uniquely identify your users. User identification gets persisted between launches but it doesn't hurt to re-identify. * * @param {string} userIdentification A string that uniquely identifies your user. * @memberof Nibbana */ identify(userIdentification: string): Promise; /** * Sets super properties that get saved with every log entry. This function merges whatever you give you into your existing super properties. They are useful for stuff like additional information you have about your users or your environment. * * @param {object} superProperties An object to be merged into your existing super properties. * @param {boolean} [persistent=false] Whether the super properties you are calling the function with should be persisted between app launches. * @memberof Nibbana */ registerSuperProperties(superProperties: object, persistent?: boolean): Promise; /** * Unsets a single super property. * * @param {string} superPropertyName The name of the property you want to delete. * @memberof Nibbana */ unsetSuperProperty(superPropertyName: string): Promise; /** * Resets your super properties (transient and persistent) to the empty object. * * @memberof Nibbana */ clearSuperProperties(): Promise; private getContext(); /** * This starts a timer for the event with the given name. The next time you call trackEvent for the event, the time between you called startTimerForEvent and the time you called trackEvent will get saved on the event as duration. * * @param {string} eventName The event name * @memberof Nibbana */ startTimerForEvent(eventName: string): void; /** * Clears timers you set with {@link Nibbana#startTimerForEvent}. * * @param {string} eventName The event name * @memberof Nibbana */ clearTimerForEvent(eventName: string): void; /** * Logs an event. This function takes an optional payload parameter that can contain any additional data you want to save with the event. Even though this function is asynchronous, you shouldn't await on it. * * @param {string} name The event name. Use something readable like "Awesome button pressed" * @param {object} [payload={}] Additional data you want to save with the event. This should be JSON serializable. * @memberof Nibbana */ logEvent(name: string, payload?: object): Promise; /** * Logs an error. This function takes an optional payload parameter that can contain any additional data you want to save with the event. Even though this function is asynchronous, you shouldn't await on it. * * @param {Error} error * @param {object} [payload={}] Additional data you want to save with the event. This should be JSON serializable. * @memberof Nibbana */ logError(error: Error, payload?: object): Promise; private uploadEntries(); }