From 17c7af581326b2ec4b5fc5cc8e7cc1529f0aadbc Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 20 Dec 2017 11:19:37 -0800 Subject: [PATCH] react-ga: Provides its own types --- notNeededPackages.json | 6 ++ types/react-ga/index.d.ts | 69 -------------------- types/react-ga/react-ga-tests.ts | 105 ------------------------------- types/react-ga/tsconfig.json | 23 ------- types/react-ga/tslint.json | 7 --- 5 files changed, 6 insertions(+), 204 deletions(-) delete mode 100644 types/react-ga/index.d.ts delete mode 100644 types/react-ga/react-ga-tests.ts delete mode 100644 types/react-ga/tsconfig.json delete mode 100644 types/react-ga/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4b6f20790b..311ca8cb9f 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -606,6 +606,12 @@ "sourceRepoURL": "https://github.com/gpbl/react-day-picker", "asOfVersion": "5.3.0" }, + { + "libraryName": "react-ga", + "typingsPackageName": "react-ga", + "sourceRepoURL": "https://github.com/react-ga/react-ga", + "asOfVersion": "2.3.0" + }, { "libraryName": "react-native-elements", "typingsPackageName": "react-native-elements", diff --git a/types/react-ga/index.d.ts b/types/react-ga/index.d.ts deleted file mode 100644 index d1d7eccc53..0000000000 --- a/types/react-ga/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -// Type definitions for react-ga 2.1 -// Project: https://github.com/react-ga/react-ga -// Definitions by: Tim Aldridge , Vasya Aksyonov -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export interface EventArgs { - category: string; - action: string; - label?: string; - value?: number; - nonInteraction?: boolean; -} - -export interface GaOptions { - name?: string; - clientId?: string; - sampleRate?: number; - siteSpeedSampleRate?: number; - alwaysSendReferrer?: boolean; - allowAnchor?: boolean; - cookieName?: string; - cookieDomain?: string; - cookieExpires?: number; - legacyCookieDomain?: string; - legacyHistoryImport?: boolean; - allowLinker?: boolean; - userId?: string; - language?: string; - hostName?: string; -} - -export interface InitializeOptions { - debug?: boolean; - titleCase?: boolean; - gaOptions?: GaOptions; -} - -export interface FieldsObject { - [i: string]: any; -} - -export interface TimingArgs { - category: string; - variable: string; - value: number; - label?: string; -} - -export interface Plugin { - require(name: string, options: any): void; - execute(pluginName: string, action: string, actionTypeOrPayload: string|any, payload?: any): void; -} - -export interface OutboundLinkArgs { - label: string; -} - -export function initialize(trackingCode: string, options?: InitializeOptions): void; -export function ga(): (...args: any[]) => any; -export function ga(...args: any[]): any; -export function set(fieldsObject: FieldsObject): void; -export function send(fieldsObject: FieldsObject): void; -export function pageview(path: string): void; -export function modalview(name: string): void; -export function timing(args: TimingArgs): void; -export function event(args: EventArgs): void; -export function exception(fieldsObject: FieldsObject): void; -export const plugin: Plugin; -export function outboundLink(args: OutboundLinkArgs, hitCallback: () => void): void; diff --git a/types/react-ga/react-ga-tests.ts b/types/react-ga/react-ga-tests.ts deleted file mode 100644 index 9e1ba7b23b..0000000000 --- a/types/react-ga/react-ga-tests.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as ga from "react-ga"; - -declare function describe(desc: string, f: () => void): void; -declare function it(desc: string, f: () => void): void; - -describe("Testing react-ga initialize object", () => { - it("Able to initialize react-ga object", () => { - ga.initialize("UA-65432-1"); - }); - it("Able to initailize react-ga object", () => { - const options: ga.InitializeOptions = { - debug: true, - }; - - ga.initialize("UA-65432-1", options); - }); -}); - -describe("Testing react-ga pageview calls", () => { - it("Able to make pageview calls", () => { - ga.initialize("UA-65432-1"); - ga.pageview("http://telshin.com"); - }); -}); - -describe("Testing react-ga modal calls", () => { - it("Able to make modal calls", () => { - ga.initialize("UA-65432-1"); - - ga.modalview("Test modal"); - }); -}); - -describe("Testing react-ga event calls", () => { - it("Able to make event calls", () => { - ga.initialize("UA-65432-1"); - - const options: ga.EventArgs = { - category: "Test", - action: "CI", - label: "Running Jasmine tests for react-ga typscript library", - value: 4, - nonInteraction: true, - }; - - ga.event(options); - }); -}); - -describe("Testing react-ga set calls", () => { - it("Able to make set calls", () => { - ga.initialize("UA-65432-1"); - - const fieldObject: ga.FieldsObject = { - page: '/users' - }; - - ga.set(fieldObject); - }); -}); - -describe("Testing react-ga v2.1.2", () => { - it("Able to make ga calls", () => { - ga.ga(); - }); - it("Able to make ga calls with any arguments", () => { - ga.ga("create", "UA-65432-1", "auto", "trackerName"); - }); - it("Able to make returned ga calls with any arguments", () => { - ga.ga()("create", "UA-65432-1", "auto", "trackerName"); - }); - it("Able to make send calls", () => { - const fieldObject: ga.FieldsObject = { - page: '/users' - }; - - ga.send(fieldObject); - }); - it("Able to make timing calls", () => { - ga.timing({ - category: 'string', - variable: 'string', - value: 1, - label: 'string' - }); - }); - it("Able to make exception calls", () => { - const fieldObject: ga.FieldsObject = { - page: '/users' - }; - ga.exception(fieldObject); - }); - it("Able to make plugin object calls", () => { - const execute = ga.plugin.execute; - const require = ga.plugin.require; - const payload = {}; - - execute('name', 'action', payload); - execute('name', 'action', 'type', payload); - require('name', {}); - }); - it("Able to make outboundLink calls", () => { - ga.outboundLink({label: 'string'}, () => {}); - }); -}); diff --git a/types/react-ga/tsconfig.json b/types/react-ga/tsconfig.json deleted file mode 100644 index e3bfb3b9b0..0000000000 --- a/types/react-ga/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-ga-tests.ts" - ] -} \ No newline at end of file diff --git a/types/react-ga/tslint.json b/types/react-ga/tslint.json deleted file mode 100644 index b1439230db..0000000000 --- a/types/react-ga/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-any-union": false - } -}