@mparticle/web-sdk 2.80.0 → 2.80.1
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 +75 -488
- package/dist/mparticle.esm.js +75 -488
- package/dist/mparticle.js +190 -670
- package/dist/types/src/configAPIClient.d.ts +1 -0
- package/dist/types/src/ecommerce.d.ts +3 -53
- package/dist/types/src/ecommerce.interfaces.d.ts +11 -12
- package/dist/types/src/events.interfaces.d.ts +1 -1
- package/dist/types/src/forwarders.d.ts +4 -26
- package/dist/types/src/forwarders.interfaces.d.ts +41 -10
- package/dist/types/src/identity-utils.d.ts +3 -3
- package/dist/types/src/identity.d.ts +3 -0
- package/dist/types/src/identity.interfaces.d.ts +45 -11
- package/dist/types/src/identityApiClient.d.ts +5 -4
- package/dist/types/src/mp-instance.d.ts +2 -2
- package/dist/types/src/persistence.interfaces.d.ts +2 -3
- package/dist/types/src/sdkRuntimeModels.d.ts +2 -2
- package/dist/types/src/store.d.ts +4 -3
- package/package.json +1 -1
- package/src/configAPIClient.ts +1 -0
- package/src/ecommerce.interfaces.ts +12 -21
- package/src/{ecommerce.js → ecommerce.ts} +144 -73
- package/src/events.interfaces.ts +1 -1
- package/src/events.ts +1 -1
- package/src/forwarders.interfaces.ts +73 -10
- package/src/{forwarders.js → forwarders.ts} +214 -176
- package/src/helpers.ts +7 -3
- package/src/identity-utils.ts +2 -2
- package/src/identity.interfaces.ts +58 -14
- package/src/{identity.js → identity.ts} +237 -192
- package/src/identityApiClient.ts +9 -9
- package/src/mp-instance.ts +2 -2
- package/src/persistence.interfaces.ts +2 -3
- package/src/sdkRuntimeModels.ts +2 -1
- package/src/store.ts +4 -3
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
IIdentityResponse,
|
|
14
14
|
} from './identity-user-interfaces';
|
|
15
15
|
import { IdentitySearchCallback } from './identity/search';
|
|
16
|
-
const {
|
|
16
|
+
const { HTTPCodes } = Constants;
|
|
17
17
|
|
|
18
18
|
export type IdentityPreProcessResult = {
|
|
19
19
|
valid: boolean;
|
|
20
20
|
error?: string;
|
|
21
|
+
cleanedIdentities?: IdentityApiData;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export type IdentityAPIMethod = valueof<typeof Constants.IdentityMethods>;
|
|
@@ -49,14 +50,14 @@ export enum SDKIdentityTypeEnum {
|
|
|
49
50
|
|
|
50
51
|
export interface IIdentityAPIRequestData {
|
|
51
52
|
client_sdk: {
|
|
52
|
-
platform:
|
|
53
|
-
sdk_vendor:
|
|
54
|
-
sdk_version:
|
|
53
|
+
platform: string;
|
|
54
|
+
sdk_vendor: string;
|
|
55
|
+
sdk_version: string;
|
|
55
56
|
};
|
|
56
57
|
context: string | null;
|
|
57
58
|
environment: Environment;
|
|
58
59
|
request_id: string;
|
|
59
|
-
|
|
60
|
+
request_timestamp_ms: number;
|
|
60
61
|
previous_mpid: MPID | null;
|
|
61
62
|
known_identities: IKnownIdentities;
|
|
62
63
|
}
|
|
@@ -99,15 +100,20 @@ export interface IIdentityRequest {
|
|
|
99
100
|
): IIdentityAPIModifyRequestData;
|
|
100
101
|
createIdentityChanges(
|
|
101
102
|
previousIdentities: UserIdentities,
|
|
102
|
-
|
|
103
|
-
): IIdentityAPIIdentityChangeData;
|
|
103
|
+
newIdentities: UserIdentities
|
|
104
|
+
): IIdentityAPIIdentityChangeData[];
|
|
104
105
|
preProcessIdentityRequest(
|
|
105
106
|
identityApiData: IdentityApiData,
|
|
106
107
|
callback: IdentityCallback,
|
|
107
108
|
method: IdentityAPIMethod
|
|
108
109
|
): IdentityPreProcessResult;
|
|
110
|
+
createAliasNetworkRequest(aliasRequest: IAliasRequest): IAliasNetworkRequest;
|
|
111
|
+
convertAliasToNative(aliasRequest: IAliasRequest): IAliasNativeRequest;
|
|
112
|
+
convertToNative(identityApiData: IdentityApiData): IIdentityNativeRequest | undefined;
|
|
109
113
|
}
|
|
110
114
|
|
|
115
|
+
export type UserAttributeChangeValue = string | string[] | null;
|
|
116
|
+
|
|
111
117
|
export type AliasRequestScope = 'device' | 'mpid';
|
|
112
118
|
|
|
113
119
|
export interface IAliasRequest {
|
|
@@ -118,6 +124,36 @@ export interface IAliasRequest {
|
|
|
118
124
|
scope?: AliasRequestScope;
|
|
119
125
|
}
|
|
120
126
|
|
|
127
|
+
export interface IAliasNetworkRequest {
|
|
128
|
+
request_id: string;
|
|
129
|
+
request_type: 'alias';
|
|
130
|
+
environment: Environment;
|
|
131
|
+
api_key: string;
|
|
132
|
+
data: {
|
|
133
|
+
destination_mpid: MPID;
|
|
134
|
+
source_mpid: MPID;
|
|
135
|
+
start_unixtime_ms: number;
|
|
136
|
+
end_unixtime_ms: number;
|
|
137
|
+
scope?: AliasRequestScope;
|
|
138
|
+
device_application_stamp: string;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface IAliasNativeRequest {
|
|
143
|
+
DestinationMpid: MPID;
|
|
144
|
+
SourceMpid: MPID;
|
|
145
|
+
StartUnixtimeMs: number;
|
|
146
|
+
EndUnixtimeMs: number;
|
|
147
|
+
Scope?: AliasRequestScope;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface IIdentityNativeRequest {
|
|
151
|
+
UserIdentities: Array<{
|
|
152
|
+
Type: number;
|
|
153
|
+
Identity: string;
|
|
154
|
+
}>;
|
|
155
|
+
}
|
|
156
|
+
|
|
121
157
|
export interface IAliasCallback {
|
|
122
158
|
(result: IAliasResult): void;
|
|
123
159
|
}
|
|
@@ -150,7 +186,7 @@ export interface SDKIdentityApi {
|
|
|
150
186
|
getUsers?(): IMParticleUser[];
|
|
151
187
|
aliasUsers?(
|
|
152
188
|
aliasRequest?: IAliasRequest,
|
|
153
|
-
callback?:
|
|
189
|
+
callback?: IAliasCallback
|
|
154
190
|
): void;
|
|
155
191
|
createAliasRequest?(
|
|
156
192
|
sourceUser: IMParticleUser,
|
|
@@ -211,12 +247,12 @@ export interface IIdentity {
|
|
|
211
247
|
IdentityAPI: SDKIdentityApi;
|
|
212
248
|
IdentityRequest: IIdentityRequest;
|
|
213
249
|
|
|
214
|
-
mParticleUser(mpid
|
|
250
|
+
mParticleUser(mpid?: MPID, IsLoggedIn?: boolean): IMParticleUser;
|
|
215
251
|
|
|
216
252
|
createUserAttributeChange(
|
|
217
253
|
key: string,
|
|
218
|
-
newValue:
|
|
219
|
-
previousUserAttributeValue:
|
|
254
|
+
newValue: UserAttributeChangeValue,
|
|
255
|
+
previousUserAttributeValue: UserAttributeChangeValue,
|
|
220
256
|
isNewAttribute: boolean,
|
|
221
257
|
deleted: boolean,
|
|
222
258
|
user: IMParticleUser
|
|
@@ -234,13 +270,13 @@ export interface IIdentity {
|
|
|
234
270
|
callback: IdentityCallback,
|
|
235
271
|
identityApiData: IdentityApiData,
|
|
236
272
|
method: IdentityAPIMethod,
|
|
237
|
-
knownIdentities:
|
|
273
|
+
knownIdentities: IKnownIdentities,
|
|
238
274
|
parsingCachedResponse: boolean
|
|
239
275
|
): void;
|
|
240
276
|
sendUserAttributeChangeEvent(
|
|
241
277
|
attributeKey: string,
|
|
242
|
-
newUserAttributeValue:
|
|
243
|
-
previousUserAttributeValue:
|
|
278
|
+
newUserAttributeValue: UserAttributeChangeValue,
|
|
279
|
+
previousUserAttributeValue: UserAttributeChangeValue,
|
|
244
280
|
isNewAttribute: boolean,
|
|
245
281
|
deleted: boolean,
|
|
246
282
|
user: IMParticleUser
|
|
@@ -251,6 +287,14 @@ export interface IIdentity {
|
|
|
251
287
|
mpid: MPID,
|
|
252
288
|
prevUserIdentities: UserIdentities
|
|
253
289
|
): void;
|
|
290
|
+
reinitForwardersOnUserChange(
|
|
291
|
+
prevUser: IMParticleUser,
|
|
292
|
+
newUser: IMParticleUser
|
|
293
|
+
): void;
|
|
294
|
+
setForwarderCallbacks(
|
|
295
|
+
user: IMParticleUser,
|
|
296
|
+
method: IdentityAPIMethod
|
|
297
|
+
): void;
|
|
254
298
|
|
|
255
299
|
/**
|
|
256
300
|
* @deprecated
|