@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.
- package/dist/mparticle.common.js +8 -4
- package/dist/mparticle.esm.js +8 -4
- package/dist/mparticle.js +31 -26
- package/package.json +1 -1
- package/src/apiClient.ts +3 -2
- package/src/batchUploader.ts +5 -9
- package/src/consent.ts +4 -3
- package/src/forwarders.interfaces.ts +20 -18
- package/src/identity-user-interfaces.ts +113 -0
- package/src/identity-utils.ts +7 -5
- package/src/identity.interfaces.ts +205 -0
- package/src/identity.js +3 -0
- package/src/persistence.interfaces.ts +1 -4
- package/src/sdkRuntimeModels.ts +28 -81
- package/src/sdkToEventsApiConverter.ts +33 -23
- package/src/serverModel.ts +10 -8
- package/src/sessionManager.ts +3 -2
- package/src/store.ts +2 -1
- package/src/types.interfaces.ts +5 -1
- package/src/utils.ts +2 -0
- package/src/validators.ts +1 -1
package/src/serverModel.ts
CHANGED
|
@@ -6,12 +6,10 @@ import Types from './types';
|
|
|
6
6
|
import Constants from './constants';
|
|
7
7
|
import {
|
|
8
8
|
BaseEvent,
|
|
9
|
-
MParticleUser,
|
|
10
9
|
MParticleWebSDK,
|
|
11
10
|
SDKEvent,
|
|
12
11
|
SDKGeoLocation,
|
|
13
12
|
SDKProduct,
|
|
14
|
-
SDKUserIdentity,
|
|
15
13
|
} from './sdkRuntimeModels';
|
|
16
14
|
import {
|
|
17
15
|
parseNumber,
|
|
@@ -27,6 +25,7 @@ import {
|
|
|
27
25
|
IPrivacyV2DTO,
|
|
28
26
|
SDKConsentState,
|
|
29
27
|
} from './consent';
|
|
28
|
+
import { IMParticleUser, ISDKUserIdentity } from './identity-user-interfaces';
|
|
30
29
|
|
|
31
30
|
const MessageType = Types.MessageType;
|
|
32
31
|
const ApplicationTransitionType = Types.ApplicationTransitionType;
|
|
@@ -48,7 +47,7 @@ export interface IServerV2DTO {
|
|
|
48
47
|
n?: string;
|
|
49
48
|
et?: number;
|
|
50
49
|
ua?: Dictionary<string | string[]>;
|
|
51
|
-
ui?:
|
|
50
|
+
ui?: ISDKUserIdentity[];
|
|
52
51
|
ia?: Dictionary<Dictionary<string>>;
|
|
53
52
|
str?: ServerSettings;
|
|
54
53
|
sdk?: string;
|
|
@@ -135,9 +134,9 @@ export interface IUploadObject extends SDKEvent {
|
|
|
135
134
|
|
|
136
135
|
export interface IServerModel {
|
|
137
136
|
convertEventToV2DTO: (event: IUploadObject) => IServerV2DTO;
|
|
138
|
-
createEventObject: (event: BaseEvent, user?:
|
|
137
|
+
createEventObject: (event: BaseEvent, user?: IMParticleUser) => SDKEvent;
|
|
139
138
|
convertToConsentStateV2DTO: (state: SDKConsentState) => IConsentStateV2DTO;
|
|
140
|
-
appendUserInfo: (user:
|
|
139
|
+
appendUserInfo: (user: IMParticleUser, event: SDKEvent) => void;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
// TODO: Make this a pure function that returns a new object
|
|
@@ -199,7 +198,10 @@ export default function ServerModel(
|
|
|
199
198
|
var self = this;
|
|
200
199
|
|
|
201
200
|
// TODO: Can we refactor this to not mutate the event?
|
|
202
|
-
this.appendUserInfo = function(
|
|
201
|
+
this.appendUserInfo = function(
|
|
202
|
+
user: IMParticleUser,
|
|
203
|
+
event: SDKEvent
|
|
204
|
+
): void {
|
|
203
205
|
if (!event) {
|
|
204
206
|
return;
|
|
205
207
|
}
|
|
@@ -230,7 +232,7 @@ export default function ServerModel(
|
|
|
230
232
|
if (mpInstance._Helpers.isObject(dtoUserIdentities)) {
|
|
231
233
|
if (Object.keys(dtoUserIdentities).length) {
|
|
232
234
|
for (var key in dtoUserIdentities) {
|
|
233
|
-
var userIdentity: Partial<
|
|
235
|
+
var userIdentity: Partial<ISDKUserIdentity> = {};
|
|
234
236
|
userIdentity.Identity = dtoUserIdentities[key];
|
|
235
237
|
userIdentity.Type = mpInstance._Helpers.parseNumber(key);
|
|
236
238
|
validUserIdentities.push(userIdentity);
|
|
@@ -292,7 +294,7 @@ export default function ServerModel(
|
|
|
292
294
|
|
|
293
295
|
this.createEventObject = function(
|
|
294
296
|
event: BaseEvent,
|
|
295
|
-
user?:
|
|
297
|
+
user?: IMParticleUser
|
|
296
298
|
): SDKEvent | IUploadObject {
|
|
297
299
|
var uploadObject: Partial<IUploadObject> = {};
|
|
298
300
|
var eventObject: Partial<SDKEvent> = {};
|
package/src/sessionManager.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { MPID } from '@mparticle/web-sdk';
|
|
2
2
|
import Constants from './constants';
|
|
3
3
|
import { IPersistenceMinified } from './persistence.interfaces';
|
|
4
|
-
import {
|
|
4
|
+
import { MParticleWebSDK } from './sdkRuntimeModels';
|
|
5
5
|
import Types from './types';
|
|
6
6
|
import { generateDeprecationMessage } from './utils';
|
|
7
|
+
import { IMParticleUser } from './identity-user-interfaces';
|
|
7
8
|
|
|
8
9
|
const { Messages } = Constants;
|
|
9
10
|
|
|
@@ -86,7 +87,7 @@ export default function SessionManager(
|
|
|
86
87
|
.generateUniqueId()
|
|
87
88
|
.toUpperCase();
|
|
88
89
|
|
|
89
|
-
const currentUser:
|
|
90
|
+
const currentUser: IMParticleUser = mpInstance.Identity.getCurrentUser();
|
|
90
91
|
const mpid: MPID = currentUser ? currentUser.getMPID() : null;
|
|
91
92
|
|
|
92
93
|
if (mpid) {
|
package/src/store.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
DataPlanConfig,
|
|
5
5
|
MPID,
|
|
6
6
|
IdentifyRequest,
|
|
7
|
-
IdentityCallback,
|
|
8
7
|
SDKEventCustomFlags,
|
|
9
8
|
} from '@mparticle/web-sdk';
|
|
10
9
|
import { IKitConfigs } from './configAPIClient';
|
|
@@ -32,6 +31,7 @@ import {
|
|
|
32
31
|
import { SDKConsentState } from './consent';
|
|
33
32
|
import { Kit, MPForwarder } from './forwarders.interfaces';
|
|
34
33
|
import { IPersistenceMinified } from './persistence.interfaces';
|
|
34
|
+
import { IdentityCallback } from './identity-user-interfaces';
|
|
35
35
|
|
|
36
36
|
// This represents the runtime configuration of the SDK AFTER
|
|
37
37
|
// initialization has been complete and all settings and
|
|
@@ -71,6 +71,7 @@ export interface SDKConfig {
|
|
|
71
71
|
identityUrl?: string;
|
|
72
72
|
userAudienceUrl?: string;
|
|
73
73
|
isIOS?: boolean;
|
|
74
|
+
maxAliasWindow: number;
|
|
74
75
|
maxProducts: number;
|
|
75
76
|
requestConfig?: boolean;
|
|
76
77
|
sessionTimeout?: number;
|
package/src/types.interfaces.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -7,6 +7,8 @@ type valueof<T> = T[keyof T];
|
|
|
7
7
|
// Placeholder for Dictionary-like Types
|
|
8
8
|
export type Dictionary<V = any> = Record<string, V>;
|
|
9
9
|
|
|
10
|
+
export type Environment = 'development' | 'production';
|
|
11
|
+
|
|
10
12
|
const createCookieString = (value: string): string =>
|
|
11
13
|
replaceCommasWithPipes(replaceQuotesWithApostrophes(value));
|
|
12
14
|
|
package/src/validators.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from './utils';
|
|
9
9
|
import Constants from './constants';
|
|
10
10
|
import { IdentityApiData } from '@mparticle/web-sdk';
|
|
11
|
-
import { IdentityAPIMethod } from './
|
|
11
|
+
import { IdentityAPIMethod } from './identity.interfaces';
|
|
12
12
|
|
|
13
13
|
type ValidationIdentitiesReturn = {
|
|
14
14
|
valid: boolean;
|