@mparticle/web-sdk 2.32.2 → 2.32.3
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 +34 -63
- package/dist/mparticle.esm.js +34 -63
- package/dist/mparticle.js +490 -501
- package/package.json +1 -1
- package/src/apiClient.ts +4 -1
- package/src/batchUploader.ts +26 -20
- package/src/constants.ts +8 -0
- 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 +9 -9
- package/src/identity.js +2 -3
- package/src/identityApiClient.ts +123 -56
- package/src/integrationCapture.ts +7 -5
- package/src/kitFilterHelper.ts +6 -7
- package/src/mp-instance.js +3 -3
- package/src/sdkRuntimeModels.ts +32 -14
- package/src/sdkToEventsApiConverter.ts +1 -1
- package/src/serverModel.ts +1 -1
- package/src/sideloadedKit.ts +12 -11
- package/src/types.ts +404 -0
- 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.3";
|
|
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,93 +876,158 @@ 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
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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;
|
|
1114
1029
|
}
|
|
1115
1030
|
};
|
|
1116
|
-
IdentityType.getIdentityName = function (identityType) {
|
|
1117
|
-
return getIdentityName(identityType);
|
|
1118
|
-
};
|
|
1119
1031
|
var ProductActionType = {
|
|
1120
1032
|
Unknown: 0,
|
|
1121
1033
|
AddToCart: 1,
|
|
@@ -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";
|
|
@@ -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:
|
|
@@ -2664,6 +2584,9 @@ var mParticle = (function () {
|
|
|
2664
2584
|
if (options.shouldUploadEvent) {
|
|
2665
2585
|
this.queueEventForBatchUpload(event);
|
|
2666
2586
|
}
|
|
2587
|
+
// https://go.mparticle.com/work/SQDSDKS-6935
|
|
2588
|
+
// While Event Name is 'usually' a string, there are some cases where it is a number
|
|
2589
|
+
// in that it could be a type of MessageType Enum
|
|
2667
2590
|
if (event.EventName !== Types.MessageType.AppStateTransition) {
|
|
2668
2591
|
if (kitBlocker && kitBlocker.kitBlockingEnabled) {
|
|
2669
2592
|
event = kitBlocker.createBlockedEvent(event);
|
|
@@ -3525,6 +3448,8 @@ var mParticle = (function () {
|
|
|
3525
3448
|
var Messages$5 = Constants.Messages;
|
|
3526
3449
|
function Ecommerce(mpInstance) {
|
|
3527
3450
|
var self = this;
|
|
3451
|
+
|
|
3452
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3528
3453
|
this.convertTransactionAttributesToProductAction = function (transactionAttributes, productAction) {
|
|
3529
3454
|
if (transactionAttributes.hasOwnProperty('Id')) {
|
|
3530
3455
|
productAction.TransactionId = transactionAttributes.Id;
|
|
@@ -3608,6 +3533,8 @@ var mParticle = (function () {
|
|
|
3608
3533
|
return Types.CommerceEventType.ProductRemoveFromCart;
|
|
3609
3534
|
case Types.ProductActionType.RemoveFromWishlist:
|
|
3610
3535
|
return Types.CommerceEventType.ProductRemoveFromWishlist;
|
|
3536
|
+
|
|
3537
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3611
3538
|
case Types.ProductActionType.Unknown:
|
|
3612
3539
|
return Types.EventType.Unknown;
|
|
3613
3540
|
case Types.ProductActionType.ViewDetail:
|
|
@@ -3631,6 +3558,8 @@ var mParticle = (function () {
|
|
|
3631
3558
|
this.generateExpandedEcommerceName = function (eventName, plusOne) {
|
|
3632
3559
|
return 'eCommerce - ' + eventName + ' - ' + (plusOne ? 'Total' : 'Item');
|
|
3633
3560
|
};
|
|
3561
|
+
|
|
3562
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3634
3563
|
this.extractProductAttributes = function (attributes, product) {
|
|
3635
3564
|
if (product.CouponCode) {
|
|
3636
3565
|
attributes['Coupon Code'] = product.CouponCode;
|
|
@@ -3661,11 +3590,15 @@ var mParticle = (function () {
|
|
|
3661
3590
|
}
|
|
3662
3591
|
attributes['Total Product Amount'] = product.TotalAmount || 0;
|
|
3663
3592
|
};
|
|
3593
|
+
|
|
3594
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3664
3595
|
this.extractTransactionId = function (attributes, productAction) {
|
|
3665
3596
|
if (productAction.TransactionId) {
|
|
3666
3597
|
attributes['Transaction Id'] = productAction.TransactionId;
|
|
3667
3598
|
}
|
|
3668
3599
|
};
|
|
3600
|
+
|
|
3601
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3669
3602
|
this.extractActionAttributes = function (attributes, productAction) {
|
|
3670
3603
|
self.extractTransactionId(attributes, productAction);
|
|
3671
3604
|
if (productAction.Affiliation) {
|
|
@@ -3690,6 +3623,8 @@ var mParticle = (function () {
|
|
|
3690
3623
|
attributes['Checkout Step'] = productAction.CheckoutStep;
|
|
3691
3624
|
}
|
|
3692
3625
|
};
|
|
3626
|
+
|
|
3627
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
3693
3628
|
this.extractPromotionAttributes = function (attributes, promotion) {
|
|
3694
3629
|
if (promotion.Id) {
|
|
3695
3630
|
attributes['Id'] = promotion.Id;
|
|
@@ -5477,10 +5412,13 @@ var mParticle = (function () {
|
|
|
5477
5412
|
for (i = 0; i < elements.length; i++) {
|
|
5478
5413
|
element = elements[i];
|
|
5479
5414
|
if (element.addEventListener) {
|
|
5415
|
+
// Modern browsers
|
|
5480
5416
|
element.addEventListener(domEvent, handler, false);
|
|
5481
5417
|
} else if (element.attachEvent) {
|
|
5418
|
+
// IE < 9
|
|
5482
5419
|
element.attachEvent('on' + domEvent, handler);
|
|
5483
5420
|
} else {
|
|
5421
|
+
// All other browsers
|
|
5484
5422
|
element['on' + domEvent] = handler;
|
|
5485
5423
|
}
|
|
5486
5424
|
}
|
|
@@ -8044,7 +7982,7 @@ var mParticle = (function () {
|
|
|
8044
7982
|
self.reinitForwardersOnUserChange(prevUser, newUser);
|
|
8045
7983
|
self.setForwarderCallbacks(newUser, method);
|
|
8046
7984
|
}
|
|
8047
|
-
var newIdentitiesByName = getNewIdentitiesByName(newIdentitiesByType);
|
|
7985
|
+
var newIdentitiesByName = IdentityType.getNewIdentitiesByName(newIdentitiesByType);
|
|
8048
7986
|
var uiByName = method === Modify$1 ? previousUIByName : incomingUIByName;
|
|
8049
7987
|
|
|
8050
7988
|
// https://go.mparticle.com/work/SQDSDKS-6501
|
|
@@ -9007,9 +8945,9 @@ var mParticle = (function () {
|
|
|
9007
8945
|
function IdentityAPIClient(mpInstance) {
|
|
9008
8946
|
this.sendAliasRequest = function (aliasRequest, aliasCallback) {
|
|
9009
8947
|
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 (
|
|
8948
|
+
var _a, verbose, error, invokeAliasCallback, aliasUrl, apiKey, uploadUrl, uploader, uploadPayload, response, aliasResponseBody, message, errorMessage, _b, xhrResponse, errorResponse, e_2, errorMessage;
|
|
8949
|
+
return __generator(this, function (_c) {
|
|
8950
|
+
switch (_c.label) {
|
|
9013
8951
|
case 0:
|
|
9014
8952
|
_a = mpInstance.Logger, verbose = _a.verbose, error = _a.error;
|
|
9015
8953
|
invokeAliasCallback = mpInstance._Helpers.invokeAliasCallback;
|
|
@@ -9026,57 +8964,73 @@ var mParticle = (function () {
|
|
|
9026
8964
|
},
|
|
9027
8965
|
body: JSON.stringify(aliasRequest)
|
|
9028
8966
|
};
|
|
9029
|
-
|
|
8967
|
+
_c.label = 1;
|
|
9030
8968
|
case 1:
|
|
9031
|
-
|
|
8969
|
+
_c.trys.push([1, 13,, 14]);
|
|
9032
8970
|
return [4 /*yield*/, uploader.upload(uploadPayload)];
|
|
9033
8971
|
case 2:
|
|
9034
|
-
response =
|
|
9035
|
-
message = void 0;
|
|
8972
|
+
response = _c.sent();
|
|
9036
8973
|
aliasResponseBody = void 0;
|
|
9037
|
-
|
|
9038
|
-
|
|
8974
|
+
message = void 0;
|
|
8975
|
+
errorMessage = void 0;
|
|
8976
|
+
_b = response.status;
|
|
8977
|
+
switch (_b) {
|
|
8978
|
+
case HTTP_ACCEPTED:
|
|
8979
|
+
return [3 /*break*/, 3];
|
|
8980
|
+
case HTTP_OK:
|
|
8981
|
+
return [3 /*break*/, 3];
|
|
8982
|
+
case HTTP_BAD_REQUEST:
|
|
8983
|
+
return [3 /*break*/, 4];
|
|
8984
|
+
}
|
|
8985
|
+
return [3 /*break*/, 11];
|
|
9039
8986
|
case 3:
|
|
9040
|
-
|
|
9041
|
-
|
|
8987
|
+
// https://go.mparticle.com/work/SQDSDKS-6670
|
|
8988
|
+
message = 'Received Alias Response from server: ' + JSON.stringify(response.status);
|
|
8989
|
+
return [3 /*break*/, 12];
|
|
9042
8990
|
case 4:
|
|
9043
|
-
|
|
9044
|
-
|
|
8991
|
+
if (!response.json) return [3 /*break*/, 9];
|
|
8992
|
+
_c.label = 5;
|
|
9045
8993
|
case 5:
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
return [3 /*break*/, 6];
|
|
8994
|
+
_c.trys.push([5, 7,, 8]);
|
|
8995
|
+
return [4 /*yield*/, response.json()];
|
|
9049
8996
|
case 6:
|
|
8997
|
+
aliasResponseBody = _c.sent();
|
|
9050
8998
|
return [3 /*break*/, 8];
|
|
9051
8999
|
case 7:
|
|
9000
|
+
_c.sent();
|
|
9001
|
+
verbose('The request has no response body');
|
|
9002
|
+
return [3 /*break*/, 8];
|
|
9003
|
+
case 8:
|
|
9004
|
+
return [3 /*break*/, 10];
|
|
9005
|
+
case 9:
|
|
9052
9006
|
xhrResponse = response;
|
|
9053
9007
|
aliasResponseBody = xhrResponse.responseText ? JSON.parse(xhrResponse.responseText) : '';
|
|
9054
|
-
|
|
9055
|
-
case
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
default:
|
|
9064
|
-
// 400 has an error message, but 403 doesn't
|
|
9065
|
-
if (aliasResponseBody === null || aliasResponseBody === void 0 ? void 0 : aliasResponseBody.message) {
|
|
9066
|
-
errorMessage = aliasResponseBody.message;
|
|
9067
|
-
}
|
|
9068
|
-
message = 'Issue with sending Alias Request to mParticle Servers, received HTTP Code of ' + response.status;
|
|
9008
|
+
_c.label = 10;
|
|
9009
|
+
case 10:
|
|
9010
|
+
errorResponse = aliasResponseBody;
|
|
9011
|
+
if (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.message) {
|
|
9012
|
+
errorMessage = errorResponse.message;
|
|
9013
|
+
}
|
|
9014
|
+
message = 'Issue with sending Alias Request to mParticle Servers, received HTTP Code of ' + response.status;
|
|
9015
|
+
if (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.code) {
|
|
9016
|
+
message += ' - ' + errorResponse.code;
|
|
9069
9017
|
}
|
|
9018
|
+
return [3 /*break*/, 12];
|
|
9019
|
+
case 11:
|
|
9020
|
+
{
|
|
9021
|
+
throw new Error('Received HTTP Code of ' + response.status);
|
|
9022
|
+
}
|
|
9023
|
+
case 12:
|
|
9070
9024
|
verbose(message);
|
|
9071
9025
|
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
|
|
9026
|
+
return [3 /*break*/, 14];
|
|
9027
|
+
case 13:
|
|
9028
|
+
e_2 = _c.sent();
|
|
9029
|
+
errorMessage = e_2.message || e_2.toString();
|
|
9030
|
+
error('Error sending alias request to mParticle servers. ' + errorMessage);
|
|
9031
|
+
invokeAliasCallback(aliasCallback, HTTPCodes$1.noHttpCoverage, errorMessage);
|
|
9032
|
+
return [3 /*break*/, 14];
|
|
9033
|
+
case 14:
|
|
9080
9034
|
return [2 /*return*/];
|
|
9081
9035
|
}
|
|
9082
9036
|
});
|
|
@@ -9085,9 +9039,9 @@ var mParticle = (function () {
|
|
|
9085
9039
|
|
|
9086
9040
|
this.sendIdentityRequest = function (identityApiRequest, method, callback, originalIdentityApiData, parseIdentityResponse, mpid, knownIdentities) {
|
|
9087
9041
|
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 (
|
|
9042
|
+
var _a, verbose, error, invokeCallback, previousMPID, uploadUrl, uploader, fetchPayload, response, identityResponse, message, _b, responseBody, errorResponse, errorMessage, err_1, errorMessage;
|
|
9043
|
+
return __generator(this, function (_c) {
|
|
9044
|
+
switch (_c.label) {
|
|
9091
9045
|
case 0:
|
|
9092
9046
|
_a = mpInstance.Logger, verbose = _a.verbose, error = _a.error;
|
|
9093
9047
|
invokeCallback = mpInstance._Helpers.invokeCallback;
|
|
@@ -9115,35 +9069,67 @@ var mParticle = (function () {
|
|
|
9115
9069
|
},
|
|
9116
9070
|
body: JSON.stringify(identityApiRequest)
|
|
9117
9071
|
};
|
|
9118
|
-
_b.label = 1;
|
|
9119
|
-
case 1:
|
|
9120
|
-
_b.trys.push([1, 6,, 7]);
|
|
9121
9072
|
mpInstance._Store.identityCallInFlight = true;
|
|
9073
|
+
_c.label = 1;
|
|
9074
|
+
case 1:
|
|
9075
|
+
_c.trys.push([1, 9,, 10]);
|
|
9122
9076
|
return [4 /*yield*/, uploader.upload(fetchPayload)];
|
|
9123
9077
|
case 2:
|
|
9124
|
-
response =
|
|
9078
|
+
response = _c.sent();
|
|
9125
9079
|
identityResponse = void 0;
|
|
9126
|
-
|
|
9127
|
-
|
|
9080
|
+
message = void 0;
|
|
9081
|
+
_b = response.status;
|
|
9082
|
+
switch (_b) {
|
|
9083
|
+
case HTTP_ACCEPTED:
|
|
9084
|
+
return [3 /*break*/, 3];
|
|
9085
|
+
case HTTP_OK:
|
|
9086
|
+
return [3 /*break*/, 3];
|
|
9087
|
+
case HTTP_BAD_REQUEST:
|
|
9088
|
+
return [3 /*break*/, 3];
|
|
9089
|
+
}
|
|
9090
|
+
return [3 /*break*/, 7];
|
|
9128
9091
|
case 3:
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
return [3 /*break*/, 5];
|
|
9092
|
+
if (!response.json) return [3 /*break*/, 5];
|
|
9093
|
+
return [4 /*yield*/, response.json()];
|
|
9132
9094
|
case 4:
|
|
9133
|
-
|
|
9134
|
-
|
|
9095
|
+
responseBody = _c.sent();
|
|
9096
|
+
identityResponse = this.getIdentityResponseFromFetch(response, responseBody);
|
|
9097
|
+
return [3 /*break*/, 6];
|
|
9135
9098
|
case 5:
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
return [3 /*break*/, 7];
|
|
9099
|
+
identityResponse = this.getIdentityResponseFromXHR(response);
|
|
9100
|
+
_c.label = 6;
|
|
9139
9101
|
case 6:
|
|
9140
|
-
|
|
9141
|
-
|
|
9102
|
+
if (identityResponse.status === HTTP_BAD_REQUEST) {
|
|
9103
|
+
errorResponse = identityResponse.responseText;
|
|
9104
|
+
message = 'Issue with sending Identity Request to mParticle Servers, received HTTP Code of ' + identityResponse.status;
|
|
9105
|
+
if (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.Errors) {
|
|
9106
|
+
errorMessage = errorResponse.Errors.map(function (error) {
|
|
9107
|
+
return error.message;
|
|
9108
|
+
}).join(', ');
|
|
9109
|
+
message += ' - ' + errorMessage;
|
|
9110
|
+
}
|
|
9111
|
+
} else {
|
|
9112
|
+
message = 'Received Identity Response from server: ';
|
|
9113
|
+
message += JSON.stringify(identityResponse.responseText);
|
|
9114
|
+
}
|
|
9115
|
+
return [3 /*break*/, 8];
|
|
9116
|
+
case 7:
|
|
9117
|
+
{
|
|
9118
|
+
throw new Error('Received HTTP Code of ' + response.status);
|
|
9119
|
+
}
|
|
9120
|
+
case 8:
|
|
9142
9121
|
mpInstance._Store.identityCallInFlight = false;
|
|
9122
|
+
verbose(message);
|
|
9123
|
+
parseIdentityResponse(identityResponse, previousMPID, callback, originalIdentityApiData, method, knownIdentities, false);
|
|
9124
|
+
return [3 /*break*/, 10];
|
|
9125
|
+
case 9:
|
|
9126
|
+
err_1 = _c.sent();
|
|
9127
|
+
mpInstance._Store.identityCallInFlight = false;
|
|
9128
|
+
errorMessage = err_1.message || err_1.toString();
|
|
9129
|
+
error('Error sending identity request to servers' + ' - ' + errorMessage);
|
|
9143
9130
|
invokeCallback(callback, HTTPCodes$1.noHttpCoverage, errorMessage);
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
case 7:
|
|
9131
|
+
return [3 /*break*/, 10];
|
|
9132
|
+
case 10:
|
|
9147
9133
|
return [2 /*return*/];
|
|
9148
9134
|
}
|
|
9149
9135
|
});
|
|
@@ -9335,10 +9321,13 @@ var mParticle = (function () {
|
|
|
9335
9321
|
return processedClickIds;
|
|
9336
9322
|
};
|
|
9337
9323
|
IntegrationCapture.prototype.filterMappings = function (outputType) {
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9324
|
+
var filteredMappings = {};
|
|
9325
|
+
for (var key in integrationMapping) {
|
|
9326
|
+
if (integrationMapping[key].output === outputType) {
|
|
9327
|
+
filteredMappings[key] = integrationMapping[key];
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9330
|
+
return filteredMappings;
|
|
9342
9331
|
};
|
|
9343
9332
|
return IntegrationCapture;
|
|
9344
9333
|
}();
|
|
@@ -9493,7 +9482,7 @@ var mParticle = (function () {
|
|
|
9493
9482
|
* @returns {String} mParticle environment setting
|
|
9494
9483
|
*/
|
|
9495
9484
|
this.getEnvironment = function () {
|
|
9496
|
-
return self._Store.SDKConfig.isDevelopmentMode ?
|
|
9485
|
+
return self._Store.SDKConfig.isDevelopmentMode ? Constants.Environment.Development : Constants.Environment.Production;
|
|
9497
9486
|
};
|
|
9498
9487
|
/**
|
|
9499
9488
|
* Returns the mParticle SDK version number
|
|
@@ -9975,7 +9964,7 @@ var mParticle = (function () {
|
|
|
9975
9964
|
* @for mParticle.eCommerce
|
|
9976
9965
|
* @method logCheckout
|
|
9977
9966
|
* @param {Number} step checkout step number
|
|
9978
|
-
* @param {String} option
|
|
9967
|
+
* @param {String} checkout option string
|
|
9979
9968
|
* @param {Object} attrs
|
|
9980
9969
|
* @param {Object} [customFlags] Custom flags for the event
|
|
9981
9970
|
* @deprecated
|
|
@@ -10633,11 +10622,11 @@ var mParticle = (function () {
|
|
|
10633
10622
|
this.filterDictionary.attributeFilters.push(hashedEventAttribute);
|
|
10634
10623
|
};
|
|
10635
10624
|
MPSideloadedKit.prototype.addScreenNameFilter = function (screenName) {
|
|
10636
|
-
var hashedScreenName = KitFilterHelper.hashEventName(screenName,
|
|
10625
|
+
var hashedScreenName = KitFilterHelper.hashEventName(screenName, EventType.Unknown);
|
|
10637
10626
|
this.filterDictionary.screenNameFilters.push(hashedScreenName);
|
|
10638
10627
|
};
|
|
10639
10628
|
MPSideloadedKit.prototype.addScreenAttributeFilter = function (screenName, screenAttribute) {
|
|
10640
|
-
var hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(
|
|
10629
|
+
var hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(EventType.Unknown, screenName, screenAttribute);
|
|
10641
10630
|
this.filterDictionary.screenAttributeFilters.push(hashedScreenAttribute);
|
|
10642
10631
|
};
|
|
10643
10632
|
MPSideloadedKit.prototype.addUserIdentityFilter = function (userIdentity) {
|