@mparticle/web-sdk 2.32.2 → 2.32.4
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 +46 -74
- package/dist/mparticle.esm.js +46 -74
- package/dist/mparticle.js +558 -579
- package/package.json +1 -1
- package/src/apiClient.ts +8 -4
- package/src/batchUploader.ts +35 -28
- package/src/configAPIClient.ts +3 -3
- package/src/consent.ts +2 -8
- package/src/constants.ts +8 -0
- package/src/cookieSyncManager.ts +2 -2
- package/src/ecommerce.interfaces.ts +201 -0
- package/src/ecommerce.js +9 -0
- package/src/events.interfaces.ts +83 -0
- package/src/events.js +3 -0
- package/src/forwarders.interfaces.ts +0 -3
- package/src/identity-user-interfaces.ts +12 -12
- package/src/identity.js +2 -3
- package/src/identityApiClient.ts +125 -58
- package/src/integrationCapture.ts +19 -15
- package/src/kitBlocking.ts +3 -2
- package/src/kitFilterHelper.ts +6 -7
- package/src/mockBatchCreator.ts +5 -6
- package/src/{mp-instance.js → mp-instance.ts} +110 -61
- package/src/{mparticle-instance-manager.js → mparticle-instance-manager.ts} +29 -16
- package/src/nativeSdkHelpers.interfaces.ts +1 -1
- package/src/pre-init-utils.ts +11 -0
- package/src/sdkRuntimeModels.ts +93 -50
- package/src/sdkToEventsApiConverter.ts +3 -3
- package/src/serverModel.ts +4 -4
- package/src/sessionManager.ts +2 -2
- package/src/sideloadedKit.ts +12 -11
- package/src/store.ts +7 -6
- package/src/types.ts +404 -0
- package/src/uploaders.ts +5 -3
- package/src/utils.ts +1 -1
- package/src/type-utils.ts +0 -66
- package/src/types.interfaces.ts +0 -56
- package/src/types.js +0 -338
package/dist/mparticle.js
CHANGED
|
@@ -203,197 +203,7 @@ var mParticle = (function () {
|
|
|
203
203
|
Base64: Base64$1
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
"@babel/helpers - typeof";
|
|
208
|
-
|
|
209
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
210
|
-
return typeof o;
|
|
211
|
-
} : function (o) {
|
|
212
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
213
|
-
}, _typeof$1(o);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function _toPrimitive(input, hint) {
|
|
217
|
-
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
218
|
-
var prim = input[Symbol.toPrimitive];
|
|
219
|
-
if (prim !== undefined) {
|
|
220
|
-
var res = prim.call(input, hint || "default");
|
|
221
|
-
if (_typeof$1(res) !== "object") return res;
|
|
222
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
223
|
-
}
|
|
224
|
-
return (hint === "string" ? String : Number)(input);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function _toPropertyKey(arg) {
|
|
228
|
-
var key = _toPrimitive(arg, "string");
|
|
229
|
-
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function _defineProperty(obj, key, value) {
|
|
233
|
-
key = _toPropertyKey(key);
|
|
234
|
-
if (key in obj) {
|
|
235
|
-
Object.defineProperty(obj, key, {
|
|
236
|
-
value: value,
|
|
237
|
-
enumerable: true,
|
|
238
|
-
configurable: true,
|
|
239
|
-
writable: true
|
|
240
|
-
});
|
|
241
|
-
} else {
|
|
242
|
-
obj[key] = value;
|
|
243
|
-
}
|
|
244
|
-
return obj;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
var EventTypeEnum;
|
|
248
|
-
(function (EventTypeEnum) {
|
|
249
|
-
EventTypeEnum[EventTypeEnum["Unknown"] = 0] = "Unknown";
|
|
250
|
-
EventTypeEnum[EventTypeEnum["Navigation"] = 1] = "Navigation";
|
|
251
|
-
EventTypeEnum[EventTypeEnum["Location"] = 2] = "Location";
|
|
252
|
-
EventTypeEnum[EventTypeEnum["Search"] = 3] = "Search";
|
|
253
|
-
EventTypeEnum[EventTypeEnum["Transaction"] = 4] = "Transaction";
|
|
254
|
-
EventTypeEnum[EventTypeEnum["UserContent"] = 5] = "UserContent";
|
|
255
|
-
EventTypeEnum[EventTypeEnum["UserPreference"] = 6] = "UserPreference";
|
|
256
|
-
EventTypeEnum[EventTypeEnum["Social"] = 7] = "Social";
|
|
257
|
-
EventTypeEnum[EventTypeEnum["Other"] = 8] = "Other";
|
|
258
|
-
EventTypeEnum[EventTypeEnum["Media"] = 9] = "Media";
|
|
259
|
-
})(EventTypeEnum || (EventTypeEnum = {}));
|
|
260
|
-
// TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403
|
|
261
|
-
var MessageType$2;
|
|
262
|
-
(function (MessageType) {
|
|
263
|
-
MessageType[MessageType["SessionStart"] = 1] = "SessionStart";
|
|
264
|
-
MessageType[MessageType["SessionEnd"] = 2] = "SessionEnd";
|
|
265
|
-
MessageType[MessageType["PageView"] = 3] = "PageView";
|
|
266
|
-
MessageType[MessageType["PageEvent"] = 4] = "PageEvent";
|
|
267
|
-
MessageType[MessageType["CrashReport"] = 5] = "CrashReport";
|
|
268
|
-
MessageType[MessageType["OptOut"] = 6] = "OptOut";
|
|
269
|
-
MessageType[MessageType["AppStateTransition"] = 10] = "AppStateTransition";
|
|
270
|
-
MessageType[MessageType["Profile"] = 14] = "Profile";
|
|
271
|
-
MessageType[MessageType["Commerce"] = 16] = "Commerce";
|
|
272
|
-
MessageType[MessageType["UserAttributeChange"] = 17] = "UserAttributeChange";
|
|
273
|
-
MessageType[MessageType["UserIdentityChange"] = 18] = "UserIdentityChange";
|
|
274
|
-
MessageType[MessageType["Media"] = 20] = "Media";
|
|
275
|
-
})(MessageType$2 || (MessageType$2 = {}));
|
|
276
|
-
var IdentityType$1;
|
|
277
|
-
(function (IdentityType) {
|
|
278
|
-
IdentityType[IdentityType["Other"] = 0] = "Other";
|
|
279
|
-
IdentityType[IdentityType["CustomerId"] = 1] = "CustomerId";
|
|
280
|
-
IdentityType[IdentityType["Facebook"] = 2] = "Facebook";
|
|
281
|
-
IdentityType[IdentityType["Twitter"] = 3] = "Twitter";
|
|
282
|
-
IdentityType[IdentityType["Google"] = 4] = "Google";
|
|
283
|
-
IdentityType[IdentityType["Microsoft"] = 5] = "Microsoft";
|
|
284
|
-
IdentityType[IdentityType["Yahoo"] = 6] = "Yahoo";
|
|
285
|
-
IdentityType[IdentityType["Email"] = 7] = "Email";
|
|
286
|
-
IdentityType[IdentityType["FacebookCustomAudienceId"] = 9] = "FacebookCustomAudienceId";
|
|
287
|
-
IdentityType[IdentityType["Other2"] = 10] = "Other2";
|
|
288
|
-
IdentityType[IdentityType["Other3"] = 11] = "Other3";
|
|
289
|
-
IdentityType[IdentityType["Other4"] = 12] = "Other4";
|
|
290
|
-
IdentityType[IdentityType["Other5"] = 13] = "Other5";
|
|
291
|
-
IdentityType[IdentityType["Other6"] = 14] = "Other6";
|
|
292
|
-
IdentityType[IdentityType["Other7"] = 15] = "Other7";
|
|
293
|
-
IdentityType[IdentityType["Other8"] = 16] = "Other8";
|
|
294
|
-
IdentityType[IdentityType["Other9"] = 17] = "Other9";
|
|
295
|
-
IdentityType[IdentityType["Other10"] = 18] = "Other10";
|
|
296
|
-
IdentityType[IdentityType["MobileNumber"] = 19] = "MobileNumber";
|
|
297
|
-
IdentityType[IdentityType["PhoneNumber2"] = 20] = "PhoneNumber2";
|
|
298
|
-
IdentityType[IdentityType["PhoneNumber3"] = 21] = "PhoneNumber3";
|
|
299
|
-
})(IdentityType$1 || (IdentityType$1 = {}));
|
|
300
|
-
|
|
301
|
-
/******************************************************************************
|
|
302
|
-
Copyright (c) Microsoft Corporation.
|
|
303
|
-
|
|
304
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
305
|
-
purpose with or without fee is hereby granted.
|
|
306
|
-
|
|
307
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
308
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
309
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
310
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
311
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
312
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
313
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
314
|
-
***************************************************************************** */
|
|
315
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
316
|
-
|
|
317
|
-
var extendStatics = function(d, b) {
|
|
318
|
-
extendStatics = Object.setPrototypeOf ||
|
|
319
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
320
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
321
|
-
return extendStatics(d, b);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
function __extends(d, b) {
|
|
325
|
-
if (typeof b !== "function" && b !== null)
|
|
326
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
327
|
-
extendStatics(d, b);
|
|
328
|
-
function __() { this.constructor = d; }
|
|
329
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
var __assign = function() {
|
|
333
|
-
__assign = Object.assign || function __assign(t) {
|
|
334
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
335
|
-
s = arguments[i];
|
|
336
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
337
|
-
}
|
|
338
|
-
return t;
|
|
339
|
-
};
|
|
340
|
-
return __assign.apply(this, arguments);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
344
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
345
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
346
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
347
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
348
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
349
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function __generator(thisArg, body) {
|
|
354
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
355
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
356
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
357
|
-
function step(op) {
|
|
358
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
359
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
360
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
361
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
362
|
-
switch (op[0]) {
|
|
363
|
-
case 0: case 1: t = op; break;
|
|
364
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
365
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
366
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
367
|
-
default:
|
|
368
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
369
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
370
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
371
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
372
|
-
if (t[2]) _.ops.pop();
|
|
373
|
-
_.trys.pop(); continue;
|
|
374
|
-
}
|
|
375
|
-
op = body.call(thisArg, _);
|
|
376
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
377
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function __spreadArray(to, from, pack) {
|
|
382
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
383
|
-
if (ar || !(i in from)) {
|
|
384
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
385
|
-
ar[i] = from[i];
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
392
|
-
var e = new Error(message);
|
|
393
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
var version = "2.32.2";
|
|
206
|
+
var version = "2.32.4";
|
|
397
207
|
|
|
398
208
|
var Constants = {
|
|
399
209
|
sdkVersion: version,
|
|
@@ -562,6 +372,10 @@ var mParticle = (function () {
|
|
|
562
372
|
Logout: 'logout',
|
|
563
373
|
Login: 'login',
|
|
564
374
|
Identify: 'identify'
|
|
375
|
+
},
|
|
376
|
+
Environment: {
|
|
377
|
+
Development: 'development',
|
|
378
|
+
Production: 'production'
|
|
565
379
|
}
|
|
566
380
|
};
|
|
567
381
|
// https://go.mparticle.com/work/SQDSDKS-6080
|
|
@@ -570,6 +384,102 @@ var mParticle = (function () {
|
|
|
570
384
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
|
|
571
385
|
var HTTP_OK = 200;
|
|
572
386
|
var HTTP_ACCEPTED = 202;
|
|
387
|
+
var HTTP_BAD_REQUEST = 400;
|
|
388
|
+
|
|
389
|
+
/******************************************************************************
|
|
390
|
+
Copyright (c) Microsoft Corporation.
|
|
391
|
+
|
|
392
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
393
|
+
purpose with or without fee is hereby granted.
|
|
394
|
+
|
|
395
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
396
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
397
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
398
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
399
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
400
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
401
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
402
|
+
***************************************************************************** */
|
|
403
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
404
|
+
|
|
405
|
+
var extendStatics = function(d, b) {
|
|
406
|
+
extendStatics = Object.setPrototypeOf ||
|
|
407
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
408
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
409
|
+
return extendStatics(d, b);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
function __extends(d, b) {
|
|
413
|
+
if (typeof b !== "function" && b !== null)
|
|
414
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
415
|
+
extendStatics(d, b);
|
|
416
|
+
function __() { this.constructor = d; }
|
|
417
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
var __assign = function() {
|
|
421
|
+
__assign = Object.assign || function __assign(t) {
|
|
422
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
423
|
+
s = arguments[i];
|
|
424
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
425
|
+
}
|
|
426
|
+
return t;
|
|
427
|
+
};
|
|
428
|
+
return __assign.apply(this, arguments);
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
432
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
433
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
434
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
435
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
436
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
437
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function __generator(thisArg, body) {
|
|
442
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
443
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
444
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
445
|
+
function step(op) {
|
|
446
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
447
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
448
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
449
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
450
|
+
switch (op[0]) {
|
|
451
|
+
case 0: case 1: t = op; break;
|
|
452
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
453
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
454
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
455
|
+
default:
|
|
456
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
457
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
458
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
459
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
460
|
+
if (t[2]) _.ops.pop();
|
|
461
|
+
_.trys.pop(); continue;
|
|
462
|
+
}
|
|
463
|
+
op = body.call(thisArg, _);
|
|
464
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
465
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function __spreadArray(to, from, pack) {
|
|
470
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
471
|
+
if (ar || !(i in from)) {
|
|
472
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
473
|
+
ar[i] = from[i];
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
480
|
+
var e = new Error(message);
|
|
481
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
482
|
+
};
|
|
573
483
|
|
|
574
484
|
var Messages$9 = Constants.Messages;
|
|
575
485
|
var createCookieString = function createCookieString(value) {
|
|
@@ -855,64 +765,6 @@ var mParticle = (function () {
|
|
|
855
765
|
return typeof window !== 'undefined' && window.location ? window.location.href : '';
|
|
856
766
|
};
|
|
857
767
|
|
|
858
|
-
function getNewIdentitiesByName(newIdentitiesByType) {
|
|
859
|
-
var newIdentitiesByName = {};
|
|
860
|
-
for (var key in newIdentitiesByType) {
|
|
861
|
-
var identityNameKey = getIdentityName(parseNumber(key));
|
|
862
|
-
newIdentitiesByName[identityNameKey] = newIdentitiesByType[key];
|
|
863
|
-
}
|
|
864
|
-
return newIdentitiesByName;
|
|
865
|
-
}
|
|
866
|
-
function getIdentityName(identityType) {
|
|
867
|
-
switch (identityType) {
|
|
868
|
-
case IdentityType$1.Other:
|
|
869
|
-
return 'other';
|
|
870
|
-
case IdentityType$1.CustomerId:
|
|
871
|
-
return 'customerid';
|
|
872
|
-
case IdentityType$1.Facebook:
|
|
873
|
-
return 'facebook';
|
|
874
|
-
case IdentityType$1.Twitter:
|
|
875
|
-
return 'twitter';
|
|
876
|
-
case IdentityType$1.Google:
|
|
877
|
-
return 'google';
|
|
878
|
-
case IdentityType$1.Microsoft:
|
|
879
|
-
return 'microsoft';
|
|
880
|
-
case IdentityType$1.Yahoo:
|
|
881
|
-
return 'yahoo';
|
|
882
|
-
case IdentityType$1.Email:
|
|
883
|
-
return 'email';
|
|
884
|
-
case IdentityType$1.FacebookCustomAudienceId:
|
|
885
|
-
return 'facebookcustomaudienceid';
|
|
886
|
-
case IdentityType$1.Other2:
|
|
887
|
-
return 'other2';
|
|
888
|
-
case IdentityType$1.Other3:
|
|
889
|
-
return 'other3';
|
|
890
|
-
case IdentityType$1.Other4:
|
|
891
|
-
return 'other4';
|
|
892
|
-
case IdentityType$1.Other5:
|
|
893
|
-
return 'other5';
|
|
894
|
-
case IdentityType$1.Other6:
|
|
895
|
-
return 'other6';
|
|
896
|
-
case IdentityType$1.Other7:
|
|
897
|
-
return 'other7';
|
|
898
|
-
case IdentityType$1.Other8:
|
|
899
|
-
return 'other8';
|
|
900
|
-
case IdentityType$1.Other9:
|
|
901
|
-
return 'other9';
|
|
902
|
-
case IdentityType$1.Other10:
|
|
903
|
-
return 'other10';
|
|
904
|
-
case IdentityType$1.MobileNumber:
|
|
905
|
-
return 'mobile_number';
|
|
906
|
-
case IdentityType$1.PhoneNumber2:
|
|
907
|
-
return 'phone_number_2';
|
|
908
|
-
case IdentityType$1.PhoneNumber3:
|
|
909
|
-
return 'phone_number_3';
|
|
910
|
-
default:
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
var _TriggerUploadType;
|
|
916
768
|
var MessageType$1 = {
|
|
917
769
|
SessionStart: 1,
|
|
918
770
|
SessionEnd: 2,
|
|
@@ -927,10 +779,6 @@ var mParticle = (function () {
|
|
|
927
779
|
UserAttributeChange: 17,
|
|
928
780
|
UserIdentityChange: 18
|
|
929
781
|
};
|
|
930
|
-
|
|
931
|
-
// Dictionary that contains MessageTypes that will
|
|
932
|
-
// trigger an immediate upload.
|
|
933
|
-
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$1.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$1.UserIdentityChange, 1), _TriggerUploadType);
|
|
934
782
|
var EventType = {
|
|
935
783
|
Unknown: 0,
|
|
936
784
|
Navigation: 1,
|
|
@@ -991,8 +839,7 @@ var mParticle = (function () {
|
|
|
991
839
|
}
|
|
992
840
|
}
|
|
993
841
|
};
|
|
994
|
-
|
|
995
|
-
// Continuation of enum above, but in seperate object since we don't expose these to end user
|
|
842
|
+
// Continuation of EventType enum above, but in seperate object since we don't expose these to end user
|
|
996
843
|
var CommerceEventType = {
|
|
997
844
|
ProductAddToCart: 10,
|
|
998
845
|
ProductRemoveFromCart: 11,
|
|
@@ -1029,92 +876,157 @@ var mParticle = (function () {
|
|
|
1029
876
|
Other10: 18,
|
|
1030
877
|
MobileNumber: 19,
|
|
1031
878
|
PhoneNumber2: 20,
|
|
1032
|
-
PhoneNumber3: 21
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
879
|
+
PhoneNumber3: 21,
|
|
880
|
+
isValid: function isValid(identityType) {
|
|
881
|
+
if (typeof identityType === 'number') {
|
|
882
|
+
for (var prop in IdentityType) {
|
|
883
|
+
if (IdentityType.hasOwnProperty(prop)) {
|
|
884
|
+
if (IdentityType[prop] === identityType) {
|
|
885
|
+
return true;
|
|
886
|
+
}
|
|
1040
887
|
}
|
|
1041
888
|
}
|
|
1042
889
|
}
|
|
890
|
+
return false;
|
|
891
|
+
},
|
|
892
|
+
getName: function getName(identityType) {
|
|
893
|
+
switch (identityType) {
|
|
894
|
+
case window.mParticle.IdentityType.CustomerId:
|
|
895
|
+
return 'Customer ID';
|
|
896
|
+
case window.mParticle.IdentityType.Facebook:
|
|
897
|
+
return 'Facebook ID';
|
|
898
|
+
case window.mParticle.IdentityType.Twitter:
|
|
899
|
+
return 'Twitter ID';
|
|
900
|
+
case window.mParticle.IdentityType.Google:
|
|
901
|
+
return 'Google ID';
|
|
902
|
+
case window.mParticle.IdentityType.Microsoft:
|
|
903
|
+
return 'Microsoft ID';
|
|
904
|
+
case window.mParticle.IdentityType.Yahoo:
|
|
905
|
+
return 'Yahoo ID';
|
|
906
|
+
case window.mParticle.IdentityType.Email:
|
|
907
|
+
return 'Email';
|
|
908
|
+
case window.mParticle.IdentityType.FacebookCustomAudienceId:
|
|
909
|
+
return 'Facebook App User ID';
|
|
910
|
+
default:
|
|
911
|
+
return 'Other ID';
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
getIdentityType: function getIdentityType(identityName) {
|
|
915
|
+
switch (identityName) {
|
|
916
|
+
case 'other':
|
|
917
|
+
return IdentityType.Other;
|
|
918
|
+
case 'customerid':
|
|
919
|
+
return IdentityType.CustomerId;
|
|
920
|
+
case 'facebook':
|
|
921
|
+
return IdentityType.Facebook;
|
|
922
|
+
case 'twitter':
|
|
923
|
+
return IdentityType.Twitter;
|
|
924
|
+
case 'google':
|
|
925
|
+
return IdentityType.Google;
|
|
926
|
+
case 'microsoft':
|
|
927
|
+
return IdentityType.Microsoft;
|
|
928
|
+
case 'yahoo':
|
|
929
|
+
return IdentityType.Yahoo;
|
|
930
|
+
case 'email':
|
|
931
|
+
return IdentityType.Email;
|
|
932
|
+
case 'facebookcustomaudienceid':
|
|
933
|
+
return IdentityType.FacebookCustomAudienceId;
|
|
934
|
+
case 'other2':
|
|
935
|
+
return IdentityType.Other2;
|
|
936
|
+
case 'other3':
|
|
937
|
+
return IdentityType.Other3;
|
|
938
|
+
case 'other4':
|
|
939
|
+
return IdentityType.Other4;
|
|
940
|
+
case 'other5':
|
|
941
|
+
return IdentityType.Other5;
|
|
942
|
+
case 'other6':
|
|
943
|
+
return IdentityType.Other6;
|
|
944
|
+
case 'other7':
|
|
945
|
+
return IdentityType.Other7;
|
|
946
|
+
case 'other8':
|
|
947
|
+
return IdentityType.Other8;
|
|
948
|
+
case 'other9':
|
|
949
|
+
return IdentityType.Other9;
|
|
950
|
+
case 'other10':
|
|
951
|
+
return IdentityType.Other10;
|
|
952
|
+
case 'mobile_number':
|
|
953
|
+
return IdentityType.MobileNumber;
|
|
954
|
+
case 'phone_number_2':
|
|
955
|
+
return IdentityType.PhoneNumber2;
|
|
956
|
+
case 'phone_number_3':
|
|
957
|
+
return IdentityType.PhoneNumber3;
|
|
958
|
+
default:
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
getIdentityName: function getIdentityName(identityType) {
|
|
963
|
+
switch (identityType) {
|
|
964
|
+
case IdentityType.Other:
|
|
965
|
+
return 'other';
|
|
966
|
+
case IdentityType.CustomerId:
|
|
967
|
+
return 'customerid';
|
|
968
|
+
case IdentityType.Facebook:
|
|
969
|
+
return 'facebook';
|
|
970
|
+
case IdentityType.Twitter:
|
|
971
|
+
return 'twitter';
|
|
972
|
+
case IdentityType.Google:
|
|
973
|
+
return 'google';
|
|
974
|
+
case IdentityType.Microsoft:
|
|
975
|
+
return 'microsoft';
|
|
976
|
+
case IdentityType.Yahoo:
|
|
977
|
+
return 'yahoo';
|
|
978
|
+
case IdentityType.Email:
|
|
979
|
+
return 'email';
|
|
980
|
+
case IdentityType.FacebookCustomAudienceId:
|
|
981
|
+
return 'facebookcustomaudienceid';
|
|
982
|
+
case IdentityType.Other2:
|
|
983
|
+
return 'other2';
|
|
984
|
+
case IdentityType.Other3:
|
|
985
|
+
return 'other3';
|
|
986
|
+
case IdentityType.Other4:
|
|
987
|
+
return 'other4';
|
|
988
|
+
case IdentityType.Other5:
|
|
989
|
+
return 'other5';
|
|
990
|
+
case IdentityType.Other6:
|
|
991
|
+
return 'other6';
|
|
992
|
+
case IdentityType.Other7:
|
|
993
|
+
return 'other7';
|
|
994
|
+
case IdentityType.Other8:
|
|
995
|
+
return 'other8';
|
|
996
|
+
case IdentityType.Other9:
|
|
997
|
+
return 'other9';
|
|
998
|
+
case IdentityType.Other10:
|
|
999
|
+
return 'other10';
|
|
1000
|
+
case IdentityType.MobileNumber:
|
|
1001
|
+
return 'mobile_number';
|
|
1002
|
+
case IdentityType.PhoneNumber2:
|
|
1003
|
+
return 'phone_number_2';
|
|
1004
|
+
case IdentityType.PhoneNumber3:
|
|
1005
|
+
return 'phone_number_3';
|
|
1006
|
+
default:
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
// Strips out functions from Identity Types for easier lookups
|
|
1011
|
+
getValuesAsStrings: function getValuesAsStrings() {
|
|
1012
|
+
return Object.values(IdentityType).map(function (value) {
|
|
1013
|
+
return isNumber(value) ? value.toString() : undefined;
|
|
1014
|
+
}).filter(function (value) {
|
|
1015
|
+
return value !== undefined;
|
|
1016
|
+
});
|
|
1017
|
+
},
|
|
1018
|
+
getNewIdentitiesByName: function getNewIdentitiesByName(newIdentitiesByType) {
|
|
1019
|
+
var newIdentitiesByName = {};
|
|
1020
|
+
var identityTypeValuesAsStrings = IdentityType.getValuesAsStrings();
|
|
1021
|
+
for (var key in newIdentitiesByType) {
|
|
1022
|
+
// IdentityTypes are stored as numbers but are passed in as strings
|
|
1023
|
+
if (identityTypeValuesAsStrings.includes(key)) {
|
|
1024
|
+
var identityNameKey = IdentityType.getIdentityName(parseNumber(key));
|
|
1025
|
+
newIdentitiesByName[identityNameKey] = newIdentitiesByType[key];
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
return newIdentitiesByName;
|
|
1043
1029
|
}
|
|
1044
|
-
return false;
|
|
1045
|
-
};
|
|
1046
|
-
IdentityType.getName = function (identityType) {
|
|
1047
|
-
switch (identityType) {
|
|
1048
|
-
case window.mParticle.IdentityType.CustomerId:
|
|
1049
|
-
return 'Customer ID';
|
|
1050
|
-
case window.mParticle.IdentityType.Facebook:
|
|
1051
|
-
return 'Facebook ID';
|
|
1052
|
-
case window.mParticle.IdentityType.Twitter:
|
|
1053
|
-
return 'Twitter ID';
|
|
1054
|
-
case window.mParticle.IdentityType.Google:
|
|
1055
|
-
return 'Google ID';
|
|
1056
|
-
case window.mParticle.IdentityType.Microsoft:
|
|
1057
|
-
return 'Microsoft ID';
|
|
1058
|
-
case window.mParticle.IdentityType.Yahoo:
|
|
1059
|
-
return 'Yahoo ID';
|
|
1060
|
-
case window.mParticle.IdentityType.Email:
|
|
1061
|
-
return 'Email';
|
|
1062
|
-
case window.mParticle.IdentityType.FacebookCustomAudienceId:
|
|
1063
|
-
return 'Facebook App User ID';
|
|
1064
|
-
default:
|
|
1065
|
-
return 'Other ID';
|
|
1066
|
-
}
|
|
1067
|
-
};
|
|
1068
|
-
IdentityType.getIdentityType = function (identityName) {
|
|
1069
|
-
switch (identityName) {
|
|
1070
|
-
case 'other':
|
|
1071
|
-
return IdentityType.Other;
|
|
1072
|
-
case 'customerid':
|
|
1073
|
-
return IdentityType.CustomerId;
|
|
1074
|
-
case 'facebook':
|
|
1075
|
-
return IdentityType.Facebook;
|
|
1076
|
-
case 'twitter':
|
|
1077
|
-
return IdentityType.Twitter;
|
|
1078
|
-
case 'google':
|
|
1079
|
-
return IdentityType.Google;
|
|
1080
|
-
case 'microsoft':
|
|
1081
|
-
return IdentityType.Microsoft;
|
|
1082
|
-
case 'yahoo':
|
|
1083
|
-
return IdentityType.Yahoo;
|
|
1084
|
-
case 'email':
|
|
1085
|
-
return IdentityType.Email;
|
|
1086
|
-
case 'facebookcustomaudienceid':
|
|
1087
|
-
return IdentityType.FacebookCustomAudienceId;
|
|
1088
|
-
case 'other2':
|
|
1089
|
-
return IdentityType.Other2;
|
|
1090
|
-
case 'other3':
|
|
1091
|
-
return IdentityType.Other3;
|
|
1092
|
-
case 'other4':
|
|
1093
|
-
return IdentityType.Other4;
|
|
1094
|
-
case 'other5':
|
|
1095
|
-
return IdentityType.Other5;
|
|
1096
|
-
case 'other6':
|
|
1097
|
-
return IdentityType.Other6;
|
|
1098
|
-
case 'other7':
|
|
1099
|
-
return IdentityType.Other7;
|
|
1100
|
-
case 'other8':
|
|
1101
|
-
return IdentityType.Other8;
|
|
1102
|
-
case 'other9':
|
|
1103
|
-
return IdentityType.Other9;
|
|
1104
|
-
case 'other10':
|
|
1105
|
-
return IdentityType.Other10;
|
|
1106
|
-
case 'mobile_number':
|
|
1107
|
-
return IdentityType.MobileNumber;
|
|
1108
|
-
case 'phone_number_2':
|
|
1109
|
-
return IdentityType.PhoneNumber2;
|
|
1110
|
-
case 'phone_number_3':
|
|
1111
|
-
return IdentityType.PhoneNumber3;
|
|
1112
|
-
default:
|
|
1113
|
-
return false;
|
|
1114
|
-
}
|
|
1115
|
-
};
|
|
1116
|
-
IdentityType.getIdentityName = function (identityType) {
|
|
1117
|
-
return getIdentityName(identityType);
|
|
1118
1030
|
};
|
|
1119
1031
|
var ProductActionType = {
|
|
1120
1032
|
Unknown: 0,
|
|
@@ -1127,87 +1039,85 @@ var mParticle = (function () {
|
|
|
1127
1039
|
Purchase: 7,
|
|
1128
1040
|
Refund: 8,
|
|
1129
1041
|
AddToWishlist: 9,
|
|
1130
|
-
RemoveFromWishlist: 10
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
return 'unknown';
|
|
1042
|
+
RemoveFromWishlist: 10,
|
|
1043
|
+
getName: function getName(id) {
|
|
1044
|
+
switch (id) {
|
|
1045
|
+
case ProductActionType.AddToCart:
|
|
1046
|
+
return 'Add to Cart';
|
|
1047
|
+
case ProductActionType.RemoveFromCart:
|
|
1048
|
+
return 'Remove from Cart';
|
|
1049
|
+
case ProductActionType.Checkout:
|
|
1050
|
+
return 'Checkout';
|
|
1051
|
+
case ProductActionType.CheckoutOption:
|
|
1052
|
+
return 'Checkout Option';
|
|
1053
|
+
case ProductActionType.Click:
|
|
1054
|
+
return 'Click';
|
|
1055
|
+
case ProductActionType.ViewDetail:
|
|
1056
|
+
return 'View Detail';
|
|
1057
|
+
case ProductActionType.Purchase:
|
|
1058
|
+
return 'Purchase';
|
|
1059
|
+
case ProductActionType.Refund:
|
|
1060
|
+
return 'Refund';
|
|
1061
|
+
case ProductActionType.AddToWishlist:
|
|
1062
|
+
return 'Add to Wishlist';
|
|
1063
|
+
case ProductActionType.RemoveFromWishlist:
|
|
1064
|
+
return 'Remove from Wishlist';
|
|
1065
|
+
default:
|
|
1066
|
+
return 'Unknown';
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
// these are the action names used by server and mobile SDKs when expanding a CommerceEvent
|
|
1070
|
+
getExpansionName: function getExpansionName(id) {
|
|
1071
|
+
switch (id) {
|
|
1072
|
+
case ProductActionType.AddToCart:
|
|
1073
|
+
return 'add_to_cart';
|
|
1074
|
+
case ProductActionType.RemoveFromCart:
|
|
1075
|
+
return 'remove_from_cart';
|
|
1076
|
+
case ProductActionType.Checkout:
|
|
1077
|
+
return 'checkout';
|
|
1078
|
+
case ProductActionType.CheckoutOption:
|
|
1079
|
+
return 'checkout_option';
|
|
1080
|
+
case ProductActionType.Click:
|
|
1081
|
+
return 'click';
|
|
1082
|
+
case ProductActionType.ViewDetail:
|
|
1083
|
+
return 'view_detail';
|
|
1084
|
+
case ProductActionType.Purchase:
|
|
1085
|
+
return 'purchase';
|
|
1086
|
+
case ProductActionType.Refund:
|
|
1087
|
+
return 'refund';
|
|
1088
|
+
case ProductActionType.AddToWishlist:
|
|
1089
|
+
return 'add_to_wishlist';
|
|
1090
|
+
case ProductActionType.RemoveFromWishlist:
|
|
1091
|
+
return 'remove_from_wishlist';
|
|
1092
|
+
default:
|
|
1093
|
+
return 'unknown';
|
|
1094
|
+
}
|
|
1184
1095
|
}
|
|
1185
1096
|
};
|
|
1186
1097
|
var PromotionActionType = {
|
|
1187
1098
|
Unknown: 0,
|
|
1188
1099
|
PromotionView: 1,
|
|
1189
|
-
PromotionClick: 2
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
return 'unknown';
|
|
1100
|
+
PromotionClick: 2,
|
|
1101
|
+
getName: function getName(id) {
|
|
1102
|
+
switch (id) {
|
|
1103
|
+
case PromotionActionType.PromotionView:
|
|
1104
|
+
return 'view';
|
|
1105
|
+
case PromotionActionType.PromotionClick:
|
|
1106
|
+
return 'click';
|
|
1107
|
+
default:
|
|
1108
|
+
return 'unknown';
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
// these are the names that the server and mobile SDKs use while expanding CommerceEvent
|
|
1112
|
+
getExpansionName: function getExpansionName(id) {
|
|
1113
|
+
switch (id) {
|
|
1114
|
+
case PromotionActionType.PromotionView:
|
|
1115
|
+
return 'view';
|
|
1116
|
+
case PromotionActionType.PromotionClick:
|
|
1117
|
+
return 'click';
|
|
1118
|
+
default:
|
|
1119
|
+
return 'unknown';
|
|
1120
|
+
}
|
|
1211
1121
|
}
|
|
1212
1122
|
};
|
|
1213
1123
|
var ProfileMessageType = {
|
|
@@ -1216,10 +1126,6 @@ var mParticle = (function () {
|
|
|
1216
1126
|
var ApplicationTransitionType$1 = {
|
|
1217
1127
|
AppInit: 1
|
|
1218
1128
|
};
|
|
1219
|
-
var Environment = {
|
|
1220
|
-
Production: 'production',
|
|
1221
|
-
Development: 'development'
|
|
1222
|
-
};
|
|
1223
1129
|
var Types = {
|
|
1224
1130
|
MessageType: MessageType$1,
|
|
1225
1131
|
EventType: EventType,
|
|
@@ -1229,10 +1135,19 @@ var mParticle = (function () {
|
|
|
1229
1135
|
ApplicationTransitionType: ApplicationTransitionType$1,
|
|
1230
1136
|
ProductActionType: ProductActionType,
|
|
1231
1137
|
PromotionActionType: PromotionActionType,
|
|
1232
|
-
|
|
1233
|
-
Environment: Environment
|
|
1138
|
+
Environment: Constants.Environment
|
|
1234
1139
|
};
|
|
1235
1140
|
|
|
1141
|
+
function _typeof$1(o) {
|
|
1142
|
+
"@babel/helpers - typeof";
|
|
1143
|
+
|
|
1144
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
1145
|
+
return typeof o;
|
|
1146
|
+
} : function (o) {
|
|
1147
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1148
|
+
}, _typeof$1(o);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1236
1151
|
var SDKProductActionType;
|
|
1237
1152
|
(function (SDKProductActionType) {
|
|
1238
1153
|
SDKProductActionType[SDKProductActionType["Unknown"] = 0] = "Unknown";
|
|
@@ -2259,11 +2174,11 @@ var mParticle = (function () {
|
|
|
2259
2174
|
reject(xhr);
|
|
2260
2175
|
};
|
|
2261
2176
|
xhr.open(method, url);
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
}
|
|
2177
|
+
for (var key in headers) {
|
|
2178
|
+
if (headers.hasOwnProperty(key)) {
|
|
2179
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2267
2182
|
xhr.send(data);
|
|
2268
2183
|
})];
|
|
2269
2184
|
});
|
|
@@ -2290,7 +2205,7 @@ var mParticle = (function () {
|
|
|
2290
2205
|
var BatchUploader = /** @class */function () {
|
|
2291
2206
|
/**
|
|
2292
2207
|
* Creates an instance of a BatchUploader
|
|
2293
|
-
* @param {
|
|
2208
|
+
* @param {IMParticleWebSDKInstance} mpInstance - the mParticle SDK instance
|
|
2294
2209
|
* @param {number} uploadInterval - the desired upload interval in milliseconds
|
|
2295
2210
|
*/
|
|
2296
2211
|
function BatchUploader(mpInstance, uploadInterval) {
|
|
@@ -2382,19 +2297,24 @@ var mParticle = (function () {
|
|
|
2382
2297
|
* @param event event that should be queued
|
|
2383
2298
|
*/
|
|
2384
2299
|
BatchUploader.prototype.queueEvent = function (event) {
|
|
2385
|
-
if (
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
this.
|
|
2392
|
-
// TODO: Remove this check once the v2 code path is removed
|
|
2393
|
-
// https://go.mparticle.com/work/SQDSDKS-3720
|
|
2394
|
-
if (!this.batchingEnabled || Types.TriggerUploadType[event.EventDataType]) {
|
|
2395
|
-
this.prepareAndUpload(false, false);
|
|
2396
|
-
}
|
|
2300
|
+
if (isEmpty(event)) {
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
var verbose = this.mpInstance.Logger.verbose;
|
|
2304
|
+
this.eventsQueuedForProcessing.push(event);
|
|
2305
|
+
if (this.offlineStorageEnabled && this.eventVault) {
|
|
2306
|
+
this.eventVault.store(this.eventsQueuedForProcessing);
|
|
2397
2307
|
}
|
|
2308
|
+
verbose("Queuing event: ".concat(JSON.stringify(event)));
|
|
2309
|
+
verbose("Queued event count: ".concat(this.eventsQueuedForProcessing.length));
|
|
2310
|
+
if (this.shouldTriggerImmediateUpload(event.EventDataType)) {
|
|
2311
|
+
this.prepareAndUpload(false, false);
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
// https://go.mparticle.com/work/SQDSDKS-3720
|
|
2315
|
+
BatchUploader.prototype.shouldTriggerImmediateUpload = function (eventDataType) {
|
|
2316
|
+
var priorityEvents = [MessageType$1.Commerce, MessageType$1.UserIdentityChange];
|
|
2317
|
+
return !this.batchingEnabled || priorityEvents.includes(eventDataType);
|
|
2398
2318
|
};
|
|
2399
2319
|
/**
|
|
2400
2320
|
* This implements crucial logic to:
|
|
@@ -2468,6 +2388,12 @@ var mParticle = (function () {
|
|
|
2468
2388
|
* @param useBeacon whether to use the beacon API - used when the page is being unloaded
|
|
2469
2389
|
*/
|
|
2470
2390
|
BatchUploader.prototype.prepareAndUpload = function (triggerFuture, useBeacon) {
|
|
2391
|
+
if (triggerFuture === void 0) {
|
|
2392
|
+
triggerFuture = false;
|
|
2393
|
+
}
|
|
2394
|
+
if (useBeacon === void 0) {
|
|
2395
|
+
useBeacon = false;
|
|
2396
|
+
}
|
|
2471
2397
|
return __awaiter(this, void 0, void 0, function () {
|
|
2472
2398
|
var currentUser, currentEvents, newBatches, batchesToUpload, batchesThatDidNotUpload;
|
|
2473
2399
|
var _a, _b, _c;
|
|
@@ -2664,6 +2590,9 @@ var mParticle = (function () {
|
|
|
2664
2590
|
if (options.shouldUploadEvent) {
|
|
2665
2591
|
this.queueEventForBatchUpload(event);
|
|
2666
2592
|
}
|
|
2593
|
+
// https://go.mparticle.com/work/SQDSDKS-6935
|
|
2594
|
+
// While Event Name is 'usually' a string, there are some cases where it is a number
|
|
2595
|
+
// in that it could be a type of MessageType Enum
|
|
2667
2596
|
if (event.EventName !== Types.MessageType.AppStateTransition) {
|
|
2668
2597
|
if (kitBlocker && kitBlocker.kitBlockingEnabled) {
|
|
2669
2598
|
event = kitBlocker.createBlockedEvent(event);
|
|
@@ -3525,6 +3454,8 @@ var mParticle = (function () {
|
|
|
3525
3454
|
var Messages$5 = Constants.Messages;
|
|
3526
3455
|
function Ecommerce(mpInstance) {
|
|
3527
3456
|
var self = this;
|
|
3457
|
+
|
|
3458
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3528
3459
|
this.convertTransactionAttributesToProductAction = function (transactionAttributes, productAction) {
|
|
3529
3460
|
if (transactionAttributes.hasOwnProperty('Id')) {
|
|
3530
3461
|
productAction.TransactionId = transactionAttributes.Id;
|
|
@@ -3608,6 +3539,8 @@ var mParticle = (function () {
|
|
|
3608
3539
|
return Types.CommerceEventType.ProductRemoveFromCart;
|
|
3609
3540
|
case Types.ProductActionType.RemoveFromWishlist:
|
|
3610
3541
|
return Types.CommerceEventType.ProductRemoveFromWishlist;
|
|
3542
|
+
|
|
3543
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3611
3544
|
case Types.ProductActionType.Unknown:
|
|
3612
3545
|
return Types.EventType.Unknown;
|
|
3613
3546
|
case Types.ProductActionType.ViewDetail:
|
|
@@ -3631,6 +3564,8 @@ var mParticle = (function () {
|
|
|
3631
3564
|
this.generateExpandedEcommerceName = function (eventName, plusOne) {
|
|
3632
3565
|
return 'eCommerce - ' + eventName + ' - ' + (plusOne ? 'Total' : 'Item');
|
|
3633
3566
|
};
|
|
3567
|
+
|
|
3568
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3634
3569
|
this.extractProductAttributes = function (attributes, product) {
|
|
3635
3570
|
if (product.CouponCode) {
|
|
3636
3571
|
attributes['Coupon Code'] = product.CouponCode;
|
|
@@ -3661,11 +3596,15 @@ var mParticle = (function () {
|
|
|
3661
3596
|
}
|
|
3662
3597
|
attributes['Total Product Amount'] = product.TotalAmount || 0;
|
|
3663
3598
|
};
|
|
3599
|
+
|
|
3600
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3664
3601
|
this.extractTransactionId = function (attributes, productAction) {
|
|
3665
3602
|
if (productAction.TransactionId) {
|
|
3666
3603
|
attributes['Transaction Id'] = productAction.TransactionId;
|
|
3667
3604
|
}
|
|
3668
3605
|
};
|
|
3606
|
+
|
|
3607
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3669
3608
|
this.extractActionAttributes = function (attributes, productAction) {
|
|
3670
3609
|
self.extractTransactionId(attributes, productAction);
|
|
3671
3610
|
if (productAction.Affiliation) {
|
|
@@ -3690,6 +3629,8 @@ var mParticle = (function () {
|
|
|
3690
3629
|
attributes['Checkout Step'] = productAction.CheckoutStep;
|
|
3691
3630
|
}
|
|
3692
3631
|
};
|
|
3632
|
+
|
|
3633
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3693
3634
|
this.extractPromotionAttributes = function (attributes, promotion) {
|
|
3694
3635
|
if (promotion.Id) {
|
|
3695
3636
|
attributes['Id'] = promotion.Id;
|
|
@@ -5477,10 +5418,13 @@ var mParticle = (function () {
|
|
|
5477
5418
|
for (i = 0; i < elements.length; i++) {
|
|
5478
5419
|
element = elements[i];
|
|
5479
5420
|
if (element.addEventListener) {
|
|
5421
|
+
// Modern browsers
|
|
5480
5422
|
element.addEventListener(domEvent, handler, false);
|
|
5481
5423
|
} else if (element.attachEvent) {
|
|
5424
|
+
// IE < 9
|
|
5482
5425
|
element.attachEvent('on' + domEvent, handler);
|
|
5483
5426
|
} else {
|
|
5427
|
+
// All other browsers
|
|
5484
5428
|
element['on' + domEvent] = handler;
|
|
5485
5429
|
}
|
|
5486
5430
|
}
|
|
@@ -8044,7 +7988,7 @@ var mParticle = (function () {
|
|
|
8044
7988
|
self.reinitForwardersOnUserChange(prevUser, newUser);
|
|
8045
7989
|
self.setForwarderCallbacks(newUser, method);
|
|
8046
7990
|
}
|
|
8047
|
-
var newIdentitiesByName = getNewIdentitiesByName(newIdentitiesByType);
|
|
7991
|
+
var newIdentitiesByName = IdentityType.getNewIdentitiesByName(newIdentitiesByType);
|
|
8048
7992
|
var uiByName = method === Modify$1 ? previousUIByName : incomingUIByName;
|
|
8049
7993
|
|
|
8050
7994
|
// https://go.mparticle.com/work/SQDSDKS-6501
|
|
@@ -9007,9 +8951,9 @@ var mParticle = (function () {
|
|
|
9007
8951
|
function IdentityAPIClient(mpInstance) {
|
|
9008
8952
|
this.sendAliasRequest = function (aliasRequest, aliasCallback) {
|
|
9009
8953
|
return __awaiter(this, void 0, void 0, function () {
|
|
9010
|
-
var _a, verbose, error, invokeAliasCallback, aliasUrl, apiKey, uploadUrl, uploader, uploadPayload, response, message,
|
|
9011
|
-
return __generator(this, function (
|
|
9012
|
-
switch (
|
|
8954
|
+
var _a, verbose, error, invokeAliasCallback, aliasUrl, apiKey, uploadUrl, uploader, uploadPayload, response, aliasResponseBody, message, errorMessage, _b, xhrResponse, errorResponse, e_2, errorMessage;
|
|
8955
|
+
return __generator(this, function (_c) {
|
|
8956
|
+
switch (_c.label) {
|
|
9013
8957
|
case 0:
|
|
9014
8958
|
_a = mpInstance.Logger, verbose = _a.verbose, error = _a.error;
|
|
9015
8959
|
invokeAliasCallback = mpInstance._Helpers.invokeAliasCallback;
|
|
@@ -9026,57 +8970,73 @@ var mParticle = (function () {
|
|
|
9026
8970
|
},
|
|
9027
8971
|
body: JSON.stringify(aliasRequest)
|
|
9028
8972
|
};
|
|
9029
|
-
|
|
8973
|
+
_c.label = 1;
|
|
9030
8974
|
case 1:
|
|
9031
|
-
|
|
8975
|
+
_c.trys.push([1, 13,, 14]);
|
|
9032
8976
|
return [4 /*yield*/, uploader.upload(uploadPayload)];
|
|
9033
8977
|
case 2:
|
|
9034
|
-
response =
|
|
9035
|
-
message = void 0;
|
|
8978
|
+
response = _c.sent();
|
|
9036
8979
|
aliasResponseBody = void 0;
|
|
9037
|
-
|
|
9038
|
-
|
|
8980
|
+
message = void 0;
|
|
8981
|
+
errorMessage = void 0;
|
|
8982
|
+
_b = response.status;
|
|
8983
|
+
switch (_b) {
|
|
8984
|
+
case HTTP_ACCEPTED:
|
|
8985
|
+
return [3 /*break*/, 3];
|
|
8986
|
+
case HTTP_OK:
|
|
8987
|
+
return [3 /*break*/, 3];
|
|
8988
|
+
case HTTP_BAD_REQUEST:
|
|
8989
|
+
return [3 /*break*/, 4];
|
|
8990
|
+
}
|
|
8991
|
+
return [3 /*break*/, 11];
|
|
9039
8992
|
case 3:
|
|
9040
|
-
|
|
9041
|
-
|
|
8993
|
+
// https://go.mparticle.com/work/SQDSDKS-6670
|
|
8994
|
+
message = 'Received Alias Response from server: ' + JSON.stringify(response.status);
|
|
8995
|
+
return [3 /*break*/, 12];
|
|
9042
8996
|
case 4:
|
|
9043
|
-
|
|
9044
|
-
|
|
8997
|
+
if (!response.json) return [3 /*break*/, 9];
|
|
8998
|
+
_c.label = 5;
|
|
9045
8999
|
case 5:
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
return [3 /*break*/, 6];
|
|
9000
|
+
_c.trys.push([5, 7,, 8]);
|
|
9001
|
+
return [4 /*yield*/, response.json()];
|
|
9049
9002
|
case 6:
|
|
9003
|
+
aliasResponseBody = _c.sent();
|
|
9050
9004
|
return [3 /*break*/, 8];
|
|
9051
9005
|
case 7:
|
|
9006
|
+
_c.sent();
|
|
9007
|
+
verbose('The request has no response body');
|
|
9008
|
+
return [3 /*break*/, 8];
|
|
9009
|
+
case 8:
|
|
9010
|
+
return [3 /*break*/, 10];
|
|
9011
|
+
case 9:
|
|
9052
9012
|
xhrResponse = response;
|
|
9053
9013
|
aliasResponseBody = xhrResponse.responseText ? JSON.parse(xhrResponse.responseText) : '';
|
|
9054
|
-
|
|
9055
|
-
case
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
message = 'Issue with sending Alias Request to mParticle Servers, received HTTP Code of ' + response.status;
|
|
9014
|
+
_c.label = 10;
|
|
9015
|
+
case 10:
|
|
9016
|
+
errorResponse = aliasResponseBody;
|
|
9017
|
+
if (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.message) {
|
|
9018
|
+
errorMessage = errorResponse.message;
|
|
9019
|
+
}
|
|
9020
|
+
message = 'Issue with sending Alias Request to mParticle Servers, received HTTP Code of ' + response.status;
|
|
9021
|
+
if (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.code) {
|
|
9022
|
+
message += ' - ' + errorResponse.code;
|
|
9023
|
+
}
|
|
9024
|
+
return [3 /*break*/, 12];
|
|
9025
|
+
case 11:
|
|
9026
|
+
{
|
|
9027
|
+
throw new Error('Received HTTP Code of ' + response.status);
|
|
9069
9028
|
}
|
|
9029
|
+
case 12:
|
|
9070
9030
|
verbose(message);
|
|
9071
9031
|
invokeAliasCallback(aliasCallback, response.status, errorMessage);
|
|
9072
|
-
return [3 /*break*/,
|
|
9073
|
-
case
|
|
9074
|
-
e_2 =
|
|
9075
|
-
|
|
9076
|
-
error('Error sending alias request to mParticle servers. ' +
|
|
9077
|
-
invokeAliasCallback(aliasCallback, HTTPCodes$1.noHttpCoverage,
|
|
9078
|
-
return [3 /*break*/,
|
|
9079
|
-
case
|
|
9032
|
+
return [3 /*break*/, 14];
|
|
9033
|
+
case 13:
|
|
9034
|
+
e_2 = _c.sent();
|
|
9035
|
+
errorMessage = e_2.message || e_2.toString();
|
|
9036
|
+
error('Error sending alias request to mParticle servers. ' + errorMessage);
|
|
9037
|
+
invokeAliasCallback(aliasCallback, HTTPCodes$1.noHttpCoverage, errorMessage);
|
|
9038
|
+
return [3 /*break*/, 14];
|
|
9039
|
+
case 14:
|
|
9080
9040
|
return [2 /*return*/];
|
|
9081
9041
|
}
|
|
9082
9042
|
});
|
|
@@ -9085,9 +9045,9 @@ var mParticle = (function () {
|
|
|
9085
9045
|
|
|
9086
9046
|
this.sendIdentityRequest = function (identityApiRequest, method, callback, originalIdentityApiData, parseIdentityResponse, mpid, knownIdentities) {
|
|
9087
9047
|
return __awaiter(this, void 0, void 0, function () {
|
|
9088
|
-
var _a, verbose, error, invokeCallback, previousMPID, uploadUrl, uploader, fetchPayload, response, identityResponse, responseBody, err_1, errorMessage;
|
|
9089
|
-
return __generator(this, function (
|
|
9090
|
-
switch (
|
|
9048
|
+
var _a, verbose, error, invokeCallback, previousMPID, uploadUrl, uploader, fetchPayload, response, identityResponse, message, _b, responseBody, errorResponse, errorMessage, err_1, errorMessage;
|
|
9049
|
+
return __generator(this, function (_c) {
|
|
9050
|
+
switch (_c.label) {
|
|
9091
9051
|
case 0:
|
|
9092
9052
|
_a = mpInstance.Logger, verbose = _a.verbose, error = _a.error;
|
|
9093
9053
|
invokeCallback = mpInstance._Helpers.invokeCallback;
|
|
@@ -9115,35 +9075,67 @@ var mParticle = (function () {
|
|
|
9115
9075
|
},
|
|
9116
9076
|
body: JSON.stringify(identityApiRequest)
|
|
9117
9077
|
};
|
|
9118
|
-
_b.label = 1;
|
|
9119
|
-
case 1:
|
|
9120
|
-
_b.trys.push([1, 6,, 7]);
|
|
9121
9078
|
mpInstance._Store.identityCallInFlight = true;
|
|
9079
|
+
_c.label = 1;
|
|
9080
|
+
case 1:
|
|
9081
|
+
_c.trys.push([1, 9,, 10]);
|
|
9122
9082
|
return [4 /*yield*/, uploader.upload(fetchPayload)];
|
|
9123
9083
|
case 2:
|
|
9124
|
-
response =
|
|
9084
|
+
response = _c.sent();
|
|
9125
9085
|
identityResponse = void 0;
|
|
9126
|
-
|
|
9127
|
-
|
|
9086
|
+
message = void 0;
|
|
9087
|
+
_b = response.status;
|
|
9088
|
+
switch (_b) {
|
|
9089
|
+
case HTTP_ACCEPTED:
|
|
9090
|
+
return [3 /*break*/, 3];
|
|
9091
|
+
case HTTP_OK:
|
|
9092
|
+
return [3 /*break*/, 3];
|
|
9093
|
+
case HTTP_BAD_REQUEST:
|
|
9094
|
+
return [3 /*break*/, 3];
|
|
9095
|
+
}
|
|
9096
|
+
return [3 /*break*/, 7];
|
|
9128
9097
|
case 3:
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
return [3 /*break*/, 5];
|
|
9098
|
+
if (!response.json) return [3 /*break*/, 5];
|
|
9099
|
+
return [4 /*yield*/, response.json()];
|
|
9132
9100
|
case 4:
|
|
9133
|
-
|
|
9134
|
-
|
|
9101
|
+
responseBody = _c.sent();
|
|
9102
|
+
identityResponse = this.getIdentityResponseFromFetch(response, responseBody);
|
|
9103
|
+
return [3 /*break*/, 6];
|
|
9135
9104
|
case 5:
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
return [3 /*break*/, 7];
|
|
9105
|
+
identityResponse = this.getIdentityResponseFromXHR(response);
|
|
9106
|
+
_c.label = 6;
|
|
9139
9107
|
case 6:
|
|
9140
|
-
|
|
9141
|
-
|
|
9108
|
+
if (identityResponse.status === HTTP_BAD_REQUEST) {
|
|
9109
|
+
errorResponse = identityResponse.responseText;
|
|
9110
|
+
message = 'Issue with sending Identity Request to mParticle Servers, received HTTP Code of ' + identityResponse.status;
|
|
9111
|
+
if (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.Errors) {
|
|
9112
|
+
errorMessage = errorResponse.Errors.map(function (error) {
|
|
9113
|
+
return error.message;
|
|
9114
|
+
}).join(', ');
|
|
9115
|
+
message += ' - ' + errorMessage;
|
|
9116
|
+
}
|
|
9117
|
+
} else {
|
|
9118
|
+
message = 'Received Identity Response from server: ';
|
|
9119
|
+
message += JSON.stringify(identityResponse.responseText);
|
|
9120
|
+
}
|
|
9121
|
+
return [3 /*break*/, 8];
|
|
9122
|
+
case 7:
|
|
9123
|
+
{
|
|
9124
|
+
throw new Error('Received HTTP Code of ' + response.status);
|
|
9125
|
+
}
|
|
9126
|
+
case 8:
|
|
9127
|
+
mpInstance._Store.identityCallInFlight = false;
|
|
9128
|
+
verbose(message);
|
|
9129
|
+
parseIdentityResponse(identityResponse, previousMPID, callback, originalIdentityApiData, method, knownIdentities, false);
|
|
9130
|
+
return [3 /*break*/, 10];
|
|
9131
|
+
case 9:
|
|
9132
|
+
err_1 = _c.sent();
|
|
9142
9133
|
mpInstance._Store.identityCallInFlight = false;
|
|
9134
|
+
errorMessage = err_1.message || err_1.toString();
|
|
9135
|
+
error('Error sending identity request to servers' + ' - ' + errorMessage);
|
|
9143
9136
|
invokeCallback(callback, HTTPCodes$1.noHttpCoverage, errorMessage);
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
case 7:
|
|
9137
|
+
return [3 /*break*/, 10];
|
|
9138
|
+
case 10:
|
|
9147
9139
|
return [2 /*return*/];
|
|
9148
9140
|
}
|
|
9149
9141
|
});
|
|
@@ -9307,13 +9299,13 @@ var mParticle = (function () {
|
|
|
9307
9299
|
if (!clickIds) {
|
|
9308
9300
|
return mappedClickIds;
|
|
9309
9301
|
}
|
|
9310
|
-
for (var
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9302
|
+
for (var key in clickIds) {
|
|
9303
|
+
if (clickIds.hasOwnProperty(key)) {
|
|
9304
|
+
var value = clickIds[key];
|
|
9305
|
+
var mappedKey = (_a = mappingList[key]) === null || _a === void 0 ? void 0 : _a.mappedKey;
|
|
9306
|
+
if (!isEmpty(mappedKey)) {
|
|
9307
|
+
mappedClickIds[mappedKey] = value;
|
|
9308
|
+
}
|
|
9317
9309
|
}
|
|
9318
9310
|
}
|
|
9319
9311
|
return mappedClickIds;
|
|
@@ -9321,24 +9313,23 @@ var mParticle = (function () {
|
|
|
9321
9313
|
IntegrationCapture.prototype.applyProcessors = function (clickIds, url, timestamp) {
|
|
9322
9314
|
var _a;
|
|
9323
9315
|
var processedClickIds = {};
|
|
9324
|
-
for (var
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
if (processor) {
|
|
9330
|
-
processedClickIds[key] = processor(value, url, timestamp);
|
|
9331
|
-
} else {
|
|
9332
|
-
processedClickIds[key] = value;
|
|
9316
|
+
for (var key in clickIds) {
|
|
9317
|
+
if (clickIds.hasOwnProperty(key)) {
|
|
9318
|
+
var value = clickIds[key];
|
|
9319
|
+
var processor = (_a = integrationMapping[key]) === null || _a === void 0 ? void 0 : _a.processor;
|
|
9320
|
+
processedClickIds[key] = processor ? processor(value, url, timestamp) : value;
|
|
9333
9321
|
}
|
|
9334
9322
|
}
|
|
9335
9323
|
return processedClickIds;
|
|
9336
9324
|
};
|
|
9337
9325
|
IntegrationCapture.prototype.filterMappings = function (outputType) {
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9326
|
+
var filteredMappings = {};
|
|
9327
|
+
for (var key in integrationMapping) {
|
|
9328
|
+
if (integrationMapping[key].output === outputType) {
|
|
9329
|
+
filteredMappings[key] = integrationMapping[key];
|
|
9330
|
+
}
|
|
9331
|
+
}
|
|
9332
|
+
return filteredMappings;
|
|
9342
9333
|
};
|
|
9343
9334
|
return IntegrationCapture;
|
|
9344
9335
|
}();
|
|
@@ -9349,7 +9340,6 @@ var mParticle = (function () {
|
|
|
9349
9340
|
var ReportBatching = FeatureFlags.ReportBatching,
|
|
9350
9341
|
CaptureIntegrationSpecificIds = FeatureFlags.CaptureIntegrationSpecificIds;
|
|
9351
9342
|
var StartingInitialization = Messages.InformationMessages.StartingInitialization;
|
|
9352
|
-
|
|
9353
9343
|
/**
|
|
9354
9344
|
* <p>All of the following methods can be called on the primary mParticle class. In version 2.10.0, we introduced <a href="https://docs.mparticle.com/developers/sdk/web/multiple-instances/">multiple instances</a>. If you are using multiple instances (self hosted environments only), you should call these methods on each instance.</p>
|
|
9355
9345
|
* <p>In current versions of mParticle, if your site has one instance, that instance name is 'default_instance'. Any methods called on mParticle on a site with one instance will be mapped to the `default_instance`.</p>
|
|
@@ -9362,7 +9352,6 @@ var mParticle = (function () {
|
|
|
9362
9352
|
*
|
|
9363
9353
|
* @class mParticle & mParticleInstance
|
|
9364
9354
|
*/
|
|
9365
|
-
|
|
9366
9355
|
function mParticleInstance(instanceName) {
|
|
9367
9356
|
var self = this;
|
|
9368
9357
|
// These classes are for internal use only. Not documented for public consumption
|
|
@@ -9384,17 +9373,15 @@ var mParticle = (function () {
|
|
|
9384
9373
|
forwarderConstructors: []
|
|
9385
9374
|
};
|
|
9386
9375
|
this._IntegrationCapture = new IntegrationCapture();
|
|
9387
|
-
|
|
9388
9376
|
// required for forwarders once they reference the mparticle instance
|
|
9389
|
-
this.IdentityType =
|
|
9390
|
-
this.EventType =
|
|
9391
|
-
this.CommerceEventType =
|
|
9392
|
-
this.PromotionType =
|
|
9393
|
-
this.ProductActionType =
|
|
9377
|
+
this.IdentityType = IdentityType;
|
|
9378
|
+
this.EventType = EventType;
|
|
9379
|
+
this.CommerceEventType = CommerceEventType;
|
|
9380
|
+
this.PromotionType = PromotionActionType;
|
|
9381
|
+
this.ProductActionType = ProductActionType;
|
|
9394
9382
|
this._Identity = new Identity(this);
|
|
9395
9383
|
this.Identity = this._Identity.IdentityAPI;
|
|
9396
9384
|
this.generateHash = this._Helpers.generateHash;
|
|
9397
|
-
|
|
9398
9385
|
// https://go.mparticle.com/work/SQDSDKS-6289
|
|
9399
9386
|
// TODO: Replace this with Store once Store is moved earlier in the init process
|
|
9400
9387
|
this.getDeviceId = this._Persistence.getDeviceId;
|
|
@@ -9411,7 +9398,6 @@ var mParticle = (function () {
|
|
|
9411
9398
|
console.warn('You did not pass a config object to init(). mParticle will not initialize properly');
|
|
9412
9399
|
}
|
|
9413
9400
|
runPreConfigFetchInitialization(this, apiKey, config);
|
|
9414
|
-
|
|
9415
9401
|
// config code - Fetch config when requestConfig = true, otherwise, proceed with SDKInitialization
|
|
9416
9402
|
// Since fetching the configuration is asynchronous, we must pass completeSDKInitialization
|
|
9417
9403
|
// to it for it to be run after fetched
|
|
@@ -9439,7 +9425,6 @@ var mParticle = (function () {
|
|
|
9439
9425
|
this.setLogLevel = function (newLogLevel) {
|
|
9440
9426
|
self.Logger.setLogLevel(newLogLevel);
|
|
9441
9427
|
};
|
|
9442
|
-
|
|
9443
9428
|
/**
|
|
9444
9429
|
* Resets the SDK to an uninitialized state and removes cookies/localStorage. You MUST call mParticle.init(apiKey, window.mParticle.config)
|
|
9445
9430
|
* before any other mParticle methods or the SDK will not function as intended.
|
|
@@ -9493,7 +9478,7 @@ var mParticle = (function () {
|
|
|
9493
9478
|
* @returns {String} mParticle environment setting
|
|
9494
9479
|
*/
|
|
9495
9480
|
this.getEnvironment = function () {
|
|
9496
|
-
return self._Store.SDKConfig.isDevelopmentMode ?
|
|
9481
|
+
return self._Store.SDKConfig.isDevelopmentMode ? Constants.Environment.Development : Constants.Environment.Production;
|
|
9497
9482
|
};
|
|
9498
9483
|
/**
|
|
9499
9484
|
* Returns the mParticle SDK version number
|
|
@@ -9536,7 +9521,6 @@ var mParticle = (function () {
|
|
|
9536
9521
|
this.isInitialized = function () {
|
|
9537
9522
|
return self._Store ? self._Store.isInitialized : false;
|
|
9538
9523
|
};
|
|
9539
|
-
|
|
9540
9524
|
/**
|
|
9541
9525
|
* Gets the app name
|
|
9542
9526
|
* @method getAppName
|
|
@@ -9621,7 +9605,6 @@ var mParticle = (function () {
|
|
|
9621
9605
|
// Sends true as an over ride vs when endSession is called from the setInterval
|
|
9622
9606
|
self._SessionManager.endSession(true);
|
|
9623
9607
|
};
|
|
9624
|
-
|
|
9625
9608
|
/**
|
|
9626
9609
|
* Logs a Base Event to mParticle's servers
|
|
9627
9610
|
* @param {Object} event Base Event Object
|
|
@@ -9638,7 +9621,7 @@ var mParticle = (function () {
|
|
|
9638
9621
|
return;
|
|
9639
9622
|
}
|
|
9640
9623
|
if (!event.eventType) {
|
|
9641
|
-
event.eventType =
|
|
9624
|
+
event.eventType = EventType.Unknown;
|
|
9642
9625
|
}
|
|
9643
9626
|
if (!self._Helpers.canLog()) {
|
|
9644
9627
|
self.Logger.error(Messages.ErrorMessages.LoggingDisabled);
|
|
@@ -9666,10 +9649,10 @@ var mParticle = (function () {
|
|
|
9666
9649
|
return;
|
|
9667
9650
|
}
|
|
9668
9651
|
if (!eventType) {
|
|
9669
|
-
eventType =
|
|
9652
|
+
eventType = EventType.Unknown;
|
|
9670
9653
|
}
|
|
9671
9654
|
if (!self._Helpers.isEventType(eventType)) {
|
|
9672
|
-
self.Logger.error('Invalid event type: ' + eventType + ', must be one of: \n' + JSON.stringify(
|
|
9655
|
+
self.Logger.error('Invalid event type: ' + eventType + ', must be one of: \n' + JSON.stringify(EventType));
|
|
9673
9656
|
return;
|
|
9674
9657
|
}
|
|
9675
9658
|
if (!self._Helpers.canLog()) {
|
|
@@ -9677,7 +9660,7 @@ var mParticle = (function () {
|
|
|
9677
9660
|
return;
|
|
9678
9661
|
}
|
|
9679
9662
|
self._Events.logEvent({
|
|
9680
|
-
messageType:
|
|
9663
|
+
messageType: MessageType$1.PageEvent,
|
|
9681
9664
|
name: eventName,
|
|
9682
9665
|
data: eventInfo,
|
|
9683
9666
|
eventType: eventType,
|
|
@@ -9717,10 +9700,10 @@ var mParticle = (function () {
|
|
|
9717
9700
|
}
|
|
9718
9701
|
}
|
|
9719
9702
|
self._Events.logEvent({
|
|
9720
|
-
messageType:
|
|
9703
|
+
messageType: MessageType$1.CrashReport,
|
|
9721
9704
|
name: error.name ? error.name : 'Error',
|
|
9722
|
-
|
|
9723
|
-
|
|
9705
|
+
eventType: EventType.Other,
|
|
9706
|
+
data: data
|
|
9724
9707
|
});
|
|
9725
9708
|
};
|
|
9726
9709
|
/**
|
|
@@ -9778,10 +9761,10 @@ var mParticle = (function () {
|
|
|
9778
9761
|
}
|
|
9779
9762
|
}
|
|
9780
9763
|
self._Events.logEvent({
|
|
9781
|
-
messageType:
|
|
9764
|
+
messageType: MessageType$1.PageView,
|
|
9782
9765
|
name: eventName,
|
|
9783
9766
|
data: attrs,
|
|
9784
|
-
eventType:
|
|
9767
|
+
eventType: EventType.Unknown,
|
|
9785
9768
|
customFlags: customFlags
|
|
9786
9769
|
}, eventOptions);
|
|
9787
9770
|
};
|
|
@@ -9790,12 +9773,12 @@ var mParticle = (function () {
|
|
|
9790
9773
|
* @method upload
|
|
9791
9774
|
*/
|
|
9792
9775
|
this.upload = function () {
|
|
9776
|
+
var _a, _b;
|
|
9793
9777
|
if (self._Helpers.canLog()) {
|
|
9794
9778
|
if (self._Store.webviewBridgeEnabled) {
|
|
9795
9779
|
self._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Upload);
|
|
9796
9780
|
} else {
|
|
9797
|
-
|
|
9798
|
-
(_self$_APIClient = self._APIClient) === null || _self$_APIClient === void 0 || (_self$_APIClient = _self$_APIClient.uploader) === null || _self$_APIClient === void 0 || _self$_APIClient.prepareAndUpload(false, false);
|
|
9781
|
+
(_b = (_a = self._APIClient) === null || _a === void 0 ? void 0 : _a.uploader) === null || _b === void 0 ? void 0 : _b.prepareAndUpload(false, false);
|
|
9799
9782
|
}
|
|
9800
9783
|
}
|
|
9801
9784
|
};
|
|
@@ -9860,8 +9843,8 @@ var mParticle = (function () {
|
|
|
9860
9843
|
*/
|
|
9861
9844
|
add: function add(product, logEventBoolean) {
|
|
9862
9845
|
self.Logger.warning('Deprecated function eCommerce.Cart.add() will be removed in future releases');
|
|
9863
|
-
var mpid
|
|
9864
|
-
|
|
9846
|
+
var mpid;
|
|
9847
|
+
var currentUser = self.Identity.getCurrentUser();
|
|
9865
9848
|
if (currentUser) {
|
|
9866
9849
|
mpid = currentUser.getMPID();
|
|
9867
9850
|
}
|
|
@@ -9876,8 +9859,8 @@ var mParticle = (function () {
|
|
|
9876
9859
|
*/
|
|
9877
9860
|
remove: function remove(product, logEventBoolean) {
|
|
9878
9861
|
self.Logger.warning('Deprecated function eCommerce.Cart.remove() will be removed in future releases');
|
|
9879
|
-
var mpid
|
|
9880
|
-
|
|
9862
|
+
var mpid;
|
|
9863
|
+
var currentUser = self.Identity.getCurrentUser();
|
|
9881
9864
|
if (currentUser) {
|
|
9882
9865
|
mpid = currentUser.getMPID();
|
|
9883
9866
|
}
|
|
@@ -9890,8 +9873,8 @@ var mParticle = (function () {
|
|
|
9890
9873
|
*/
|
|
9891
9874
|
clear: function clear() {
|
|
9892
9875
|
self.Logger.warning('Deprecated function eCommerce.Cart.clear() will be removed in future releases');
|
|
9893
|
-
var mpid
|
|
9894
|
-
|
|
9876
|
+
var mpid;
|
|
9877
|
+
var currentUser = self.Identity.getCurrentUser();
|
|
9895
9878
|
if (currentUser) {
|
|
9896
9879
|
mpid = currentUser.getMPID();
|
|
9897
9880
|
}
|
|
@@ -9975,7 +9958,7 @@ var mParticle = (function () {
|
|
|
9975
9958
|
* @for mParticle.eCommerce
|
|
9976
9959
|
* @method logCheckout
|
|
9977
9960
|
* @param {Number} step checkout step number
|
|
9978
|
-
* @param {String} option
|
|
9961
|
+
* @param {String} checkout option string
|
|
9979
9962
|
* @param {Object} attrs
|
|
9980
9963
|
* @param {Object} [customFlags] Custom flags for the event
|
|
9981
9964
|
* @deprecated
|
|
@@ -10108,7 +10091,6 @@ var mParticle = (function () {
|
|
|
10108
10091
|
self.setSessionAttribute(key, value);
|
|
10109
10092
|
}, self);
|
|
10110
10093
|
if (queued) return;
|
|
10111
|
-
|
|
10112
10094
|
// Logs to cookie
|
|
10113
10095
|
// And logs to in-memory object
|
|
10114
10096
|
// Example: mParticle.setSessionAttribute('location', '33431');
|
|
@@ -10243,7 +10225,7 @@ var mParticle = (function () {
|
|
|
10243
10225
|
};
|
|
10244
10226
|
/*
|
|
10245
10227
|
An integration delay is a workaround that prevents events from being sent when it is necessary to do so.
|
|
10246
|
-
Some server side integrations require a client side value to be included in the payload to successfully
|
|
10228
|
+
Some server side integrations require a client side value to be included in the payload to successfully
|
|
10247
10229
|
forward. This value can only be pulled from the client side partner SDK.
|
|
10248
10230
|
During the kit initialization, the kit:
|
|
10249
10231
|
* sets an integration delay to `true`
|
|
@@ -10257,14 +10239,12 @@ var mParticle = (function () {
|
|
|
10257
10239
|
*/
|
|
10258
10240
|
this._setIntegrationDelay = function (module, shouldDelayIntegration) {
|
|
10259
10241
|
self._preInit.integrationDelays[module] = shouldDelayIntegration;
|
|
10260
|
-
|
|
10261
10242
|
// If the integration delay is set to true, no further action needed
|
|
10262
10243
|
if (shouldDelayIntegration === true) {
|
|
10263
10244
|
return;
|
|
10264
10245
|
}
|
|
10265
10246
|
// If the integration delay is set to false, check to see if there are any
|
|
10266
10247
|
// other integration delays set to true. It not, process the queued events/.
|
|
10267
|
-
|
|
10268
10248
|
var integrationDelaysKeys = Object.keys(self._preInit.integrationDelays);
|
|
10269
10249
|
if (integrationDelaysKeys.length === 0) {
|
|
10270
10250
|
return;
|
|
@@ -10276,7 +10256,6 @@ var mParticle = (function () {
|
|
|
10276
10256
|
self._APIClient.processQueuedEvents();
|
|
10277
10257
|
}
|
|
10278
10258
|
};
|
|
10279
|
-
|
|
10280
10259
|
// Internal use only. Used by our wrapper SDKs to identify themselves during initialization.
|
|
10281
10260
|
this._setWrapperSDKInfo = function (name, version) {
|
|
10282
10261
|
var queued = queueIfNotInitialized(function () {
|
|
@@ -10292,7 +10271,6 @@ var mParticle = (function () {
|
|
|
10292
10271
|
}
|
|
10293
10272
|
};
|
|
10294
10273
|
}
|
|
10295
|
-
|
|
10296
10274
|
// Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
|
|
10297
10275
|
function completeSDKInitialization(apiKey, config, mpInstance) {
|
|
10298
10276
|
var kitBlocker = createKitBlocker(config, mpInstance);
|
|
@@ -10301,7 +10279,6 @@ var mParticle = (function () {
|
|
|
10301
10279
|
mpInstance._Store.processConfig(config);
|
|
10302
10280
|
mpInstance._Identity.idCache = createIdentityCache(mpInstance);
|
|
10303
10281
|
removeExpiredIdentityCacheDates(mpInstance._Identity.idCache);
|
|
10304
|
-
|
|
10305
10282
|
// Web View Bridge is used for cases where the Web SDK is loaded within an iOS or Android device's
|
|
10306
10283
|
// Web View. The Web SDK simply acts as a passthrough to the mParticle Native SDK. It is not
|
|
10307
10284
|
// responsible for sending events directly to mParticle's servers. The Web SDK will not initialize
|
|
@@ -10310,11 +10287,9 @@ var mParticle = (function () {
|
|
|
10310
10287
|
mpInstance._NativeSdkHelpers.initializeSessionAttributes(apiKey);
|
|
10311
10288
|
} else {
|
|
10312
10289
|
// Main SDK initialization flow
|
|
10313
|
-
|
|
10314
10290
|
// Load any settings/identities/attributes from cookie or localStorage
|
|
10315
10291
|
mpInstance._Persistence.initializeStorage();
|
|
10316
10292
|
mpInstance._Store.syncPersistenceData();
|
|
10317
|
-
|
|
10318
10293
|
// Set up user identitiy variables for later use
|
|
10319
10294
|
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
10320
10295
|
var currentUserMPID = currentUser ? currentUser.getMPID() : null;
|
|
@@ -10330,36 +10305,35 @@ var mParticle = (function () {
|
|
|
10330
10305
|
}
|
|
10331
10306
|
mpInstance._Forwarders.processForwarders(config, mpInstance._APIClient.prepareForwardingStats);
|
|
10332
10307
|
mpInstance._Forwarders.processPixelConfigs(config);
|
|
10333
|
-
|
|
10334
10308
|
// Checks if session is created, resumed, or needs to be ended
|
|
10335
10309
|
// Logs a session start or session end event accordingly
|
|
10336
10310
|
mpInstance._SessionManager.initialize();
|
|
10337
10311
|
mpInstance._Events.logAST();
|
|
10338
10312
|
processIdentityCallback(mpInstance, currentUser, currentUserMPID, currentUserIdentities);
|
|
10339
10313
|
}
|
|
10340
|
-
|
|
10341
10314
|
// We will continue to clear out the ready queue as part of the initial init flow
|
|
10342
10315
|
// if an identify request is unnecessary, such as if there is an existing session
|
|
10343
10316
|
if (mpInstance._Store.mpid && !mpInstance._Store.identifyCalled || mpInstance._Store.webviewBridgeEnabled) {
|
|
10344
10317
|
mpInstance._Store.isInitialized = true;
|
|
10345
10318
|
mpInstance._preInit.readyQueue = processReadyQueue(mpInstance._preInit.readyQueue);
|
|
10346
10319
|
}
|
|
10347
|
-
|
|
10348
10320
|
// https://go.mparticle.com/work/SQDSDKS-6040
|
|
10349
10321
|
if (mpInstance._Store.isFirstRun) {
|
|
10350
10322
|
mpInstance._Store.isFirstRun = false;
|
|
10351
10323
|
}
|
|
10352
10324
|
}
|
|
10325
|
+
// https://go.mparticle.com/work/SQDSDKS-7061
|
|
10353
10326
|
function createKitBlocker(config, mpInstance) {
|
|
10354
|
-
var kitBlocker
|
|
10355
|
-
|
|
10327
|
+
var kitBlocker;
|
|
10328
|
+
var dataPlanForKitBlocker;
|
|
10329
|
+
var kitBlockError;
|
|
10330
|
+
var kitBlockOptions;
|
|
10356
10331
|
/* There are three ways a data plan object for blocking can be passed to the SDK:
|
|
10357
10332
|
1. Manually via config.dataPlanOptions (this takes priority)
|
|
10358
10333
|
If not passed in manually, we user the server provided via either
|
|
10359
10334
|
2. Snippet via /mparticle.js endpoint (config.dataPlan.document)
|
|
10360
10335
|
3. Self hosting via /config endpoint (config.dataPlanResult)
|
|
10361
10336
|
*/
|
|
10362
|
-
|
|
10363
10337
|
if (config.dataPlanOptions) {
|
|
10364
10338
|
mpInstance.Logger.verbose('Customer provided data plan found');
|
|
10365
10339
|
kitBlockOptions = config.dataPlanOptions;
|
|
@@ -10417,7 +10391,6 @@ var mParticle = (function () {
|
|
|
10417
10391
|
mpInstance._Store = new Store(config, mpInstance, apiKey);
|
|
10418
10392
|
window.mParticle.Store = mpInstance._Store;
|
|
10419
10393
|
mpInstance.Logger.verbose(StartingInitialization);
|
|
10420
|
-
|
|
10421
10394
|
// Check to see if localStorage is available before main configuration runs
|
|
10422
10395
|
// since we will need this for the current implementation of user persistence
|
|
10423
10396
|
// TODO: Refactor this when we refactor User Identity Persistence
|
|
@@ -10633,11 +10606,11 @@ var mParticle = (function () {
|
|
|
10633
10606
|
this.filterDictionary.attributeFilters.push(hashedEventAttribute);
|
|
10634
10607
|
};
|
|
10635
10608
|
MPSideloadedKit.prototype.addScreenNameFilter = function (screenName) {
|
|
10636
|
-
var hashedScreenName = KitFilterHelper.hashEventName(screenName,
|
|
10609
|
+
var hashedScreenName = KitFilterHelper.hashEventName(screenName, EventType.Unknown);
|
|
10637
10610
|
this.filterDictionary.screenNameFilters.push(hashedScreenName);
|
|
10638
10611
|
};
|
|
10639
10612
|
MPSideloadedKit.prototype.addScreenAttributeFilter = function (screenName, screenAttribute) {
|
|
10640
|
-
var hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(
|
|
10613
|
+
var hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(EventType.Unknown, screenName, screenAttribute);
|
|
10641
10614
|
this.filterDictionary.screenAttributeFilters.push(hashedScreenAttribute);
|
|
10642
10615
|
};
|
|
10643
10616
|
MPSideloadedKit.prototype.addUserIdentityFilter = function (userIdentity) {
|
|
@@ -10660,25 +10633,26 @@ var mParticle = (function () {
|
|
|
10660
10633
|
if (!Array.prototype.filter) {
|
|
10661
10634
|
Array.prototype.filter = Polyfill.filter;
|
|
10662
10635
|
}
|
|
10636
|
+
// https://go.mparticle.com/work/SQDSDKS-6768
|
|
10663
10637
|
if (!Array.isArray) {
|
|
10638
|
+
// @ts-ignore
|
|
10664
10639
|
Array.prototype.isArray = Polyfill.isArray;
|
|
10665
10640
|
}
|
|
10666
|
-
function
|
|
10641
|
+
function mParticleInstanceManager() {
|
|
10667
10642
|
var self = this;
|
|
10668
10643
|
// Only leaving this here in case any clients are trying to access mParticle.Store, to prevent from throwing
|
|
10669
10644
|
this.Store = {};
|
|
10670
10645
|
this._instances = {};
|
|
10671
10646
|
this.IdentityType = Types.IdentityType;
|
|
10672
|
-
this.EventType =
|
|
10673
|
-
this.CommerceEventType =
|
|
10674
|
-
this.PromotionType =
|
|
10675
|
-
this.ProductActionType =
|
|
10647
|
+
this.EventType = EventType;
|
|
10648
|
+
this.CommerceEventType = CommerceEventType;
|
|
10649
|
+
this.PromotionType = PromotionActionType;
|
|
10650
|
+
this.ProductActionType = ProductActionType;
|
|
10676
10651
|
this.MPSideloadedKit = MPSideloadedKit;
|
|
10677
10652
|
if (typeof window !== 'undefined') {
|
|
10678
10653
|
this.isIOS = window.mParticle && window.mParticle.isIOS ? window.mParticle.isIOS : false;
|
|
10679
10654
|
this.config = window.mParticle && window.mParticle.config ? window.mParticle.config : {};
|
|
10680
10655
|
}
|
|
10681
|
-
|
|
10682
10656
|
/**
|
|
10683
10657
|
* Initializes the mParticle instance. If no instanceName is provided, an instance name of `default_instance` will be used.
|
|
10684
10658
|
* <p>
|
|
@@ -10696,7 +10670,7 @@ var mParticle = (function () {
|
|
|
10696
10670
|
instanceName = (!instanceName || instanceName.length === 0 ? Constants.DefaultInstance : instanceName).toLowerCase();
|
|
10697
10671
|
var client = self._instances[instanceName];
|
|
10698
10672
|
if (client === undefined) {
|
|
10699
|
-
client = new mParticleInstance(
|
|
10673
|
+
client = new mParticleInstance(instanceName);
|
|
10700
10674
|
self._instances[instanceName] = client;
|
|
10701
10675
|
}
|
|
10702
10676
|
client.init(apiKey, config, instanceName);
|
|
@@ -10934,12 +10908,17 @@ var mParticle = (function () {
|
|
|
10934
10908
|
self.getInstance()._setWrapperSDKInfo(name, version);
|
|
10935
10909
|
};
|
|
10936
10910
|
}
|
|
10937
|
-
var
|
|
10911
|
+
var mParticleManager = new mParticleInstanceManager();
|
|
10938
10912
|
if (typeof window !== 'undefined') {
|
|
10939
|
-
|
|
10913
|
+
// mParticle is the global object used to access the SDK and predates instance manager,
|
|
10914
|
+
// when mParticle was a singleton. We now support multiple instances. Calling methods
|
|
10915
|
+
// on mParticle directly will access the default instance, but mParticle can also be used
|
|
10916
|
+
// as the instance manager in self hosted mode.
|
|
10917
|
+
window.mParticle = mParticleManager;
|
|
10918
|
+
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
10940
10919
|
window.mParticle._BatchValidator = new _BatchValidator();
|
|
10941
10920
|
}
|
|
10942
10921
|
|
|
10943
|
-
return
|
|
10922
|
+
return mParticleManager;
|
|
10944
10923
|
|
|
10945
10924
|
})();
|