diff --git a/src/index.ts b/src/index.ts index c0ed45b366..f00e64be6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -68,6 +68,7 @@ import { NativePageTransitions } from './plugins/native-page-transitions'; import { NativeStorage } from './plugins/nativestorage'; import { Market } from './plugins/market'; import { MediaPlugin } from './plugins/media'; +import { Mixpanel } from './plugins/mixpanel'; import { Network } from './plugins/network'; import { NFC } from './plugins/nfc'; import { OneSignal } from './plugins/onesignal'; @@ -128,6 +129,7 @@ export * from './plugins/localnotifications'; export * from './plugins/nfc'; export * from './plugins/media'; export * from './plugins/media-capture'; +export * from './plugins/mixpanel'; export * from './plugins/pay-pal'; export * from './plugins/native-page-transitions'; export * from './plugins/printer'; @@ -265,6 +267,7 @@ window['IonicNative'] = { Market: Market, MediaCapture: MediaCapture, MediaPlugin: MediaPlugin, + Mixpanel: Mixpanel, NativeAudio: NativeAudio, NativePageTransitions: NativePageTransitions, NativeStorage: NativeStorage, diff --git a/src/plugins/mixpanel.ts b/src/plugins/mixpanel.ts new file mode 100644 index 0000000000..c876b72030 --- /dev/null +++ b/src/plugins/mixpanel.ts @@ -0,0 +1,105 @@ +import {Plugin, Cordova, CordovaProperty} from './plugin'; +/** + * @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); + * + * ``` + */ +@Plugin({ + plugin: 'cordova-plugin-mixpanel', + pluginRef: 'mixpanel', + repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin' +}) +export class Mixpanel { + /** + * + * @param aliasId {string} + * @param originalId {string} + * @returns {Promise} + */ + @Cordova() + static alias(aliasId: string, originalId: string): Promise {return; } + + /** + * + * @returns {Promise} + */ + @Cordova() + static distinctId(): Promise {return; } + + /** + * + */ + @Cordova() + static flush(): Promise {return; } + + /** + * + * @param distinctId {string} + * @returns {Promise} + */ + @Cordova() + static identify(distinctId): Promise {return; } + + /** + * + * @param token {string} + * @returns {Promise} + */ + @Cordova() + static init(token: string): Promise {return; } + + /** + * + * @param superProperties + * @returns {Promise} + */ + @Cordova() + static registerSuperProperties(superProperties: any): Promise {return; } + + /** + * + * @returns {Promise} + */ + @Cordova() + static reset(): Promise {return; } + + /** + * + * @param eventName + * @param eventProperties + */ + @Cordova() + static track(eventName: string, eventProperties: any): Promise {return; } + + /** + * + * @returns {Promise} + */ + @Cordova() + static showSurvey(): Promise {return; } + + /** + * + * @returns {MixpanelPeople} + */ + @CordovaProperty + static people: MixpanelPeople; + +} +export declare class MixpanelPeople { + static identify(distinctId: string, onSuccess?: Function, onFail?: Function): void; + static increment(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; + static setPushId(pushId: string, onSuccess?: Function, onFail?: Function): void; + static set(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; + static setOnce(peopleProperties: any, onSuccess?: Function, onFail?: Function): void; +}