@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.
@@ -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?: SDKUserIdentity[];
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?: MParticleUser) => SDKEvent;
137
+ createEventObject: (event: BaseEvent, user?: IMParticleUser) => SDKEvent;
139
138
  convertToConsentStateV2DTO: (state: SDKConsentState) => IConsentStateV2DTO;
140
- appendUserInfo: (user: MParticleUser, event: SDKEvent) => void;
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(user: MParticleUser, event: SDKEvent): void {
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<SDKUserIdentity> = {};
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?: MParticleUser
297
+ user?: IMParticleUser
296
298
  ): SDKEvent | IUploadObject {
297
299
  var uploadObject: Partial<IUploadObject> = {};
298
300
  var eventObject: Partial<SDKEvent> = {};
@@ -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 { MParticleUser, MParticleWebSDK } from './sdkRuntimeModels';
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: MParticleUser = mpInstance.Identity.getCurrentUser();
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;
@@ -49,4 +49,8 @@ export enum IdentityType {
49
49
  MobileNumber = 19,
50
50
  PhoneNumber2 = 20,
51
51
  PhoneNumber3 = 21,
52
- }
52
+ }
53
+
54
+ export interface IIdentityType {
55
+ getIdentityType(identityType: string): IdentityType | null;
56
+ }
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 './sdkRuntimeModels';
11
+ import { IdentityAPIMethod } from './identity.interfaces';
12
12
 
13
13
  type ValidationIdentitiesReturn = {
14
14
  valid: boolean;