Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/events.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Callback,
SDKEventAttrs,
SDKEventOptions,
TransactionAttributes,
Expand All @@ -8,13 +7,20 @@ import {
BaseEvent,
SDKEvent,
SDKEventCustomFlags,
SDKImpression,
SDKProduct,
SDKProductImpression,
SDKPromotion,
} from './sdkRuntimeModels';
import { valueof } from './utils';
import { EventType, ProductActionType, PromotionActionType } from './types';

export type TrackingCallback = ((
position?: GeolocationPosition | {
coords: { latitude: number | string; longitude: number | string };
}
) => void) | null;

// Supports wrapping event handlers functions that will ideally return a specific type
type EventHandlerFunction<T> = (element: HTMLLinkElement | HTMLFormElement) => T;

Expand Down Expand Up @@ -45,11 +51,12 @@ export interface IEvents {
): void;
logEvent(event: BaseEvent, eventOptions?: SDKEventOptions): void;
logImpressionEvent(
impression: SDKProductImpression,
// https://go/j/SDKE-1199
impression: SDKImpression | SDKImpression[] | SDKProductImpression | SDKProductImpression[],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I brought this up with @rmi22186 earlier. I would like for us to not support both arrays and non-arrays for these endpoints, but that might have to be a follow up project.

Copy link
Copy Markdown
Contributor Author

@jaissica12 jaissica12 May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a follow-up ticket to track this: https://go/j/SDKE-1199

attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags,
eventOptions?: SDKEventOptions
);
): void;
logOptOut(): void;
logProductActionEvent(
productActionType: valueof<typeof ProductActionType>,
Expand All @@ -61,7 +68,7 @@ export interface IEvents {
): void;
logPromotionEvent(
promotionType: valueof<typeof PromotionActionType>,
promotion: SDKPromotion,
promotion: SDKPromotion | SDKPromotion[],
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags,
eventOptions?: SDKEventOptions
Expand All @@ -78,6 +85,6 @@ export interface IEvents {
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;
startTracking(callback: Callback): void;
startTracking(callback: TrackingCallback): void;
stopTracking(): void;
}
Loading
Loading