Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit fdb2dad

Browse files
committed
feat(types): export events library functions
1 parent 440d2e2 commit fdb2dad

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"terser-webpack-plugin": "^2.2.1",
5757
"vue": "^2.6.10",
5858
"vue-router": "^3.1.3",
59+
"vuex": "^3.1.2",
5960
"webpack": "^4.41.2",
6061
"webpack-cli": "^3.3.10"
6162
}

vue-analytics.d.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
declare module 'vue-analytics' {
33
import _Vue, { PluginFunction } from 'vue';
44
import VueRouter, { Route } from 'vue-router';
5+
import { Store } from 'vuex';
56

67
interface eventFn {
78
(category: string, action?: string, label?: string, value?: number): void;
@@ -50,7 +51,7 @@ declare module 'vue-analytics' {
5051
timingLabel: string
5152
}): void;
5253
}
53-
54+
5455
interface EcommerceItem {
5556
id: string;
5657
name: string;
@@ -236,22 +237,35 @@ declare module 'vue-analytics' {
236237

237238
export default class VueAnalytics {
238239
static install(Vue: typeof _Vue, options: InstallOptions): void;
239-
analyticsMiddleware: any;
240-
onAnalyticsReady: () => Promise<void>;
240+
analyticsMiddleware<T>(store: Store<T>): void;
241+
onAnalyticsReady: onAnalyticsReadyFn;
241242
event: eventFn;
242243
ecommerce: Ecommerce;
243244
set: setFn;
244245
page: pageFn;
245-
query: any;
246-
screenview: ((screen: string) => void) | ((option: { screenName: string, [otherProperties: string]: any }) => void);
246+
query: queryFn;
247+
screenview: screenviewFn;
247248
time: timeFn;
248-
require: (pluginName: string, options?: any) => void;
249-
exception: (exception: Error | string) => void;
249+
require: requireFn;
250+
exception: exceptionFn;
250251
social: socialFn;
251252
disable: () => void;
252253
enable: () => void;
253254
}
254255

256+
export const analyticsMiddleware: analyticsMiddlewareFn;
257+
export const onAnalyticsReady: onAnalyticsReadyFn;
258+
export const event: eventFn;
259+
export const ecommerce: Ecommerce;
260+
export const set: setFn;
261+
export const page: pageFn;
262+
export const query: queryFn;
263+
export const screenview: screenviewFn;
264+
export const time: timeFn;
265+
export const require: requireFn;
266+
export const exception: exceptionFn;
267+
export const social: socialFn;
268+
255269
module 'vue/types/options' {
256270
interface ComponentOptions<V extends _Vue> {
257271
ga?: VueAnalytics;

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8542,6 +8542,11 @@ vue@^2.6.10:
85428542
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637"
85438543
integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==
85448544

8545+
vuex@^3.1.2:
8546+
version "3.1.2"
8547+
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.1.2.tgz#a2863f4005aa73f2587e55c3fadf3f01f69c7d4d"
8548+
integrity sha512-ha3jNLJqNhhrAemDXcmMJMKf1Zu4sybMPr9KxJIuOpVcsDQlTBYLLladav2U+g1AvdYDG5Gs0xBTb0M5pXXYFQ==
8549+
85458550
w3c-hr-time@^1.0.1:
85468551
version "1.0.1"
85478552
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045"

0 commit comments

Comments
 (0)