Moved 'region' from payload.data to payload root, align with backend contract
All checks were successful
armco-org/analytics/pipeline/head This commit looks good
All checks were successful
armco-org/analytics/pipeline/head This commit looks good
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@armco/analytics",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.3",
|
||||
"description": "Universal Analytics Library for Browser and Node.js",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
getTimestamp,
|
||||
deepMerge,
|
||||
} from "../utils/helpers";
|
||||
import { ensureRegion } from "../utils/region";
|
||||
import { getRegionFallback } from "../utils/region";
|
||||
import { resolveEndpoint, detectEnvironment } from "../utils/config-loader";
|
||||
import type { EndpointConfig } from "./types";
|
||||
|
||||
@@ -317,12 +317,13 @@ export class Analytics implements IAnalytics {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create base event with region enrichment
|
||||
// Create base event with region at top level
|
||||
const event: TrackingEvent<T> = {
|
||||
eventType,
|
||||
timestamp: getTimestamp(),
|
||||
eventId: uuidv4(),
|
||||
data: ensureRegion(sanitizeEventData(data || {})) as T,
|
||||
region: getRegionFallback(),
|
||||
data: sanitizeEventData(data || {}) as T,
|
||||
};
|
||||
|
||||
// Process through plugins
|
||||
|
||||
@@ -43,6 +43,7 @@ export interface TrackingEvent<T extends EventData = EventData> {
|
||||
eventId: string;
|
||||
sessionId?: string;
|
||||
userId?: string;
|
||||
region?: string;
|
||||
data: T;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user