From 30910fe299159e6e960e8ccd750565228f682b74 Mon Sep 17 00:00:00 2001 From: christianmat Date: Wed, 27 Nov 2024 17:43:49 -0800 Subject: [PATCH] fix: make properties optional --- .changeset/blue-emus-deliver.md | 5 +++++ packages/trench-js/src/index.ts | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/blue-emus-deliver.md diff --git a/.changeset/blue-emus-deliver.md b/.changeset/blue-emus-deliver.md new file mode 100644 index 0000000..c271e09 --- /dev/null +++ b/.changeset/blue-emus-deliver.md @@ -0,0 +1,5 @@ +--- +'trench-js': patch +--- + +Make all `properties` optional diff --git a/packages/trench-js/src/index.ts b/packages/trench-js/src/index.ts index af83096..8f0e651 100644 --- a/packages/trench-js/src/index.ts +++ b/packages/trench-js/src/index.ts @@ -82,11 +82,11 @@ class Trench { } } - track(event: string, properties: Record) { + track(event: string, properties?: Record) { this.analytics.track(event, properties); } - page(properties: Record) { + page(properties?: Record) { const mergedProperties = { referrer: typeof document !== 'undefined' ? document.referrer : undefined, userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : undefined, @@ -95,11 +95,11 @@ class Trench { this.analytics.page(mergedProperties); } - identify(userId: string, traits: Record) { + identify(userId: string, traits?: Record) { this.analytics.identify(userId, traits); } - group(groupId: string, traits: Record) { + group(groupId: string, traits?: Record) { // @ts-ignore this.analytics.plugins.trench.group(groupId, traits); }