@mparticle/web-sdk 2.26.3 → 2.26.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,12 @@ import { Dictionary, parseNumber, isObject, generateHash } from './utils';
3
3
  import { BaseVault } from './vault';
4
4
  import Types from './types';
5
5
  import { IdentityApiData, UserIdentities, IdentityCallback } from '@mparticle/web-sdk';
6
- import { IdentityAPIMethod, MParticleWebSDK } from './sdkRuntimeModels';
6
+ import { IdentityAPIMethod } from './identity.interfaces';
7
7
 
8
8
  const { Identify, Modify, Login, Logout } = Constants.IdentityMethods;
9
9
 
10
+ export type IdentityCache = BaseVault<Dictionary<ICachedIdentityCall>>;
11
+
10
12
  export type IParseCachedIdentityResponse = (
11
13
  cachedIdentity: ICachedIdentityCall,
12
14
  mpid: string,
@@ -69,7 +71,7 @@ export const cacheIdentityRequest = (
69
71
  method: IdentityAPIMethod,
70
72
  identities: IKnownIdentities,
71
73
  expireTimestamp: number,
72
- idCache: BaseVault<Dictionary<ICachedIdentityCall>>,
74
+ idCache: IdentityCache,
73
75
  xhr: XMLHttpRequest
74
76
  ): void => {
75
77
  const cache: Dictionary<ICachedIdentityCall> = idCache.retrieve() || ({} as Dictionary<ICachedIdentityCall>);
@@ -126,7 +128,7 @@ export const concatenateIdentities = (
126
128
  export const hasValidCachedIdentity = (
127
129
  method: IdentityAPIMethod,
128
130
  proposedUserIdentities: IKnownIdentities,
129
- idCache?: BaseVault<Dictionary<ICachedIdentityCall>>
131
+ idCache?: IdentityCache,
130
132
  ): boolean => {
131
133
  // There is an edge case where multiple identity calls are taking place
132
134
  // before identify fires, so there may not be a cache. See what happens when
@@ -166,7 +168,7 @@ export const hasValidCachedIdentity = (
166
168
  export const getCachedIdentity = (
167
169
  method: IdentityAPIMethod,
168
170
  proposedUserIdentities: IKnownIdentities,
169
- idCache: BaseVault<Dictionary<ICachedIdentityCall>>
171
+ idCache: IdentityCache,
170
172
  ): ICachedIdentityCall | null => {
171
173
  const cacheKey: string = concatenateIdentities(
172
174
  method,
@@ -215,7 +217,7 @@ export const removeExpiredIdentityCacheDates = (idCache: BaseVault<Dictionary<IC
215
217
 
216
218
  export const tryCacheIdentity = (
217
219
  knownIdentities: IKnownIdentities,
218
- idCache: BaseVault<Dictionary<ICachedIdentityCall>>,
220
+ idCache: IdentityCache,
219
221
  parseIdentityResponse: IParseCachedIdentityResponse,
220
222
  mpid: string,
221
223
  callback: IdentityCallback,
@@ -0,0 +1,205 @@
1
+ import { IdentityApiData, MPID, UserIdentities } from '@mparticle/web-sdk';
2
+ import AudienceManager from './audienceManager';
3
+ import { ICachedIdentityCall, IKnownIdentities } from './identity-utils';
4
+ import { BaseVault } from './vault';
5
+ import { Dictionary, Environment, valueof } from './utils';
6
+ import Constants from './constants';
7
+ import {
8
+ IdentityCallback,
9
+ IUserAttributeChangeEvent,
10
+ IUserIdentityChangeEvent,
11
+ IMParticleUser,
12
+ mParticleUserCart,
13
+ } from './identity-user-interfaces';
14
+ const { platform, sdkVendor, sdkVersion, HTTPCodes } = Constants;
15
+
16
+ export type IdentityPreProcessResult = {
17
+ valid: boolean;
18
+ error?: string;
19
+ };
20
+
21
+ export type IdentityAPIMethod = valueof<typeof Constants.IdentityMethods>;
22
+
23
+ export enum SDKIdentityTypeEnum {
24
+ other = 'other',
25
+ customerId = 'customerid',
26
+ facebook = 'facebook',
27
+ twitter = 'twitter',
28
+ google = 'google',
29
+ microsoft = 'microsoft',
30
+ yahoo = 'yahoo',
31
+ email = 'email',
32
+ alias = 'alias',
33
+ facebookCustomAudienceId = 'facebookcustomaudienceid',
34
+ otherId2 = 'other2',
35
+ otherId3 = 'other3',
36
+ otherId4 = 'other4',
37
+ otherId5 = 'other5',
38
+ otherId6 = 'other6',
39
+ otherId7 = 'other7',
40
+ otherId8 = 'other8',
41
+ otherId9 = 'other9',
42
+ otherId10 = 'other10',
43
+ mobileNumber = 'mobile_number',
44
+ phoneNumber2 = 'phone_number_2',
45
+ phoneNumber3 = 'phone_number_3',
46
+ }
47
+
48
+ export interface IIdentityAPIRequestData {
49
+ client_sdk: {
50
+ platform: typeof platform;
51
+ sdk_vendor: typeof sdkVendor;
52
+ sdk_version: typeof sdkVersion;
53
+ };
54
+ context: string | null;
55
+ environment: Environment;
56
+ request_id: string;
57
+ reqest_timestamp_unixtime_ms: number;
58
+ previous_mpid: MPID | null;
59
+ known_identities: IKnownIdentities;
60
+ }
61
+
62
+ export interface IIdentityAPIModifyRequestData
63
+ extends Omit<
64
+ IIdentityAPIRequestData,
65
+ 'known_identities' | 'previous_mpid'
66
+ > {
67
+ identity_changes: IIdentityAPIIdentityChangeData[];
68
+ }
69
+
70
+ export interface IIdentityAPIIdentityChangeData {
71
+ identity_type: SDKIdentityTypeEnum;
72
+ old_value: string;
73
+ new_value: string;
74
+ }
75
+
76
+ export interface IIdentityRequest {
77
+ combineUserIdentities(
78
+ previousUIByName: UserIdentities,
79
+ newUIByName: UserIdentities
80
+ ): UserIdentities;
81
+ createIdentityRequest(
82
+ identityApiData: IdentityApiData,
83
+ platform: string,
84
+ sdkVendor: string,
85
+ sdkVersion: string,
86
+ deviceId: string,
87
+ context: string | null,
88
+ mpid: MPID
89
+ ): IIdentityAPIRequestData;
90
+ createModifyIdentityRequest(
91
+ currentUserIdentities: UserIdentities,
92
+ newUserIdentities: UserIdentities,
93
+ platform: string,
94
+ sdkVendor: string,
95
+ sdkVersion: string,
96
+ context: string | null
97
+ ): IIdentityAPIModifyRequestData;
98
+ createIdentityChanges(
99
+ previousIdentities: UserIdentities,
100
+ newIdentitie: UserIdentities
101
+ ): IIdentityAPIIdentityChangeData;
102
+ preProcessIdentityRequest(
103
+ identityApiData: IdentityApiData,
104
+ callback: IdentityCallback,
105
+ method: IdentityAPIMethod
106
+ ): IdentityPreProcessResult;
107
+ }
108
+
109
+ export interface IAliasRequest {
110
+ destinationMpid: MPID;
111
+ sourceMpid: MPID;
112
+ startTime: number;
113
+ endTime: number;
114
+ scope?: string;
115
+ }
116
+
117
+ export interface SDKIdentityApi {
118
+ HTTPCodes: typeof HTTPCodes;
119
+ identify?(
120
+ identityApiData?: IdentityApiData,
121
+ callback?: IdentityCallback
122
+ ): void;
123
+ login?(
124
+ identityApiData?: IdentityApiData,
125
+ callback?: IdentityCallback
126
+ ): void;
127
+ logout?(
128
+ identityApiData?: IdentityApiData,
129
+ callback?: IdentityCallback
130
+ ): void;
131
+ modify?(
132
+ identityApiData?: IdentityApiData,
133
+ callback?: IdentityCallback
134
+ ): void;
135
+ getCurrentUser?(): IMParticleUser;
136
+ getUser?(mpid: string): IMParticleUser;
137
+ getUsers?(): IMParticleUser[];
138
+ aliasUsers?(
139
+ aliasRequest?: IAliasRequest,
140
+ callback?: IdentityCallback
141
+ ): void;
142
+ createAliasRequest?(
143
+ sourceUser: IMParticleUser,
144
+ destinationUser: IMParticleUser
145
+ ): IAliasRequest;
146
+ }
147
+
148
+ export interface IIdentity {
149
+ audienceManager: AudienceManager;
150
+ idCache: BaseVault<Dictionary<ICachedIdentityCall>>;
151
+
152
+ IdentityAPI: SDKIdentityApi;
153
+ IdentityRequest: IIdentityRequest;
154
+
155
+ mParticleUser(mpid: MPID, IsLoggedIn: boolean): IMParticleUser;
156
+
157
+ checkIdentitySwap(
158
+ previousMPID: MPID,
159
+ currentMPID: MPID,
160
+ currentSessionMPIDs?: MPID[]
161
+ ): void;
162
+ createUserAttributeChange(
163
+ key: string,
164
+ newValue: string,
165
+ previousUserAttributeValue: string,
166
+ isNewAttribute: boolean,
167
+ deleted: boolean,
168
+ user: IMParticleUser
169
+ ): IUserAttributeChangeEvent;
170
+ createUserIdentityChange(
171
+ identityType: SDKIdentityTypeEnum,
172
+ newIdentity: string,
173
+ oldIdentity: string,
174
+ newCreatedThisBatch: boolean,
175
+ userInMemory: IMParticleUser
176
+ ): IUserIdentityChangeEvent;
177
+ parseIdentityResponse(
178
+ xhr: XMLHttpRequest,
179
+ previousMPID: MPID,
180
+ callback: IdentityCallback,
181
+ identityApiData: IdentityApiData,
182
+ method: IdentityAPIMethod,
183
+ knownIdentities: UserIdentities,
184
+ parsingCachedResponse: boolean
185
+ ): void;
186
+ sendUserAttributeChangeEvent(
187
+ attributeKey: string,
188
+ newUserAttributeValue: string,
189
+ previousUserAttributeValue: string,
190
+ isNewAttribute: boolean,
191
+ deleted: boolean,
192
+ user: IMParticleUser
193
+ ): void;
194
+ sendUserIdentityChangeEvent(
195
+ newUserIdentities: UserIdentities,
196
+ method: IdentityAPIMethod,
197
+ mpid: MPID,
198
+ prevUserIdentities: UserIdentities
199
+ ): void;
200
+
201
+ /**
202
+ * @deprecated
203
+ */
204
+ mParticleUserCart(mpid: MPID): mParticleUserCart;
205
+ }
package/src/identity.js CHANGED
@@ -1272,6 +1272,7 @@ export default function Identity(mpInstance) {
1272
1272
  * @method getuserAudiences
1273
1273
  * @param {Function} [callback] A callback function that is invoked when the user audience request completes
1274
1274
  */
1275
+ // https://go.mparticle.com/work/SQDSDKS-6436
1275
1276
  getUserAudiences: function(callback) {
1276
1277
  // user audience API is feature flagged
1277
1278
  if (
@@ -1829,6 +1830,7 @@ export default function Identity(mpInstance) {
1829
1830
  ) {
1830
1831
  var userIdentityChangeEvent;
1831
1832
 
1833
+ // https://go.mparticle.com/work/SQDSDKS-6439
1832
1834
  userIdentityChangeEvent = mpInstance._ServerModel.createEventObject({
1833
1835
  messageType: Types.MessageType.UserIdentityChange,
1834
1836
  userIdentityChanges: {
@@ -1883,6 +1885,7 @@ export default function Identity(mpInstance) {
1883
1885
  }
1884
1886
  var userAttributeChangeEvent;
1885
1887
  if (newValue !== previousUserAttributeValue) {
1888
+ // https://go.mparticle.com/work/SQDSDKS-6439
1886
1889
  userAttributeChangeEvent = mpInstance._ServerModel.createEventObject(
1887
1890
  {
1888
1891
  messageType: Types.MessageType.UserAttributeChange,
@@ -14,6 +14,7 @@ import {
14
14
  SessionAttributes,
15
15
  } from './store';
16
16
  import { Dictionary } from './utils';
17
+ import { UserAttributes } from './identity-user-interfaces';
17
18
 
18
19
  export type CookieSyncDate = Dictionary<string>;
19
20
  export type UploadsTable = Dictionary<any>;
@@ -22,10 +23,6 @@ export interface iForwardingStatsBatches {
22
23
  forwardingStatsEventQueue: ForwardingStatsData[];
23
24
  }
24
25
 
25
- // TODO: Migrate this to @types/mparticle__web-sdk
26
- // https://go.mparticle.com/work/SQDSDKS-5196
27
- export type UserAttributes = AllUserAttributes;
28
-
29
26
  export interface IGlobalStoreV2MinifiedKeys {
30
27
  sid: string; // Session ID
31
28
  ie: boolean; // Is Enabled
@@ -2,13 +2,13 @@ import * as EventsApi from '@mparticle/event-models';
2
2
  import { DataPlanVersion } from '@mparticle/data-planning-models';
3
3
  import {
4
4
  MPConfiguration,
5
- IdentityApiData,
6
5
  MPID,
7
6
  Callback,
7
+ IdentityApiData,
8
8
  } from '@mparticle/web-sdk';
9
9
  import { IStore } from './store';
10
10
  import Validators from './validators';
11
- import { Dictionary, valueof } from './utils';
11
+ import { Dictionary } from './utils';
12
12
  import { IServerModel } from './serverModel';
13
13
  import { IKitConfigs } from './configAPIClient';
14
14
  import { SDKConsentApi, SDKConsentState } from './consent';
@@ -16,7 +16,15 @@ import { IPersistence } from './persistence.interfaces';
16
16
  import { IMPSideloadedKit } from './sideloadedKit';
17
17
  import { ISessionManager } from './sessionManager';
18
18
  import { Kit, MPForwarder } from './forwarders.interfaces';
19
- import Constants from './constants';
19
+ import { IIdentity, SDKIdentityApi } from './identity.interfaces';
20
+ import {
21
+ ISDKUserAttributeChangeData,
22
+ ISDKUserIdentityChanges,
23
+ IMParticleUser,
24
+ ISDKUserIdentity,
25
+ IdentityCallback,
26
+ } from './identity-user-interfaces';
27
+ import { IIdentityType } from './types.interfaces';
20
28
 
21
29
  // TODO: Resolve this with version in @mparticle/web-sdk
22
30
  export type SDKEventCustomFlags = Dictionary<any>;
@@ -27,7 +35,7 @@ export interface SDKEvent {
27
35
  EventName: string;
28
36
  EventCategory: number;
29
37
  UserAttributes?: { [key: string]: string | string[] | null };
30
- UserIdentities?: SDKUserIdentity[];
38
+ UserIdentities?: ISDKUserIdentity[];
31
39
  SourceMessageId: string;
32
40
  MPID: string;
33
41
  EventAttributes?: { [key: string]: string };
@@ -51,15 +59,12 @@ export interface SDKEvent {
51
59
  PromotionAction?: SDKPromotionAction;
52
60
  ProductImpressions?: SDKProductImpression[];
53
61
  ShoppingCart?: SDKShoppingCart;
54
- UserIdentityChanges?: SDKUserIdentityChangeData;
55
- UserAttributeChanges?: SDKUserAttributeChangeData;
62
+ UserIdentityChanges?: ISDKUserIdentityChanges;
63
+ UserAttributeChanges?: ISDKUserAttributeChangeData;
56
64
  CurrencyCode: string;
57
65
  DataPlan?: SDKDataPlan;
58
66
  LaunchReferral?: string;
59
67
  }
60
-
61
- export type IdentityAPIMethod = valueof<typeof Constants.IdentityMethods>;
62
-
63
68
  export interface SDKGeoLocation {
64
69
  lat: number | string;
65
70
  lng: number | string;
@@ -70,11 +75,6 @@ export interface SDKDataPlan {
70
75
  PlanId?: string | null;
71
76
  }
72
77
 
73
- export interface SDKUserIdentity {
74
- Identity?: string;
75
- Type: number;
76
- }
77
-
78
78
  export interface SDKShoppingCart {
79
79
  ProductList?: SDKProduct[];
80
80
  }
@@ -144,6 +144,8 @@ interface IEvents {
144
144
 
145
145
  export interface MParticleWebSDK {
146
146
  addForwarder(mockForwarder: MPForwarder): void;
147
+ IdentityType: IIdentityType;
148
+ _Identity: IIdentity;
147
149
  Identity: SDKIdentityApi;
148
150
  Logger: SDKLoggerApi;
149
151
  MPSideloadedKit: IMPSideloadedKit;
@@ -167,14 +169,20 @@ export interface MParticleWebSDK {
167
169
  keepPersistence?: boolean,
168
170
  instance?: MParticleWebSDK
169
171
  ): void;
172
+ endSession(): void;
173
+ identifyRequest: IdentityApiData;
170
174
  init(apiKey: string, config: SDKInitConfig, instanceName?: string): void;
175
+ _getActiveForwarders(): MPForwarder[];
171
176
  getAppName(): string;
172
177
  getAppVersion(): string;
173
178
  getDeviceId(): string;
179
+ setDeviceId(deviceId: string): void;
174
180
  getInstance(): MParticleWebSDK; // TODO: Create a new type for MParticleWebSDKInstance
175
181
  ServerModel();
176
182
  upload();
183
+ setLogLevel(logLevel: LogLevelType): void;
177
184
  setPosition(lat: number | string, lng: number | string): void;
185
+ startNewSession(): void;
178
186
  logEvent(
179
187
  eventName: string,
180
188
  eventType?: number,
@@ -231,6 +239,9 @@ export interface SDKInitConfig
231
239
 
232
240
  workspaceToken?: string;
233
241
  isDevelopmentMode?: boolean;
242
+
243
+ // https://go.mparticle.com/work/SQDSDKS-6460
244
+ identityCallback?: IdentityCallback;
234
245
  }
235
246
 
236
247
  export interface DataPlanConfig {
@@ -239,16 +250,6 @@ export interface DataPlanConfig {
239
250
  document?: DataPlanResult; // when the data plan comes from the server via /mparticle.js
240
251
  }
241
252
 
242
- export interface SDKIdentityApi {
243
- getCurrentUser();
244
- IdentityAPI;
245
- identify;
246
- login;
247
- logout;
248
- modify;
249
- getUser(mpid: string): MParticleUser;
250
- }
251
-
252
253
  export interface SDKHelpersApi {
253
254
  canLog?(): boolean;
254
255
  createMainStorageName?(workspaceToken: string): string;
@@ -271,7 +272,7 @@ export interface SDKHelpersApi {
271
272
  callback: Callback,
272
273
  code: string,
273
274
  body: string,
274
- mParticleUser?: MParticleUser,
275
+ mParticleUser?: IMParticleUser,
275
276
  previousMpid?: MPID
276
277
  ): void;
277
278
  sanitizeAttributes?(
@@ -304,35 +305,6 @@ export interface SDKConfigApi {
304
305
  onCreateBatch(batch: EventsApi.Batch): EventsApi.Batch;
305
306
  }
306
307
 
307
- // FIXME: Resolve with User in @types/mparticle-web-sdk
308
- // https://go.mparticle.com/work/SQDSDKS-5033
309
- export interface MParticleUser {
310
- getMPID(): string;
311
- getConsentState(): SDKConsentState;
312
- getAllUserAttributes(): any; // FIXME;
313
- getUserIdentities(): IdentityApiData; // FIXME: Is this correct?
314
- }
315
-
316
- export interface SDKUserIdentityChangeData {
317
- New: Identity;
318
- Old: Identity;
319
- }
320
-
321
- export interface Identity {
322
- IdentityType: SDKIdentityTypeEnum;
323
- Identity: string;
324
- Timestamp: number;
325
- CreatedThisBatch: boolean;
326
- }
327
-
328
- export interface SDKUserAttributeChangeData {
329
- UserAttributeName: string;
330
- New: string;
331
- Old: string;
332
- Deleted: boolean;
333
- IsNewAttribute: boolean;
334
- }
335
-
336
308
  export interface BaseEvent {
337
309
  messageType: number;
338
310
  name?: string;
@@ -341,8 +313,8 @@ export interface BaseEvent {
341
313
  customFlags?: { [key: string]: string };
342
314
  toEventAPIObject?(): SDKEvent;
343
315
  sourceMessageId?: string;
344
- userAttributeChanges?: SDKUserAttributeChangeData;
345
- userIdentityChanges?: SDKUserIdentityChangeData;
316
+ userAttributeChanges?: ISDKUserAttributeChangeData;
317
+ userIdentityChanges?: ISDKUserIdentityChanges;
346
318
  }
347
319
 
348
320
  export interface KitBlockerOptions {
@@ -369,28 +341,3 @@ export interface DataPlanResult {
369
341
  };
370
342
  error_message?: string;
371
343
  }
372
-
373
- export enum SDKIdentityTypeEnum {
374
- other = 'other',
375
- customerId = 'customerid',
376
- facebook = 'facebook',
377
- twitter = 'twitter',
378
- google = 'google',
379
- microsoft = 'microsoft',
380
- yahoo = 'yahoo',
381
- email = 'email',
382
- alias = 'alias',
383
- facebookCustomAudienceId = 'facebookcustomaudienceid',
384
- otherId2 = 'other2',
385
- otherId3 = 'other3',
386
- otherId4 = 'other4',
387
- otherId5 = 'other5',
388
- otherId6 = 'other6',
389
- otherId7 = 'other7',
390
- otherId8 = 'other8',
391
- otherId9 = 'other9',
392
- otherId10 = 'other10',
393
- mobileNumber = 'mobile_number',
394
- phoneNumber2 = 'phone_number_2',
395
- phoneNumber3 = 'phone_number_3',
396
- }
@@ -3,10 +3,8 @@ import {
3
3
  SDKGeoLocation,
4
4
  SDKProduct,
5
5
  SDKPromotion,
6
- SDKUserIdentity,
7
6
  SDKProductActionType,
8
7
  MParticleWebSDK,
9
- SDKIdentityTypeEnum,
10
8
  } from './sdkRuntimeModels';
11
9
  import * as EventsApi from '@mparticle/event-models';
12
10
  import {
@@ -16,6 +14,8 @@ import {
16
14
  } from './consent';
17
15
  import Types from './types';
18
16
  import { isEmpty } from './utils';
17
+ import { ISDKUserIdentity } from './identity-user-interfaces';
18
+ import { SDKIdentityTypeEnum } from './identity.interfaces';
19
19
 
20
20
  export function convertEvents(
21
21
  mpid: string,
@@ -151,7 +151,7 @@ export function convertCcpaConsentState(
151
151
  }
152
152
 
153
153
  export function convertUserIdentities(
154
- sdkUserIdentities?: SDKUserIdentity[]
154
+ sdkUserIdentities?: ISDKUserIdentity[]
155
155
  ): EventsApi.BatchUserIdentities | null {
156
156
  if (!sdkUserIdentities || !sdkUserIdentities.length) {
157
157
  return null;
@@ -407,8 +407,9 @@ export function convertShoppingCart(
407
407
  export function convertCommerceEvent(
408
408
  sdkEvent: SDKEvent
409
409
  ): EventsApi.CommerceEvent {
410
- const commonEventData: EventsApi.CommonEventData =
411
- convertBaseEventData(sdkEvent);
410
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
411
+ sdkEvent
412
+ );
412
413
  let commerceEventData: EventsApi.CommerceEventData = {
413
414
  custom_flags: sdkEvent.CustomFlags,
414
415
  product_action: convertProductAction(sdkEvent),
@@ -427,8 +428,9 @@ export function convertCommerceEvent(
427
428
  export function convertCrashReportEvent(
428
429
  sdkEvent: SDKEvent
429
430
  ): EventsApi.CrashReportEvent {
430
- const commonEventData: EventsApi.CommonEventData =
431
- convertBaseEventData(sdkEvent);
431
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
432
+ sdkEvent
433
+ );
432
434
  let crashReportEventData: EventsApi.CrashReportEventData = {
433
435
  message: sdkEvent.EventName,
434
436
  };
@@ -442,8 +444,9 @@ export function convertCrashReportEvent(
442
444
  export function convertAST(
443
445
  sdkEvent: SDKEvent
444
446
  ): EventsApi.ApplicationStateTransitionEvent {
445
- const commonEventData: EventsApi.CommonEventData =
446
- convertBaseEventData(sdkEvent);
447
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
448
+ sdkEvent
449
+ );
447
450
  let astEventData: EventsApi.ApplicationStateTransitionEventData = {
448
451
  application_transition_type:
449
452
  EventsApi
@@ -463,8 +466,9 @@ export function convertAST(
463
466
  export function convertSessionEndEvent(
464
467
  sdkEvent: SDKEvent
465
468
  ): EventsApi.SessionEndEvent {
466
- const commonEventData: EventsApi.CommonEventData =
467
- convertBaseEventData(sdkEvent);
469
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
470
+ sdkEvent
471
+ );
468
472
  let sessionEndEventData: EventsApi.SessionEndEventData = {
469
473
  session_duration_ms: sdkEvent.SessionLength,
470
474
  //note: External Events DTO does not support the session mpids array as of this time.
@@ -480,8 +484,9 @@ export function convertSessionEndEvent(
480
484
  export function convertSessionStartEvent(
481
485
  sdkEvent: SDKEvent
482
486
  ): EventsApi.SessionStartEvent {
483
- const commonEventData: EventsApi.CommonEventData =
484
- convertBaseEventData(sdkEvent);
487
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
488
+ sdkEvent
489
+ );
485
490
  let sessionStartEventData: EventsApi.SessionStartEventData = {};
486
491
  sessionStartEventData = Object.assign(
487
492
  sessionStartEventData,
@@ -496,8 +501,9 @@ export function convertSessionStartEvent(
496
501
  export function convertPageViewEvent(
497
502
  sdkEvent: SDKEvent
498
503
  ): EventsApi.ScreenViewEvent {
499
- const commonEventData: EventsApi.CommonEventData =
500
- convertBaseEventData(sdkEvent);
504
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
505
+ sdkEvent
506
+ );
501
507
  let screenViewEventData: EventsApi.ScreenViewEventData = {
502
508
  custom_flags: sdkEvent.CustomFlags,
503
509
  screen_name: sdkEvent.EventName,
@@ -510,8 +516,9 @@ export function convertPageViewEvent(
510
516
  }
511
517
 
512
518
  export function convertOptOutEvent(sdkEvent: SDKEvent): EventsApi.OptOutEvent {
513
- const commonEventData: EventsApi.CommonEventData =
514
- convertBaseEventData(sdkEvent);
519
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
520
+ sdkEvent
521
+ );
515
522
  let optOutEventData: EventsApi.OptOutEventData = {
516
523
  is_opted_out: sdkEvent.OptOut,
517
524
  };
@@ -523,8 +530,9 @@ export function convertOptOutEvent(sdkEvent: SDKEvent): EventsApi.OptOutEvent {
523
530
  }
524
531
 
525
532
  export function convertCustomEvent(sdkEvent: SDKEvent): EventsApi.CustomEvent {
526
- const commonEventData: EventsApi.CommonEventData =
527
- convertBaseEventData(sdkEvent);
533
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
534
+ sdkEvent
535
+ );
528
536
  let customEventData: EventsApi.CustomEventData = {
529
537
  custom_event_type: convertSdkEventType(
530
538
  sdkEvent.EventCategory
@@ -628,8 +636,9 @@ export function convertSDKLocation(
628
636
  export function convertUserAttributeChangeEvent(
629
637
  sdkEvent: SDKEvent
630
638
  ): EventsApi.UserAttributeChangeEvent | null {
631
- const commonEventData: EventsApi.CommonEventData =
632
- convertBaseEventData(sdkEvent);
639
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
640
+ sdkEvent
641
+ );
633
642
  let userAttributeChangeEvent: EventsApi.UserAttributeChangeEventData = {
634
643
  user_attribute_name: sdkEvent.UserAttributeChanges.UserAttributeName,
635
644
  new: sdkEvent.UserAttributeChanges.New,
@@ -652,8 +661,9 @@ export function convertUserAttributeChangeEvent(
652
661
  export function convertUserIdentityChangeEvent(
653
662
  sdkEvent: SDKEvent
654
663
  ): EventsApi.UserIdentityChangeEvent | null {
655
- const commonEventData: EventsApi.CommonEventData =
656
- convertBaseEventData(sdkEvent);
664
+ const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
665
+ sdkEvent
666
+ );
657
667
 
658
668
  let userIdentityChangeEvent: EventsApi.UserIdentityChangeEventData = {
659
669
  new: {