Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
feat(types): extract and export payload types for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
romansp committed Dec 16, 2019
1 parent 7986a44 commit be5ec8d
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions vue-analytics.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ declare module 'vue-analytics' {
import VueRouter, { Route } from 'vue-router';
import { Store } from 'vuex';

interface EventPayload {
eventCategory: string;
eventAction?: string;
eventLabel?: string;
eventValue?: number;
}

interface eventFn {
(category: string, action?: string, label?: string, value?: number): void;
(options: {
eventCategory: string,
eventAction?: string,
eventLabel?: string,
eventValue?: number
}): void;
(options: EventPayload): void;
}

type pageDetails = {
Expand All @@ -33,23 +35,27 @@ declare module 'vue-analytics' {
}): void;
}

interface SocialPayload {
socialNetwork: string;
socialAction: string;
socialTarget: string;
}

interface socialFn {
(network: string, action: string, target: string): void;
(options: {
socialNetwork: string,
socialAction: string,
socialTarget: string
}): void;
(options: SocialPayload): void;
}

interface TimePayload {
timingCategory: string;
timingVar: string;
timingValue: number;
timingLabel: string;
}

interface timeFn {
(category: string, variable: string, value: number, label: string): void;
(options: {
timingCategory: string,
timingVar: string,
timingValue: number,
timingLabel: string
}): void;
(options: TimePayload): void;
}

interface EcommerceItem {
Expand Down Expand Up @@ -156,12 +162,14 @@ declare module 'vue-analytics' {
send(): void;
}

interface ScreenViewPayload {
screenName: string;
[otherProperties: string]: any;
}

interface screenviewFn {
(screen: string) :void;
(option: {
screenName: string;
[otherProperties: string]: any;
}): void;
(option: ScreenViewPayload): void;
}

interface requireFn {
Expand Down

0 comments on commit be5ec8d

Please sign in to comment.