mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge pull request #22347 from DefinitelyTyped/not-needed-react-ga
react-ga: Provides its own types
This commit is contained in:
@@ -732,6 +732,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",
|
||||
|
||||
Vendored
-69
@@ -1,69 +0,0 @@
|
||||
// Type definitions for react-ga 2.1
|
||||
// Project: https://github.com/react-ga/react-ga
|
||||
// Definitions by: Tim Aldridge <https://github.com/telshin>, Vasya Aksyonov <https://github.com/outring>
|
||||
// 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;
|
||||
@@ -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'}, () => {});
|
||||
});
|
||||
});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user