From 4293bc56e1805b566eb77d1dc881fe9902a8815e Mon Sep 17 00:00:00 2001 From: Stijn Mommersteeg Date: Fri, 27 Jun 2025 10:55:41 +0200 Subject: [PATCH 1/2] fixed type definition --- dist/index.d.ts | 6 +++--- types/index.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 8d30055..0b77a95 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -2,7 +2,7 @@ import type { App, Plugin, InjectionKey } from 'vue' declare global { interface Window { - sa_event?: (event: string) => void; + sa_event?: (event: string, metadata?: Record) => void; } } @@ -11,7 +11,7 @@ export interface SimpleAnalyticsOptions { domain?: string; } -export declare const saEventKey: InjectionKey<(event: string) => void>; +export declare const saEventKey: InjectionKey<(event: string, metadata?: Record) => void>; type SimpleAnalyticsPlugin = Plugin & { install(app: App, options?: SimpleAnalyticsOptions): void; @@ -22,6 +22,6 @@ export default SimpleAnalytics; declare module '@vue/runtime-core' { interface InjectionKeys { - saEvent: (event: string) => void; + saEvent: (event: string, metadata?: Record) => void; } } \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts index 8d30055..0b77a95 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -2,7 +2,7 @@ import type { App, Plugin, InjectionKey } from 'vue' declare global { interface Window { - sa_event?: (event: string) => void; + sa_event?: (event: string, metadata?: Record) => void; } } @@ -11,7 +11,7 @@ export interface SimpleAnalyticsOptions { domain?: string; } -export declare const saEventKey: InjectionKey<(event: string) => void>; +export declare const saEventKey: InjectionKey<(event: string, metadata?: Record) => void>; type SimpleAnalyticsPlugin = Plugin & { install(app: App, options?: SimpleAnalyticsOptions): void; @@ -22,6 +22,6 @@ export default SimpleAnalytics; declare module '@vue/runtime-core' { interface InjectionKeys { - saEvent: (event: string) => void; + saEvent: (event: string, metadata?: Record) => void; } } \ No newline at end of file From 4d3eb4ce13491c5185479670d82dccd5ca3ac34d Mon Sep 17 00:00:00 2001 From: Stijn Mommersteeg Date: Fri, 27 Jun 2025 11:19:33 +0200 Subject: [PATCH 2/2] Make readme match the implementation --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d7920ad..6e3bc9b 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,9 @@ To send an event, inject the `saEvent` method into your Vue 3 setup script like