Repository URL to install this package:
|
Version:
0.7.0 ▾
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var ActionTypes = exports.ActionTypes = {
INIT_AMPLITUDE: '@doodle/amplitude/INIT_AMPLITUDE',
INIT_AMPLITUDE_SUCCESS: '@doodle/amplitude/INIT_AMPLITUDE_SUCCESS',
LOG_AMPLITUDE_EVENT: '@doodle/amplitude/LOG_AMPLITUDE_EVENT',
SET_AMPLITUDE_USER_ID: '@doodle/amplitude/SET_AMPLITUDE_USER_ID',
SET_AMPLITUDE_USER_PROPERTIES: '@doodle/amplitude/SET_AMPLITUDE_USER_PROPERTIES',
UNSET_AMPLITUDE_USER_PROPERTY: '@doodle/amplitude/UNSET_AMPLITUDE_USER_PROPERTIES',
REGENERATE_AMPLITUDE_DEVICE_ID: '@doodle/amplitude/REGENERATE_AMPLITUDE_DEVICE_ID',
INIT_AMPLITUDE_FAILED: '@doodle/amplitude/INIT_AMPLITUDE_FAILED'
};
/**
* initializes amplitude.
* @method
* @public
*/
var initAmplitude = exports.initAmplitude = function initAmplitude() {
return {
type: ActionTypes.INIT_AMPLITUDE
};
};
/**
* Triggered when amplitude is successfull initialized
* @method
* @public
*/
var initAmplitudeSuccess = exports.initAmplitudeSuccess = function initAmplitudeSuccess() {
return {
type: ActionTypes.INIT_AMPLITUDE_SUCCESS
};
};
/**
* Logs an event via the amplitude sdk
* @method
* @public
* @param {string} eventType The type of the event.
* @param {string} eventName The name of the event.
* @param {object} eventProperties Key / Value pairs of properties. The key should be a string.
* @param {function} callback Will be called after an event is succesfully logged.
*/
var logAmplitudeEvent = exports.logAmplitudeEvent = function logAmplitudeEvent(eventType, eventName) {
var eventProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var callback = arguments[3];
return {
type: ActionTypes.LOG_AMPLITUDE_EVENT,
payload: {
eventType: eventType,
eventName: eventName,
eventProperties: eventProperties,
callback: callback
}
};
};
/**
* Sets a specific userId for the session
* @method
* @public
* @param {*} userId The userId sould be the userId of the logged in doodle account. Set to null to reset the user after logout.
*/
var setAmplitudeUserId = exports.setAmplitudeUserId = function setAmplitudeUserId(userId) {
return {
type: ActionTypes.SET_AMPLITUDE_USER_ID,
userId: userId
};
};
/**
* Sets one or multiple user properties.
* @method
* @public
* @param {object} userProperties Key/value pairs of user properties
* @param {boolean} once Set to true if this specific propertie should only be tracked once.
*/
var setAmplitudeUserProperties = exports.setAmplitudeUserProperties = function setAmplitudeUserProperties(userProperties, once) {
return {
type: ActionTypes.SET_AMPLITUDE_USER_PROPERTIES,
payload: {
userProperties: userProperties,
once: once
}
};
};
/**
* Unset a specific user property
* @method
* @public
* @param {string} userProperty Name of the user property you want to delete.
*/
var unsetAmplitudeUserProperty = exports.unsetAmplitudeUserProperty = function unsetAmplitudeUserProperty(userProperty) {
return {
type: ActionTypes.UNSET_AMPLITUDE_USER_PROPERTY,
userProperty: userProperty
};
};
/**
* Generates a new deviceId by manually
* @method
* @public
*/
var regenerateAmplitudeDeviceId = exports.regenerateAmplitudeDeviceId = function regenerateAmplitudeDeviceId() {
return {
type: ActionTypes.REGENERATE_AMPLITUDE_DEVICE_ID
};
};