@mparticle/web-sdk 2.26.6 → 2.26.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mparticle.js CHANGED
@@ -244,371 +244,156 @@ var mParticle = (function () {
244
244
  return obj;
245
245
  }
246
246
 
247
- var _TriggerUploadType;
248
- var MessageType$2 = {
249
- SessionStart: 1,
250
- SessionEnd: 2,
251
- PageView: 3,
252
- PageEvent: 4,
253
- CrashReport: 5,
254
- OptOut: 6,
255
- AppStateTransition: 10,
256
- Profile: 14,
257
- Commerce: 16,
258
- Media: 20,
259
- UserAttributeChange: 17,
260
- UserIdentityChange: 18
261
- };
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 = {}));
262
300
 
263
- // Dictionary that contains MessageTypes that will
264
- // trigger an immediate upload.
265
- var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$2.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$2.UserIdentityChange, 1), _TriggerUploadType);
266
- var EventType = {
267
- Unknown: 0,
268
- Navigation: 1,
269
- Location: 2,
270
- Search: 3,
271
- Transaction: 4,
272
- UserContent: 5,
273
- UserPreference: 6,
274
- Social: 7,
275
- Other: 8,
276
- Media: 9,
277
- getName: function getName(id) {
278
- switch (id) {
279
- case EventType.Unknown:
280
- return 'Unknown';
281
- case EventType.Navigation:
282
- return 'Navigation';
283
- case EventType.Location:
284
- return 'Location';
285
- case EventType.Search:
286
- return 'Search';
287
- case EventType.Transaction:
288
- return 'Transaction';
289
- case EventType.UserContent:
290
- return 'User Content';
291
- case EventType.UserPreference:
292
- return 'User Preference';
293
- case EventType.Social:
294
- return 'Social';
295
- case CommerceEventType.ProductAddToCart:
296
- return 'Product Added to Cart';
297
- case CommerceEventType.ProductAddToWishlist:
298
- return 'Product Added to Wishlist';
299
- case CommerceEventType.ProductCheckout:
300
- return 'Product Checkout';
301
- case CommerceEventType.ProductCheckoutOption:
302
- return 'Product Checkout Options';
303
- case CommerceEventType.ProductClick:
304
- return 'Product Click';
305
- case CommerceEventType.ProductImpression:
306
- return 'Product Impression';
307
- case CommerceEventType.ProductPurchase:
308
- return 'Product Purchased';
309
- case CommerceEventType.ProductRefund:
310
- return 'Product Refunded';
311
- case CommerceEventType.ProductRemoveFromCart:
312
- return 'Product Removed From Cart';
313
- case CommerceEventType.ProductRemoveFromWishlist:
314
- return 'Product Removed from Wishlist';
315
- case CommerceEventType.ProductViewDetail:
316
- return 'Product View Details';
317
- case CommerceEventType.PromotionClick:
318
- return 'Promotion Click';
319
- case CommerceEventType.PromotionView:
320
- return 'Promotion View';
321
- default:
322
- return 'Other';
323
- }
324
- }
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;
325
394
  };
326
395
 
327
- // Continuation of enum above, but in seperate object since we don't expose these to end user
328
- var CommerceEventType = {
329
- ProductAddToCart: 10,
330
- ProductRemoveFromCart: 11,
331
- ProductCheckout: 12,
332
- ProductCheckoutOption: 13,
333
- ProductClick: 14,
334
- ProductViewDetail: 15,
335
- ProductPurchase: 16,
336
- ProductRefund: 17,
337
- PromotionView: 18,
338
- PromotionClick: 19,
339
- ProductAddToWishlist: 20,
340
- ProductRemoveFromWishlist: 21,
341
- ProductImpression: 22
342
- };
343
- var IdentityType$1 = {
344
- Other: 0,
345
- CustomerId: 1,
346
- Facebook: 2,
347
- Twitter: 3,
348
- Google: 4,
349
- Microsoft: 5,
350
- Yahoo: 6,
351
- Email: 7,
352
- FacebookCustomAudienceId: 9,
353
- Other2: 10,
354
- Other3: 11,
355
- Other4: 12,
356
- Other5: 13,
357
- Other6: 14,
358
- Other7: 15,
359
- Other8: 16,
360
- Other9: 17,
361
- Other10: 18,
362
- MobileNumber: 19,
363
- PhoneNumber2: 20,
364
- PhoneNumber3: 21
365
- };
366
- IdentityType$1.isValid = function (identityType) {
367
- if (typeof identityType === 'number') {
368
- for (var prop in IdentityType$1) {
369
- if (IdentityType$1.hasOwnProperty(prop)) {
370
- if (IdentityType$1[prop] === identityType) {
371
- return true;
372
- }
373
- }
374
- }
375
- }
376
- return false;
377
- };
378
- IdentityType$1.getName = function (identityType) {
379
- switch (identityType) {
380
- case window.mParticle.IdentityType.CustomerId:
381
- return 'Customer ID';
382
- case window.mParticle.IdentityType.Facebook:
383
- return 'Facebook ID';
384
- case window.mParticle.IdentityType.Twitter:
385
- return 'Twitter ID';
386
- case window.mParticle.IdentityType.Google:
387
- return 'Google ID';
388
- case window.mParticle.IdentityType.Microsoft:
389
- return 'Microsoft ID';
390
- case window.mParticle.IdentityType.Yahoo:
391
- return 'Yahoo ID';
392
- case window.mParticle.IdentityType.Email:
393
- return 'Email';
394
- case window.mParticle.IdentityType.FacebookCustomAudienceId:
395
- return 'Facebook App User ID';
396
- default:
397
- return 'Other ID';
398
- }
399
- };
400
- IdentityType$1.getIdentityType = function (identityName) {
401
- switch (identityName) {
402
- case 'other':
403
- return IdentityType$1.Other;
404
- case 'customerid':
405
- return IdentityType$1.CustomerId;
406
- case 'facebook':
407
- return IdentityType$1.Facebook;
408
- case 'twitter':
409
- return IdentityType$1.Twitter;
410
- case 'google':
411
- return IdentityType$1.Google;
412
- case 'microsoft':
413
- return IdentityType$1.Microsoft;
414
- case 'yahoo':
415
- return IdentityType$1.Yahoo;
416
- case 'email':
417
- return IdentityType$1.Email;
418
- case 'facebookcustomaudienceid':
419
- return IdentityType$1.FacebookCustomAudienceId;
420
- case 'other2':
421
- return IdentityType$1.Other2;
422
- case 'other3':
423
- return IdentityType$1.Other3;
424
- case 'other4':
425
- return IdentityType$1.Other4;
426
- case 'other5':
427
- return IdentityType$1.Other5;
428
- case 'other6':
429
- return IdentityType$1.Other6;
430
- case 'other7':
431
- return IdentityType$1.Other7;
432
- case 'other8':
433
- return IdentityType$1.Other8;
434
- case 'other9':
435
- return IdentityType$1.Other9;
436
- case 'other10':
437
- return IdentityType$1.Other10;
438
- case 'mobile_number':
439
- return IdentityType$1.MobileNumber;
440
- case 'phone_number_2':
441
- return IdentityType$1.PhoneNumber2;
442
- case 'phone_number_3':
443
- return IdentityType$1.PhoneNumber3;
444
- default:
445
- return false;
446
- }
447
- };
448
- IdentityType$1.getIdentityName = function (identityType) {
449
- switch (identityType) {
450
- case IdentityType$1.Other:
451
- return 'other';
452
- case IdentityType$1.CustomerId:
453
- return 'customerid';
454
- case IdentityType$1.Facebook:
455
- return 'facebook';
456
- case IdentityType$1.Twitter:
457
- return 'twitter';
458
- case IdentityType$1.Google:
459
- return 'google';
460
- case IdentityType$1.Microsoft:
461
- return 'microsoft';
462
- case IdentityType$1.Yahoo:
463
- return 'yahoo';
464
- case IdentityType$1.Email:
465
- return 'email';
466
- case IdentityType$1.FacebookCustomAudienceId:
467
- return 'facebookcustomaudienceid';
468
- case IdentityType$1.Other2:
469
- return 'other2';
470
- case IdentityType$1.Other3:
471
- return 'other3';
472
- case IdentityType$1.Other4:
473
- return 'other4';
474
- case IdentityType$1.Other5:
475
- return 'other5';
476
- case IdentityType$1.Other6:
477
- return 'other6';
478
- case IdentityType$1.Other7:
479
- return 'other7';
480
- case IdentityType$1.Other8:
481
- return 'other8';
482
- case IdentityType$1.Other9:
483
- return 'other9';
484
- case IdentityType$1.Other10:
485
- return 'other10';
486
- case IdentityType$1.MobileNumber:
487
- return 'mobile_number';
488
- case IdentityType$1.PhoneNumber2:
489
- return 'phone_number_2';
490
- case IdentityType$1.PhoneNumber3:
491
- return 'phone_number_3';
492
- }
493
- };
494
- var ProductActionType = {
495
- Unknown: 0,
496
- AddToCart: 1,
497
- RemoveFromCart: 2,
498
- Checkout: 3,
499
- CheckoutOption: 4,
500
- Click: 5,
501
- ViewDetail: 6,
502
- Purchase: 7,
503
- Refund: 8,
504
- AddToWishlist: 9,
505
- RemoveFromWishlist: 10
506
- };
507
- ProductActionType.getName = function (id) {
508
- switch (id) {
509
- case ProductActionType.AddToCart:
510
- return 'Add to Cart';
511
- case ProductActionType.RemoveFromCart:
512
- return 'Remove from Cart';
513
- case ProductActionType.Checkout:
514
- return 'Checkout';
515
- case ProductActionType.CheckoutOption:
516
- return 'Checkout Option';
517
- case ProductActionType.Click:
518
- return 'Click';
519
- case ProductActionType.ViewDetail:
520
- return 'View Detail';
521
- case ProductActionType.Purchase:
522
- return 'Purchase';
523
- case ProductActionType.Refund:
524
- return 'Refund';
525
- case ProductActionType.AddToWishlist:
526
- return 'Add to Wishlist';
527
- case ProductActionType.RemoveFromWishlist:
528
- return 'Remove from Wishlist';
529
- default:
530
- return 'Unknown';
531
- }
532
- };
533
-
534
- // these are the action names used by server and mobile SDKs when expanding a CommerceEvent
535
- ProductActionType.getExpansionName = function (id) {
536
- switch (id) {
537
- case ProductActionType.AddToCart:
538
- return 'add_to_cart';
539
- case ProductActionType.RemoveFromCart:
540
- return 'remove_from_cart';
541
- case ProductActionType.Checkout:
542
- return 'checkout';
543
- case ProductActionType.CheckoutOption:
544
- return 'checkout_option';
545
- case ProductActionType.Click:
546
- return 'click';
547
- case ProductActionType.ViewDetail:
548
- return 'view_detail';
549
- case ProductActionType.Purchase:
550
- return 'purchase';
551
- case ProductActionType.Refund:
552
- return 'refund';
553
- case ProductActionType.AddToWishlist:
554
- return 'add_to_wishlist';
555
- case ProductActionType.RemoveFromWishlist:
556
- return 'remove_from_wishlist';
557
- default:
558
- return 'unknown';
559
- }
560
- };
561
- var PromotionActionType = {
562
- Unknown: 0,
563
- PromotionView: 1,
564
- PromotionClick: 2
565
- };
566
- PromotionActionType.getName = function (id) {
567
- switch (id) {
568
- case PromotionActionType.PromotionView:
569
- return 'view';
570
- case PromotionActionType.PromotionClick:
571
- return 'click';
572
- default:
573
- return 'unknown';
574
- }
575
- };
576
-
577
- // these are the names that the server and mobile SDKs use while expanding CommerceEvent
578
- PromotionActionType.getExpansionName = function (id) {
579
- switch (id) {
580
- case PromotionActionType.PromotionView:
581
- return 'view';
582
- case PromotionActionType.PromotionClick:
583
- return 'click';
584
- default:
585
- return 'unknown';
586
- }
587
- };
588
- var ProfileMessageType = {
589
- Logout: 3
590
- };
591
- var ApplicationTransitionType$1 = {
592
- AppInit: 1
593
- };
594
- var Environment = {
595
- Production: 'production',
596
- Development: 'development'
597
- };
598
- var Types = {
599
- MessageType: MessageType$2,
600
- EventType: EventType,
601
- CommerceEventType: CommerceEventType,
602
- IdentityType: IdentityType$1,
603
- ProfileMessageType: ProfileMessageType,
604
- ApplicationTransitionType: ApplicationTransitionType$1,
605
- ProductActionType: ProductActionType,
606
- PromotionActionType: PromotionActionType,
607
- TriggerUploadType: TriggerUploadType,
608
- Environment: Environment
609
- };
610
-
611
- var version = "2.26.6";
396
+ var version = "2.26.8";
612
397
 
613
398
  var Constants = {
614
399
  sdkVersion: version,
@@ -782,529 +567,815 @@ var mParticle = (function () {
782
567
  var ONE_DAY_IN_SECONDS = 60 * 60 * 24;
783
568
  var MILLIS_IN_ONE_SEC = 1000;
784
569
 
785
- /******************************************************************************
786
- Copyright (c) Microsoft Corporation.
787
-
788
- Permission to use, copy, modify, and/or distribute this software for any
789
- purpose with or without fee is hereby granted.
790
-
791
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
792
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
793
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
794
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
795
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
796
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
797
- PERFORMANCE OF THIS SOFTWARE.
798
- ***************************************************************************** */
799
- /* global Reflect, Promise, SuppressedError, Symbol */
800
-
801
- var extendStatics = function(d, b) {
802
- extendStatics = Object.setPrototypeOf ||
803
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
804
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
805
- return extendStatics(d, b);
806
- };
807
-
808
- function __extends(d, b) {
809
- if (typeof b !== "function" && b !== null)
810
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
811
- extendStatics(d, b);
812
- function __() { this.constructor = d; }
813
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
814
- }
815
-
816
- var __assign = function() {
817
- __assign = Object.assign || function __assign(t) {
818
- for (var s, i = 1, n = arguments.length; i < n; i++) {
819
- s = arguments[i];
820
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
821
- }
822
- return t;
823
- };
824
- return __assign.apply(this, arguments);
825
- };
826
-
827
- function __awaiter(thisArg, _arguments, P, generator) {
828
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
829
- return new (P || (P = Promise))(function (resolve, reject) {
830
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
831
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
832
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
833
- step((generator = generator.apply(thisArg, _arguments || [])).next());
834
- });
835
- }
836
-
837
- function __generator(thisArg, body) {
838
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
839
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
840
- function verb(n) { return function (v) { return step([n, v]); }; }
841
- function step(op) {
842
- if (f) throw new TypeError("Generator is already executing.");
843
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
844
- 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;
845
- if (y = 0, t) op = [op[0] & 2, t.value];
846
- switch (op[0]) {
847
- case 0: case 1: t = op; break;
848
- case 4: _.label++; return { value: op[1], done: false };
849
- case 5: _.label++; y = op[1]; op = [0]; continue;
850
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
851
- default:
852
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
853
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
854
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
855
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
856
- if (t[2]) _.ops.pop();
857
- _.trys.pop(); continue;
858
- }
859
- op = body.call(thisArg, _);
860
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
861
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
862
- }
863
- }
864
-
865
- function __spreadArray(to, from, pack) {
866
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
867
- if (ar || !(i in from)) {
868
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
869
- ar[i] = from[i];
870
- }
871
- }
872
- return to.concat(ar || Array.prototype.slice.call(from));
873
- }
874
-
875
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
876
- var e = new Error(message);
877
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
570
+ var Messages$9 = Constants.Messages;
571
+ var createCookieString = function createCookieString(value) {
572
+ return replaceCommasWithPipes(replaceQuotesWithApostrophes(value));
878
573
  };
574
+ var revertCookieString = function revertCookieString(value) {
575
+ return replacePipesWithCommas(replaceApostrophesWithQuotes(value));
576
+ };
577
+ var inArray = function inArray(items, name) {
578
+ var i = 0;
579
+ if (Array.prototype.indexOf) {
580
+ return items.indexOf(name, 0) >= 0;
581
+ } else {
582
+ for (var n = items.length; i < n; i++) {
583
+ if (i in items && items[i] === name) {
584
+ return true;
585
+ }
586
+ }
587
+ }
588
+ return false;
589
+ };
590
+ var findKeyInObject = function findKeyInObject(obj, key) {
591
+ if (key && obj) {
592
+ for (var prop in obj) {
593
+ if (obj.hasOwnProperty(prop) && prop.toLowerCase() === key.toLowerCase()) {
594
+ return prop;
595
+ }
596
+ }
597
+ }
598
+ return null;
599
+ };
600
+ var generateDeprecationMessage = function generateDeprecationMessage(methodName, alternateMethod) {
601
+ var messageArray = [methodName, Messages$9.DeprecationMessages.MethodIsDeprecatedPostfix];
602
+ if (alternateMethod) {
603
+ messageArray.push(alternateMethod);
604
+ messageArray.push(Messages$9.DeprecationMessages.MethodIsDeprecatedPostfix);
605
+ }
606
+ return messageArray.join(' ');
607
+ };
608
+ function generateHash(name) {
609
+ var hash = 0;
610
+ var character;
611
+ if (name === undefined || name === null) {
612
+ return 0;
613
+ }
614
+ name = name.toString().toLowerCase();
615
+ if (Array.prototype.reduce) {
616
+ return name.split('').reduce(function (a, b) {
617
+ a = (a << 5) - a + b.charCodeAt(0);
618
+ return a & a;
619
+ }, 0);
620
+ }
621
+ if (name.length === 0) {
622
+ return hash;
623
+ }
624
+ for (var i = 0; i < name.length; i++) {
625
+ character = name.charCodeAt(i);
626
+ hash = (hash << 5) - hash + character;
627
+ hash = hash & hash;
628
+ }
629
+ return hash;
630
+ }
631
+ var generateRandomValue = function generateRandomValue(value) {
632
+ var randomValue;
633
+ var a;
634
+ if (window.crypto && window.crypto.getRandomValues) {
635
+ // @ts-ignore
636
+ randomValue = window.crypto.getRandomValues(new Uint8Array(1)); // eslint-disable-line no-undef
637
+ }
879
638
 
880
- var SDKProductActionType;
881
- (function (SDKProductActionType) {
882
- SDKProductActionType[SDKProductActionType["Unknown"] = 0] = "Unknown";
883
- SDKProductActionType[SDKProductActionType["AddToCart"] = 1] = "AddToCart";
884
- SDKProductActionType[SDKProductActionType["RemoveFromCart"] = 2] = "RemoveFromCart";
885
- SDKProductActionType[SDKProductActionType["Checkout"] = 3] = "Checkout";
886
- SDKProductActionType[SDKProductActionType["CheckoutOption"] = 4] = "CheckoutOption";
887
- SDKProductActionType[SDKProductActionType["Click"] = 5] = "Click";
888
- SDKProductActionType[SDKProductActionType["ViewDetail"] = 6] = "ViewDetail";
889
- SDKProductActionType[SDKProductActionType["Purchase"] = 7] = "Purchase";
890
- SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund";
891
- SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist";
892
- SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist";
893
- })(SDKProductActionType || (SDKProductActionType = {}));
894
-
895
- var dist = {};
639
+ if (randomValue) {
640
+ // @ts-ignore
641
+ return (a ^ randomValue[0] % 16 >> a / 4).toString(16);
642
+ }
643
+ return (a ^ Math.random() * 16 >> a / 4).toString(16);
644
+ };
645
+ var generateUniqueId = function generateUniqueId(a) {
646
+ // https://gist.github.com/jed/982883
647
+ // Added support for crypto for better random
648
+ if (a === void 0) {
649
+ a = '';
650
+ }
651
+ return a // if the placeholder was passed, return
652
+ ? generateRandomValue() // if the placeholder was passed, return
653
+ :
654
+ // [1e7] -> // 10000000 +
655
+ // -1e3 -> // -1000 +
656
+ // -4e3 -> // -4000 +
657
+ // -8e3 -> // -80000000 +
658
+ // -1e11 -> //-100000000000,
659
+ "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g,
660
+ // zeroes, ones, and eights with
661
+ generateUniqueId // random hex digits
662
+ );
663
+ };
664
+ /**
665
+ * Returns a value between 1-100 inclusive.
666
+ */
667
+ var getRampNumber = function getRampNumber(value) {
668
+ if (!value) {
669
+ return 100;
670
+ }
671
+ var hash = generateHash(value);
672
+ return Math.abs(hash % 100) + 1;
673
+ };
674
+ var isObject = function isObject(value) {
675
+ var objType = Object.prototype.toString.call(value);
676
+ return objType === '[object Object]' || objType === '[object Error]';
677
+ };
678
+ var parseNumber = function parseNumber(value) {
679
+ if (isNaN(value) || !isFinite(value)) {
680
+ return 0;
681
+ }
682
+ var floatValue = parseFloat(value);
683
+ return isNaN(floatValue) ? 0 : floatValue;
684
+ };
685
+ var parseStringOrNumber = function parseStringOrNumber(value) {
686
+ if (isStringOrNumber(value)) {
687
+ return value;
688
+ } else {
689
+ return null;
690
+ }
691
+ };
692
+ var replaceCommasWithPipes = function replaceCommasWithPipes(value) {
693
+ return value.replace(/,/g, '|');
694
+ };
695
+ var replacePipesWithCommas = function replacePipesWithCommas(value) {
696
+ return value.replace(/\|/g, ',');
697
+ };
698
+ var replaceApostrophesWithQuotes = function replaceApostrophesWithQuotes(value) {
699
+ return value.replace(/\'/g, '"');
700
+ };
701
+ var replaceQuotesWithApostrophes = function replaceQuotesWithApostrophes(value) {
702
+ return value.replace(/\"/g, "'");
703
+ };
704
+ // FIXME: REFACTOR for V3
705
+ // only used in store.js to sanitize server-side formatting of
706
+ // booleans when checking for `isDevelopmentMode`
707
+ // Should be removed in v3
708
+ var returnConvertedBoolean = function returnConvertedBoolean(data) {
709
+ if (data === 'false' || data === '0') {
710
+ return false;
711
+ } else {
712
+ return Boolean(data);
713
+ }
714
+ };
715
+ var decoded = function decoded(s) {
716
+ return decodeURIComponent(s.replace(/\+/g, ' '));
717
+ };
718
+ var converted = function converted(s) {
719
+ if (s.indexOf('"') === 0) {
720
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
721
+ }
722
+ return s;
723
+ };
724
+ var isString = function isString(value) {
725
+ return typeof value === 'string';
726
+ };
727
+ var isNumber = function isNumber(value) {
728
+ return typeof value === 'number';
729
+ };
730
+ var isBoolean = function isBoolean(value) {
731
+ return typeof value === 'boolean';
732
+ };
733
+ var isFunction = function isFunction(fn) {
734
+ return typeof fn === 'function';
735
+ };
736
+ var isValidCustomFlagProperty = function isValidCustomFlagProperty(value) {
737
+ return isNumber(value) || isString(value) || isBoolean(value);
738
+ };
739
+ var toDataPlanSlug = function toDataPlanSlug(value) {
740
+ // Make sure we are only acting on strings or numbers
741
+ return isStringOrNumber(value) ? value.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g, '_') : '';
742
+ };
743
+ var isDataPlanSlug = function isDataPlanSlug(str) {
744
+ return str === toDataPlanSlug(str);
745
+ };
746
+ var isStringOrNumber = function isStringOrNumber(value) {
747
+ return isString(value) || isNumber(value);
748
+ };
749
+ var isEmpty = function isEmpty(value) {
750
+ return value == null || !(Object.keys(value) || value).length;
751
+ };
752
+ var moveElementToEnd = function moveElementToEnd(array, index) {
753
+ return array.slice(0, index).concat(array.slice(index + 1), array[index]);
754
+ };
896
755
 
897
- (function (exports) {
898
- Object.defineProperty(exports, "__esModule", { value: true });
899
- (function (ApplicationInformationOsEnum) {
900
- ApplicationInformationOsEnum["unknown"] = "Unknown";
901
- ApplicationInformationOsEnum["iOS"] = "IOS";
902
- ApplicationInformationOsEnum["android"] = "Android";
903
- ApplicationInformationOsEnum["windowsPhone"] = "WindowsPhone";
904
- ApplicationInformationOsEnum["mobileWeb"] = "MobileWeb";
905
- ApplicationInformationOsEnum["unityIOS"] = "UnityIOS";
906
- ApplicationInformationOsEnum["unityAndroid"] = "UnityAndroid";
907
- ApplicationInformationOsEnum["desktop"] = "Desktop";
908
- ApplicationInformationOsEnum["tvOS"] = "TVOS";
909
- ApplicationInformationOsEnum["roku"] = "Roku";
910
- ApplicationInformationOsEnum["outOfBand"] = "OutOfBand";
911
- ApplicationInformationOsEnum["alexa"] = "Alexa";
912
- ApplicationInformationOsEnum["smartTV"] = "SmartTV";
913
- ApplicationInformationOsEnum["fireTV"] = "FireTV";
914
- ApplicationInformationOsEnum["xbox"] = "Xbox";
915
- })(exports.ApplicationInformationOsEnum || (exports.ApplicationInformationOsEnum = {}));
916
- (function (ApplicationStateTransitionEventEventTypeEnum) {
917
- ApplicationStateTransitionEventEventTypeEnum["applicationStateTransition"] = "application_state_transition";
918
- })(exports.ApplicationStateTransitionEventEventTypeEnum || (exports.ApplicationStateTransitionEventEventTypeEnum = {}));
919
- (function (ApplicationStateTransitionEventDataApplicationTransitionTypeEnum) {
920
- ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationInitialized"] = "application_initialized";
921
- ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationExit"] = "application_exit";
922
- ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationBackground"] = "application_background";
923
- ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationForeground"] = "application_foreground";
924
- })(exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum || (exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum = {}));
925
- (function (BatchEnvironmentEnum) {
926
- BatchEnvironmentEnum["unknown"] = "unknown";
927
- BatchEnvironmentEnum["development"] = "development";
928
- BatchEnvironmentEnum["production"] = "production";
929
- })(exports.BatchEnvironmentEnum || (exports.BatchEnvironmentEnum = {}));
930
- (function (BreadcrumbEventEventTypeEnum) {
931
- BreadcrumbEventEventTypeEnum["breadcrumb"] = "breadcrumb";
932
- })(exports.BreadcrumbEventEventTypeEnum || (exports.BreadcrumbEventEventTypeEnum = {}));
933
- (function (CommerceEventEventTypeEnum) {
934
- CommerceEventEventTypeEnum["commerceEvent"] = "commerce_event";
935
- })(exports.CommerceEventEventTypeEnum || (exports.CommerceEventEventTypeEnum = {}));
936
- (function (CommerceEventDataCustomEventTypeEnum) {
937
- CommerceEventDataCustomEventTypeEnum["addToCart"] = "add_to_cart";
938
- CommerceEventDataCustomEventTypeEnum["removeFromCart"] = "remove_from_cart";
939
- CommerceEventDataCustomEventTypeEnum["checkout"] = "checkout";
940
- CommerceEventDataCustomEventTypeEnum["checkoutOption"] = "checkout_option";
941
- CommerceEventDataCustomEventTypeEnum["click"] = "click";
942
- CommerceEventDataCustomEventTypeEnum["viewDetail"] = "view_detail";
943
- CommerceEventDataCustomEventTypeEnum["purchase"] = "purchase";
944
- CommerceEventDataCustomEventTypeEnum["refund"] = "refund";
945
- CommerceEventDataCustomEventTypeEnum["promotionView"] = "promotion_view";
946
- CommerceEventDataCustomEventTypeEnum["promotionClick"] = "promotion_click";
947
- CommerceEventDataCustomEventTypeEnum["addToWishlist"] = "add_to_wishlist";
948
- CommerceEventDataCustomEventTypeEnum["removeFromWishlist"] = "remove_from_wishlist";
949
- CommerceEventDataCustomEventTypeEnum["impression"] = "impression";
950
- })(exports.CommerceEventDataCustomEventTypeEnum || (exports.CommerceEventDataCustomEventTypeEnum = {}));
951
- (function (CrashReportEventEventTypeEnum) {
952
- CrashReportEventEventTypeEnum["crashReport"] = "crash_report";
953
- })(exports.CrashReportEventEventTypeEnum || (exports.CrashReportEventEventTypeEnum = {}));
954
- (function (CustomEventEventTypeEnum) {
955
- CustomEventEventTypeEnum["customEvent"] = "custom_event";
956
- })(exports.CustomEventEventTypeEnum || (exports.CustomEventEventTypeEnum = {}));
957
- (function (CustomEventDataCustomEventTypeEnum) {
958
- CustomEventDataCustomEventTypeEnum["navigation"] = "navigation";
959
- CustomEventDataCustomEventTypeEnum["location"] = "location";
960
- CustomEventDataCustomEventTypeEnum["search"] = "search";
961
- CustomEventDataCustomEventTypeEnum["transaction"] = "transaction";
962
- CustomEventDataCustomEventTypeEnum["userContent"] = "user_content";
963
- CustomEventDataCustomEventTypeEnum["userPreference"] = "user_preference";
964
- CustomEventDataCustomEventTypeEnum["social"] = "social";
965
- CustomEventDataCustomEventTypeEnum["media"] = "media";
966
- CustomEventDataCustomEventTypeEnum["other"] = "other";
967
- CustomEventDataCustomEventTypeEnum["unknown"] = "unknown";
968
- })(exports.CustomEventDataCustomEventTypeEnum || (exports.CustomEventDataCustomEventTypeEnum = {}));
969
- (function (DeviceCurrentStateDeviceOrientationEnum) {
970
- DeviceCurrentStateDeviceOrientationEnum["portrait"] = "portrait";
971
- DeviceCurrentStateDeviceOrientationEnum["portraitUpsideDown"] = "portrait_upside_down";
972
- DeviceCurrentStateDeviceOrientationEnum["landscape"] = "landscape";
973
- DeviceCurrentStateDeviceOrientationEnum["landscapeLeft"] = "LandscapeLeft";
974
- DeviceCurrentStateDeviceOrientationEnum["landscapeRight"] = "LandscapeRight";
975
- DeviceCurrentStateDeviceOrientationEnum["faceUp"] = "FaceUp";
976
- DeviceCurrentStateDeviceOrientationEnum["faceDown"] = "FaceDown";
977
- DeviceCurrentStateDeviceOrientationEnum["square"] = "Square";
978
- })(exports.DeviceCurrentStateDeviceOrientationEnum || (exports.DeviceCurrentStateDeviceOrientationEnum = {}));
979
- (function (DeviceCurrentStateStatusBarOrientationEnum) {
980
- DeviceCurrentStateStatusBarOrientationEnum["portrait"] = "portrait";
981
- DeviceCurrentStateStatusBarOrientationEnum["portraitUpsideDown"] = "portrait_upside_down";
982
- DeviceCurrentStateStatusBarOrientationEnum["landscape"] = "landscape";
983
- DeviceCurrentStateStatusBarOrientationEnum["landscapeLeft"] = "LandscapeLeft";
984
- DeviceCurrentStateStatusBarOrientationEnum["landscapeRight"] = "LandscapeRight";
985
- DeviceCurrentStateStatusBarOrientationEnum["faceUp"] = "FaceUp";
986
- DeviceCurrentStateStatusBarOrientationEnum["faceDown"] = "FaceDown";
987
- DeviceCurrentStateStatusBarOrientationEnum["square"] = "Square";
988
- })(exports.DeviceCurrentStateStatusBarOrientationEnum || (exports.DeviceCurrentStateStatusBarOrientationEnum = {}));
989
- (function (DeviceInformationPlatformEnum) {
990
- DeviceInformationPlatformEnum["iOS"] = "iOS";
991
- DeviceInformationPlatformEnum["android"] = "Android";
992
- DeviceInformationPlatformEnum["web"] = "web";
993
- DeviceInformationPlatformEnum["desktop"] = "desktop";
994
- DeviceInformationPlatformEnum["tvOS"] = "tvOS";
995
- DeviceInformationPlatformEnum["roku"] = "roku";
996
- DeviceInformationPlatformEnum["outOfBand"] = "out_of_band";
997
- DeviceInformationPlatformEnum["smartTV"] = "smart_tv";
998
- DeviceInformationPlatformEnum["xbox"] = "xbox";
999
- })(exports.DeviceInformationPlatformEnum || (exports.DeviceInformationPlatformEnum = {}));
1000
- (function (EventTypeEnum) {
1001
- EventTypeEnum["unknown"] = "unknown";
1002
- EventTypeEnum["sessionStart"] = "session_start";
1003
- EventTypeEnum["sessionEnd"] = "session_end";
1004
- EventTypeEnum["screenView"] = "screen_view";
1005
- EventTypeEnum["customEvent"] = "custom_event";
1006
- EventTypeEnum["crashReport"] = "crash_report";
1007
- EventTypeEnum["optOut"] = "opt_out";
1008
- EventTypeEnum["firstRun"] = "first_run";
1009
- EventTypeEnum["preAttribution"] = "pre_attribution";
1010
- EventTypeEnum["pushRegistration"] = "push_registration";
1011
- EventTypeEnum["applicationStateTransition"] = "application_state_transition";
1012
- EventTypeEnum["pushMessage"] = "push_message";
1013
- EventTypeEnum["networkPerformance"] = "network_performance";
1014
- EventTypeEnum["breadcrumb"] = "breadcrumb";
1015
- EventTypeEnum["profile"] = "profile";
1016
- EventTypeEnum["pushReaction"] = "push_reaction";
1017
- EventTypeEnum["commerceEvent"] = "commerce_event";
1018
- EventTypeEnum["userAttributeChange"] = "user_attribute_change";
1019
- EventTypeEnum["userIdentityChange"] = "user_identity_change";
1020
- EventTypeEnum["uninstall"] = "uninstall";
1021
- EventTypeEnum["validationResult"] = "validation_result";
1022
- })(exports.EventTypeEnum || (exports.EventTypeEnum = {}));
1023
- (function (IdentityTypeEnum) {
1024
- IdentityTypeEnum["other"] = "other";
1025
- IdentityTypeEnum["customerId"] = "customer_id";
1026
- IdentityTypeEnum["facebook"] = "facebook";
1027
- IdentityTypeEnum["twitter"] = "twitter";
1028
- IdentityTypeEnum["google"] = "google";
1029
- IdentityTypeEnum["microsoft"] = "microsoft";
1030
- IdentityTypeEnum["yahoo"] = "yahoo";
1031
- IdentityTypeEnum["email"] = "email";
1032
- IdentityTypeEnum["alias"] = "alias";
1033
- IdentityTypeEnum["facebookCustomAudienceId"] = "facebook_custom_audience_id";
1034
- IdentityTypeEnum["otherId2"] = "other_id_2";
1035
- IdentityTypeEnum["otherId3"] = "other_id_3";
1036
- IdentityTypeEnum["otherId4"] = "other_id_4";
1037
- IdentityTypeEnum["otherId5"] = "other_id_5";
1038
- IdentityTypeEnum["otherId6"] = "other_id_6";
1039
- IdentityTypeEnum["otherId7"] = "other_id_7";
1040
- IdentityTypeEnum["otherId8"] = "other_id_8";
1041
- IdentityTypeEnum["otherId9"] = "other_id_9";
1042
- IdentityTypeEnum["otherId10"] = "other_id_10";
1043
- IdentityTypeEnum["mobileNumber"] = "mobile_number";
1044
- IdentityTypeEnum["phoneNumber2"] = "phone_number_2";
1045
- IdentityTypeEnum["phoneNumber3"] = "phone_number_3";
1046
- })(exports.IdentityTypeEnum || (exports.IdentityTypeEnum = {}));
1047
- (function (NetworkPerformanceEventEventTypeEnum) {
1048
- NetworkPerformanceEventEventTypeEnum["networkPerformance"] = "network_performance";
1049
- })(exports.NetworkPerformanceEventEventTypeEnum || (exports.NetworkPerformanceEventEventTypeEnum = {}));
1050
- (function (OptOutEventEnum) {
1051
- OptOutEventEnum["optOut"] = "opt_out";
1052
- })(exports.OptOutEventEnum || (exports.OptOutEventEnum = {}));
1053
- (function (ProductActionActionEnum) {
1054
- ProductActionActionEnum["unknown"] = "unknown";
1055
- ProductActionActionEnum["addToCart"] = "add_to_cart";
1056
- ProductActionActionEnum["removeFromCart"] = "remove_from_cart";
1057
- ProductActionActionEnum["checkout"] = "checkout";
1058
- ProductActionActionEnum["checkoutOption"] = "checkout_option";
1059
- ProductActionActionEnum["click"] = "click";
1060
- ProductActionActionEnum["viewDetail"] = "view_detail";
1061
- ProductActionActionEnum["purchase"] = "purchase";
1062
- ProductActionActionEnum["refund"] = "refund";
1063
- ProductActionActionEnum["addToWishlist"] = "add_to_wishlist";
1064
- ProductActionActionEnum["removeFromWishlist"] = "remove_from_wish_list";
1065
- })(exports.ProductActionActionEnum || (exports.ProductActionActionEnum = {}));
1066
- (function (ProfileEventEventTypeEnum) {
1067
- ProfileEventEventTypeEnum["profile"] = "profile";
1068
- })(exports.ProfileEventEventTypeEnum || (exports.ProfileEventEventTypeEnum = {}));
1069
- (function (ProfileEventDataProfileEventTypeEnum) {
1070
- ProfileEventDataProfileEventTypeEnum["signup"] = "signup";
1071
- ProfileEventDataProfileEventTypeEnum["login"] = "login";
1072
- ProfileEventDataProfileEventTypeEnum["logout"] = "logout";
1073
- ProfileEventDataProfileEventTypeEnum["update"] = "update";
1074
- ProfileEventDataProfileEventTypeEnum["delete"] = "delete";
1075
- })(exports.ProfileEventDataProfileEventTypeEnum || (exports.ProfileEventDataProfileEventTypeEnum = {}));
1076
- (function (PromotionActionActionEnum) {
1077
- PromotionActionActionEnum["view"] = "view";
1078
- PromotionActionActionEnum["click"] = "click";
1079
- })(exports.PromotionActionActionEnum || (exports.PromotionActionActionEnum = {}));
1080
- (function (PushMessageEventEventTypeEnum) {
1081
- PushMessageEventEventTypeEnum["pushMessage"] = "push_message";
1082
- })(exports.PushMessageEventEventTypeEnum || (exports.PushMessageEventEventTypeEnum = {}));
1083
- (function (PushMessageEventDataPushMessageTypeEnum) {
1084
- PushMessageEventDataPushMessageTypeEnum["sent"] = "sent";
1085
- PushMessageEventDataPushMessageTypeEnum["received"] = "received";
1086
- PushMessageEventDataPushMessageTypeEnum["action"] = "action";
1087
- })(exports.PushMessageEventDataPushMessageTypeEnum || (exports.PushMessageEventDataPushMessageTypeEnum = {}));
1088
- (function (PushMessageEventDataApplicationStateEnum) {
1089
- PushMessageEventDataApplicationStateEnum["notRunning"] = "not_running";
1090
- PushMessageEventDataApplicationStateEnum["background"] = "background";
1091
- PushMessageEventDataApplicationStateEnum["foreground"] = "foreground";
1092
- })(exports.PushMessageEventDataApplicationStateEnum || (exports.PushMessageEventDataApplicationStateEnum = {}));
1093
- (function (PushMessageEventDataPushMessageBehaviorEnum) {
1094
- PushMessageEventDataPushMessageBehaviorEnum["received"] = "Received";
1095
- PushMessageEventDataPushMessageBehaviorEnum["directOpen"] = "DirectOpen";
1096
- PushMessageEventDataPushMessageBehaviorEnum["read"] = "Read";
1097
- PushMessageEventDataPushMessageBehaviorEnum["influencedOpen"] = "InfluencedOpen";
1098
- PushMessageEventDataPushMessageBehaviorEnum["displayed"] = "Displayed";
1099
- })(exports.PushMessageEventDataPushMessageBehaviorEnum || (exports.PushMessageEventDataPushMessageBehaviorEnum = {}));
1100
- (function (PushRegistrationEventEventTypeEnum) {
1101
- PushRegistrationEventEventTypeEnum["pushRegistration"] = "push_registration";
1102
- })(exports.PushRegistrationEventEventTypeEnum || (exports.PushRegistrationEventEventTypeEnum = {}));
1103
- (function (SessionEndEventEventTypeEnum) {
1104
- SessionEndEventEventTypeEnum["sessionEnd"] = "session_end";
1105
- })(exports.SessionEndEventEventTypeEnum || (exports.SessionEndEventEventTypeEnum = {}));
1106
- (function (SessionStartEventEventTypeEnum) {
1107
- SessionStartEventEventTypeEnum["sessionStart"] = "session_start";
1108
- })(exports.SessionStartEventEventTypeEnum || (exports.SessionStartEventEventTypeEnum = {}));
1109
- (function (SourceInformationChannelEnum) {
1110
- SourceInformationChannelEnum["native"] = "native";
1111
- SourceInformationChannelEnum["javascript"] = "javascript";
1112
- SourceInformationChannelEnum["pixel"] = "pixel";
1113
- SourceInformationChannelEnum["desktop"] = "desktop";
1114
- SourceInformationChannelEnum["partner"] = "partner";
1115
- SourceInformationChannelEnum["serverToServer"] = "server_to_server";
1116
- })(exports.SourceInformationChannelEnum || (exports.SourceInformationChannelEnum = {}));
1117
- (function (UserAttributeChangeEventEventTypeEnum) {
1118
- UserAttributeChangeEventEventTypeEnum["userAttributeChange"] = "user_attribute_change";
1119
- })(exports.UserAttributeChangeEventEventTypeEnum || (exports.UserAttributeChangeEventEventTypeEnum = {}));
1120
- (function (UserIdentityChangeEventEventTypeEnum) {
1121
- UserIdentityChangeEventEventTypeEnum["userIdentityChange"] = "user_identity_change";
1122
- })(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {}));
1123
- } (dist));
756
+ function getNewIdentitiesByName(newIdentitiesByType) {
757
+ var newIdentitiesByName = {};
758
+ for (var key in newIdentitiesByType) {
759
+ var identityNameKey = getIdentityName(parseNumber(key));
760
+ newIdentitiesByName[identityNameKey] = newIdentitiesByType[key];
761
+ }
762
+ return newIdentitiesByName;
763
+ }
764
+ function getIdentityName(identityType) {
765
+ switch (identityType) {
766
+ case IdentityType$1.Other:
767
+ return 'other';
768
+ case IdentityType$1.CustomerId:
769
+ return 'customerid';
770
+ case IdentityType$1.Facebook:
771
+ return 'facebook';
772
+ case IdentityType$1.Twitter:
773
+ return 'twitter';
774
+ case IdentityType$1.Google:
775
+ return 'google';
776
+ case IdentityType$1.Microsoft:
777
+ return 'microsoft';
778
+ case IdentityType$1.Yahoo:
779
+ return 'yahoo';
780
+ case IdentityType$1.Email:
781
+ return 'email';
782
+ case IdentityType$1.FacebookCustomAudienceId:
783
+ return 'facebookcustomaudienceid';
784
+ case IdentityType$1.Other2:
785
+ return 'other2';
786
+ case IdentityType$1.Other3:
787
+ return 'other3';
788
+ case IdentityType$1.Other4:
789
+ return 'other4';
790
+ case IdentityType$1.Other5:
791
+ return 'other5';
792
+ case IdentityType$1.Other6:
793
+ return 'other6';
794
+ case IdentityType$1.Other7:
795
+ return 'other7';
796
+ case IdentityType$1.Other8:
797
+ return 'other8';
798
+ case IdentityType$1.Other9:
799
+ return 'other9';
800
+ case IdentityType$1.Other10:
801
+ return 'other10';
802
+ case IdentityType$1.MobileNumber:
803
+ return 'mobile_number';
804
+ case IdentityType$1.PhoneNumber2:
805
+ return 'phone_number_2';
806
+ case IdentityType$1.PhoneNumber3:
807
+ return 'phone_number_3';
808
+ default:
809
+ return null;
810
+ }
811
+ }
812
+
813
+ var _TriggerUploadType;
814
+ var MessageType$1 = {
815
+ SessionStart: 1,
816
+ SessionEnd: 2,
817
+ PageView: 3,
818
+ PageEvent: 4,
819
+ CrashReport: 5,
820
+ OptOut: 6,
821
+ AppStateTransition: 10,
822
+ Profile: 14,
823
+ Commerce: 16,
824
+ Media: 20,
825
+ UserAttributeChange: 17,
826
+ UserIdentityChange: 18
827
+ };
828
+
829
+ // Dictionary that contains MessageTypes that will
830
+ // trigger an immediate upload.
831
+ var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$1.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$1.UserIdentityChange, 1), _TriggerUploadType);
832
+ var EventType = {
833
+ Unknown: 0,
834
+ Navigation: 1,
835
+ Location: 2,
836
+ Search: 3,
837
+ Transaction: 4,
838
+ UserContent: 5,
839
+ UserPreference: 6,
840
+ Social: 7,
841
+ Other: 8,
842
+ Media: 9,
843
+ getName: function getName(id) {
844
+ switch (id) {
845
+ case EventType.Unknown:
846
+ return 'Unknown';
847
+ case EventType.Navigation:
848
+ return 'Navigation';
849
+ case EventType.Location:
850
+ return 'Location';
851
+ case EventType.Search:
852
+ return 'Search';
853
+ case EventType.Transaction:
854
+ return 'Transaction';
855
+ case EventType.UserContent:
856
+ return 'User Content';
857
+ case EventType.UserPreference:
858
+ return 'User Preference';
859
+ case EventType.Social:
860
+ return 'Social';
861
+ case CommerceEventType.ProductAddToCart:
862
+ return 'Product Added to Cart';
863
+ case CommerceEventType.ProductAddToWishlist:
864
+ return 'Product Added to Wishlist';
865
+ case CommerceEventType.ProductCheckout:
866
+ return 'Product Checkout';
867
+ case CommerceEventType.ProductCheckoutOption:
868
+ return 'Product Checkout Options';
869
+ case CommerceEventType.ProductClick:
870
+ return 'Product Click';
871
+ case CommerceEventType.ProductImpression:
872
+ return 'Product Impression';
873
+ case CommerceEventType.ProductPurchase:
874
+ return 'Product Purchased';
875
+ case CommerceEventType.ProductRefund:
876
+ return 'Product Refunded';
877
+ case CommerceEventType.ProductRemoveFromCart:
878
+ return 'Product Removed From Cart';
879
+ case CommerceEventType.ProductRemoveFromWishlist:
880
+ return 'Product Removed from Wishlist';
881
+ case CommerceEventType.ProductViewDetail:
882
+ return 'Product View Details';
883
+ case CommerceEventType.PromotionClick:
884
+ return 'Promotion Click';
885
+ case CommerceEventType.PromotionView:
886
+ return 'Promotion View';
887
+ default:
888
+ return 'Other';
889
+ }
890
+ }
891
+ };
1124
892
 
1125
- var Messages$9 = Constants.Messages;
1126
- var createCookieString = function createCookieString(value) {
1127
- return replaceCommasWithPipes(replaceQuotesWithApostrophes(value));
893
+ // Continuation of enum above, but in seperate object since we don't expose these to end user
894
+ var CommerceEventType = {
895
+ ProductAddToCart: 10,
896
+ ProductRemoveFromCart: 11,
897
+ ProductCheckout: 12,
898
+ ProductCheckoutOption: 13,
899
+ ProductClick: 14,
900
+ ProductViewDetail: 15,
901
+ ProductPurchase: 16,
902
+ ProductRefund: 17,
903
+ PromotionView: 18,
904
+ PromotionClick: 19,
905
+ ProductAddToWishlist: 20,
906
+ ProductRemoveFromWishlist: 21,
907
+ ProductImpression: 22
1128
908
  };
1129
- var revertCookieString = function revertCookieString(value) {
1130
- return replacePipesWithCommas(replaceApostrophesWithQuotes(value));
909
+ var IdentityType = {
910
+ Other: 0,
911
+ CustomerId: 1,
912
+ Facebook: 2,
913
+ Twitter: 3,
914
+ Google: 4,
915
+ Microsoft: 5,
916
+ Yahoo: 6,
917
+ Email: 7,
918
+ FacebookCustomAudienceId: 9,
919
+ Other2: 10,
920
+ Other3: 11,
921
+ Other4: 12,
922
+ Other5: 13,
923
+ Other6: 14,
924
+ Other7: 15,
925
+ Other8: 16,
926
+ Other9: 17,
927
+ Other10: 18,
928
+ MobileNumber: 19,
929
+ PhoneNumber2: 20,
930
+ PhoneNumber3: 21
1131
931
  };
1132
- var inArray = function inArray(items, name) {
1133
- var i = 0;
1134
- if (Array.prototype.indexOf) {
1135
- return items.indexOf(name, 0) >= 0;
1136
- } else {
1137
- for (var n = items.length; i < n; i++) {
1138
- if (i in items && items[i] === name) {
1139
- return true;
932
+ IdentityType.isValid = function (identityType) {
933
+ if (typeof identityType === 'number') {
934
+ for (var prop in IdentityType) {
935
+ if (IdentityType.hasOwnProperty(prop)) {
936
+ if (IdentityType[prop] === identityType) {
937
+ return true;
938
+ }
1140
939
  }
1141
940
  }
1142
941
  }
1143
942
  return false;
1144
943
  };
1145
- var findKeyInObject = function findKeyInObject(obj, key) {
1146
- if (key && obj) {
1147
- for (var prop in obj) {
1148
- if (obj.hasOwnProperty(prop) && prop.toLowerCase() === key.toLowerCase()) {
1149
- return prop;
1150
- }
1151
- }
1152
- }
1153
- return null;
1154
- };
1155
- var generateDeprecationMessage = function generateDeprecationMessage(methodName, alternateMethod) {
1156
- var messageArray = [methodName, Messages$9.DeprecationMessages.MethodIsDeprecatedPostfix];
1157
- if (alternateMethod) {
1158
- messageArray.push(alternateMethod);
1159
- messageArray.push(Messages$9.DeprecationMessages.MethodIsDeprecatedPostfix);
1160
- }
1161
- return messageArray.join(' ');
1162
- };
1163
- function generateHash(name) {
1164
- var hash = 0;
1165
- var character;
1166
- if (name === undefined || name === null) {
1167
- return 0;
1168
- }
1169
- name = name.toString().toLowerCase();
1170
- if (Array.prototype.reduce) {
1171
- return name.split('').reduce(function (a, b) {
1172
- a = (a << 5) - a + b.charCodeAt(0);
1173
- return a & a;
1174
- }, 0);
1175
- }
1176
- if (name.length === 0) {
1177
- return hash;
1178
- }
1179
- for (var i = 0; i < name.length; i++) {
1180
- character = name.charCodeAt(i);
1181
- hash = (hash << 5) - hash + character;
1182
- hash = hash & hash;
1183
- }
1184
- return hash;
1185
- }
1186
- var generateRandomValue = function generateRandomValue(value) {
1187
- var randomValue;
1188
- var a;
1189
- if (window.crypto && window.crypto.getRandomValues) {
1190
- // @ts-ignore
1191
- randomValue = window.crypto.getRandomValues(new Uint8Array(1)); // eslint-disable-line no-undef
1192
- }
1193
-
1194
- if (randomValue) {
1195
- // @ts-ignore
1196
- return (a ^ randomValue[0] % 16 >> a / 4).toString(16);
1197
- }
1198
- return (a ^ Math.random() * 16 >> a / 4).toString(16);
1199
- };
1200
- var generateUniqueId = function generateUniqueId(a) {
1201
- // https://gist.github.com/jed/982883
1202
- // Added support for crypto for better random
1203
- if (a === void 0) {
1204
- a = '';
944
+ IdentityType.getName = function (identityType) {
945
+ switch (identityType) {
946
+ case window.mParticle.IdentityType.CustomerId:
947
+ return 'Customer ID';
948
+ case window.mParticle.IdentityType.Facebook:
949
+ return 'Facebook ID';
950
+ case window.mParticle.IdentityType.Twitter:
951
+ return 'Twitter ID';
952
+ case window.mParticle.IdentityType.Google:
953
+ return 'Google ID';
954
+ case window.mParticle.IdentityType.Microsoft:
955
+ return 'Microsoft ID';
956
+ case window.mParticle.IdentityType.Yahoo:
957
+ return 'Yahoo ID';
958
+ case window.mParticle.IdentityType.Email:
959
+ return 'Email';
960
+ case window.mParticle.IdentityType.FacebookCustomAudienceId:
961
+ return 'Facebook App User ID';
962
+ default:
963
+ return 'Other ID';
1205
964
  }
1206
- return a // if the placeholder was passed, return
1207
- ? generateRandomValue() // if the placeholder was passed, return
1208
- :
1209
- // [1e7] -> // 10000000 +
1210
- // -1e3 -> // -1000 +
1211
- // -4e3 -> // -4000 +
1212
- // -8e3 -> // -80000000 +
1213
- // -1e11 -> //-100000000000,
1214
- "".concat(1e7, "-").concat(1e3, "-").concat(4e3, "-").concat(8e3, "-").concat(1e11).replace(/[018]/g,
1215
- // zeroes, ones, and eights with
1216
- generateUniqueId // random hex digits
1217
- );
1218
965
  };
1219
- /**
1220
- * Returns a value between 1-100 inclusive.
1221
- */
1222
- var getRampNumber = function getRampNumber(value) {
1223
- if (!value) {
1224
- return 100;
966
+ IdentityType.getIdentityType = function (identityName) {
967
+ switch (identityName) {
968
+ case 'other':
969
+ return IdentityType.Other;
970
+ case 'customerid':
971
+ return IdentityType.CustomerId;
972
+ case 'facebook':
973
+ return IdentityType.Facebook;
974
+ case 'twitter':
975
+ return IdentityType.Twitter;
976
+ case 'google':
977
+ return IdentityType.Google;
978
+ case 'microsoft':
979
+ return IdentityType.Microsoft;
980
+ case 'yahoo':
981
+ return IdentityType.Yahoo;
982
+ case 'email':
983
+ return IdentityType.Email;
984
+ case 'facebookcustomaudienceid':
985
+ return IdentityType.FacebookCustomAudienceId;
986
+ case 'other2':
987
+ return IdentityType.Other2;
988
+ case 'other3':
989
+ return IdentityType.Other3;
990
+ case 'other4':
991
+ return IdentityType.Other4;
992
+ case 'other5':
993
+ return IdentityType.Other5;
994
+ case 'other6':
995
+ return IdentityType.Other6;
996
+ case 'other7':
997
+ return IdentityType.Other7;
998
+ case 'other8':
999
+ return IdentityType.Other8;
1000
+ case 'other9':
1001
+ return IdentityType.Other9;
1002
+ case 'other10':
1003
+ return IdentityType.Other10;
1004
+ case 'mobile_number':
1005
+ return IdentityType.MobileNumber;
1006
+ case 'phone_number_2':
1007
+ return IdentityType.PhoneNumber2;
1008
+ case 'phone_number_3':
1009
+ return IdentityType.PhoneNumber3;
1010
+ default:
1011
+ return false;
1225
1012
  }
1226
- var hash = generateHash(value);
1227
- return Math.abs(hash % 100) + 1;
1228
1013
  };
1229
- var isObject = function isObject(value) {
1230
- var objType = Object.prototype.toString.call(value);
1231
- return objType === '[object Object]' || objType === '[object Error]';
1014
+ IdentityType.getIdentityName = function (identityType) {
1015
+ return getIdentityName(identityType);
1232
1016
  };
1233
- var parseNumber = function parseNumber(value) {
1234
- if (isNaN(value) || !isFinite(value)) {
1235
- return 0;
1236
- }
1237
- var floatValue = parseFloat(value);
1238
- return isNaN(floatValue) ? 0 : floatValue;
1017
+ var ProductActionType = {
1018
+ Unknown: 0,
1019
+ AddToCart: 1,
1020
+ RemoveFromCart: 2,
1021
+ Checkout: 3,
1022
+ CheckoutOption: 4,
1023
+ Click: 5,
1024
+ ViewDetail: 6,
1025
+ Purchase: 7,
1026
+ Refund: 8,
1027
+ AddToWishlist: 9,
1028
+ RemoveFromWishlist: 10
1239
1029
  };
1240
- var parseStringOrNumber = function parseStringOrNumber(value) {
1241
- if (isStringOrNumber(value)) {
1242
- return value;
1243
- } else {
1244
- return null;
1030
+ ProductActionType.getName = function (id) {
1031
+ switch (id) {
1032
+ case ProductActionType.AddToCart:
1033
+ return 'Add to Cart';
1034
+ case ProductActionType.RemoveFromCart:
1035
+ return 'Remove from Cart';
1036
+ case ProductActionType.Checkout:
1037
+ return 'Checkout';
1038
+ case ProductActionType.CheckoutOption:
1039
+ return 'Checkout Option';
1040
+ case ProductActionType.Click:
1041
+ return 'Click';
1042
+ case ProductActionType.ViewDetail:
1043
+ return 'View Detail';
1044
+ case ProductActionType.Purchase:
1045
+ return 'Purchase';
1046
+ case ProductActionType.Refund:
1047
+ return 'Refund';
1048
+ case ProductActionType.AddToWishlist:
1049
+ return 'Add to Wishlist';
1050
+ case ProductActionType.RemoveFromWishlist:
1051
+ return 'Remove from Wishlist';
1052
+ default:
1053
+ return 'Unknown';
1245
1054
  }
1246
1055
  };
1247
- var replaceCommasWithPipes = function replaceCommasWithPipes(value) {
1248
- return value.replace(/,/g, '|');
1249
- };
1250
- var replacePipesWithCommas = function replacePipesWithCommas(value) {
1251
- return value.replace(/\|/g, ',');
1252
- };
1253
- var replaceApostrophesWithQuotes = function replaceApostrophesWithQuotes(value) {
1254
- return value.replace(/\'/g, '"');
1255
- };
1256
- var replaceQuotesWithApostrophes = function replaceQuotesWithApostrophes(value) {
1257
- return value.replace(/\"/g, "'");
1258
- };
1259
- // FIXME: REFACTOR for V3
1260
- // only used in store.js to sanitize server-side formatting of
1261
- // booleans when checking for `isDevelopmentMode`
1262
- // Should be removed in v3
1263
- var returnConvertedBoolean = function returnConvertedBoolean(data) {
1264
- if (data === 'false' || data === '0') {
1265
- return false;
1266
- } else {
1267
- return Boolean(data);
1056
+
1057
+ // these are the action names used by server and mobile SDKs when expanding a CommerceEvent
1058
+ ProductActionType.getExpansionName = function (id) {
1059
+ switch (id) {
1060
+ case ProductActionType.AddToCart:
1061
+ return 'add_to_cart';
1062
+ case ProductActionType.RemoveFromCart:
1063
+ return 'remove_from_cart';
1064
+ case ProductActionType.Checkout:
1065
+ return 'checkout';
1066
+ case ProductActionType.CheckoutOption:
1067
+ return 'checkout_option';
1068
+ case ProductActionType.Click:
1069
+ return 'click';
1070
+ case ProductActionType.ViewDetail:
1071
+ return 'view_detail';
1072
+ case ProductActionType.Purchase:
1073
+ return 'purchase';
1074
+ case ProductActionType.Refund:
1075
+ return 'refund';
1076
+ case ProductActionType.AddToWishlist:
1077
+ return 'add_to_wishlist';
1078
+ case ProductActionType.RemoveFromWishlist:
1079
+ return 'remove_from_wishlist';
1080
+ default:
1081
+ return 'unknown';
1268
1082
  }
1269
1083
  };
1270
- var decoded = function decoded(s) {
1271
- return decodeURIComponent(s.replace(/\+/g, ' '));
1084
+ var PromotionActionType = {
1085
+ Unknown: 0,
1086
+ PromotionView: 1,
1087
+ PromotionClick: 2
1272
1088
  };
1273
- var converted = function converted(s) {
1274
- if (s.indexOf('"') === 0) {
1275
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
1089
+ PromotionActionType.getName = function (id) {
1090
+ switch (id) {
1091
+ case PromotionActionType.PromotionView:
1092
+ return 'view';
1093
+ case PromotionActionType.PromotionClick:
1094
+ return 'click';
1095
+ default:
1096
+ return 'unknown';
1276
1097
  }
1277
- return s;
1278
- };
1279
- var isString = function isString(value) {
1280
- return typeof value === 'string';
1281
- };
1282
- var isNumber = function isNumber(value) {
1283
- return typeof value === 'number';
1284
- };
1285
- var isBoolean = function isBoolean(value) {
1286
- return typeof value === 'boolean';
1287
1098
  };
1288
- var isFunction = function isFunction(fn) {
1289
- return typeof fn === 'function';
1290
- };
1291
- var isValidCustomFlagProperty = function isValidCustomFlagProperty(value) {
1292
- return isNumber(value) || isString(value) || isBoolean(value);
1099
+
1100
+ // these are the names that the server and mobile SDKs use while expanding CommerceEvent
1101
+ PromotionActionType.getExpansionName = function (id) {
1102
+ switch (id) {
1103
+ case PromotionActionType.PromotionView:
1104
+ return 'view';
1105
+ case PromotionActionType.PromotionClick:
1106
+ return 'click';
1107
+ default:
1108
+ return 'unknown';
1109
+ }
1293
1110
  };
1294
- var toDataPlanSlug = function toDataPlanSlug(value) {
1295
- // Make sure we are only acting on strings or numbers
1296
- return isStringOrNumber(value) ? value.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g, '_') : '';
1111
+ var ProfileMessageType = {
1112
+ Logout: 3
1297
1113
  };
1298
- var isDataPlanSlug = function isDataPlanSlug(str) {
1299
- return str === toDataPlanSlug(str);
1114
+ var ApplicationTransitionType$1 = {
1115
+ AppInit: 1
1300
1116
  };
1301
- var isStringOrNumber = function isStringOrNumber(value) {
1302
- return isString(value) || isNumber(value);
1117
+ var Environment = {
1118
+ Production: 'production',
1119
+ Development: 'development'
1303
1120
  };
1304
- var isEmpty = function isEmpty(value) {
1305
- return value == null || !(Object.keys(value) || value).length;
1121
+ var Types = {
1122
+ MessageType: MessageType$1,
1123
+ EventType: EventType,
1124
+ CommerceEventType: CommerceEventType,
1125
+ IdentityType: IdentityType,
1126
+ ProfileMessageType: ProfileMessageType,
1127
+ ApplicationTransitionType: ApplicationTransitionType$1,
1128
+ ProductActionType: ProductActionType,
1129
+ PromotionActionType: PromotionActionType,
1130
+ TriggerUploadType: TriggerUploadType,
1131
+ Environment: Environment
1306
1132
  };
1307
1133
 
1134
+ var SDKProductActionType;
1135
+ (function (SDKProductActionType) {
1136
+ SDKProductActionType[SDKProductActionType["Unknown"] = 0] = "Unknown";
1137
+ SDKProductActionType[SDKProductActionType["AddToCart"] = 1] = "AddToCart";
1138
+ SDKProductActionType[SDKProductActionType["RemoveFromCart"] = 2] = "RemoveFromCart";
1139
+ SDKProductActionType[SDKProductActionType["Checkout"] = 3] = "Checkout";
1140
+ SDKProductActionType[SDKProductActionType["CheckoutOption"] = 4] = "CheckoutOption";
1141
+ SDKProductActionType[SDKProductActionType["Click"] = 5] = "Click";
1142
+ SDKProductActionType[SDKProductActionType["ViewDetail"] = 6] = "ViewDetail";
1143
+ SDKProductActionType[SDKProductActionType["Purchase"] = 7] = "Purchase";
1144
+ SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund";
1145
+ SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist";
1146
+ SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist";
1147
+ })(SDKProductActionType || (SDKProductActionType = {}));
1148
+
1149
+ var dist = {};
1150
+
1151
+ (function (exports) {
1152
+ Object.defineProperty(exports, "__esModule", { value: true });
1153
+ (function (ApplicationInformationOsEnum) {
1154
+ ApplicationInformationOsEnum["unknown"] = "Unknown";
1155
+ ApplicationInformationOsEnum["iOS"] = "IOS";
1156
+ ApplicationInformationOsEnum["android"] = "Android";
1157
+ ApplicationInformationOsEnum["windowsPhone"] = "WindowsPhone";
1158
+ ApplicationInformationOsEnum["mobileWeb"] = "MobileWeb";
1159
+ ApplicationInformationOsEnum["unityIOS"] = "UnityIOS";
1160
+ ApplicationInformationOsEnum["unityAndroid"] = "UnityAndroid";
1161
+ ApplicationInformationOsEnum["desktop"] = "Desktop";
1162
+ ApplicationInformationOsEnum["tvOS"] = "TVOS";
1163
+ ApplicationInformationOsEnum["roku"] = "Roku";
1164
+ ApplicationInformationOsEnum["outOfBand"] = "OutOfBand";
1165
+ ApplicationInformationOsEnum["alexa"] = "Alexa";
1166
+ ApplicationInformationOsEnum["smartTV"] = "SmartTV";
1167
+ ApplicationInformationOsEnum["fireTV"] = "FireTV";
1168
+ ApplicationInformationOsEnum["xbox"] = "Xbox";
1169
+ })(exports.ApplicationInformationOsEnum || (exports.ApplicationInformationOsEnum = {}));
1170
+ (function (ApplicationStateTransitionEventEventTypeEnum) {
1171
+ ApplicationStateTransitionEventEventTypeEnum["applicationStateTransition"] = "application_state_transition";
1172
+ })(exports.ApplicationStateTransitionEventEventTypeEnum || (exports.ApplicationStateTransitionEventEventTypeEnum = {}));
1173
+ (function (ApplicationStateTransitionEventDataApplicationTransitionTypeEnum) {
1174
+ ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationInitialized"] = "application_initialized";
1175
+ ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationExit"] = "application_exit";
1176
+ ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationBackground"] = "application_background";
1177
+ ApplicationStateTransitionEventDataApplicationTransitionTypeEnum["applicationForeground"] = "application_foreground";
1178
+ })(exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum || (exports.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum = {}));
1179
+ (function (BatchEnvironmentEnum) {
1180
+ BatchEnvironmentEnum["unknown"] = "unknown";
1181
+ BatchEnvironmentEnum["development"] = "development";
1182
+ BatchEnvironmentEnum["production"] = "production";
1183
+ })(exports.BatchEnvironmentEnum || (exports.BatchEnvironmentEnum = {}));
1184
+ (function (BreadcrumbEventEventTypeEnum) {
1185
+ BreadcrumbEventEventTypeEnum["breadcrumb"] = "breadcrumb";
1186
+ })(exports.BreadcrumbEventEventTypeEnum || (exports.BreadcrumbEventEventTypeEnum = {}));
1187
+ (function (CommerceEventEventTypeEnum) {
1188
+ CommerceEventEventTypeEnum["commerceEvent"] = "commerce_event";
1189
+ })(exports.CommerceEventEventTypeEnum || (exports.CommerceEventEventTypeEnum = {}));
1190
+ (function (CommerceEventDataCustomEventTypeEnum) {
1191
+ CommerceEventDataCustomEventTypeEnum["addToCart"] = "add_to_cart";
1192
+ CommerceEventDataCustomEventTypeEnum["removeFromCart"] = "remove_from_cart";
1193
+ CommerceEventDataCustomEventTypeEnum["checkout"] = "checkout";
1194
+ CommerceEventDataCustomEventTypeEnum["checkoutOption"] = "checkout_option";
1195
+ CommerceEventDataCustomEventTypeEnum["click"] = "click";
1196
+ CommerceEventDataCustomEventTypeEnum["viewDetail"] = "view_detail";
1197
+ CommerceEventDataCustomEventTypeEnum["purchase"] = "purchase";
1198
+ CommerceEventDataCustomEventTypeEnum["refund"] = "refund";
1199
+ CommerceEventDataCustomEventTypeEnum["promotionView"] = "promotion_view";
1200
+ CommerceEventDataCustomEventTypeEnum["promotionClick"] = "promotion_click";
1201
+ CommerceEventDataCustomEventTypeEnum["addToWishlist"] = "add_to_wishlist";
1202
+ CommerceEventDataCustomEventTypeEnum["removeFromWishlist"] = "remove_from_wishlist";
1203
+ CommerceEventDataCustomEventTypeEnum["impression"] = "impression";
1204
+ })(exports.CommerceEventDataCustomEventTypeEnum || (exports.CommerceEventDataCustomEventTypeEnum = {}));
1205
+ (function (CrashReportEventEventTypeEnum) {
1206
+ CrashReportEventEventTypeEnum["crashReport"] = "crash_report";
1207
+ })(exports.CrashReportEventEventTypeEnum || (exports.CrashReportEventEventTypeEnum = {}));
1208
+ (function (CustomEventEventTypeEnum) {
1209
+ CustomEventEventTypeEnum["customEvent"] = "custom_event";
1210
+ })(exports.CustomEventEventTypeEnum || (exports.CustomEventEventTypeEnum = {}));
1211
+ (function (CustomEventDataCustomEventTypeEnum) {
1212
+ CustomEventDataCustomEventTypeEnum["navigation"] = "navigation";
1213
+ CustomEventDataCustomEventTypeEnum["location"] = "location";
1214
+ CustomEventDataCustomEventTypeEnum["search"] = "search";
1215
+ CustomEventDataCustomEventTypeEnum["transaction"] = "transaction";
1216
+ CustomEventDataCustomEventTypeEnum["userContent"] = "user_content";
1217
+ CustomEventDataCustomEventTypeEnum["userPreference"] = "user_preference";
1218
+ CustomEventDataCustomEventTypeEnum["social"] = "social";
1219
+ CustomEventDataCustomEventTypeEnum["media"] = "media";
1220
+ CustomEventDataCustomEventTypeEnum["other"] = "other";
1221
+ CustomEventDataCustomEventTypeEnum["unknown"] = "unknown";
1222
+ })(exports.CustomEventDataCustomEventTypeEnum || (exports.CustomEventDataCustomEventTypeEnum = {}));
1223
+ (function (DeviceCurrentStateDeviceOrientationEnum) {
1224
+ DeviceCurrentStateDeviceOrientationEnum["portrait"] = "portrait";
1225
+ DeviceCurrentStateDeviceOrientationEnum["portraitUpsideDown"] = "portrait_upside_down";
1226
+ DeviceCurrentStateDeviceOrientationEnum["landscape"] = "landscape";
1227
+ DeviceCurrentStateDeviceOrientationEnum["landscapeLeft"] = "LandscapeLeft";
1228
+ DeviceCurrentStateDeviceOrientationEnum["landscapeRight"] = "LandscapeRight";
1229
+ DeviceCurrentStateDeviceOrientationEnum["faceUp"] = "FaceUp";
1230
+ DeviceCurrentStateDeviceOrientationEnum["faceDown"] = "FaceDown";
1231
+ DeviceCurrentStateDeviceOrientationEnum["square"] = "Square";
1232
+ })(exports.DeviceCurrentStateDeviceOrientationEnum || (exports.DeviceCurrentStateDeviceOrientationEnum = {}));
1233
+ (function (DeviceCurrentStateStatusBarOrientationEnum) {
1234
+ DeviceCurrentStateStatusBarOrientationEnum["portrait"] = "portrait";
1235
+ DeviceCurrentStateStatusBarOrientationEnum["portraitUpsideDown"] = "portrait_upside_down";
1236
+ DeviceCurrentStateStatusBarOrientationEnum["landscape"] = "landscape";
1237
+ DeviceCurrentStateStatusBarOrientationEnum["landscapeLeft"] = "LandscapeLeft";
1238
+ DeviceCurrentStateStatusBarOrientationEnum["landscapeRight"] = "LandscapeRight";
1239
+ DeviceCurrentStateStatusBarOrientationEnum["faceUp"] = "FaceUp";
1240
+ DeviceCurrentStateStatusBarOrientationEnum["faceDown"] = "FaceDown";
1241
+ DeviceCurrentStateStatusBarOrientationEnum["square"] = "Square";
1242
+ })(exports.DeviceCurrentStateStatusBarOrientationEnum || (exports.DeviceCurrentStateStatusBarOrientationEnum = {}));
1243
+ (function (DeviceInformationPlatformEnum) {
1244
+ DeviceInformationPlatformEnum["iOS"] = "iOS";
1245
+ DeviceInformationPlatformEnum["android"] = "Android";
1246
+ DeviceInformationPlatformEnum["web"] = "web";
1247
+ DeviceInformationPlatformEnum["desktop"] = "desktop";
1248
+ DeviceInformationPlatformEnum["tvOS"] = "tvOS";
1249
+ DeviceInformationPlatformEnum["roku"] = "roku";
1250
+ DeviceInformationPlatformEnum["outOfBand"] = "out_of_band";
1251
+ DeviceInformationPlatformEnum["smartTV"] = "smart_tv";
1252
+ DeviceInformationPlatformEnum["xbox"] = "xbox";
1253
+ })(exports.DeviceInformationPlatformEnum || (exports.DeviceInformationPlatformEnum = {}));
1254
+ (function (EventTypeEnum) {
1255
+ EventTypeEnum["unknown"] = "unknown";
1256
+ EventTypeEnum["sessionStart"] = "session_start";
1257
+ EventTypeEnum["sessionEnd"] = "session_end";
1258
+ EventTypeEnum["screenView"] = "screen_view";
1259
+ EventTypeEnum["customEvent"] = "custom_event";
1260
+ EventTypeEnum["crashReport"] = "crash_report";
1261
+ EventTypeEnum["optOut"] = "opt_out";
1262
+ EventTypeEnum["firstRun"] = "first_run";
1263
+ EventTypeEnum["preAttribution"] = "pre_attribution";
1264
+ EventTypeEnum["pushRegistration"] = "push_registration";
1265
+ EventTypeEnum["applicationStateTransition"] = "application_state_transition";
1266
+ EventTypeEnum["pushMessage"] = "push_message";
1267
+ EventTypeEnum["networkPerformance"] = "network_performance";
1268
+ EventTypeEnum["breadcrumb"] = "breadcrumb";
1269
+ EventTypeEnum["profile"] = "profile";
1270
+ EventTypeEnum["pushReaction"] = "push_reaction";
1271
+ EventTypeEnum["commerceEvent"] = "commerce_event";
1272
+ EventTypeEnum["userAttributeChange"] = "user_attribute_change";
1273
+ EventTypeEnum["userIdentityChange"] = "user_identity_change";
1274
+ EventTypeEnum["uninstall"] = "uninstall";
1275
+ EventTypeEnum["validationResult"] = "validation_result";
1276
+ })(exports.EventTypeEnum || (exports.EventTypeEnum = {}));
1277
+ (function (IdentityTypeEnum) {
1278
+ IdentityTypeEnum["other"] = "other";
1279
+ IdentityTypeEnum["customerId"] = "customer_id";
1280
+ IdentityTypeEnum["facebook"] = "facebook";
1281
+ IdentityTypeEnum["twitter"] = "twitter";
1282
+ IdentityTypeEnum["google"] = "google";
1283
+ IdentityTypeEnum["microsoft"] = "microsoft";
1284
+ IdentityTypeEnum["yahoo"] = "yahoo";
1285
+ IdentityTypeEnum["email"] = "email";
1286
+ IdentityTypeEnum["alias"] = "alias";
1287
+ IdentityTypeEnum["facebookCustomAudienceId"] = "facebook_custom_audience_id";
1288
+ IdentityTypeEnum["otherId2"] = "other_id_2";
1289
+ IdentityTypeEnum["otherId3"] = "other_id_3";
1290
+ IdentityTypeEnum["otherId4"] = "other_id_4";
1291
+ IdentityTypeEnum["otherId5"] = "other_id_5";
1292
+ IdentityTypeEnum["otherId6"] = "other_id_6";
1293
+ IdentityTypeEnum["otherId7"] = "other_id_7";
1294
+ IdentityTypeEnum["otherId8"] = "other_id_8";
1295
+ IdentityTypeEnum["otherId9"] = "other_id_9";
1296
+ IdentityTypeEnum["otherId10"] = "other_id_10";
1297
+ IdentityTypeEnum["mobileNumber"] = "mobile_number";
1298
+ IdentityTypeEnum["phoneNumber2"] = "phone_number_2";
1299
+ IdentityTypeEnum["phoneNumber3"] = "phone_number_3";
1300
+ })(exports.IdentityTypeEnum || (exports.IdentityTypeEnum = {}));
1301
+ (function (NetworkPerformanceEventEventTypeEnum) {
1302
+ NetworkPerformanceEventEventTypeEnum["networkPerformance"] = "network_performance";
1303
+ })(exports.NetworkPerformanceEventEventTypeEnum || (exports.NetworkPerformanceEventEventTypeEnum = {}));
1304
+ (function (OptOutEventEnum) {
1305
+ OptOutEventEnum["optOut"] = "opt_out";
1306
+ })(exports.OptOutEventEnum || (exports.OptOutEventEnum = {}));
1307
+ (function (ProductActionActionEnum) {
1308
+ ProductActionActionEnum["unknown"] = "unknown";
1309
+ ProductActionActionEnum["addToCart"] = "add_to_cart";
1310
+ ProductActionActionEnum["removeFromCart"] = "remove_from_cart";
1311
+ ProductActionActionEnum["checkout"] = "checkout";
1312
+ ProductActionActionEnum["checkoutOption"] = "checkout_option";
1313
+ ProductActionActionEnum["click"] = "click";
1314
+ ProductActionActionEnum["viewDetail"] = "view_detail";
1315
+ ProductActionActionEnum["purchase"] = "purchase";
1316
+ ProductActionActionEnum["refund"] = "refund";
1317
+ ProductActionActionEnum["addToWishlist"] = "add_to_wishlist";
1318
+ ProductActionActionEnum["removeFromWishlist"] = "remove_from_wish_list";
1319
+ })(exports.ProductActionActionEnum || (exports.ProductActionActionEnum = {}));
1320
+ (function (ProfileEventEventTypeEnum) {
1321
+ ProfileEventEventTypeEnum["profile"] = "profile";
1322
+ })(exports.ProfileEventEventTypeEnum || (exports.ProfileEventEventTypeEnum = {}));
1323
+ (function (ProfileEventDataProfileEventTypeEnum) {
1324
+ ProfileEventDataProfileEventTypeEnum["signup"] = "signup";
1325
+ ProfileEventDataProfileEventTypeEnum["login"] = "login";
1326
+ ProfileEventDataProfileEventTypeEnum["logout"] = "logout";
1327
+ ProfileEventDataProfileEventTypeEnum["update"] = "update";
1328
+ ProfileEventDataProfileEventTypeEnum["delete"] = "delete";
1329
+ })(exports.ProfileEventDataProfileEventTypeEnum || (exports.ProfileEventDataProfileEventTypeEnum = {}));
1330
+ (function (PromotionActionActionEnum) {
1331
+ PromotionActionActionEnum["view"] = "view";
1332
+ PromotionActionActionEnum["click"] = "click";
1333
+ })(exports.PromotionActionActionEnum || (exports.PromotionActionActionEnum = {}));
1334
+ (function (PushMessageEventEventTypeEnum) {
1335
+ PushMessageEventEventTypeEnum["pushMessage"] = "push_message";
1336
+ })(exports.PushMessageEventEventTypeEnum || (exports.PushMessageEventEventTypeEnum = {}));
1337
+ (function (PushMessageEventDataPushMessageTypeEnum) {
1338
+ PushMessageEventDataPushMessageTypeEnum["sent"] = "sent";
1339
+ PushMessageEventDataPushMessageTypeEnum["received"] = "received";
1340
+ PushMessageEventDataPushMessageTypeEnum["action"] = "action";
1341
+ })(exports.PushMessageEventDataPushMessageTypeEnum || (exports.PushMessageEventDataPushMessageTypeEnum = {}));
1342
+ (function (PushMessageEventDataApplicationStateEnum) {
1343
+ PushMessageEventDataApplicationStateEnum["notRunning"] = "not_running";
1344
+ PushMessageEventDataApplicationStateEnum["background"] = "background";
1345
+ PushMessageEventDataApplicationStateEnum["foreground"] = "foreground";
1346
+ })(exports.PushMessageEventDataApplicationStateEnum || (exports.PushMessageEventDataApplicationStateEnum = {}));
1347
+ (function (PushMessageEventDataPushMessageBehaviorEnum) {
1348
+ PushMessageEventDataPushMessageBehaviorEnum["received"] = "Received";
1349
+ PushMessageEventDataPushMessageBehaviorEnum["directOpen"] = "DirectOpen";
1350
+ PushMessageEventDataPushMessageBehaviorEnum["read"] = "Read";
1351
+ PushMessageEventDataPushMessageBehaviorEnum["influencedOpen"] = "InfluencedOpen";
1352
+ PushMessageEventDataPushMessageBehaviorEnum["displayed"] = "Displayed";
1353
+ })(exports.PushMessageEventDataPushMessageBehaviorEnum || (exports.PushMessageEventDataPushMessageBehaviorEnum = {}));
1354
+ (function (PushRegistrationEventEventTypeEnum) {
1355
+ PushRegistrationEventEventTypeEnum["pushRegistration"] = "push_registration";
1356
+ })(exports.PushRegistrationEventEventTypeEnum || (exports.PushRegistrationEventEventTypeEnum = {}));
1357
+ (function (SessionEndEventEventTypeEnum) {
1358
+ SessionEndEventEventTypeEnum["sessionEnd"] = "session_end";
1359
+ })(exports.SessionEndEventEventTypeEnum || (exports.SessionEndEventEventTypeEnum = {}));
1360
+ (function (SessionStartEventEventTypeEnum) {
1361
+ SessionStartEventEventTypeEnum["sessionStart"] = "session_start";
1362
+ })(exports.SessionStartEventEventTypeEnum || (exports.SessionStartEventEventTypeEnum = {}));
1363
+ (function (SourceInformationChannelEnum) {
1364
+ SourceInformationChannelEnum["native"] = "native";
1365
+ SourceInformationChannelEnum["javascript"] = "javascript";
1366
+ SourceInformationChannelEnum["pixel"] = "pixel";
1367
+ SourceInformationChannelEnum["desktop"] = "desktop";
1368
+ SourceInformationChannelEnum["partner"] = "partner";
1369
+ SourceInformationChannelEnum["serverToServer"] = "server_to_server";
1370
+ })(exports.SourceInformationChannelEnum || (exports.SourceInformationChannelEnum = {}));
1371
+ (function (UserAttributeChangeEventEventTypeEnum) {
1372
+ UserAttributeChangeEventEventTypeEnum["userAttributeChange"] = "user_attribute_change";
1373
+ })(exports.UserAttributeChangeEventEventTypeEnum || (exports.UserAttributeChangeEventEventTypeEnum = {}));
1374
+ (function (UserIdentityChangeEventEventTypeEnum) {
1375
+ UserIdentityChangeEventEventTypeEnum["userIdentityChange"] = "user_identity_change";
1376
+ })(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {}));
1377
+ } (dist));
1378
+
1308
1379
  var SDKIdentityTypeEnum;
1309
1380
  (function (SDKIdentityTypeEnum) {
1310
1381
  SDKIdentityTypeEnum["other"] = "other";
@@ -3841,23 +3912,7 @@ var mParticle = (function () {
3841
3912
  },
3842
3913
  // Placeholder for in-memory persistence model
3843
3914
  persistenceData: {
3844
- cu: null,
3845
- gs: {
3846
- sid: null,
3847
- ie: null,
3848
- sa: null,
3849
- ss: null,
3850
- dt: null,
3851
- av: null,
3852
- cgid: null,
3853
- das: null,
3854
- ia: null,
3855
- c: null,
3856
- csm: null,
3857
- les: null,
3858
- ssd: null
3859
- },
3860
- l: null
3915
+ gs: {}
3861
3916
  }
3862
3917
  };
3863
3918
  for (var key in defaultStore) {
@@ -4001,10 +4056,56 @@ var mParticle = (function () {
4001
4056
  }
4002
4057
  }
4003
4058
  }
4059
+ this._getFromPersistence = function (mpid, key) {
4060
+ if (!mpid) {
4061
+ return null;
4062
+ }
4063
+ _this.syncPersistenceData();
4064
+ if (_this.persistenceData && _this.persistenceData[mpid] && _this.persistenceData[mpid][key]) {
4065
+ return _this.persistenceData[mpid][key];
4066
+ } else {
4067
+ return null;
4068
+ }
4069
+ };
4070
+ this._setPersistence = function (mpid, key, value) {
4071
+ var _a;
4072
+ if (!mpid) {
4073
+ return;
4074
+ }
4075
+ _this.syncPersistenceData();
4076
+ if (_this.persistenceData) {
4077
+ if (_this.persistenceData[mpid]) {
4078
+ _this.persistenceData[mpid][key] = value;
4079
+ } else {
4080
+ _this.persistenceData[mpid] = (_a = {}, _a[key] = value, _a);
4081
+ }
4082
+ // Clear out persistence attributes that are empty
4083
+ // so that we don't upload empty or undefined values
4084
+ if (isObject(_this.persistenceData[mpid][key]) && isEmpty(_this.persistenceData[mpid][key])) {
4085
+ delete _this.persistenceData[mpid][key];
4086
+ }
4087
+ mpInstance._Persistence.savePersistence(_this.persistenceData);
4088
+ }
4089
+ };
4004
4090
  this.hasInvalidIdentifyRequest = function () {
4005
4091
  var identifyRequest = _this.SDKConfig.identifyRequest;
4006
4092
  return isObject(identifyRequest) && isObject(identifyRequest.userIdentities) && isEmpty(identifyRequest.userIdentities) || !identifyRequest;
4007
4093
  };
4094
+ this.getConsentState = function (mpid) {
4095
+ var fromMinifiedJsonObject = mpInstance._Consent.ConsentSerialization.fromMinifiedJsonObject;
4096
+ var serializedConsentState = _this._getFromPersistence(mpid, 'con');
4097
+ if (!isEmpty(serializedConsentState)) {
4098
+ return fromMinifiedJsonObject(serializedConsentState);
4099
+ }
4100
+ return null;
4101
+ };
4102
+ this.setConsentState = function (mpid, consentState) {
4103
+ var toMinifiedJsonObject = mpInstance._Consent.ConsentSerialization.toMinifiedJsonObject;
4104
+ // If ConsentState is null, we assume the intent is to clear out the consent state
4105
+ if (consentState || consentState === null) {
4106
+ _this._setPersistence(mpid, 'con', toMinifiedJsonObject(consentState));
4107
+ }
4108
+ };
4008
4109
  this.getDeviceId = function () {
4009
4110
  return _this.deviceId;
4010
4111
  };
@@ -4014,58 +4115,46 @@ var mParticle = (function () {
4014
4115
  mpInstance._Persistence.update();
4015
4116
  };
4016
4117
  this.getFirstSeenTime = function (mpid) {
4017
- if (!mpid) {
4018
- return null;
4019
- }
4020
- if (_this.persistenceData && _this.persistenceData[mpid] && _this.persistenceData[mpid].fst) {
4021
- return _this.persistenceData[mpid].fst;
4022
- } else {
4023
- return null;
4024
- }
4118
+ return _this._getFromPersistence(mpid, 'fst');
4025
4119
  };
4026
4120
  this.setFirstSeenTime = function (mpid, _time) {
4027
4121
  if (!mpid) {
4028
4122
  return;
4029
4123
  }
4030
4124
  var time = _time || new Date().getTime();
4031
- if (_this.persistenceData) {
4032
- if (!_this.persistenceData[mpid]) {
4033
- _this.persistenceData[mpid] = {};
4034
- }
4035
- if (!_this.persistenceData[mpid].fst) {
4036
- _this.persistenceData[mpid].fst = time;
4037
- mpInstance._Persistence.savePersistence(_this.persistenceData);
4038
- }
4039
- }
4125
+ _this._setPersistence(mpid, 'fst', time);
4040
4126
  };
4041
4127
  this.getLastSeenTime = function (mpid) {
4042
4128
  if (!mpid) {
4043
4129
  return null;
4044
4130
  }
4045
- // // https://go.mparticle.com/work/SQDSDKS-6315
4131
+ // https://go.mparticle.com/work/SQDSDKS-6315
4046
4132
  var currentUser = mpInstance.Identity.getCurrentUser();
4047
4133
  if (mpid === (currentUser === null || currentUser === void 0 ? void 0 : currentUser.getMPID())) {
4048
4134
  // if the mpid is the current user, its last seen time is the current time
4049
4135
  return new Date().getTime();
4050
- } else if (_this.persistenceData && _this.persistenceData[mpid] && _this.persistenceData[mpid].lst) {
4051
- return _this.persistenceData[mpid].lst;
4052
- } else {
4053
- return null;
4054
4136
  }
4137
+ return _this._getFromPersistence(mpid, 'lst');
4055
4138
  };
4056
4139
  this.setLastSeenTime = function (mpid, _time) {
4057
4140
  if (!mpid) {
4058
4141
  return;
4059
4142
  }
4060
4143
  var time = _time || new Date().getTime();
4061
- if (_this.persistenceData) {
4062
- if (!_this.persistenceData[mpid]) {
4063
- _this.persistenceData[mpid] = {};
4064
- }
4065
- if (!_this.persistenceData[mpid].lst) {
4066
- _this.persistenceData[mpid].lst = time;
4067
- mpInstance._Persistence.savePersistence(_this.persistenceData);
4068
- }
4144
+ _this._setPersistence(mpid, 'lst', time);
4145
+ };
4146
+ this.syncPersistenceData = function () {
4147
+ var persistenceData = mpInstance._Persistence.getPersistence();
4148
+ _this.persistenceData = mpInstance._Helpers.extend({}, _this.persistenceData, persistenceData);
4149
+ };
4150
+ this.addMpidToSessionHistory = function (mpid, previousMPID) {
4151
+ var indexOfMPID = _this.currentSessionMPIDs.indexOf(mpid);
4152
+ if (mpid && previousMPID !== mpid && indexOfMPID < 0) {
4153
+ _this.currentSessionMPIDs.push(mpid);
4154
+ return;
4155
+ }
4156
+ if (indexOfMPID >= 0) {
4157
+ _this.currentSessionMPIDs = moveElementToEnd(_this.currentSessionMPIDs, indexOfMPID);
4069
4158
  }
4070
4159
  };
4071
4160
  this.nullifySession = function () {
@@ -4933,23 +5022,6 @@ var mParticle = (function () {
4933
5022
  self.savePersistence(persistence);
4934
5023
  }
4935
5024
  };
4936
- this.saveUserConsentStateToCookies = function (mpid, consentState) {
4937
- //it's currently not supported to set persistence
4938
- //for any MPID that's not the current one.
4939
- if (consentState || consentState === null) {
4940
- var persistence = self.getPersistence();
4941
- if (persistence) {
4942
- if (persistence[mpid]) {
4943
- persistence[mpid].con = mpInstance._Consent.ConsentSerialization.toMinifiedJsonObject(consentState);
4944
- } else {
4945
- persistence[mpid] = {
4946
- con: mpInstance._Consent.ConsentSerialization.toMinifiedJsonObject(consentState)
4947
- };
4948
- }
4949
- self.savePersistence(persistence);
4950
- }
4951
- }
4952
- };
4953
5025
  this.swapCurrentUser = function (previousMPID, currentMPID, currentSessionMPIDs) {
4954
5026
  if (previousMPID && currentMPID && previousMPID !== currentMPID) {
4955
5027
  var persistence = self.getPersistence();
@@ -4987,14 +5059,6 @@ var mParticle = (function () {
4987
5059
  var persistence = this.useLocalStorage() ? this.getLocalStorage() : this.getCookie();
4988
5060
  return persistence;
4989
5061
  };
4990
- this.getConsentState = function (mpid) {
4991
- var persistence = self.getPersistence();
4992
- if (persistence && persistence[mpid] && persistence[mpid].con) {
4993
- return mpInstance._Consent.ConsentSerialization.fromMinifiedJsonObject(persistence[mpid].con);
4994
- } else {
4995
- return null;
4996
- }
4997
- };
4998
5062
  this.getFirstSeenTime = function (mpid) {
4999
5063
  if (!mpid) {
5000
5064
  return null;
@@ -5429,11 +5493,11 @@ var mParticle = (function () {
5429
5493
  };
5430
5494
  }
5431
5495
 
5432
- var _Constants$IdentityMe$1 = Constants.IdentityMethods,
5433
- Modify$3 = _Constants$IdentityMe$1.Modify,
5434
- Identify$2 = _Constants$IdentityMe$1.Identify,
5435
- Login$2 = _Constants$IdentityMe$1.Login,
5436
- Logout$2 = _Constants$IdentityMe$1.Logout;
5496
+ var _Constants$IdentityMe = Constants.IdentityMethods,
5497
+ Modify$3 = _Constants$IdentityMe.Modify,
5498
+ Identify$2 = _Constants$IdentityMe.Identify,
5499
+ Login$2 = _Constants$IdentityMe.Login,
5500
+ Logout$2 = _Constants$IdentityMe.Logout;
5437
5501
  function Forwarders(mpInstance, kitBlocker) {
5438
5502
  var self = this;
5439
5503
  var UserAttributeActionTypes = {
@@ -5907,7 +5971,7 @@ var mParticle = (function () {
5907
5971
  }
5908
5972
 
5909
5973
  // TODO: This file is no longer the server model because the web SDK payload
5910
- var MessageType$1 = Types.MessageType;
5974
+ var MessageType = Types.MessageType;
5911
5975
  var ApplicationTransitionType = Types.ApplicationTransitionType;
5912
5976
  // TODO: Make this a pure function that returns a new object
5913
5977
  function convertCustomFlags(event, dto) {
@@ -6090,7 +6154,7 @@ var mParticle = (function () {
6090
6154
  CurrencyCode: mpInstance._Store.currencyCode,
6091
6155
  DataPlan: mpInstance._Store.SDKConfig.dataPlan ? mpInstance._Store.SDKConfig.dataPlan : {}
6092
6156
  };
6093
- if (eventObject.EventDataType === MessageType$1.AppStateTransition) {
6157
+ if (eventObject.EventDataType === MessageType.AppStateTransition) {
6094
6158
  eventObject.IsFirstRun = mpInstance._Store.isFirstRun;
6095
6159
  eventObject.LaunchReferral = window.location.href || null;
6096
6160
  }
@@ -6150,7 +6214,7 @@ var mParticle = (function () {
6150
6214
  if (consent) {
6151
6215
  dto.con = consent;
6152
6216
  }
6153
- if (event.EventDataType === MessageType$1.AppStateTransition) {
6217
+ if (event.EventDataType === MessageType.AppStateTransition) {
6154
6218
  dto.fr = event.IsFirstRun;
6155
6219
  dto.iu = false;
6156
6220
  dto.at = ApplicationTransitionType.AppInit;
@@ -6162,7 +6226,7 @@ var mParticle = (function () {
6162
6226
  if (event.CustomFlags) {
6163
6227
  convertCustomFlags(event, dto);
6164
6228
  }
6165
- if (event.EventDataType === MessageType$1.Commerce) {
6229
+ if (event.EventDataType === MessageType.Commerce) {
6166
6230
  dto.cu = event.CurrencyCode;
6167
6231
  // TODO: If Cart is deprecated, we should deprecate this too
6168
6232
  if (event.ShoppingCart) {
@@ -6203,7 +6267,7 @@ var mParticle = (function () {
6203
6267
  };
6204
6268
  });
6205
6269
  }
6206
- } else if (event.EventDataType === MessageType$1.Profile) {
6270
+ } else if (event.EventDataType === MessageType.Profile) {
6207
6271
  dto.pet = event.ProfileMessageType;
6208
6272
  }
6209
6273
  return dto;
@@ -6462,16 +6526,28 @@ var mParticle = (function () {
6462
6526
  return AudienceManager;
6463
6527
  }();
6464
6528
 
6529
+ function hasMPIDAndUserLoginChanged(previousUser, newUser) {
6530
+ return !previousUser || newUser.getMPID() !== previousUser.getMPID() || previousUser.isLoggedIn() !== newUser.isLoggedIn();
6531
+ }
6532
+ // https://go.mparticle.com/work/SQDSDKS-6504
6533
+ function hasMPIDChanged(prevUser, identityApiResult) {
6534
+ return !prevUser || prevUser.getMPID() && identityApiResult.mpid && identityApiResult.mpid !== prevUser.getMPID();
6535
+ }
6536
+
6465
6537
  var Messages$2 = Constants.Messages,
6466
6538
  HTTPCodes$2 = Constants.HTTPCodes,
6467
- FeatureFlags$1 = Constants.FeatureFlags;
6539
+ FeatureFlags$1 = Constants.FeatureFlags,
6540
+ IdentityMethods = Constants.IdentityMethods;
6468
6541
  var ErrorMessages = Messages$2.ErrorMessages;
6469
- var _Constants$IdentityMe = Constants.IdentityMethods,
6470
- Identify = _Constants$IdentityMe.Identify,
6471
- Modify$1 = _Constants$IdentityMe.Modify,
6472
- Login = _Constants$IdentityMe.Login,
6473
- Logout = _Constants$IdentityMe.Logout;
6542
+ var CacheIdentity = FeatureFlags$1.CacheIdentity;
6543
+ var Identify = IdentityMethods.Identify,
6544
+ Modify$1 = IdentityMethods.Modify,
6545
+ Login = IdentityMethods.Login,
6546
+ Logout = IdentityMethods.Logout;
6474
6547
  function Identity(mpInstance) {
6548
+ var _mpInstance$_Helpers = mpInstance._Helpers,
6549
+ getFeatureFlag = _mpInstance$_Helpers.getFeatureFlag,
6550
+ extend = _mpInstance$_Helpers.extend;
6475
6551
  var self = this;
6476
6552
  this.idCache = null;
6477
6553
  this.audienceManager = null;
@@ -6533,7 +6609,7 @@ var mParticle = (function () {
6533
6609
  createIdentityChanges: function createIdentityChanges(previousIdentities, newIdentities) {
6534
6610
  var identityChanges = [];
6535
6611
  var key;
6536
- if (newIdentities && mpInstance._Helpers.isObject(newIdentities) && previousIdentities && mpInstance._Helpers.isObject(previousIdentities)) {
6612
+ if (newIdentities && isObject(newIdentities) && previousIdentities && isObject(previousIdentities)) {
6537
6613
  for (key in newIdentities) {
6538
6614
  identityChanges.push({
6539
6615
  old_value: previousIdentities[key] || null,
@@ -6547,7 +6623,7 @@ var mParticle = (function () {
6547
6623
  // takes 2 UI objects keyed by name, combines them, returns them keyed by type
6548
6624
  combineUserIdentities: function combineUserIdentities(previousUIByName, newUIByName) {
6549
6625
  var combinedUIByType = {};
6550
- var combinedUIByName = mpInstance._Helpers.extend(previousUIByName, newUIByName);
6626
+ var combinedUIByName = extend({}, previousUIByName, newUIByName);
6551
6627
  for (var key in combinedUIByName) {
6552
6628
  var type = Types.IdentityType.getIdentityType(key);
6553
6629
  // this check removes anything that is not whitelisted as an identity type
@@ -7024,7 +7100,7 @@ var mParticle = (function () {
7024
7100
  */
7025
7101
  setUserAttributes: function setUserAttributes(userAttributes) {
7026
7102
  mpInstance._SessionManager.resetSessionTimer();
7027
- if (mpInstance._Helpers.isObject(userAttributes)) {
7103
+ if (isObject(userAttributes)) {
7028
7104
  if (mpInstance._Helpers.canLog()) {
7029
7105
  for (var key in userAttributes) {
7030
7106
  if (userAttributes.hasOwnProperty(key)) {
@@ -7207,7 +7283,7 @@ var mParticle = (function () {
7207
7283
  * @return a ConsentState object
7208
7284
  */
7209
7285
  getConsentState: function getConsentState() {
7210
- return mpInstance._Persistence.getConsentState(mpid);
7286
+ return mpInstance._Store.getConsentState(mpid);
7211
7287
  },
7212
7288
  /**
7213
7289
  * Sets the Consent State stored locally for this user.
@@ -7215,7 +7291,7 @@ var mParticle = (function () {
7215
7291
  * @param {Object} consent state
7216
7292
  */
7217
7293
  setConsentState: function setConsentState(state) {
7218
- mpInstance._Persistence.saveUserConsentStateToCookies(mpid, state);
7294
+ mpInstance._Store.setConsentState(mpid, state);
7219
7295
  mpInstance._Forwarders.initForwarders(this.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats);
7220
7296
  mpInstance._CookieSyncManager.attemptCookieSync(null, this.getMPID());
7221
7297
  },
@@ -7368,72 +7444,62 @@ var mParticle = (function () {
7368
7444
 
7369
7445
  // https://go.mparticle.com/work/SQDSDKS-6355
7370
7446
  this.parseIdentityResponse = function (xhr, previousMPID, callback, identityApiData, method, knownIdentities, parsingCachedResponse) {
7371
- var prevUser = mpInstance.Identity.getUser(previousMPID),
7372
- newUser,
7373
- mpidIsNotInCookies,
7374
- identityApiResult,
7375
- indexOfMPID,
7376
- newIdentitiesByType = {},
7377
- previousUIByName = prevUser ? prevUser.getUserIdentities().userIdentities : {},
7378
- previousUIByNameCopy = mpInstance._Helpers.extend({}, previousUIByName);
7447
+ var prevUser = mpInstance.Identity.getUser(previousMPID);
7448
+ var prevUserMPID = prevUser ? prevUser.getMPID() : null;
7449
+ var previousUIByName = prevUser ? prevUser.getUserIdentities().userIdentities : {};
7450
+ var mpidIsNotInCookies;
7451
+ var identityApiResult;
7452
+ var newUser;
7453
+ var newIdentitiesByType = {};
7379
7454
  mpInstance._Store.identityCallInFlight = false;
7380
7455
  try {
7456
+ var _identityApiResult;
7381
7457
  mpInstance.Logger.verbose('Parsing "' + method + '" identity response from server');
7382
- if (xhr.responseText) {
7383
- identityApiResult = JSON.parse(xhr.responseText);
7384
- if (identityApiResult.hasOwnProperty('is_logged_in')) {
7385
- mpInstance._Store.isLoggedIn = identityApiResult.is_logged_in;
7386
- }
7387
- }
7458
+ identityApiResult = xhr.responseText ? JSON.parse(xhr.responseText) : null;
7459
+ mpInstance._Store.isLoggedIn = ((_identityApiResult = identityApiResult) === null || _identityApiResult === void 0 ? void 0 : _identityApiResult.is_logged_in) || false;
7388
7460
 
7461
+ // https://go.mparticle.com/work/SQDSDKS-6504
7389
7462
  // set currentUser
7390
- if (!prevUser || prevUser.getMPID() && identityApiResult.mpid && identityApiResult.mpid !== prevUser.getMPID()) {
7463
+ if (hasMPIDChanged(prevUser, identityApiResult)) {
7391
7464
  mpInstance._Store.mpid = identityApiResult.mpid;
7392
7465
  if (prevUser) {
7393
7466
  // https://go.mparticle.com/work/SQDSDKS-6329
7394
7467
  mpInstance._Persistence.setLastSeenTime(previousMPID);
7395
7468
  }
7396
- if (!mpInstance._Persistence.getFirstSeenTime(identityApiResult.mpid)) mpidIsNotInCookies = true;
7469
+ mpidIsNotInCookies = !mpInstance._Persistence.getFirstSeenTime(identityApiResult.mpid);
7470
+
7471
+ // https://go.mparticle.com/work/SQDSDKS-6329
7397
7472
  mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid);
7398
7473
  }
7399
7474
  if (xhr.status === 200) {
7400
- if (mpInstance._Helpers.getFeatureFlag(Constants.FeatureFlags.CacheIdentity)) {
7475
+ if (getFeatureFlag(CacheIdentity)) {
7401
7476
  cacheOrClearIdCache(method, knownIdentities, self.idCache, xhr, parsingCachedResponse);
7402
7477
  }
7478
+ var incomingUser = self.IdentityAPI.getUser(identityApiResult.mpid);
7479
+ var incomingUIByName = incomingUser ? incomingUser.getUserIdentities().userIdentities : {};
7403
7480
  if (method === Modify$1) {
7404
7481
  newIdentitiesByType = mpInstance._Identity.IdentityRequest.combineUserIdentities(previousUIByName, identityApiData.userIdentities);
7405
7482
  mpInstance._Persistence.saveUserIdentitiesToPersistence(previousMPID, newIdentitiesByType);
7406
7483
  } else {
7407
- var incomingUser = self.IdentityAPI.getUser(identityApiResult.mpid);
7408
- var incomingMpidUIByName = incomingUser ? incomingUser.getUserIdentities().userIdentities : {};
7409
- var incomingMpidUIByNameCopy = mpInstance._Helpers.extend({}, incomingMpidUIByName);
7410
- mpInstance.Logger.verbose('Successfully parsed Identity Response');
7411
-
7412
7484
  // https://go.mparticle.com/work/SQDSDKS-6356
7413
7485
  //this covers an edge case where, users stored before "firstSeenTime" was introduced
7414
7486
  //will not have a value for "fst" until the current MPID changes, and in some cases,
7415
7487
  //the current MPID will never change
7416
- if (method === Identify && prevUser && identityApiResult.mpid === prevUser.getMPID()) {
7488
+ if (method === Identify && prevUser && identityApiResult.mpid === prevUserMPID) {
7417
7489
  // https://go.mparticle.com/work/SQDSDKS-6329
7418
7490
  mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid);
7419
7491
  }
7420
- indexOfMPID = mpInstance._Store.currentSessionMPIDs.indexOf(identityApiResult.mpid);
7421
- if (mpInstance._Store.sessionId && identityApiResult.mpid && previousMPID !== identityApiResult.mpid && indexOfMPID < 0) {
7422
- mpInstance._Store.currentSessionMPIDs.push(identityApiResult.mpid);
7423
- }
7424
- if (indexOfMPID > -1) {
7425
- mpInstance._Store.currentSessionMPIDs = mpInstance._Store.currentSessionMPIDs.slice(0, indexOfMPID).concat(mpInstance._Store.currentSessionMPIDs.slice(indexOfMPID + 1, mpInstance._Store.currentSessionMPIDs.length));
7426
- mpInstance._Store.currentSessionMPIDs.push(identityApiResult.mpid);
7427
- }
7492
+ mpInstance._Store.addMpidToSessionHistory(identityApiResult.mpid, previousMPID);
7428
7493
  mpInstance._CookieSyncManager.attemptCookieSync(previousMPID, identityApiResult.mpid, mpidIsNotInCookies);
7429
7494
  mpInstance._Persistence.swapCurrentUser(previousMPID, identityApiResult.mpid, mpInstance._Store.currentSessionMPIDs);
7430
- if (identityApiData && identityApiData.userIdentities && Object.keys(identityApiData.userIdentities).length) {
7431
- newIdentitiesByType = self.IdentityRequest.combineUserIdentities(incomingMpidUIByName, identityApiData.userIdentities);
7495
+ if (identityApiData && !isEmpty(identityApiData.userIdentities)) {
7496
+ newIdentitiesByType = self.IdentityRequest.combineUserIdentities(incomingUIByName, identityApiData.userIdentities);
7432
7497
  }
7433
7498
 
7434
7499
  // https://go.mparticle.com/work/SQDSDKS-6041
7435
7500
  mpInstance._Persistence.saveUserIdentitiesToPersistence(identityApiResult.mpid, newIdentitiesByType);
7436
7501
  mpInstance._Persistence.update();
7502
+ mpInstance._Store.syncPersistenceData();
7437
7503
  mpInstance._Persistence.findPrevCookiesBasedOnUI(identityApiData);
7438
7504
 
7439
7505
  // https://go.mparticle.com/work/SQDSDKS-6357
@@ -7442,43 +7508,27 @@ var mParticle = (function () {
7442
7508
  newUser = mpInstance.Identity.getCurrentUser();
7443
7509
 
7444
7510
  // https://go.mparticle.com/work/SQDSDKS-6359
7445
- if (identityApiData && identityApiData.onUserAlias && mpInstance._Helpers.Validators.isFunction(identityApiData.onUserAlias)) {
7446
- try {
7447
- mpInstance.Logger.warning('Deprecated function onUserAlias will be removed in future releases');
7448
- identityApiData.onUserAlias(prevUser, newUser);
7449
- } catch (e) {
7450
- mpInstance.Logger.error('There was an error with your onUserAlias function - ' + e);
7451
- }
7452
- }
7511
+ tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger);
7453
7512
  var persistence = mpInstance._Persistence.getPersistence();
7454
7513
  if (newUser) {
7455
7514
  mpInstance._Persistence.storeDataInMemory(persistence, newUser.getMPID());
7456
- if (!prevUser || newUser.getMPID() !== prevUser.getMPID() || prevUser.isLoggedIn() !== newUser.isLoggedIn()) {
7457
- mpInstance._Forwarders.initForwarders(newUser.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats);
7458
- }
7459
-
7460
- // TODO: https://go.mparticle.com/work/SQDSDKS-6036
7461
- mpInstance._Forwarders.setForwarderUserIdentities(newUser.getUserIdentities().userIdentities);
7462
- mpInstance._Forwarders.setForwarderOnIdentityComplete(newUser, method);
7463
- mpInstance._Forwarders.setForwarderOnUserIdentified(newUser);
7515
+ self.reinitForwardersOnUserChange(prevUser, newUser);
7516
+ self.setForwarderCallbacks(newUser, method);
7464
7517
  }
7465
- var newIdentitiesByName = {};
7466
- for (var key in newIdentitiesByType) {
7467
- newIdentitiesByName[Types.IdentityType.getIdentityName(mpInstance._Helpers.parseNumber(key))] = newIdentitiesByType[key];
7468
- }
7469
- self.sendUserIdentityChangeEvent(newIdentitiesByName, method, identityApiResult.mpid, method === Modify$1 ? previousUIByNameCopy : incomingMpidUIByNameCopy);
7518
+ var newIdentitiesByName = getNewIdentitiesByName(newIdentitiesByType);
7519
+ var uiByName = method === Modify$1 ? previousUIByName : incomingUIByName;
7520
+
7521
+ // https://go.mparticle.com/work/SQDSDKS-6501
7522
+ self.sendUserIdentityChangeEvent(newIdentitiesByName, method, identityApiResult.mpid, uiByName);
7470
7523
  }
7471
7524
  if (callback) {
7472
- if (xhr.status === 0) {
7473
- mpInstance._Helpers.invokeCallback(callback, HTTPCodes$2.noHttpCoverage, identityApiResult || null, newUser);
7474
- } else {
7475
- mpInstance._Helpers.invokeCallback(callback, xhr.status, identityApiResult || null, newUser);
7476
- }
7477
- } else {
7478
- if (identityApiResult && identityApiResult.errors && identityApiResult.errors.length) {
7479
- mpInstance.Logger.error('Received HTTP response code of ' + xhr.status + ' - ' + identityApiResult.errors[0].message);
7480
- }
7525
+ var callbackCode = xhr.status === 0 ? HTTPCodes$2.noHttpCoverage : xhr.status;
7526
+ mpInstance._Helpers.invokeCallback(callback, callbackCode, identityApiResult || null, newUser);
7527
+ } else if (identityApiResult && !isEmpty(identityApiResult.errors)) {
7528
+ // https://go.mparticle.com/work/SQDSDKS-6500
7529
+ mpInstance.Logger.error('Received HTTP response code of ' + xhr.status + ' - ' + identityApiResult.errors[0].message);
7481
7530
  }
7531
+ mpInstance.Logger.verbose('Successfully parsed Identity Response');
7482
7532
  mpInstance._APIClient.processQueuedEvents();
7483
7533
  } catch (e) {
7484
7534
  if (callback) {
@@ -7491,26 +7541,29 @@ var mParticle = (function () {
7491
7541
  // send a user identity change request on identify, login, logout, modify when any values change.
7492
7542
  // compare what identities exist vs what is previously was for the specific user if they were in memory before.
7493
7543
  // if it's the first time the user is logging in, send a user identity change request with
7494
-
7495
7544
  this.sendUserIdentityChangeEvent = function (newUserIdentities, method, mpid, prevUserIdentities) {
7496
- var currentUserInMemory, userIdentityChangeEvent;
7497
7545
  if (!mpid) {
7546
+ // https://go.mparticle.com/work/SQDSDKS-6501
7498
7547
  if (method !== Modify$1) {
7499
7548
  return;
7500
7549
  }
7501
7550
  }
7502
7551
 
7503
7552
  // https://go.mparticle.com/work/SQDSDKS-6354
7504
- currentUserInMemory = this.IdentityAPI.getUser(mpid);
7553
+ var currentUserInMemory = this.IdentityAPI.getUser(mpid);
7505
7554
  for (var identityType in newUserIdentities) {
7555
+ // Verifies a change actually happened
7506
7556
  if (prevUserIdentities[identityType] !== newUserIdentities[identityType]) {
7557
+ // If a new identity type was introduced when the identity changes
7558
+ // we need to notify the server so that the user profile is updated in
7559
+ // the mParticle UI.
7507
7560
  var isNewUserIdentityType = !prevUserIdentities[identityType];
7508
- userIdentityChangeEvent = self.createUserIdentityChange(identityType, newUserIdentities[identityType], prevUserIdentities[identityType], isNewUserIdentityType, currentUserInMemory);
7561
+ var userIdentityChangeEvent = self.createUserIdentityChange(identityType, newUserIdentities[identityType], prevUserIdentities[identityType], isNewUserIdentityType, currentUserInMemory);
7509
7562
  mpInstance._APIClient.sendEventToServer(userIdentityChangeEvent);
7510
7563
  }
7511
7564
  }
7512
7565
  };
7513
- this.createUserIdentityChange = function (identityType, newIdentity, oldIdentity, newCreatedThisBatch, userInMemory) {
7566
+ this.createUserIdentityChange = function (identityType, newIdentity, oldIdentity, isIdentityTypeNewToBatch, userInMemory) {
7514
7567
  var userIdentityChangeEvent;
7515
7568
 
7516
7569
  // https://go.mparticle.com/work/SQDSDKS-6439
@@ -7520,7 +7573,7 @@ var mParticle = (function () {
7520
7573
  New: {
7521
7574
  IdentityType: identityType,
7522
7575
  Identity: newIdentity,
7523
- CreatedThisBatch: newCreatedThisBatch
7576
+ CreatedThisBatch: isIdentityTypeNewToBatch
7524
7577
  },
7525
7578
  Old: {
7526
7579
  IdentityType: identityType,
@@ -7558,6 +7611,29 @@ var mParticle = (function () {
7558
7611
  }
7559
7612
  return userAttributeChangeEvent;
7560
7613
  };
7614
+ this.reinitForwardersOnUserChange = function (prevUser, newUser) {
7615
+ if (hasMPIDAndUserLoginChanged(prevUser, newUser)) {
7616
+ mpInstance._Forwarders.initForwarders(newUser.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats);
7617
+ }
7618
+ };
7619
+ this.setForwarderCallbacks = function (user, method) {
7620
+ // https://go.mparticle.com/work/SQDSDKS-6036
7621
+ mpInstance._Forwarders.setForwarderUserIdentities(user.getUserIdentities().userIdentities);
7622
+ mpInstance._Forwarders.setForwarderOnIdentityComplete(user, method);
7623
+ mpInstance._Forwarders.setForwarderOnUserIdentified(user);
7624
+ };
7625
+ }
7626
+
7627
+ // https://go.mparticle.com/work/SQDSDKS-6359
7628
+ function tryOnUserAlias(previousUser, newUser, identityApiData, logger) {
7629
+ if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) {
7630
+ try {
7631
+ logger.warning(generateDeprecationMessage('onUserAlias'));
7632
+ identityApiData.onUserAlias(previousUser, newUser);
7633
+ } catch (e) {
7634
+ logger.error('There was an error with your onUserAlias function - ' + e);
7635
+ }
7636
+ }
7561
7637
  }
7562
7638
 
7563
7639
  var CCPAPurpose = Constants.CCPAPurpose;
@@ -9396,6 +9472,7 @@ var mParticle = (function () {
9396
9472
 
9397
9473
  // Load any settings/identities/attributes from cookie or localStorage
9398
9474
  mpInstance._Persistence.initializeStorage();
9475
+ mpInstance._Store.syncPersistenceData();
9399
9476
 
9400
9477
  // Set up user identitiy variables for later use
9401
9478
  var currentUser = mpInstance.Identity.getCurrentUser();
@@ -9711,60 +9788,6 @@ var mParticle = (function () {
9711
9788
  return _BatchValidator;
9712
9789
  }();
9713
9790
 
9714
- var EventTypeEnum;
9715
- (function (EventTypeEnum) {
9716
- EventTypeEnum[EventTypeEnum["Unknown"] = 0] = "Unknown";
9717
- EventTypeEnum[EventTypeEnum["Navigation"] = 1] = "Navigation";
9718
- EventTypeEnum[EventTypeEnum["Location"] = 2] = "Location";
9719
- EventTypeEnum[EventTypeEnum["Search"] = 3] = "Search";
9720
- EventTypeEnum[EventTypeEnum["Transaction"] = 4] = "Transaction";
9721
- EventTypeEnum[EventTypeEnum["UserContent"] = 5] = "UserContent";
9722
- EventTypeEnum[EventTypeEnum["UserPreference"] = 6] = "UserPreference";
9723
- EventTypeEnum[EventTypeEnum["Social"] = 7] = "Social";
9724
- EventTypeEnum[EventTypeEnum["Other"] = 8] = "Other";
9725
- EventTypeEnum[EventTypeEnum["Media"] = 9] = "Media";
9726
- })(EventTypeEnum || (EventTypeEnum = {}));
9727
- // TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403
9728
- var MessageType;
9729
- (function (MessageType) {
9730
- MessageType[MessageType["SessionStart"] = 1] = "SessionStart";
9731
- MessageType[MessageType["SessionEnd"] = 2] = "SessionEnd";
9732
- MessageType[MessageType["PageView"] = 3] = "PageView";
9733
- MessageType[MessageType["PageEvent"] = 4] = "PageEvent";
9734
- MessageType[MessageType["CrashReport"] = 5] = "CrashReport";
9735
- MessageType[MessageType["OptOut"] = 6] = "OptOut";
9736
- MessageType[MessageType["AppStateTransition"] = 10] = "AppStateTransition";
9737
- MessageType[MessageType["Profile"] = 14] = "Profile";
9738
- MessageType[MessageType["Commerce"] = 16] = "Commerce";
9739
- MessageType[MessageType["UserAttributeChange"] = 17] = "UserAttributeChange";
9740
- MessageType[MessageType["UserIdentityChange"] = 18] = "UserIdentityChange";
9741
- MessageType[MessageType["Media"] = 20] = "Media";
9742
- })(MessageType || (MessageType = {}));
9743
- var IdentityType;
9744
- (function (IdentityType) {
9745
- IdentityType[IdentityType["Other"] = 0] = "Other";
9746
- IdentityType[IdentityType["CustomerId"] = 1] = "CustomerId";
9747
- IdentityType[IdentityType["Facebook"] = 2] = "Facebook";
9748
- IdentityType[IdentityType["Twitter"] = 3] = "Twitter";
9749
- IdentityType[IdentityType["Google"] = 4] = "Google";
9750
- IdentityType[IdentityType["Microsoft"] = 5] = "Microsoft";
9751
- IdentityType[IdentityType["Yahoo"] = 6] = "Yahoo";
9752
- IdentityType[IdentityType["Email"] = 7] = "Email";
9753
- IdentityType[IdentityType["FacebookCustomAudienceId"] = 9] = "FacebookCustomAudienceId";
9754
- IdentityType[IdentityType["Other2"] = 10] = "Other2";
9755
- IdentityType[IdentityType["Other3"] = 11] = "Other3";
9756
- IdentityType[IdentityType["Other4"] = 12] = "Other4";
9757
- IdentityType[IdentityType["Other5"] = 13] = "Other5";
9758
- IdentityType[IdentityType["Other6"] = 14] = "Other6";
9759
- IdentityType[IdentityType["Other7"] = 15] = "Other7";
9760
- IdentityType[IdentityType["Other8"] = 16] = "Other8";
9761
- IdentityType[IdentityType["Other9"] = 17] = "Other9";
9762
- IdentityType[IdentityType["Other10"] = 18] = "Other10";
9763
- IdentityType[IdentityType["MobileNumber"] = 19] = "MobileNumber";
9764
- IdentityType[IdentityType["PhoneNumber2"] = 20] = "PhoneNumber2";
9765
- IdentityType[IdentityType["PhoneNumber3"] = 21] = "PhoneNumber3";
9766
- })(IdentityType || (IdentityType = {}));
9767
-
9768
9791
  var MPSideloadedKit = /** @class */function () {
9769
9792
  function MPSideloadedKit(unregisteredKitInstance) {
9770
9793
  this.filterDictionary = {