From 542bf0b031db8cc8634056dc3e17baaf9a5f455a Mon Sep 17 00:00:00 2001 From: rupesh-checkatrade Date: Fri, 8 Nov 2024 16:09:42 +0000 Subject: [PATCH 1/2] Extend EventTags type to support Event Properties - https://docs.developers.optimizely.com/feature-experimentation/docs/track-events#event-properties --- lib/shared_types.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/shared_types.ts b/lib/shared_types.ts index 8902820eb..d34896bf4 100644 --- a/lib/shared_types.ts +++ b/lib/shared_types.ts @@ -76,10 +76,18 @@ export interface UserProfile { experiment_bucket_map: ExperimentBucketMap; } -export type EventTags = { - [key: string]: string | number | null; +export type EventPropertyValue = string | number | boolean; + +export type EventProperties = { + '$opt_event_properties'?: { + [key: string]: EventPropertyValue; + }; }; +export type EventTags = { + [key: string]: string | number | null; +} | EventProperties; + export interface UserProfileService { lookup(userId: string): UserProfile; save(profile: UserProfile): void; From 0208c0828c5d02415737ea05bbafaaeb6e4846f2 Mon Sep 17 00:00:00 2001 From: rupesh-checkatrade Date: Fri, 8 Nov 2024 16:15:26 +0000 Subject: [PATCH 2/2] fix formatting --- lib/shared_types.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/shared_types.ts b/lib/shared_types.ts index d34896bf4..818b45bfe 100644 --- a/lib/shared_types.ts +++ b/lib/shared_types.ts @@ -79,13 +79,13 @@ export interface UserProfile { export type EventPropertyValue = string | number | boolean; export type EventProperties = { - '$opt_event_properties'?: { - [key: string]: EventPropertyValue; - }; + '$opt_event_properties'?: { + [key: string]: EventPropertyValue; + }; }; export type EventTags = { - [key: string]: string | number | null; + [key: string]: string | number | null; } | EventProperties; export interface UserProfileService {