@mparticle/web-sdk 2.17.3 → 2.18.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/dist/mparticle.js CHANGED
@@ -708,6 +708,10 @@ var mParticle = (function () {
708
708
  var ApplicationTransitionType$1 = {
709
709
  AppInit: 1
710
710
  };
711
+ var Environment = {
712
+ Production: 'production',
713
+ Development: 'development'
714
+ };
711
715
  var Types = {
712
716
  MessageType: MessageType$1,
713
717
  EventType: EventType,
@@ -717,10 +721,11 @@ var mParticle = (function () {
717
721
  ApplicationTransitionType: ApplicationTransitionType$1,
718
722
  ProductActionType: ProductActionType,
719
723
  PromotionActionType: PromotionActionType,
720
- TriggerUploadType: TriggerUploadType
724
+ TriggerUploadType: TriggerUploadType,
725
+ Environment: Environment
721
726
  };
722
727
 
723
- var version = "2.17.3";
728
+ var version = "2.18.0";
724
729
 
725
730
  var Constants = {
726
731
  sdkVersion: version,
@@ -2555,7 +2560,7 @@ var mParticle = (function () {
2555
2560
  };
2556
2561
  }
2557
2562
 
2558
- var slugify = {exports: {}};
2563
+ var slugify$1 = {exports: {}};
2559
2564
 
2560
2565
  (function (module, exports) {
2561
2566
  (function (name, root, factory) {
@@ -2619,9 +2624,9 @@ var mParticle = (function () {
2619
2624
 
2620
2625
  return replace
2621
2626
  }));
2622
- } (slugify));
2627
+ } (slugify$1));
2623
2628
 
2624
- var Slugify = slugify.exports;
2629
+ var slugify = slugify$1.exports;
2625
2630
 
2626
2631
  var inArray = function inArray(items, name) {
2627
2632
  var i = 0;
@@ -2663,6 +2668,14 @@ var mParticle = (function () {
2663
2668
 
2664
2669
  var floatValue = parseFloat(value);
2665
2670
  return isNaN(floatValue) ? 0 : floatValue;
2671
+ };
2672
+
2673
+ var parseStringOrNumber = function parseStringOrNumber(value) {
2674
+ if (isStringOrNumber(value)) {
2675
+ return value;
2676
+ } else {
2677
+ return null;
2678
+ }
2666
2679
  }; // FIXME: REFACTOR for V3
2667
2680
  // only used in store.js to sanitize server-side formatting of
2668
2681
  // booleans when checking for `isDevelopmentMode`
@@ -2689,23 +2702,41 @@ var mParticle = (function () {
2689
2702
  return s;
2690
2703
  };
2691
2704
 
2705
+ var isString = function isString(value) {
2706
+ return typeof value === 'string';
2707
+ };
2708
+
2709
+ var isNumber = function isNumber(value) {
2710
+ return typeof value === 'number';
2711
+ };
2712
+
2713
+ var isFunction = function isFunction(fn) {
2714
+ return typeof fn === 'function';
2715
+ }; // TODO: Refactor this to a regex
2716
+
2717
+
2718
+ var isDataPlanSlug = function isDataPlanSlug(str) {
2719
+ return isString(str) && str === slugify(str);
2720
+ };
2721
+
2722
+ var isStringOrNumber = function isStringOrNumber(value) {
2723
+ return isString(value) || isNumber(value);
2724
+ };
2725
+
2692
2726
  var Validators = {
2727
+ // From ./utils
2728
+ // Utility Functions for backwards compatability
2729
+ isNumber: isNumber,
2730
+ isFunction: isFunction,
2731
+ isStringOrNumber: isStringOrNumber,
2693
2732
  isValidAttributeValue: function isValidAttributeValue(value) {
2694
2733
  return value !== undefined && !isObject(value) && !Array.isArray(value);
2695
2734
  },
2735
+ // Validator Functions
2696
2736
  // Neither null nor undefined can be a valid Key
2697
2737
  isValidKeyValue: function isValidKeyValue(key) {
2698
2738
  return Boolean(key && !isObject(key) && !Array.isArray(key) && !this.isFunction(key));
2699
2739
  },
2700
- isStringOrNumber: function isStringOrNumber(value) {
2701
- return typeof value === 'string' || typeof value === 'number';
2702
- },
2703
- isNumber: function isNumber(value) {
2704
- return typeof value === 'number';
2705
- },
2706
- isFunction: function isFunction(fn) {
2707
- return typeof fn === 'function';
2708
- },
2709
2740
  validateIdentities: function validateIdentities(identityApiData, method) {
2710
2741
  var validIdentityRequestKeys = {
2711
2742
  userIdentities: 1,
@@ -3132,14 +3163,6 @@ var mParticle = (function () {
3132
3163
  return false;
3133
3164
  };
3134
3165
 
3135
- this.parseStringOrNumber = function (value) {
3136
- if (Validators.isStringOrNumber(value)) {
3137
- return value;
3138
- } else {
3139
- return null;
3140
- }
3141
- };
3142
-
3143
3166
  this.generateHash = function (name) {
3144
3167
  var hash = 0,
3145
3168
  i = 0,
@@ -3220,10 +3243,6 @@ var mParticle = (function () {
3220
3243
  } else {
3221
3244
  return StorageNames$2.currentStorageProductsName;
3222
3245
  }
3223
- };
3224
-
3225
- this.isSlug = function (str) {
3226
- return str === Slugify(str);
3227
3246
  }; // Utility Functions
3228
3247
 
3229
3248
 
@@ -3233,7 +3252,8 @@ var mParticle = (function () {
3233
3252
  this.inArray = inArray;
3234
3253
  this.isObject = isObject;
3235
3254
  this.decoded = decoded;
3236
- this.returnConvertedBoolean = returnConvertedBoolean; // Imported Validators
3255
+ this.returnConvertedBoolean = returnConvertedBoolean;
3256
+ this.parseStringOrNumber = parseStringOrNumber; // Imported Validators
3237
3257
 
3238
3258
  this.Validators = Validators;
3239
3259
  }
@@ -4137,6 +4157,7 @@ var mParticle = (function () {
4137
4157
  }
4138
4158
 
4139
4159
  function createSDKConfig(config) {
4160
+ // TODO: Refactor to create a default config object
4140
4161
  var sdkConfig = {};
4141
4162
 
4142
4163
  for (var prop in Constants.DefaultConfig) {
@@ -4146,14 +4167,14 @@ var mParticle = (function () {
4146
4167
  }
4147
4168
 
4148
4169
  if (config) {
4149
- for (prop in config) {
4170
+ for (var prop in config) {
4150
4171
  if (config.hasOwnProperty(prop)) {
4151
4172
  sdkConfig[prop] = config[prop];
4152
4173
  }
4153
4174
  }
4154
4175
  }
4155
4176
 
4156
- for (prop in Constants.DefaultUrls) {
4177
+ for (var prop in Constants.DefaultUrls) {
4157
4178
  sdkConfig[prop] = Constants.DefaultUrls[prop];
4158
4179
  }
4159
4180
 
@@ -4182,7 +4203,7 @@ var mParticle = (function () {
4182
4203
  eventQueue: [],
4183
4204
  currencyCode: null,
4184
4205
  globalTimer: null,
4185
- context: '',
4206
+ context: null,
4186
4207
  configurationLoaded: false,
4187
4208
  identityCallInFlight: false,
4188
4209
  SDKConfig: {},
@@ -4248,15 +4269,8 @@ var mParticle = (function () {
4248
4269
  this.SDKConfig.logLevel = config.logLevel;
4249
4270
  }
4250
4271
 
4251
- if (config.hasOwnProperty('useNativeSdk')) {
4252
- this.SDKConfig.useNativeSdk = config.useNativeSdk;
4253
- } else {
4254
- this.SDKConfig.useNativeSdk = false;
4255
- }
4256
-
4257
- if (config.hasOwnProperty('kits')) {
4258
- this.SDKConfig.kits = config.kits;
4259
- }
4272
+ this.SDKConfig.useNativeSdk = !!config.useNativeSdk;
4273
+ this.SDKConfig.kits = config.kits || {};
4260
4274
 
4261
4275
  if (config.hasOwnProperty('isIOS')) {
4262
4276
  this.SDKConfig.isIOS = config.isIOS;
@@ -4306,7 +4320,7 @@ var mParticle = (function () {
4306
4320
  if (mpInstance._Helpers.Validators.isFunction(callback)) {
4307
4321
  this.SDKConfig.identityCallback = config.identityCallback;
4308
4322
  } else {
4309
- mpInstance.Logger.warning('The optional callback must be a function. You tried entering a(n) ' + _typeof(callback), ' . Callback not set. Please set your callback again.');
4323
+ mpInstance.Logger.warning('The optional callback must be a function. You tried entering a(n) ' + _typeof(callback) + ' . Callback not set. Please set your callback again.');
4310
4324
  }
4311
4325
  }
4312
4326
 
@@ -4327,26 +4341,25 @@ var mParticle = (function () {
4327
4341
  PlanVersion: null,
4328
4342
  PlanId: null
4329
4343
  };
4344
+ var dataPlan = config.dataPlan;
4330
4345
 
4331
- if (config.dataPlan.hasOwnProperty('planId')) {
4332
- if (typeof config.dataPlan.planId === 'string') {
4333
- if (mpInstance._Helpers.isSlug(config.dataPlan.planId)) {
4334
- this.SDKConfig.dataPlan.PlanId = config.dataPlan.planId;
4335
- } else {
4336
- mpInstance.Logger.error('Your data plan id must be in a slug format');
4337
- }
4346
+ if (dataPlan.planId) {
4347
+ if (isDataPlanSlug(dataPlan.planId)) {
4348
+ this.SDKConfig.dataPlan.PlanId = dataPlan.planId;
4338
4349
  } else {
4339
- mpInstance.Logger.error('Your data plan id must be a string');
4350
+ mpInstance.Logger.error('Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)');
4340
4351
  }
4341
4352
  }
4342
4353
 
4343
- if (config.dataPlan.hasOwnProperty('planVersion')) {
4344
- if (typeof config.dataPlan.planVersion === 'number') {
4345
- this.SDKConfig.dataPlan.PlanVersion = config.dataPlan.planVersion;
4354
+ if (dataPlan.planVersion) {
4355
+ if (isNumber(dataPlan.planVersion)) {
4356
+ this.SDKConfig.dataPlan.PlanVersion = dataPlan.planVersion;
4346
4357
  } else {
4347
4358
  mpInstance.Logger.error('Your data plan version must be a number');
4348
4359
  }
4349
4360
  }
4361
+ } else {
4362
+ this.SDKConfig.dataPlan = {};
4350
4363
  }
4351
4364
 
4352
4365
  if (config.hasOwnProperty('forceHttps')) {
@@ -4356,9 +4369,7 @@ var mParticle = (function () {
4356
4369
  } // Some forwarders require custom flags on initialization, so allow them to be set using config object
4357
4370
 
4358
4371
 
4359
- if (config.hasOwnProperty('customFlags')) {
4360
- this.SDKConfig.customFlags = config.customFlags;
4361
- }
4372
+ this.SDKConfig.customFlags = config.customFlags || {};
4362
4373
 
4363
4374
  if (config.hasOwnProperty('minWebviewBridgeVersion')) {
4364
4375
  this.SDKConfig.minWebviewBridgeVersion = config.minWebviewBridgeVersion;
@@ -9368,6 +9379,16 @@ var mParticle = (function () {
9368
9379
  self._preInit.readyQueue.push(f);
9369
9380
  }
9370
9381
  };
9382
+ /**
9383
+ * Returns the current mParticle environment setting
9384
+ * @method getEnvironment
9385
+ * @returns {String} mParticle environment setting
9386
+ */
9387
+
9388
+
9389
+ this.getEnvironment = function () {
9390
+ return self._Store.SDKConfig.isDevelopmentMode ? Types.Environment.Development : Types.Environment.Production;
9391
+ };
9371
9392
  /**
9372
9393
  * Returns the mParticle SDK version number
9373
9394
  * @method getVersion
@@ -10247,9 +10268,44 @@ var mParticle = (function () {
10247
10268
  this._getIntegrationDelays = function () {
10248
10269
  return self._preInit.integrationDelays;
10249
10270
  };
10271
+ /*
10272
+ An integration delay is a workaround that prevents events from being sent when it is necessary to do so.
10273
+ Some server side integrations require a client side value to be included in the payload to successfully
10274
+ forward. This value can only be pulled from the client side partner SDK.
10275
+ During the kit initialization, the kit:
10276
+ * sets an integration delay to `true`
10277
+ * grabs the required value from the partner SDK,
10278
+ * sets it via `setIntegrationAttribute`
10279
+ * sets the integration delay to `false`
10280
+ The core SDK can then read via `isDelayedByIntegration` to no longer delay sending events.
10281
+ This integration attribute is now on the batch payload for the server side to read.
10282
+ If there is no delay, then the events sent before an integration attribute is included would not
10283
+ be forwarded successfully server side.
10284
+ */
10285
+
10250
10286
 
10251
- this._setIntegrationDelay = function (module, _boolean) {
10252
- self._preInit.integrationDelays[module] = _boolean;
10287
+ this._setIntegrationDelay = function (module, shouldDelayIntegration) {
10288
+ self._preInit.integrationDelays[module] = shouldDelayIntegration; // If the integration delay is set to true, no further action needed
10289
+
10290
+ if (shouldDelayIntegration === true) {
10291
+ return;
10292
+ } // If the integration delay is set to false, check to see if there are any
10293
+ // other integration delays set to true. It not, process the queued events/.
10294
+
10295
+
10296
+ var integrationDelaysKeys = Object.keys(self._preInit.integrationDelays);
10297
+
10298
+ if (integrationDelaysKeys.length === 0) {
10299
+ return;
10300
+ }
10301
+
10302
+ var hasIntegrationDelays = integrationDelaysKeys.some(function (integration) {
10303
+ return self._preInit.integrationDelays[integration] === true;
10304
+ });
10305
+
10306
+ if (!hasIntegrationDelays) {
10307
+ self._APIClient.processQueuedEvents();
10308
+ }
10253
10309
  };
10254
10310
  } // Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
10255
10311
 
@@ -10682,6 +10738,10 @@ var mParticle = (function () {
10682
10738
  return self.getInstance().getAppVersion();
10683
10739
  };
10684
10740
 
10741
+ this.getEnvironment = function () {
10742
+ return self.getInstance().getEnvironment();
10743
+ };
10744
+
10685
10745
  this.stopTrackingLocation = function () {
10686
10746
  self.getInstance().stopTrackingLocation();
10687
10747
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.17.3",
3
+ "version": "2.18.0",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
package/src/helpers.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import Types from './types';
2
2
  import Constants from './constants';
3
- import Slugify from 'slugify';
4
3
  import * as utils from './utils';
5
4
  import Validators from './validators';
6
5
 
@@ -399,14 +398,6 @@ export default function Helpers(mpInstance) {
399
398
  return false;
400
399
  };
401
400
 
402
- this.parseStringOrNumber = function(value) {
403
- if (Validators.isStringOrNumber(value)) {
404
- return value;
405
- } else {
406
- return null;
407
- }
408
- };
409
-
410
401
  this.generateHash = function(name) {
411
402
  var hash = 0,
412
403
  i = 0,
@@ -505,10 +496,6 @@ export default function Helpers(mpInstance) {
505
496
  }
506
497
  };
507
498
 
508
- this.isSlug = function(str) {
509
- return str === Slugify(str);
510
- };
511
-
512
499
  // Utility Functions
513
500
  this.converted = utils.converted;
514
501
  this.findKeyInObject = utils.findKeyInObject;
@@ -517,6 +504,7 @@ export default function Helpers(mpInstance) {
517
504
  this.isObject = utils.isObject;
518
505
  this.decoded = utils.decoded;
519
506
  this.returnConvertedBoolean = utils.returnConvertedBoolean;
507
+ this.parseStringOrNumber = utils.parseStringOrNumber;
520
508
 
521
509
  // Imported Validators
522
510
  this.Validators = Validators;
@@ -188,6 +188,16 @@ export default function mParticleInstance(instanceName) {
188
188
  self._preInit.readyQueue.push(f);
189
189
  }
190
190
  };
191
+ /**
192
+ * Returns the current mParticle environment setting
193
+ * @method getEnvironment
194
+ * @returns {String} mParticle environment setting
195
+ */
196
+ this.getEnvironment = function() {
197
+ return self._Store.SDKConfig.isDevelopmentMode
198
+ ? Types.Environment.Development
199
+ : Types.Environment.Production;
200
+ };
191
201
  /**
192
202
  * Returns the mParticle SDK version number
193
203
  * @method getVersion
@@ -1205,8 +1215,51 @@ export default function mParticleInstance(instanceName) {
1205
1215
  this._getIntegrationDelays = function() {
1206
1216
  return self._preInit.integrationDelays;
1207
1217
  };
1208
- this._setIntegrationDelay = function(module, boolean) {
1209
- self._preInit.integrationDelays[module] = boolean;
1218
+ /*
1219
+ An integration delay is a workaround that prevents events from being sent when it is necessary to do so.
1220
+ Some server side integrations require a client side value to be included in the payload to successfully
1221
+ forward. This value can only be pulled from the client side partner SDK.
1222
+
1223
+ During the kit initialization, the kit:
1224
+ * sets an integration delay to `true`
1225
+ * grabs the required value from the partner SDK,
1226
+ * sets it via `setIntegrationAttribute`
1227
+ * sets the integration delay to `false`
1228
+
1229
+ The core SDK can then read via `isDelayedByIntegration` to no longer delay sending events.
1230
+
1231
+ This integration attribute is now on the batch payload for the server side to read.
1232
+
1233
+ If there is no delay, then the events sent before an integration attribute is included would not
1234
+ be forwarded successfully server side.
1235
+ */
1236
+ this._setIntegrationDelay = function(module, shouldDelayIntegration) {
1237
+ self._preInit.integrationDelays[module] = shouldDelayIntegration;
1238
+
1239
+ // If the integration delay is set to true, no further action needed
1240
+ if (shouldDelayIntegration === true) {
1241
+ return;
1242
+ }
1243
+ // If the integration delay is set to false, check to see if there are any
1244
+ // other integration delays set to true. It not, process the queued events/.
1245
+
1246
+ const integrationDelaysKeys = Object.keys(
1247
+ self._preInit.integrationDelays
1248
+ );
1249
+
1250
+ if (integrationDelaysKeys.length === 0) {
1251
+ return;
1252
+ }
1253
+
1254
+ const hasIntegrationDelays = integrationDelaysKeys.some(function(
1255
+ integration
1256
+ ) {
1257
+ return self._preInit.integrationDelays[integration] === true;
1258
+ });
1259
+
1260
+ if (!hasIntegrationDelays) {
1261
+ self._APIClient.processQueuedEvents();
1262
+ }
1210
1263
  };
1211
1264
  }
1212
1265
 
@@ -128,6 +128,9 @@ function mParticle() {
128
128
  this.getAppVersion = function() {
129
129
  return self.getInstance().getAppVersion();
130
130
  };
131
+ this.getEnvironment = function() {
132
+ return self.getInstance().getEnvironment();
133
+ };
131
134
  this.stopTrackingLocation = function() {
132
135
  self.getInstance().stopTrackingLocation();
133
136
  };
@@ -1,5 +1,9 @@
1
- import * as EventsApi from '@mparticle/event-models';
2
- import { DataPlanVersion, DataPlan } from '@mparticle/data-planning-models';
1
+ import { DataPlanVersion } from '@mparticle/data-planning-models';
2
+ import { Batch } from '@mparticle/event-models';
3
+ import { MPConfiguration, SDKEventCustomFlags } from '@mparticle/web-sdk';
4
+ import { SDKConfig } from './store';
5
+ import { Dictionary } from './utils';
6
+ import Validators from './validators';
3
7
 
4
8
  export interface SDKEvent {
5
9
  DeviceId: string;
@@ -116,59 +120,77 @@ export interface SDKProduct {
116
120
  }
117
121
 
118
122
  export interface MParticleWebSDK {
119
- addForwarder(mockForwarder: any);
123
+ addForwarder(mockForwarder: MPForwarder): void;
120
124
  Identity: SDKIdentityApi;
121
125
  Logger: SDKLoggerApi;
122
126
  _Store: SDKStoreApi;
123
127
  _Helpers: SDKHelpersApi;
124
- config: SDKConfig;
128
+ config: SDKInitConfig;
125
129
  _resetForTests(MPConfig: SDKConfig): void;
126
- init(apiKey: string, config: SDKConfig): void;
130
+ init(apiKey: string, config: SDKInitConfig, instanceName?: string): void;
127
131
  getInstance();
128
132
  ServerModel();
129
133
  upload();
130
134
  setPosition(lat: number | string, lng: number | string): void;
131
- logEvent(eventName: string, eventType?: number, attrs?: { [key: string]: string }): void;
135
+ logEvent(
136
+ eventName: string,
137
+ eventType?: number,
138
+ attrs?: { [key: string]: string },
139
+ customFlags?: SDKEventCustomFlags
140
+ ): void;
132
141
  logBaseEvent(event: any): void;
133
142
  eCommerce: any;
134
143
  logLevel: string;
135
144
  ProductActionType: SDKProductActionType;
136
145
  generateHash(value: string);
146
+ isIOS?: boolean;
137
147
  }
138
148
 
139
- export interface SDKConfig {
140
- isDevelopmentMode?: boolean;
141
- logger: {
142
- error?(msg);
143
- warning?(msg)
144
- verbose?(msg)
145
- };
146
- onCreateBatch(batch: EventsApi.Batch): EventsApi.Batch;
147
- dataPlan: DataPlanConfig;
148
- appVersion?: string;
149
- package?: string;
150
- flags?: { [key: string]: string | number };
151
- kitConfigs: any;
152
- appName?: string;
153
- logLevel?: string;
149
+ export type LogLevelType = 'none' | 'verbose' | 'warning' | 'error';
150
+
151
+ // TODO: Create true types for Kits and Kit Configs
152
+ export type KitConfigs = Dictionary;
153
+ export type Kit = Dictionary;
154
+ export type MPForwarder = Dictionary;
155
+
156
+ // TODO: This should eventually be moved into wherever init logic lives
157
+ // TODO: Replace/Merge this with MPConfiguration in @types/mparticle__web-sdk
158
+ // SDK Init Config represents the config that is passed into mParticle.init when
159
+ // the sdk is initialized.
160
+ // Currently, this extends MPConfiguration in @types/mparticle__web-sdk
161
+ // and the two will be merged in once the Store module is refactored
162
+ export interface SDKInitConfig
163
+ extends Omit<MPConfiguration, 'dataPlan' | 'logLevel'> {
164
+ dataPlan?: DataPlanConfig | KitBlockerDataPlan; // TODO: These should be eventually split into two different attributes
165
+ logLevel?: LogLevelType;
166
+
167
+ kitConfigs?: KitConfigs[];
168
+ kits?: Dictionary<Kit>;
169
+ dataPlanOptions?: KitBlockerOptions;
170
+ flags?: Dictionary;
171
+
172
+ aliasMaxWindow: number;
173
+ deviceId?: string;
174
+ forceHttps?: boolean;
175
+ aliasUrl?: string;
176
+ configUrl?: string;
177
+ identityUrl?: string;
178
+ integrationDelayTimeout: number;
179
+ isIOS?: boolean;
180
+ maxProducts: number;
181
+ requestConfig?: boolean;
154
182
  sessionTimeout?: number;
183
+ useNativeSdk?: boolean;
155
184
  useCookieStorage?: boolean;
156
- cookieDomain?: string;
157
- workspaceToken: string;
158
- requiredWebviewBridgeName: string;
159
- minWebviewBridgeVersion: number;
160
- isIOS?: boolean;
161
- identifyRequest: { [key: string]: {[key: string]: string} };
162
- identityCallback: (result) => void;
163
- requestConfig: boolean;
164
- dataPlanOptions: KitBlockerOptions // when the user provides their own data plan
165
- dataPlanResult?: DataPlanResult // when the data plan comes from the server via /config
185
+ v1SecureServiceUrl?: string;
186
+ v2SecureServiceUrl?: string;
187
+ v3SecureServiceUrl?: string;
166
188
  }
167
189
 
168
190
  export interface DataPlanConfig {
169
191
  planId?: string;
170
192
  planVersion?: number;
171
- document?: DataPlanResult // when the data plan comes from the server via /mparticle.js
193
+ document?: DataPlanResult; // when the data plan comes from the server via /mparticle.js
172
194
  }
173
195
 
174
196
  export interface SDKIdentityApi {
@@ -182,9 +204,11 @@ export interface SDKIdentityApi {
182
204
 
183
205
  export interface SDKHelpersApi {
184
206
  createServiceUrl(arg0: string, arg1: string): void;
185
- parseNumber(value: number)
207
+ parseNumber(value: number);
186
208
  generateUniqueId();
187
- isObject(item: any)
209
+ isObject(item: any);
210
+ returnConvertedBoolean(data: string | boolean | number): boolean;
211
+ Validators: typeof Validators;
188
212
  }
189
213
 
190
214
  export interface SDKLoggerApi {
@@ -205,7 +229,7 @@ export interface SDKConfigApi {
205
229
  v3SecureServiceUrl?: string;
206
230
  isDevelopmentMode: boolean;
207
231
  appVersion?: string;
208
- onCreateBatch(batch: EventsApi.Batch): EventsApi.Batch
232
+ onCreateBatch(batch: Batch): Batch;
209
233
  }
210
234
  export interface MParticleUser {
211
235
  getMPID(): string;
@@ -267,7 +291,7 @@ export interface KitBlockerOptions {
267
291
  }
268
292
 
269
293
  export interface KitBlockerDataPlan {
270
- document: DataPlanResult
294
+ document: DataPlanResult;
271
295
  }
272
296
 
273
297
  export interface DataPlanResult {
@@ -280,30 +304,30 @@ export interface DataPlanResult {
280
304
  id: boolean;
281
305
  };
282
306
  };
283
- error_message?: string
307
+ error_message?: string;
284
308
  }
285
309
 
286
310
  export enum SDKIdentityTypeEnum {
287
- other = "other",
288
- customerId = "customerid",
289
- facebook = "facebook",
290
- twitter = "twitter",
291
- google = "google",
292
- microsoft = "microsoft",
293
- yahoo = "yahoo",
294
- email = "email",
295
- alias = "alias",
296
- facebookCustomAudienceId = "facebookcustomaudienceid",
297
- otherId2 = "other2",
298
- otherId3 = "other3",
299
- otherId4 = "other4",
300
- otherId5 = "other5",
301
- otherId6 = "other6",
302
- otherId7 = "other7",
303
- otherId8 = "other8",
304
- otherId9 = "other9",
305
- otherId10 = "other10",
306
- mobileNumber = "mobile_number",
307
- phoneNumber2 = "phone_number_2",
308
- phoneNumber3 = "phone_number_3"
309
- }
311
+ other = 'other',
312
+ customerId = 'customerid',
313
+ facebook = 'facebook',
314
+ twitter = 'twitter',
315
+ google = 'google',
316
+ microsoft = 'microsoft',
317
+ yahoo = 'yahoo',
318
+ email = 'email',
319
+ alias = 'alias',
320
+ facebookCustomAudienceId = 'facebookcustomaudienceid',
321
+ otherId2 = 'other2',
322
+ otherId3 = 'other3',
323
+ otherId4 = 'other4',
324
+ otherId5 = 'other5',
325
+ otherId6 = 'other6',
326
+ otherId7 = 'other7',
327
+ otherId8 = 'other8',
328
+ otherId9 = 'other9',
329
+ otherId10 = 'other10',
330
+ mobileNumber = 'mobile_number',
331
+ phoneNumber2 = 'phone_number_2',
332
+ phoneNumber3 = 'phone_number_3',
333
+ }