Add expo-mixpanel-analytics type definitions

This commit is contained in:
Martin Treurnicht
2019-03-07 15:05:20 -08:00
parent 350ea557e8
commit b8edb8089d
4 changed files with 81 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import ExpoMixpanelAnalytics from 'expo-mixpanel-analytics';
const analytics = new ExpoMixpanelAnalytics('5224da5bbbed3fdeaad0911820f1bf2x');
analytics.identify("13793");
analytics.track("Signed Up", { "Referred By": "Friend" });
analytics.people_set({
$first_name: "Joe",
$last_name: "Doe",
$email: "joe.doe@example.com",
$created: "2013-04-01T13:20:00",
$phone: "4805551212",
Address: "1313 Mockingbird Lane",
Birthday: "1948-01-01"
});
analytics.people_set_once({ "First login date": "2013-04-01T13:20:00" });
analytics.people_unset([ "Days Overdue" ]);
analytics.people_increment({ "Coins Gathered": 12 });
analytics.people_append({ "Power Ups": "Bubble Lead" });
analytics.people_union({ "Items purchased": ["socks", "shirts"] });
analytics.people_delete_user();
analytics.reset();

View File

@@ -0,0 +1,26 @@
// Type definitions for expo-mixpanel-analytics 0.0
// Project: https://github.com/codekadiya/expo-mixpanel-analytics
// Definitions by: Martin Treurnicht <https://github.com/martintreurnicht>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare class ExpoMixpanelAnalytics {
constructor(token: string);
identify(userId: string): void;
track(name: string, props: Props): void;
people_set(props: Props): void;
people_set_once(props: Props): void;
people_unset(keys: string[]): void;
people_increment(props: Props<number>): void;
people_append(props: Props): void;
people_union(props: Props<string[]>): void;
people_delete_user(): void;
reset(): void;
token: string;
}
interface Props<T = any> {
[key: string]: T;
}
export default ExpoMixpanelAnalytics;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"expo-mixpanel-analytics-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }