Skip to content

Commit 0f48a8e

Browse files
committed
add comment for future work
1 parent b9d7d39 commit 0f48a8e

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/batchUploader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from './uploaders';
1414
import { IMParticleUser } from './identity-user-interfaces';
1515
import { IMParticleWebSDKInstance } from './mp-instance';
16-
1716
/**
1817
* BatchUploader contains all the logic to store/retrieve events and batches
1918
* to/from persistence, and upload batches to mParticle.
@@ -142,6 +141,7 @@ export class BatchUploader {
142141
return false;
143142
}
144143

144+
// https://go.mparticle.com/work/SQDSDKS-7133
145145
private createBackgroundASTEvent(): SDKEvent {
146146
const now = Date.now();
147147
const { _Store, Identity, _timeOnSiteTimer } = this.mpInstance;

src/event-creator.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { SDKEvent } from './sdkRuntimeModels';
2+
import { IMParticleWebSDKInstance } from './mp-instance';
3+
import Constants from './constants';
4+
import { EventType } from './types';
5+
6+
export function createBaseEvent(
7+
mpInstance: IMParticleWebSDKInstance,
8+
messageType: number,
9+
eventName: string = ''
10+
): SDKEvent {
11+
const now = Date.now();
12+
const { _Store, Identity, _timeOnSiteTimer } = mpInstance;
13+
const { sessionId, deviceId, sessionStartDate, SDKConfig } = _Store;
14+
return {
15+
EventDataType: messageType,
16+
EventName: eventName,
17+
EventCategory: EventType.Other,
18+
Timestamp: now,
19+
SessionId: sessionId,
20+
MPID: Identity.getCurrentUser()?.getMPID(),
21+
DeviceId: deviceId,
22+
IsFirstRun: false,
23+
SourceMessageId: '',
24+
SDKVersion: Constants.sdkVersion,
25+
CustomFlags: {},
26+
UserAttributes: {},
27+
UserIdentities: [],
28+
SessionStartDate: sessionStartDate?.getTime() || now,
29+
Debug: SDKConfig.isDevelopmentMode,
30+
CurrencyCode: null,
31+
ExpandedEventCount: 0,
32+
ActiveTimeOnSite: _timeOnSiteTimer?.getTimeInForeground() || 0
33+
};
34+
}

0 commit comments

Comments
 (0)