2016-10-15 07:41:37 -07:00
|
|
|
import { Cordova, Plugin } from './plugin';
|
2016-08-29 16:58:00 +02:00
|
|
|
|
2016-08-27 02:10:50 -04:00
|
|
|
declare var mixpanel: any;
|
2016-08-29 16:58:00 +02:00
|
|
|
|
2016-08-27 02:05:35 -04:00
|
|
|
/**
|
|
|
|
* @name Mixpanel
|
|
|
|
* @description
|
|
|
|
* Cordova Plugin that wraps Mixpanel SDK for Android and iOS
|
|
|
|
*
|
|
|
|
* @usage
|
|
|
|
* ```
|
|
|
|
* import {Mixpanel} from 'ionic-native';
|
|
|
|
*
|
|
|
|
* Mixpanel.init(token)
|
|
|
|
* .then(onSuccess)
|
|
|
|
* .catch(onError);
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
*/
|
2016-10-27 04:25:12 -07:00
|
|
|
@Plugin({
|
|
|
|
name: 'Mixpanel',
|
|
|
|
plugin: 'cordova-plugin-mixpanel',
|
|
|
|
pluginRef: 'mixpanel',
|
|
|
|
repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin'
|
|
|
|
})
|
2016-08-27 02:05:35 -04:00
|
|
|
export class Mixpanel {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param aliasId {string}
|
|
|
|
* @param originalId {string}
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static alias(aliasId: string, originalId: string): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static distinctId(): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static flush(): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param distinctId {string}
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static identify(distinctId): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param token {string}
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static init(token: string): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param superProperties
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static registerSuperProperties(superProperties: any): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static reset(): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param eventName
|
|
|
|
* @param eventProperties
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static track(eventName: string, eventProperties?: any): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @returns {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-08-29 16:58:00 +02:00
|
|
|
static showSurvey(): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @returns {MixpanelPeople}
|
|
|
|
*/
|
2016-10-15 07:41:37 -07:00
|
|
|
static get people(): typeof MixpanelPeople {
|
|
|
|
return MixpanelPeople;
|
|
|
|
};
|
2016-08-27 02:05:35 -04:00
|
|
|
|
|
|
|
}
|
2016-08-27 12:33:02 -04:00
|
|
|
/**
|
|
|
|
* @private
|
|
|
|
*/
|
2016-10-15 07:41:37 -07:00
|
|
|
export class MixpanelPeople {
|
|
|
|
/**
|
|
|
|
* @private
|
|
|
|
*/
|
2016-10-27 07:26:12 -04:00
|
|
|
static plugin: string = 'cordova-plugin-mixpanel';
|
2016-10-15 07:41:37 -07:00
|
|
|
/**
|
|
|
|
* @private
|
|
|
|
*/
|
2016-10-27 07:26:12 -04:00
|
|
|
static pluginRef: string = 'mixpanel.people';
|
2016-10-15 07:41:37 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param distinctId {string}
|
|
|
|
* @return {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static identify(distinctId: string): Promise<any> { return; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param peopleProperties {string}
|
|
|
|
* @return {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static increment(peopleProperties: any): Promise<any> { return; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param pushId
|
|
|
|
* @return {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static setPushId(pushId: string): Promise<any> { return; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param peopleProperties
|
|
|
|
* @return {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static set(peopleProperties: any): Promise<any> { return; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param peopleProperties
|
|
|
|
* @return {Promise<any>}
|
|
|
|
*/
|
|
|
|
@Cordova()
|
|
|
|
static setOnce(peopleProperties: any): Promise<any> { return; }
|
2016-08-27 02:05:35 -04:00
|
|
|
}
|