@mparticle/web-sdk 2.33.1 → 2.35.0
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.
- package/README.md +1 -3
- package/dist/mparticle.common.js +27 -20
- package/dist/mparticle.esm.js +27 -20
- package/dist/mparticle.js +193 -61
- package/package.json +1 -1
- package/src/apiClient.ts +2 -1
- package/src/batchUploader.ts +70 -9
- package/src/constants.ts +1 -0
- package/src/forwarders.interfaces.ts +22 -16
- package/src/integrationCapture.ts +7 -0
- package/src/mp-instance.ts +7 -4
- package/src/mparticle-instance-manager.ts +9 -7
- package/src/roktManager.ts +76 -0
- package/src/sdkRuntimeModels.ts +17 -11
- package/src/sdkToEventsApiConverter.ts +6 -4
- package/src/serverModel.ts +2 -47
- package/src/store.ts +7 -3
- package/src/user-utils.ts +51 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Polyfill from './polyfill';
|
|
2
|
-
import
|
|
2
|
+
import { CommerceEventType, EventType, IdentityType, ProductActionType, PromotionActionType } from './types';
|
|
3
3
|
import Constants from './constants';
|
|
4
4
|
import mParticleInstance, { IMParticleWebSDKInstance } from './mp-instance.js';
|
|
5
5
|
import _BatchValidator from './mockBatchCreator';
|
|
@@ -7,7 +7,6 @@ import MPSideloadedKit from './sideloadedKit';
|
|
|
7
7
|
import { IMParticleInstanceManager } from './sdkRuntimeModels';
|
|
8
8
|
import { IStore } from './store';
|
|
9
9
|
import { Dictionary } from '@mparticle/web-sdk';
|
|
10
|
-
import { valueof } from './utils';
|
|
11
10
|
|
|
12
11
|
if (!Array.prototype.forEach) {
|
|
13
12
|
Array.prototype.forEach = Polyfill.forEach;
|
|
@@ -32,11 +31,11 @@ function mParticleInstanceManager(this: IMParticleInstanceManager) {
|
|
|
32
31
|
// Only leaving this here in case any clients are trying to access mParticle.Store, to prevent from throwing
|
|
33
32
|
this.Store = {} as IStore;
|
|
34
33
|
this._instances = {} as Dictionary<IMParticleWebSDKInstance>;
|
|
35
|
-
this.IdentityType =
|
|
36
|
-
this.EventType = EventType
|
|
37
|
-
this.CommerceEventType = CommerceEventType
|
|
38
|
-
this.PromotionType = PromotionActionType
|
|
39
|
-
this.ProductActionType = ProductActionType
|
|
34
|
+
this.IdentityType = IdentityType;
|
|
35
|
+
this.EventType = EventType;
|
|
36
|
+
this.CommerceEventType = CommerceEventType;
|
|
37
|
+
this.PromotionType = PromotionActionType;
|
|
38
|
+
this.ProductActionType = ProductActionType;
|
|
40
39
|
|
|
41
40
|
this.MPSideloadedKit = MPSideloadedKit;
|
|
42
41
|
|
|
@@ -104,6 +103,9 @@ function mParticleInstanceManager(this: IMParticleInstanceManager) {
|
|
|
104
103
|
return client;
|
|
105
104
|
}
|
|
106
105
|
};
|
|
106
|
+
|
|
107
|
+
this.Rokt = self.getInstance()._RoktManager;
|
|
108
|
+
|
|
107
109
|
this.getDeviceId = function() {
|
|
108
110
|
return self.getInstance().getDeviceId();
|
|
109
111
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// https://docs.rokt.com/developers/integration-guides/web/library/attributes
|
|
2
|
+
export interface IRoktPartnerAttributes {
|
|
3
|
+
[key: string]: string | number | boolean | undefined | null;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// https://docs.rokt.com/developers/integration-guides/web/library/select-placements-options
|
|
7
|
+
export interface IRoktSelectPlacementsOptions {
|
|
8
|
+
attributes: IRoktPartnerAttributes;
|
|
9
|
+
identifier?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IRoktPlacement {}
|
|
13
|
+
|
|
14
|
+
export interface IRoktSelection {
|
|
15
|
+
close: () => void;
|
|
16
|
+
getPlacements: () => Promise<IRoktPlacement[]>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IRoktLauncher {
|
|
20
|
+
selectPlacements: (options: IRoktSelectPlacementsOptions) => Promise<IRoktSelection>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IRoktMessage {
|
|
24
|
+
methodName: string;
|
|
25
|
+
payload: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default class RoktManager {
|
|
29
|
+
public launcher: IRoktLauncher | null = null;
|
|
30
|
+
private messageQueue: IRoktMessage[] = [];
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
this.launcher = null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public attachLauncher(launcher: IRoktLauncher): void {
|
|
37
|
+
this.setLauncher(launcher);
|
|
38
|
+
this.processMessageQueue();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public selectPlacements(options: IRoktSelectPlacementsOptions): Promise<IRoktSelection> {
|
|
42
|
+
if (!this.launcher) {
|
|
43
|
+
this.queueMessage({
|
|
44
|
+
methodName: 'selectPlacements',
|
|
45
|
+
payload: options,
|
|
46
|
+
});
|
|
47
|
+
return Promise.resolve({} as IRoktSelection);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
return this.launcher.selectPlacements(options);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
return Promise.reject(error instanceof Error ? error : new Error('Unknown error occurred'));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private processMessageQueue(): void {
|
|
58
|
+
if (this.messageQueue.length > 0) {
|
|
59
|
+
this.messageQueue.forEach(async (message) => {
|
|
60
|
+
if (this.launcher && message.methodName in this.launcher) {
|
|
61
|
+
await (this.launcher[message.methodName] as Function)(message.payload);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
this.messageQueue = [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
private queueMessage(message: IRoktMessage): void {
|
|
70
|
+
this.messageQueue.push(message);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private setLauncher(launcher: IRoktLauncher): void {
|
|
74
|
+
this.launcher = launcher;
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/sdkRuntimeModels.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { IKitConfigs } from './configAPIClient';
|
|
|
14
14
|
import { SDKConsentApi, SDKConsentState } from './consent';
|
|
15
15
|
import MPSideloadedKit from './sideloadedKit';
|
|
16
16
|
import { ISessionManager } from './sessionManager';
|
|
17
|
-
import {
|
|
17
|
+
import { ConfiguredKit, MPForwarder, UnregisteredKit } from './forwarders.interfaces';
|
|
18
18
|
import {
|
|
19
19
|
SDKIdentityApi,
|
|
20
20
|
IAliasCallback,
|
|
@@ -39,6 +39,7 @@ import _BatchValidator from './mockBatchCreator';
|
|
|
39
39
|
import { SDKECommerceAPI } from './ecommerce.interfaces';
|
|
40
40
|
import { IErrorLogMessage, IMParticleWebSDKInstance, IntegrationDelays } from './mp-instance';
|
|
41
41
|
import Constants from './constants';
|
|
42
|
+
import RoktManager from './roktManager';
|
|
42
43
|
|
|
43
44
|
// TODO: Resolve this with version in @mparticle/web-sdk
|
|
44
45
|
export type SDKEventCustomFlags = Dictionary<any>;
|
|
@@ -80,6 +81,7 @@ export interface SDKEvent {
|
|
|
80
81
|
LaunchReferral?: string;
|
|
81
82
|
ExpandedEventCount: number;
|
|
82
83
|
ActiveTimeOnSite: number;
|
|
84
|
+
IsBackgroundAST?: boolean;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
export interface SDKGeoLocation {
|
|
@@ -163,11 +165,12 @@ export interface SDKProduct {
|
|
|
163
165
|
|
|
164
166
|
// https://go.mparticle.com/work/SQDSDKS-6949
|
|
165
167
|
export interface MParticleWebSDK {
|
|
166
|
-
addForwarder(
|
|
167
|
-
IdentityType:
|
|
168
|
-
CommerceEventType:
|
|
169
|
-
EventType:
|
|
170
|
-
PromotionType:
|
|
168
|
+
addForwarder(forwarder: UnregisteredKit): void;
|
|
169
|
+
IdentityType: typeof IdentityType;
|
|
170
|
+
CommerceEventType: typeof CommerceEventType;
|
|
171
|
+
EventType: typeof EventType;
|
|
172
|
+
PromotionType: typeof PromotionActionType;
|
|
173
|
+
ProductActionType: typeof ProductActionType;
|
|
171
174
|
Identity: SDKIdentityApi;
|
|
172
175
|
Logger: SDKLoggerApi;
|
|
173
176
|
Consent: SDKConsentApi;
|
|
@@ -179,7 +182,7 @@ export interface MParticleWebSDK {
|
|
|
179
182
|
configurePixel(config: IPixelConfiguration): void;
|
|
180
183
|
endSession(): void;
|
|
181
184
|
init(apiKey: string, config: SDKInitConfig, instanceName?: string): void;
|
|
182
|
-
_getActiveForwarders():
|
|
185
|
+
_getActiveForwarders(): ConfiguredKit[];
|
|
183
186
|
_getIntegrationDelays(): IntegrationDelays;
|
|
184
187
|
_setIntegrationDelay(module: number, shouldDelayIntegration: boolean): void;
|
|
185
188
|
_setWrapperSDKInfo(name: WrapperSDKTypes, version: string): void;
|
|
@@ -205,13 +208,15 @@ export interface MParticleWebSDK {
|
|
|
205
208
|
logError(error: IErrorLogMessage, attrs?: SDKEventAttrs): void;
|
|
206
209
|
logLink(selector: string, eventName: string, eventType: valueof<typeof EventType>, eventInfo: SDKEventAttrs): void;
|
|
207
210
|
logForm(selector: string, eventName: string, eventType: valueof<typeof EventType>, eventInfo: SDKEventAttrs): void;
|
|
208
|
-
logPageView(eventName
|
|
211
|
+
logPageView(eventName?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
209
212
|
setOptOut(isOptingOut: boolean): void;
|
|
210
213
|
eCommerce: SDKECommerceAPI;
|
|
211
214
|
isInitialized(): boolean;
|
|
212
|
-
ProductActionType: valueof<typeof ProductActionType>;
|
|
213
215
|
ready(f: Function): void;
|
|
214
|
-
|
|
216
|
+
|
|
217
|
+
// https://go.mparticle.com/work/SQDSDKS-7072
|
|
218
|
+
reset(instance?: IMParticleWebSDKInstance): void;
|
|
219
|
+
|
|
215
220
|
setAppName(name: string): void;
|
|
216
221
|
setAppVersion(version: string): void;
|
|
217
222
|
setOptOut(isOptingOut: boolean): void;
|
|
@@ -239,6 +244,7 @@ export interface IMParticleInstanceManager extends MParticleWebSDK {
|
|
|
239
244
|
config: SDKInitConfig;
|
|
240
245
|
isIOS?: boolean;
|
|
241
246
|
MPSideloadedKit: typeof MPSideloadedKit;
|
|
247
|
+
Rokt: RoktManager;
|
|
242
248
|
// https://go.mparticle.com/work/SQDSDKS-7060
|
|
243
249
|
sessionManager: Pick<ISessionManager, 'getSession'>;
|
|
244
250
|
Store: IStore;
|
|
@@ -266,7 +272,7 @@ export interface SDKInitConfig
|
|
|
266
272
|
logLevel?: LogLevelType;
|
|
267
273
|
|
|
268
274
|
kitConfigs?: IKitConfigs[];
|
|
269
|
-
kits?: Dictionary<
|
|
275
|
+
kits?: Dictionary<UnregisteredKit>;
|
|
270
276
|
sideloadedKits?: MPForwarder[];
|
|
271
277
|
dataPlanOptions?: KitBlockerOptions;
|
|
272
278
|
flags?: Dictionary;
|
|
@@ -489,11 +489,13 @@ export function convertAST(
|
|
|
489
489
|
const commonEventData: EventsApi.CommonEventData = convertBaseEventData(
|
|
490
490
|
sdkEvent
|
|
491
491
|
);
|
|
492
|
+
|
|
493
|
+
// Determine the transition type based on IsBackgroundAST flag
|
|
494
|
+
const { applicationBackground, applicationInitialized } = EventsApi.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum;
|
|
495
|
+
const transitionType = sdkEvent.IsBackgroundAST ? applicationBackground : applicationInitialized;
|
|
496
|
+
|
|
492
497
|
let astEventData: EventsApi.ApplicationStateTransitionEventData = {
|
|
493
|
-
application_transition_type:
|
|
494
|
-
EventsApi
|
|
495
|
-
.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum
|
|
496
|
-
.applicationInitialized,
|
|
498
|
+
application_transition_type: transitionType,
|
|
497
499
|
is_first_run: sdkEvent.IsFirstRun,
|
|
498
500
|
is_upgrade: false,
|
|
499
501
|
launch_referral: sdkEvent.LaunchReferral,
|
package/src/serverModel.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from './consent';
|
|
28
28
|
import { IMParticleUser, ISDKUserIdentity } from './identity-user-interfaces';
|
|
29
29
|
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
30
|
+
import { appendUserInfo } from './user-utils';
|
|
30
31
|
|
|
31
32
|
const MessageType = Types.MessageType;
|
|
32
33
|
const ApplicationTransitionType = Types.ApplicationTransitionType;
|
|
@@ -140,7 +141,6 @@ export interface IServerModel {
|
|
|
140
141
|
convertEventToV2DTO: (event: IUploadObject) => IServerV2DTO;
|
|
141
142
|
createEventObject: (event: BaseEvent, user?: IMParticleUser) => SDKEvent;
|
|
142
143
|
convertToConsentStateV2DTO: (state: SDKConsentState) => IConsentStateV2DTO;
|
|
143
|
-
appendUserInfo: (user: IMParticleUser, event: SDKEvent) => void;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
// TODO: Make this a pure function that returns a new object
|
|
@@ -201,51 +201,6 @@ export default function ServerModel(
|
|
|
201
201
|
) {
|
|
202
202
|
var self = this;
|
|
203
203
|
|
|
204
|
-
// TODO: Can we refactor this to not mutate the event?
|
|
205
|
-
this.appendUserInfo = function(
|
|
206
|
-
user: IMParticleUser,
|
|
207
|
-
event: SDKEvent
|
|
208
|
-
): void {
|
|
209
|
-
if (!event) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (!user) {
|
|
213
|
-
event.MPID = null;
|
|
214
|
-
event.ConsentState = null;
|
|
215
|
-
event.UserAttributes = null;
|
|
216
|
-
event.UserIdentities = null;
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (event.MPID && event.MPID === user.getMPID()) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
event.MPID = user.getMPID();
|
|
223
|
-
event.ConsentState = user.getConsentState();
|
|
224
|
-
event.UserAttributes = user.getAllUserAttributes();
|
|
225
|
-
|
|
226
|
-
var userIdentities = user.getUserIdentities().userIdentities;
|
|
227
|
-
var dtoUserIdentities = {};
|
|
228
|
-
for (var identityKey in userIdentities) {
|
|
229
|
-
var identityType = Types.IdentityType.getIdentityType(identityKey);
|
|
230
|
-
if (identityType !== false) {
|
|
231
|
-
dtoUserIdentities[identityType] = userIdentities[identityKey];
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
var validUserIdentities = [];
|
|
236
|
-
if (mpInstance._Helpers.isObject(dtoUserIdentities)) {
|
|
237
|
-
if (Object.keys(dtoUserIdentities).length) {
|
|
238
|
-
for (var key in dtoUserIdentities) {
|
|
239
|
-
var userIdentity: Partial<ISDKUserIdentity> = {};
|
|
240
|
-
userIdentity.Identity = dtoUserIdentities[key];
|
|
241
|
-
userIdentity.Type = mpInstance._Helpers.parseNumber(key);
|
|
242
|
-
validUserIdentities.push(userIdentity);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
event.UserIdentities = validUserIdentities;
|
|
247
|
-
};
|
|
248
|
-
|
|
249
204
|
this.convertToConsentStateV2DTO = function(
|
|
250
205
|
state: SDKConsentState
|
|
251
206
|
): IConsentStateV2DTO {
|
|
@@ -397,7 +352,7 @@ export default function ServerModel(
|
|
|
397
352
|
// FIXME: Remove duplicate occurence
|
|
398
353
|
eventObject.CurrencyCode = mpInstance._Store.currencyCode;
|
|
399
354
|
var currentUser = user || mpInstance.Identity.getCurrentUser();
|
|
400
|
-
|
|
355
|
+
appendUserInfo(currentUser, eventObject as SDKEvent);
|
|
401
356
|
|
|
402
357
|
if (event.messageType === Types.MessageType.SessionEnd) {
|
|
403
358
|
eventObject.SessionLength =
|
package/src/store.ts
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
returnConvertedBoolean,
|
|
31
31
|
} from './utils';
|
|
32
32
|
import { IMinifiedConsentJSONObject, SDKConsentState } from './consent';
|
|
33
|
-
import {
|
|
33
|
+
import { ConfiguredKit, MPForwarder, UnregisteredKit } from './forwarders.interfaces';
|
|
34
34
|
import { IdentityCallback, UserAttributes } from './identity-user-interfaces';
|
|
35
35
|
import {
|
|
36
36
|
IGlobalStoreV2MinifiedKeys,
|
|
@@ -61,7 +61,7 @@ export interface SDKConfig {
|
|
|
61
61
|
package?: string;
|
|
62
62
|
flags?: IFeatureFlags;
|
|
63
63
|
kitConfigs: IKitConfigs[];
|
|
64
|
-
kits: Dictionary<
|
|
64
|
+
kits: Dictionary<UnregisteredKit>;
|
|
65
65
|
logLevel?: LogLevelType;
|
|
66
66
|
cookieDomain?: string;
|
|
67
67
|
maxCookieSize?: number | undefined;
|
|
@@ -138,6 +138,8 @@ export interface IFeatureFlags {
|
|
|
138
138
|
offlineStorage?: string;
|
|
139
139
|
directURLRouting?: boolean;
|
|
140
140
|
cacheIdentity?: boolean;
|
|
141
|
+
captureIntegrationSpecificIds?: boolean;
|
|
142
|
+
astBackgroundEvents?: boolean;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
// Temporary Interface until Store can be refactored as a class
|
|
@@ -176,7 +178,7 @@ export interface IStore {
|
|
|
176
178
|
isLocalStorageAvailable: boolean | null;
|
|
177
179
|
storageName: string | null;
|
|
178
180
|
prodStorageName: string | null;
|
|
179
|
-
activeForwarders:
|
|
181
|
+
activeForwarders: ConfiguredKit[];
|
|
180
182
|
kits: Dictionary<MPForwarder>;
|
|
181
183
|
sideloadedKits: MPForwarder[];
|
|
182
184
|
configuredForwarders: MPForwarder[];
|
|
@@ -714,6 +716,7 @@ export function processFlags(config: SDKInitConfig): IFeatureFlags {
|
|
|
714
716
|
CacheIdentity,
|
|
715
717
|
AudienceAPI,
|
|
716
718
|
CaptureIntegrationSpecificIds,
|
|
719
|
+
AstBackgroundEvents
|
|
717
720
|
} = Constants.FeatureFlags;
|
|
718
721
|
|
|
719
722
|
if (!config.flags) {
|
|
@@ -732,6 +735,7 @@ export function processFlags(config: SDKInitConfig): IFeatureFlags {
|
|
|
732
735
|
flags[CacheIdentity] = config.flags[CacheIdentity] === 'True';
|
|
733
736
|
flags[AudienceAPI] = config.flags[AudienceAPI] === 'True';
|
|
734
737
|
flags[CaptureIntegrationSpecificIds] = config.flags[CaptureIntegrationSpecificIds] === 'True';
|
|
738
|
+
flags[AstBackgroundEvents] = config.flags[AstBackgroundEvents] === 'True';
|
|
735
739
|
|
|
736
740
|
return flags;
|
|
737
741
|
}
|
package/src/user-utils.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserIdentities } from '@mparticle/web-sdk';
|
|
2
|
+
import { IMParticleUser, ISDKUserIdentity, IdentityResultBody } from './identity-user-interfaces';
|
|
3
|
+
import { SDKEvent } from './sdkRuntimeModels';
|
|
4
|
+
import Types from './types';
|
|
5
|
+
import { isObject, parseNumber } from './utils';
|
|
2
6
|
|
|
3
7
|
export function hasMPIDAndUserLoginChanged(
|
|
4
8
|
previousUser: IMParticleUser,
|
|
@@ -23,3 +27,49 @@ export function hasMPIDChanged(
|
|
|
23
27
|
identityApiResult.mpid !== prevUser.getMPID())
|
|
24
28
|
);
|
|
25
29
|
}
|
|
30
|
+
|
|
31
|
+
// https://go.mparticle.com/work/SQDSDKS-7136
|
|
32
|
+
export function appendUserInfo(
|
|
33
|
+
user: IMParticleUser,
|
|
34
|
+
event: SDKEvent
|
|
35
|
+
): void {
|
|
36
|
+
if (!event) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!user) {
|
|
40
|
+
event.MPID = null;
|
|
41
|
+
event.ConsentState = null;
|
|
42
|
+
event.UserAttributes = null;
|
|
43
|
+
event.UserIdentities = null;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (event.MPID && event.MPID === user.getMPID()) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
event.MPID = user.getMPID();
|
|
51
|
+
event.ConsentState = user.getConsentState();
|
|
52
|
+
event.UserAttributes = user.getAllUserAttributes();
|
|
53
|
+
|
|
54
|
+
const userIdentities: UserIdentities = user.getUserIdentities().userIdentities;
|
|
55
|
+
const dtoUserIdentities = {};
|
|
56
|
+
for (const identityKey in userIdentities) {
|
|
57
|
+
const identityType = Types.IdentityType.getIdentityType(identityKey);
|
|
58
|
+
if (identityType !== false) {
|
|
59
|
+
dtoUserIdentities[identityType] = userIdentities[identityKey];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const validUserIdentities: ISDKUserIdentity[] = [];
|
|
64
|
+
if (isObject(dtoUserIdentities)) {
|
|
65
|
+
if (Object.keys(dtoUserIdentities).length) {
|
|
66
|
+
for (const key in dtoUserIdentities) {
|
|
67
|
+
const userIdentity = {} as ISDKUserIdentity;
|
|
68
|
+
userIdentity.Identity = dtoUserIdentities[key];
|
|
69
|
+
userIdentity.Type = parseNumber(key);
|
|
70
|
+
validUserIdentities.push(userIdentity);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
event.UserIdentities = validUserIdentities;
|
|
75
|
+
}
|