diff --git a/types/react-native-mixpanel/index.d.ts b/types/react-native-mixpanel/index.d.ts new file mode 100644 index 0000000000..510ac9991d --- /dev/null +++ b/types/react-native-mixpanel/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for react-native-mixpanel 0.1 +// Project: https://github.com/davodesign84/react-native-mixpanel#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export function sharedInstanceWithToken(token: string): void; +export function track(event: string): void; +export function trackWithProperties(event: string, property: object): void; +export function createAlias(id: string): void; +export function identify(id: string): void; +export function set(property: object): void; +export function setOnce(property: object): void; +export function timeEvent(event: string): void; +export function registerSuperProperties(property: object): void; +export function registerSuperPropertiesOnce(property: object): void; +export function trackCharge(id: number): void; +export function trackChargeWithProperties(id: number, property: object): void; +export function increment(property: string, value: number): void; +export function setPushRegistrationId(token: string): void; +export function initPushHandling(token: string): void; +export function clearPushRegistrationId(): void; +export function addPushDeviceToken(token: string): void; +export function reset(): void; +export function getDistinctId(handler: (id: string) => void): void; diff --git a/types/react-native-mixpanel/react-native-mixpanel-tests.ts b/types/react-native-mixpanel/react-native-mixpanel-tests.ts new file mode 100644 index 0000000000..3f997e80f9 --- /dev/null +++ b/types/react-native-mixpanel/react-native-mixpanel-tests.ts @@ -0,0 +1,22 @@ +import Mixpanel = require('react-native-mixpanel'); + +Mixpanel.sharedInstanceWithToken('1234567890'); +Mixpanel.track('Event name'); +Mixpanel.trackWithProperties('Click Button', { button_type: 'yellow button', button_text: 'magic button' }); +Mixpanel.createAlias('123456'); +Mixpanel.identify('123456'); +Mixpanel.set({ $email: 'elvis@email.com' }); +Mixpanel.setOnce({ $email: 'elvis@email.com', Created: new Date().toISOString() }); +Mixpanel.timeEvent('Image Upload'); +Mixpanel.track('Image Upload'); +Mixpanel.registerSuperProperties({ 'Account type': 'Free', 'User Type': 'Vendor' }); +Mixpanel.registerSuperPropertiesOnce({ Gender: 'Female' }); +Mixpanel.trackCharge(399); +Mixpanel.trackChargeWithProperties(399, { product: 'ACME Wearable tech' }); +Mixpanel.increment("Login Count", 1); +Mixpanel.setPushRegistrationId('1234567890abc'); +Mixpanel.initPushHandling('123456666'); +Mixpanel.clearPushRegistrationId(); +Mixpanel.addPushDeviceToken('1234567890abc'); +Mixpanel.reset(); +Mixpanel.getDistinctId((id) => (id)); diff --git a/types/react-native-mixpanel/tsconfig.json b/types/react-native-mixpanel/tsconfig.json new file mode 100644 index 0000000000..489842ded8 --- /dev/null +++ b/types/react-native-mixpanel/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "react-native-mixpanel-tests.ts" + ] +} diff --git a/types/react-native-mixpanel/tslint.json b/types/react-native-mixpanel/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-mixpanel/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }