@mparticle/web-sdk 2.68.0 → 2.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mparticle.common.js +53 -52
- package/dist/mparticle.esm.js +53 -52
- package/dist/mparticle.js +168 -277
- package/dist/types/src/ecommerce.d.ts +1 -1
- package/dist/types/src/forwarders.d.ts +0 -1
- package/dist/types/src/public-types.d.ts +1 -1
- package/dist/types/src/reporting/deprecatedMethodLogger.d.ts +8 -0
- package/dist/types/src/reporting/types.d.ts +1 -0
- package/dist/types/src/sdkRuntimeModels.d.ts +11 -2
- package/dist/types/src/stub/mparticle.stub.d.ts +1 -0
- package/dist/types/src/types.d.ts +47 -2
- package/package.json +1 -1
- package/src/batchUploader.ts +0 -12
- package/src/consent.ts +8 -2
- package/src/ecommerce.js +28 -0
- package/src/events.js +7 -0
- package/src/forwarders.js +0 -58
- package/src/identity.js +77 -33
- package/src/mp-instance.ts +60 -29
- package/src/mparticle-instance-manager.ts +2 -1
- package/src/public-types.ts +2 -0
- package/src/reporting/deprecatedMethodLogger.ts +19 -0
- package/src/reporting/types.ts +1 -0
- package/src/sdkRuntimeModels.ts +10 -0
- package/src/sessionManager.ts +12 -6
- package/src/stub/mparticle.stub.js +1 -0
- package/src/types.ts +75 -0
package/dist/mparticle.js
CHANGED
|
@@ -203,7 +203,7 @@ var mParticle = (function () {
|
|
|
203
203
|
Base64: Base64$1
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
var version = "2.
|
|
206
|
+
var version = "2.70.0";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -1293,6 +1293,18 @@ var mParticle = (function () {
|
|
|
1293
1293
|
Refund: 8,
|
|
1294
1294
|
AddToWishlist: 9,
|
|
1295
1295
|
RemoveFromWishlist: 10,
|
|
1296
|
+
// Rokt Brain commerce-adjacent types
|
|
1297
|
+
ViewCart: 11,
|
|
1298
|
+
AddShippingInfo: 12,
|
|
1299
|
+
AddPaymentInfo: 13,
|
|
1300
|
+
PaymentMethodSelected: 14,
|
|
1301
|
+
PaymentAttempted: 15,
|
|
1302
|
+
PaymentSucceeded: 16,
|
|
1303
|
+
PaymentFailed: 17,
|
|
1304
|
+
RefundInitiated: 18,
|
|
1305
|
+
isRoktCommerceType: function isRoktCommerceType(id) {
|
|
1306
|
+
return id >= ProductActionType.ViewCart && id <= ProductActionType.RefundInitiated;
|
|
1307
|
+
},
|
|
1296
1308
|
getName: function getName(id) {
|
|
1297
1309
|
switch (id) {
|
|
1298
1310
|
case ProductActionType.AddToCart:
|
|
@@ -1315,6 +1327,22 @@ var mParticle = (function () {
|
|
|
1315
1327
|
return 'Add to Wishlist';
|
|
1316
1328
|
case ProductActionType.RemoveFromWishlist:
|
|
1317
1329
|
return 'Remove from Wishlist';
|
|
1330
|
+
case ProductActionType.ViewCart:
|
|
1331
|
+
return 'View Cart';
|
|
1332
|
+
case ProductActionType.AddShippingInfo:
|
|
1333
|
+
return 'Add Shipping Info';
|
|
1334
|
+
case ProductActionType.AddPaymentInfo:
|
|
1335
|
+
return 'Add Payment Info';
|
|
1336
|
+
case ProductActionType.PaymentMethodSelected:
|
|
1337
|
+
return 'Payment Method Selected';
|
|
1338
|
+
case ProductActionType.PaymentAttempted:
|
|
1339
|
+
return 'Payment Attempted';
|
|
1340
|
+
case ProductActionType.PaymentSucceeded:
|
|
1341
|
+
return 'Payment Succeeded';
|
|
1342
|
+
case ProductActionType.PaymentFailed:
|
|
1343
|
+
return 'Payment Failed';
|
|
1344
|
+
case ProductActionType.RefundInitiated:
|
|
1345
|
+
return 'Refund Initiated';
|
|
1318
1346
|
default:
|
|
1319
1347
|
return 'Unknown';
|
|
1320
1348
|
}
|
|
@@ -1342,11 +1370,40 @@ var mParticle = (function () {
|
|
|
1342
1370
|
return 'add_to_wishlist';
|
|
1343
1371
|
case ProductActionType.RemoveFromWishlist:
|
|
1344
1372
|
return 'remove_from_wishlist';
|
|
1373
|
+
case ProductActionType.ViewCart:
|
|
1374
|
+
return 'view_cart';
|
|
1375
|
+
case ProductActionType.AddShippingInfo:
|
|
1376
|
+
return 'add_shipping_info';
|
|
1377
|
+
case ProductActionType.AddPaymentInfo:
|
|
1378
|
+
return 'add_payment_info';
|
|
1379
|
+
case ProductActionType.PaymentMethodSelected:
|
|
1380
|
+
return 'payment_method_selected';
|
|
1381
|
+
case ProductActionType.PaymentAttempted:
|
|
1382
|
+
return 'payment_attempted';
|
|
1383
|
+
case ProductActionType.PaymentSucceeded:
|
|
1384
|
+
return 'payment_succeeded';
|
|
1385
|
+
case ProductActionType.PaymentFailed:
|
|
1386
|
+
return 'payment_failed';
|
|
1387
|
+
case ProductActionType.RefundInitiated:
|
|
1388
|
+
return 'refund_initiated';
|
|
1345
1389
|
default:
|
|
1346
1390
|
return 'unknown';
|
|
1347
1391
|
}
|
|
1348
1392
|
}
|
|
1349
1393
|
};
|
|
1394
|
+
var RoktEvents = {
|
|
1395
|
+
SignUp: 'sign_up',
|
|
1396
|
+
Subscribe: 'subscribe',
|
|
1397
|
+
StartTrial: 'start_trial',
|
|
1398
|
+
GenerateLead: 'generate_lead',
|
|
1399
|
+
Search: 'search',
|
|
1400
|
+
Upsell: 'upsell',
|
|
1401
|
+
EarnVirtualCurrency: 'earn_virtual_currency',
|
|
1402
|
+
DwellTime: 'dwell_time',
|
|
1403
|
+
Hover: 'hover',
|
|
1404
|
+
Scroll: 'scroll',
|
|
1405
|
+
ClickToExpand: 'click_to_expand'
|
|
1406
|
+
};
|
|
1350
1407
|
var PromotionActionType = {
|
|
1351
1408
|
Unknown: 0,
|
|
1352
1409
|
PromotionView: 1,
|
|
@@ -1384,131 +1441,6 @@ var mParticle = (function () {
|
|
|
1384
1441
|
JointSdkSelectPlacements: 'mp:jointSdkSelectPlacements',
|
|
1385
1442
|
JointSdkRoktKitInit: 'mp:jointSdkRoktKitInit'
|
|
1386
1443
|
};
|
|
1387
|
-
function getMessageTypeFromEventType(eventType) {
|
|
1388
|
-
switch (eventType) {
|
|
1389
|
-
case 'custom_event':
|
|
1390
|
-
return MessageType$1.PageEvent;
|
|
1391
|
-
case 'screen_view':
|
|
1392
|
-
return MessageType$1.PageView;
|
|
1393
|
-
case 'commerce_event':
|
|
1394
|
-
return MessageType$1.Commerce;
|
|
1395
|
-
case 'session_start':
|
|
1396
|
-
return MessageType$1.SessionStart;
|
|
1397
|
-
case 'session_end':
|
|
1398
|
-
return MessageType$1.SessionEnd;
|
|
1399
|
-
case 'crash_report':
|
|
1400
|
-
return MessageType$1.CrashReport;
|
|
1401
|
-
case 'opt_out':
|
|
1402
|
-
return MessageType$1.OptOut;
|
|
1403
|
-
case 'application_state_transition':
|
|
1404
|
-
return MessageType$1.AppStateTransition;
|
|
1405
|
-
case 'user_attribute_change':
|
|
1406
|
-
return MessageType$1.UserAttributeChange;
|
|
1407
|
-
case 'user_identity_change':
|
|
1408
|
-
return MessageType$1.UserIdentityChange;
|
|
1409
|
-
default:
|
|
1410
|
-
return -1;
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
function getEventCategoryFromCustomEventType(customEventType) {
|
|
1414
|
-
switch (customEventType) {
|
|
1415
|
-
case 'navigation':
|
|
1416
|
-
return EventType.Navigation;
|
|
1417
|
-
case 'location':
|
|
1418
|
-
return EventType.Location;
|
|
1419
|
-
case 'search':
|
|
1420
|
-
return EventType.Search;
|
|
1421
|
-
case 'transaction':
|
|
1422
|
-
return EventType.Transaction;
|
|
1423
|
-
case 'user_content':
|
|
1424
|
-
return EventType.UserContent;
|
|
1425
|
-
case 'user_preference':
|
|
1426
|
-
return EventType.UserPreference;
|
|
1427
|
-
case 'social':
|
|
1428
|
-
return EventType.Social;
|
|
1429
|
-
case 'other':
|
|
1430
|
-
return EventType.Other;
|
|
1431
|
-
case 'media':
|
|
1432
|
-
return EventType.Media;
|
|
1433
|
-
case 'add_to_cart':
|
|
1434
|
-
return CommerceEventType.ProductAddToCart;
|
|
1435
|
-
case 'remove_from_cart':
|
|
1436
|
-
return CommerceEventType.ProductRemoveFromCart;
|
|
1437
|
-
case 'checkout':
|
|
1438
|
-
return CommerceEventType.ProductCheckout;
|
|
1439
|
-
case 'checkout_option':
|
|
1440
|
-
return CommerceEventType.ProductCheckoutOption;
|
|
1441
|
-
case 'click':
|
|
1442
|
-
return CommerceEventType.ProductClick;
|
|
1443
|
-
case 'view_detail':
|
|
1444
|
-
return CommerceEventType.ProductViewDetail;
|
|
1445
|
-
case 'purchase':
|
|
1446
|
-
return CommerceEventType.ProductPurchase;
|
|
1447
|
-
case 'refund':
|
|
1448
|
-
return CommerceEventType.ProductRefund;
|
|
1449
|
-
case 'promotion_view':
|
|
1450
|
-
return CommerceEventType.PromotionView;
|
|
1451
|
-
case 'promotion_click':
|
|
1452
|
-
return CommerceEventType.PromotionClick;
|
|
1453
|
-
case 'add_to_wishlist':
|
|
1454
|
-
return CommerceEventType.ProductAddToWishlist;
|
|
1455
|
-
case 'remove_from_wishlist':
|
|
1456
|
-
case 'remove_from_wish_list':
|
|
1457
|
-
return CommerceEventType.ProductRemoveFromWishlist;
|
|
1458
|
-
case 'impression':
|
|
1459
|
-
return CommerceEventType.ProductImpression;
|
|
1460
|
-
default:
|
|
1461
|
-
return EventType.Unknown;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
function getIdentityTypeFromBatchKey(key) {
|
|
1465
|
-
switch (key) {
|
|
1466
|
-
case 'other':
|
|
1467
|
-
return IdentityType.Other;
|
|
1468
|
-
case 'customer_id':
|
|
1469
|
-
return IdentityType.CustomerId;
|
|
1470
|
-
case 'facebook':
|
|
1471
|
-
return IdentityType.Facebook;
|
|
1472
|
-
case 'twitter':
|
|
1473
|
-
return IdentityType.Twitter;
|
|
1474
|
-
case 'google':
|
|
1475
|
-
return IdentityType.Google;
|
|
1476
|
-
case 'microsoft':
|
|
1477
|
-
return IdentityType.Microsoft;
|
|
1478
|
-
case 'yahoo':
|
|
1479
|
-
return IdentityType.Yahoo;
|
|
1480
|
-
case 'email':
|
|
1481
|
-
return IdentityType.Email;
|
|
1482
|
-
case 'facebook_custom_audience_id':
|
|
1483
|
-
return IdentityType.FacebookCustomAudienceId;
|
|
1484
|
-
case 'other_id_2':
|
|
1485
|
-
return IdentityType.Other2;
|
|
1486
|
-
case 'other_id_3':
|
|
1487
|
-
return IdentityType.Other3;
|
|
1488
|
-
case 'other_id_4':
|
|
1489
|
-
return IdentityType.Other4;
|
|
1490
|
-
case 'other_id_5':
|
|
1491
|
-
return IdentityType.Other5;
|
|
1492
|
-
case 'other_id_6':
|
|
1493
|
-
return IdentityType.Other6;
|
|
1494
|
-
case 'other_id_7':
|
|
1495
|
-
return IdentityType.Other7;
|
|
1496
|
-
case 'other_id_8':
|
|
1497
|
-
return IdentityType.Other8;
|
|
1498
|
-
case 'other_id_9':
|
|
1499
|
-
return IdentityType.Other9;
|
|
1500
|
-
case 'other_id_10':
|
|
1501
|
-
return IdentityType.Other10;
|
|
1502
|
-
case 'mobile_number':
|
|
1503
|
-
return IdentityType.MobileNumber;
|
|
1504
|
-
case 'phone_number_2':
|
|
1505
|
-
return IdentityType.PhoneNumber2;
|
|
1506
|
-
case 'phone_number_3':
|
|
1507
|
-
return IdentityType.PhoneNumber3;
|
|
1508
|
-
default:
|
|
1509
|
-
return -1;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
1444
|
var Types = {
|
|
1513
1445
|
MessageType: MessageType$1,
|
|
1514
1446
|
EventType: EventType,
|
|
@@ -1518,6 +1450,7 @@ var mParticle = (function () {
|
|
|
1518
1450
|
ApplicationTransitionType: ApplicationTransitionType$1,
|
|
1519
1451
|
ProductActionType: ProductActionType,
|
|
1520
1452
|
PromotionActionType: PromotionActionType,
|
|
1453
|
+
RoktEvents: RoktEvents,
|
|
1521
1454
|
Environment: Constants.Environment
|
|
1522
1455
|
};
|
|
1523
1456
|
|
|
@@ -1534,6 +1467,14 @@ var mParticle = (function () {
|
|
|
1534
1467
|
SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund";
|
|
1535
1468
|
SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist";
|
|
1536
1469
|
SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist";
|
|
1470
|
+
SDKProductActionType[SDKProductActionType["ViewCart"] = 11] = "ViewCart";
|
|
1471
|
+
SDKProductActionType[SDKProductActionType["AddShippingInfo"] = 12] = "AddShippingInfo";
|
|
1472
|
+
SDKProductActionType[SDKProductActionType["AddPaymentInfo"] = 13] = "AddPaymentInfo";
|
|
1473
|
+
SDKProductActionType[SDKProductActionType["PaymentMethodSelected"] = 14] = "PaymentMethodSelected";
|
|
1474
|
+
SDKProductActionType[SDKProductActionType["PaymentAttempted"] = 15] = "PaymentAttempted";
|
|
1475
|
+
SDKProductActionType[SDKProductActionType["PaymentSucceeded"] = 16] = "PaymentSucceeded";
|
|
1476
|
+
SDKProductActionType[SDKProductActionType["PaymentFailed"] = 17] = "PaymentFailed";
|
|
1477
|
+
SDKProductActionType[SDKProductActionType["RefundInitiated"] = 18] = "RefundInitiated";
|
|
1537
1478
|
})(SDKProductActionType || (SDKProductActionType = {}));
|
|
1538
1479
|
var LogLevelType = {
|
|
1539
1480
|
None: 'none',
|
|
@@ -2410,44 +2351,6 @@ var mParticle = (function () {
|
|
|
2410
2351
|
return dist.IdentityTypeEnum.phoneNumber3;
|
|
2411
2352
|
}
|
|
2412
2353
|
}
|
|
2413
|
-
function getEventNameFromBatchEvent(batchEvent) {
|
|
2414
|
-
if (!batchEvent || !batchEvent.data) {
|
|
2415
|
-
return '';
|
|
2416
|
-
}
|
|
2417
|
-
if (batchEvent.event_type === 'screen_view') {
|
|
2418
|
-
return batchEvent.data.screen_name || '';
|
|
2419
|
-
}
|
|
2420
|
-
return batchEvent.data.event_name || '';
|
|
2421
|
-
}
|
|
2422
|
-
function getEventCategoryFromBatchEvent(batchEvent) {
|
|
2423
|
-
if (!batchEvent || !batchEvent.data) {
|
|
2424
|
-
return Types.EventType.Unknown;
|
|
2425
|
-
}
|
|
2426
|
-
var data = batchEvent.data;
|
|
2427
|
-
if (data.custom_event_type) {
|
|
2428
|
-
return getEventCategoryFromCustomEventType(data.custom_event_type);
|
|
2429
|
-
}
|
|
2430
|
-
if (batchEvent.event_type === 'commerce_event') {
|
|
2431
|
-
return getCommerceEventCategory(data);
|
|
2432
|
-
}
|
|
2433
|
-
return Types.EventType.Unknown;
|
|
2434
|
-
}
|
|
2435
|
-
function getCommerceEventCategory(data) {
|
|
2436
|
-
if (data.product_action && data.product_action.action) {
|
|
2437
|
-
return getEventCategoryFromCustomEventType(data.product_action.action);
|
|
2438
|
-
}
|
|
2439
|
-
var promoAction = data.promotion_action && data.promotion_action.action;
|
|
2440
|
-
if (promoAction === 'view') {
|
|
2441
|
-
return Types.CommerceEventType.PromotionView;
|
|
2442
|
-
}
|
|
2443
|
-
if (promoAction === 'click') {
|
|
2444
|
-
return Types.CommerceEventType.PromotionClick;
|
|
2445
|
-
}
|
|
2446
|
-
if (data.product_impressions) {
|
|
2447
|
-
return Types.CommerceEventType.ProductImpression;
|
|
2448
|
-
}
|
|
2449
|
-
return Types.EventType.Unknown;
|
|
2450
|
-
}
|
|
2451
2354
|
|
|
2452
2355
|
var BaseVault = /** @class */function () {
|
|
2453
2356
|
/**
|
|
@@ -2952,13 +2855,6 @@ var mParticle = (function () {
|
|
|
2952
2855
|
for (var _d = 0, _e = Array.from(eventsBySession.entries()); _d < _e.length; _d++) {
|
|
2953
2856
|
var entry_1 = _e[_d];
|
|
2954
2857
|
var uploadBatchObject = convertEvents(mpid, entry_1[1], mpInstance);
|
|
2955
|
-
if (uploadBatchObject) {
|
|
2956
|
-
try {
|
|
2957
|
-
mpInstance._Forwarders.sendBatchToForwarders(uploadBatchObject);
|
|
2958
|
-
} catch (e) {
|
|
2959
|
-
mpInstance.Logger.error("Error forwarding batch to kits. ".concat(e));
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
2858
|
var onCreateBatchCallback = mpInstance._Store.SDKConfig.onCreateBatch;
|
|
2963
2859
|
if (onCreateBatchCallback) {
|
|
2964
2860
|
uploadBatchObject = onCreateBatchCallback(uploadBatchObject);
|
|
@@ -3128,7 +3024,8 @@ var mParticle = (function () {
|
|
|
3128
3024
|
UNHANDLED_EXCEPTION: 'UNHANDLED_EXCEPTION',
|
|
3129
3025
|
IDENTITY_REQUEST: 'IDENTITY_REQUEST',
|
|
3130
3026
|
IDENTITY_MISMATCH: 'IDENTITY_MISMATCH',
|
|
3131
|
-
ROKT_KIT_ATTACHED: 'ROKT_KIT_ATTACHED'
|
|
3027
|
+
ROKT_KIT_ATTACHED: 'ROKT_KIT_ATTACHED',
|
|
3028
|
+
MP_DEPRECATED_METHOD_USAGE: 'MP_DEPRECATED_METHOD_USAGE'
|
|
3132
3029
|
};
|
|
3133
3030
|
var WSDKErrorSeverity = {
|
|
3134
3031
|
ERROR: 'ERROR',
|
|
@@ -4278,6 +4175,14 @@ var mParticle = (function () {
|
|
|
4278
4175
|
return new Date().getTime() > new Date(lastSyncDate).getTime() + frequencyCap * DAYS_IN_MILLISECONDS;
|
|
4279
4176
|
};
|
|
4280
4177
|
|
|
4178
|
+
function logDeprecatedMethodUsage(usage, logger, loggingDispatcher) {
|
|
4179
|
+
logger.warning(usage.warningMessage);
|
|
4180
|
+
loggingDispatcher === null || loggingDispatcher === void 0 ? void 0 : loggingDispatcher.log({
|
|
4181
|
+
message: usage.methodName,
|
|
4182
|
+
code: ErrorCodes.MP_DEPRECATED_METHOD_USAGE
|
|
4183
|
+
});
|
|
4184
|
+
}
|
|
4185
|
+
|
|
4281
4186
|
var Messages$6 = Constants.Messages;
|
|
4282
4187
|
function SessionManager(mpInstance) {
|
|
4283
4188
|
var self = this;
|
|
@@ -4308,7 +4213,10 @@ var mParticle = (function () {
|
|
|
4308
4213
|
}
|
|
4309
4214
|
};
|
|
4310
4215
|
this.getSession = function () {
|
|
4311
|
-
|
|
4216
|
+
logDeprecatedMethodUsage({
|
|
4217
|
+
methodName: 'SessionManager.getSession()',
|
|
4218
|
+
warningMessage: generateDeprecationMessage('SessionManager.getSession()', false, 'SessionManager.getSessionId()')
|
|
4219
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
4312
4220
|
return this.getSessionId();
|
|
4313
4221
|
};
|
|
4314
4222
|
this.getSessionId = function () {
|
|
@@ -4493,6 +4401,22 @@ var mParticle = (function () {
|
|
|
4493
4401
|
return 'RemoveFromWishlist';
|
|
4494
4402
|
case Types.ProductActionType.ViewDetail:
|
|
4495
4403
|
return 'ViewDetail';
|
|
4404
|
+
case Types.ProductActionType.ViewCart:
|
|
4405
|
+
return 'ViewCart';
|
|
4406
|
+
case Types.ProductActionType.AddShippingInfo:
|
|
4407
|
+
return 'AddShippingInfo';
|
|
4408
|
+
case Types.ProductActionType.AddPaymentInfo:
|
|
4409
|
+
return 'AddPaymentInfo';
|
|
4410
|
+
case Types.ProductActionType.PaymentMethodSelected:
|
|
4411
|
+
return 'PaymentMethodSelected';
|
|
4412
|
+
case Types.ProductActionType.PaymentAttempted:
|
|
4413
|
+
return 'PaymentAttempted';
|
|
4414
|
+
case Types.ProductActionType.PaymentSucceeded:
|
|
4415
|
+
return 'PaymentSucceeded';
|
|
4416
|
+
case Types.ProductActionType.PaymentFailed:
|
|
4417
|
+
return 'PaymentFailed';
|
|
4418
|
+
case Types.ProductActionType.RefundInitiated:
|
|
4419
|
+
return 'RefundInitiated';
|
|
4496
4420
|
case Types.ProductActionType.Unknown:
|
|
4497
4421
|
default:
|
|
4498
4422
|
return 'Unknown';
|
|
@@ -4534,6 +4458,17 @@ var mParticle = (function () {
|
|
|
4534
4458
|
return Types.EventType.Unknown;
|
|
4535
4459
|
case Types.ProductActionType.ViewDetail:
|
|
4536
4460
|
return Types.CommerceEventType.ProductViewDetail;
|
|
4461
|
+
|
|
4462
|
+
// Rokt Brain commerce-adjacent types map to Unknown on server
|
|
4463
|
+
case Types.ProductActionType.ViewCart:
|
|
4464
|
+
case Types.ProductActionType.AddShippingInfo:
|
|
4465
|
+
case Types.ProductActionType.AddPaymentInfo:
|
|
4466
|
+
case Types.ProductActionType.PaymentMethodSelected:
|
|
4467
|
+
case Types.ProductActionType.PaymentAttempted:
|
|
4468
|
+
case Types.ProductActionType.PaymentSucceeded:
|
|
4469
|
+
case Types.ProductActionType.PaymentFailed:
|
|
4470
|
+
case Types.ProductActionType.RefundInitiated:
|
|
4471
|
+
return Types.EventType.Unknown;
|
|
4537
4472
|
default:
|
|
4538
4473
|
mpInstance.Logger.error('Could not convert product action type ' + productActionType + ' to event type');
|
|
4539
4474
|
return null;
|
|
@@ -6333,6 +6268,10 @@ var mParticle = (function () {
|
|
|
6333
6268
|
ProductActionType: productActionType,
|
|
6334
6269
|
ProductList: productList
|
|
6335
6270
|
};
|
|
6271
|
+
if (Types.ProductActionType.isRoktCommerceType(productActionType)) {
|
|
6272
|
+
event.CustomFlags = event.CustomFlags || {};
|
|
6273
|
+
event.CustomFlags['Rokt.CommerceEventType'] = Types.ProductActionType.getExpansionName(productActionType);
|
|
6274
|
+
}
|
|
6336
6275
|
if (mpInstance._Helpers.isObject(transactionAttributes)) {
|
|
6337
6276
|
mpInstance._Ecommerce.convertTransactionAttributesToProductAction(transactionAttributes, event.ProductAction);
|
|
6338
6277
|
}
|
|
@@ -7001,48 +6940,7 @@ var mParticle = (function () {
|
|
|
7001
6940
|
return !inArray(filterList, KitFilterHelper.hashUserIdentity(userIdentity.Type));
|
|
7002
6941
|
});
|
|
7003
6942
|
}
|
|
7004
|
-
function isBatchEventAllowed(batchEvent, forwarder) {
|
|
7005
|
-
if (!batchEvent || !batchEvent.data) {
|
|
7006
|
-
return true;
|
|
7007
|
-
}
|
|
7008
|
-
var messageType = getMessageTypeFromEventType(batchEvent.event_type);
|
|
7009
|
-
var eventName = getEventNameFromBatchEvent(batchEvent);
|
|
7010
|
-
var eventCategory = getEventCategoryFromBatchEvent(batchEvent);
|
|
7011
|
-
if (isBlockedByForwardingRule(messageType, batchEvent.data.custom_attributes, forwarder)) {
|
|
7012
|
-
return false;
|
|
7013
|
-
}
|
|
7014
|
-
var hashedEventName = KitFilterHelper.hashEventName(eventName, eventCategory);
|
|
7015
|
-
var hashedEventType = KitFilterHelper.hashEventType(eventCategory);
|
|
7016
|
-
return !isBlockedByEventFilter(messageType, hashedEventName, hashedEventType, forwarder);
|
|
7017
|
-
}
|
|
7018
|
-
function filterBatchEventAttributes(batchEvent, forwarder) {
|
|
7019
|
-
if (!batchEvent || !batchEvent.data) {
|
|
7020
|
-
return;
|
|
7021
|
-
}
|
|
7022
|
-
var messageType = getMessageTypeFromEventType(batchEvent.event_type);
|
|
7023
|
-
var eventName = getEventNameFromBatchEvent(batchEvent);
|
|
7024
|
-
var eventCategory = getEventCategoryFromBatchEvent(batchEvent);
|
|
7025
|
-
batchEvent.data.custom_attributes = filterEventAttributes(messageType, eventCategory, eventName, batchEvent.data.custom_attributes, forwarder);
|
|
7026
|
-
}
|
|
7027
|
-
function filterBatchIdentities(userIdentities, filterList) {
|
|
7028
|
-
if (!userIdentities || !filterList) {
|
|
7029
|
-
return userIdentities;
|
|
7030
|
-
}
|
|
7031
|
-
var filtered = {};
|
|
7032
|
-
for (var key in userIdentities) {
|
|
7033
|
-
if (userIdentities.hasOwnProperty(key)) {
|
|
7034
|
-
var identityType = getIdentityTypeFromBatchKey(key);
|
|
7035
|
-
if (identityType === -1 || !inArray(filterList, identityType)) {
|
|
7036
|
-
filtered[key] = userIdentities[key];
|
|
7037
|
-
}
|
|
7038
|
-
}
|
|
7039
|
-
}
|
|
7040
|
-
return filtered;
|
|
7041
|
-
}
|
|
7042
6943
|
|
|
7043
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
7044
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7045
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7046
6944
|
var _Constants$IdentityMe = Constants.IdentityMethods,
|
|
7047
6945
|
Modify$2 = _Constants$IdentityMe.Modify,
|
|
7048
6946
|
Identify$1 = _Constants$IdentityMe.Identify,
|
|
@@ -7180,54 +7078,6 @@ var mParticle = (function () {
|
|
|
7180
7078
|
}
|
|
7181
7079
|
}
|
|
7182
7080
|
};
|
|
7183
|
-
this.sendBatchToForwarders = function (batch) {
|
|
7184
|
-
if (mpInstance._Store.webviewBridgeEnabled || !mpInstance._Store.activeForwarders) {
|
|
7185
|
-
return;
|
|
7186
|
-
}
|
|
7187
|
-
var _iterator = _createForOfIteratorHelper(mpInstance._Store.activeForwarders),
|
|
7188
|
-
_step;
|
|
7189
|
-
try {
|
|
7190
|
-
var _loop = function _loop() {
|
|
7191
|
-
var forwarder = _step.value;
|
|
7192
|
-
if (!forwarder.processBatch) {
|
|
7193
|
-
return 0; // continue
|
|
7194
|
-
}
|
|
7195
|
-
try {
|
|
7196
|
-
var batchCopy = extend(true, {}, batch);
|
|
7197
|
-
if (batchCopy.events) {
|
|
7198
|
-
batchCopy.events = batchCopy.events.filter(function (batchEvent) {
|
|
7199
|
-
return isBatchEventAllowed(batchEvent, forwarder);
|
|
7200
|
-
});
|
|
7201
|
-
batchCopy.events.forEach(function (batchEvent) {
|
|
7202
|
-
filterBatchEventAttributes(batchEvent, forwarder);
|
|
7203
|
-
});
|
|
7204
|
-
}
|
|
7205
|
-
batchCopy.user_identities = filterBatchIdentities(batchCopy.user_identities, forwarder.userIdentityFilters);
|
|
7206
|
-
if (batchCopy.user_attributes) {
|
|
7207
|
-
batchCopy.user_attributes = KitFilterHelper.filterUserAttributes(batchCopy.user_attributes, forwarder.userAttributeFilters);
|
|
7208
|
-
}
|
|
7209
|
-
if (!batchCopy.events || batchCopy.events.length === 0) {
|
|
7210
|
-
return 0; // continue
|
|
7211
|
-
}
|
|
7212
|
-
var result = forwarder.processBatch(batchCopy);
|
|
7213
|
-
if (result) {
|
|
7214
|
-
mpInstance.Logger.verbose(result);
|
|
7215
|
-
}
|
|
7216
|
-
} catch (e) {
|
|
7217
|
-
mpInstance.Logger.verbose(e);
|
|
7218
|
-
}
|
|
7219
|
-
},
|
|
7220
|
-
_ret;
|
|
7221
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
7222
|
-
_ret = _loop();
|
|
7223
|
-
if (_ret === 0) continue;
|
|
7224
|
-
}
|
|
7225
|
-
} catch (err) {
|
|
7226
|
-
_iterator.e(err);
|
|
7227
|
-
} finally {
|
|
7228
|
-
_iterator.f();
|
|
7229
|
-
}
|
|
7230
|
-
};
|
|
7231
7081
|
this.handleForwarderUserAttributes = function (functionNameKey, key, value) {
|
|
7232
7082
|
if (kitBlocker && kitBlocker.isAttributeKeyBlocked(key) || !mpInstance._Store.activeForwarders.length) {
|
|
7233
7083
|
return;
|
|
@@ -8770,7 +8620,10 @@ var mParticle = (function () {
|
|
|
8770
8620
|
* @return a cart object
|
|
8771
8621
|
*/
|
|
8772
8622
|
getCart: function getCart() {
|
|
8773
|
-
|
|
8623
|
+
logDeprecatedMethodUsage({
|
|
8624
|
+
methodName: 'Identity.getCurrentUser().getCart()',
|
|
8625
|
+
warningMessage: 'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases'
|
|
8626
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8774
8627
|
return self.mParticleUserCart();
|
|
8775
8628
|
},
|
|
8776
8629
|
/**
|
|
@@ -8834,7 +8687,10 @@ var mParticle = (function () {
|
|
|
8834
8687
|
* @deprecated
|
|
8835
8688
|
*/
|
|
8836
8689
|
add: function add() {
|
|
8837
|
-
|
|
8690
|
+
logDeprecatedMethodUsage({
|
|
8691
|
+
methodName: 'Identity.getCurrentUser().getCart().add()',
|
|
8692
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8693
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8838
8694
|
},
|
|
8839
8695
|
/**
|
|
8840
8696
|
* Removes a cart product from the current user cart
|
|
@@ -8842,7 +8698,10 @@ var mParticle = (function () {
|
|
|
8842
8698
|
* @deprecated
|
|
8843
8699
|
*/
|
|
8844
8700
|
remove: function remove() {
|
|
8845
|
-
|
|
8701
|
+
logDeprecatedMethodUsage({
|
|
8702
|
+
methodName: 'Identity.getCurrentUser().getCart().remove()',
|
|
8703
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8704
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8846
8705
|
},
|
|
8847
8706
|
/**
|
|
8848
8707
|
* Clears the user's cart
|
|
@@ -8850,7 +8709,10 @@ var mParticle = (function () {
|
|
|
8850
8709
|
* @deprecated
|
|
8851
8710
|
*/
|
|
8852
8711
|
clear: function clear() {
|
|
8853
|
-
|
|
8712
|
+
logDeprecatedMethodUsage({
|
|
8713
|
+
methodName: 'Identity.getCurrentUser().getCart().clear()',
|
|
8714
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8715
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8854
8716
|
},
|
|
8855
8717
|
/**
|
|
8856
8718
|
* Returns all cart products
|
|
@@ -8859,7 +8721,10 @@ var mParticle = (function () {
|
|
|
8859
8721
|
* @deprecated
|
|
8860
8722
|
*/
|
|
8861
8723
|
getCartProducts: function getCartProducts() {
|
|
8862
|
-
|
|
8724
|
+
logDeprecatedMethodUsage({
|
|
8725
|
+
methodName: 'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
8726
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8727
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8863
8728
|
return [];
|
|
8864
8729
|
}
|
|
8865
8730
|
};
|
|
@@ -8932,7 +8797,7 @@ var mParticle = (function () {
|
|
|
8932
8797
|
newUser = mpInstance.Identity.getCurrentUser();
|
|
8933
8798
|
|
|
8934
8799
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
8935
|
-
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger);
|
|
8800
|
+
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8936
8801
|
var persistence = mpInstance._Persistence.getPersistence();
|
|
8937
8802
|
if (newUser) {
|
|
8938
8803
|
mpInstance._Persistence.storeDataInMemory(persistence, newUser.getMPID());
|
|
@@ -9065,10 +8930,13 @@ var mParticle = (function () {
|
|
|
9065
8930
|
}
|
|
9066
8931
|
|
|
9067
8932
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
9068
|
-
function tryOnUserAlias(previousUser, newUser, identityApiData, logger) {
|
|
8933
|
+
function tryOnUserAlias(previousUser, newUser, identityApiData, logger, loggingDispatcher) {
|
|
9069
8934
|
if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) {
|
|
9070
8935
|
try {
|
|
9071
|
-
|
|
8936
|
+
logDeprecatedMethodUsage({
|
|
8937
|
+
methodName: 'onUserAlias',
|
|
8938
|
+
warningMessage: generateDeprecationMessage('onUserAlias')
|
|
8939
|
+
}, logger, loggingDispatcher);
|
|
9072
8940
|
identityApiData.onUserAlias(previousUser, newUser);
|
|
9073
8941
|
} catch (e) {
|
|
9074
8942
|
logger.error('There was an error with your onUserAlias function - ' + e);
|
|
@@ -9349,7 +9217,10 @@ var mParticle = (function () {
|
|
|
9349
9217
|
}
|
|
9350
9218
|
// TODO: Can we remove this? It is deprecated.
|
|
9351
9219
|
function removeCCPAState() {
|
|
9352
|
-
|
|
9220
|
+
logDeprecatedMethodUsage({
|
|
9221
|
+
methodName: 'Consent.removeCCPAState',
|
|
9222
|
+
warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead'
|
|
9223
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
9353
9224
|
// @ts-ignore
|
|
9354
9225
|
return removeCCPAConsentState();
|
|
9355
9226
|
}
|
|
@@ -11179,6 +11050,7 @@ var mParticle = (function () {
|
|
|
11179
11050
|
this.CommerceEventType = CommerceEventType;
|
|
11180
11051
|
this.PromotionType = PromotionActionType;
|
|
11181
11052
|
this.ProductActionType = ProductActionType;
|
|
11053
|
+
this.RoktEvents = RoktEvents;
|
|
11182
11054
|
this._Identity = new Identity(this);
|
|
11183
11055
|
this.Identity = this._Identity.IdentityAPI;
|
|
11184
11056
|
this.generateHash = this._Helpers.generateHash;
|
|
@@ -11651,7 +11523,10 @@ var mParticle = (function () {
|
|
|
11651
11523
|
* @deprecated
|
|
11652
11524
|
*/
|
|
11653
11525
|
add: function add(product, logEventBoolean) {
|
|
11654
|
-
|
|
11526
|
+
logDeprecatedMethodUsage({
|
|
11527
|
+
methodName: 'mPInstance.eCommerce.Cart.add()',
|
|
11528
|
+
warningMessage: generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11529
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11655
11530
|
},
|
|
11656
11531
|
/**
|
|
11657
11532
|
* Removes a product from the cart
|
|
@@ -11661,7 +11536,10 @@ var mParticle = (function () {
|
|
|
11661
11536
|
* @deprecated
|
|
11662
11537
|
*/
|
|
11663
11538
|
remove: function remove(product, logEventBoolean) {
|
|
11664
|
-
|
|
11539
|
+
logDeprecatedMethodUsage({
|
|
11540
|
+
methodName: 'mPInstance.eCommerce.Cart.remove()',
|
|
11541
|
+
warningMessage: generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11542
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11665
11543
|
},
|
|
11666
11544
|
/**
|
|
11667
11545
|
* Clears the cart
|
|
@@ -11669,7 +11547,10 @@ var mParticle = (function () {
|
|
|
11669
11547
|
* @deprecated
|
|
11670
11548
|
*/
|
|
11671
11549
|
clear: function clear() {
|
|
11672
|
-
|
|
11550
|
+
logDeprecatedMethodUsage({
|
|
11551
|
+
methodName: 'mPInstance.eCommerce.Cart.clear()',
|
|
11552
|
+
warningMessage: generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11553
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11673
11554
|
}
|
|
11674
11555
|
},
|
|
11675
11556
|
/**
|
|
@@ -11755,7 +11636,10 @@ var mParticle = (function () {
|
|
|
11755
11636
|
* @deprecated
|
|
11756
11637
|
*/
|
|
11757
11638
|
logCheckout: function logCheckout(step, option, attrs, customFlags) {
|
|
11758
|
-
|
|
11639
|
+
logDeprecatedMethodUsage({
|
|
11640
|
+
methodName: 'mParticle.logCheckout',
|
|
11641
|
+
warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead'
|
|
11642
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11759
11643
|
if (!self._Store.isInitialized) {
|
|
11760
11644
|
self.ready(function () {
|
|
11761
11645
|
self.eCommerce.logCheckout(step, option, attrs, customFlags);
|
|
@@ -11796,7 +11680,10 @@ var mParticle = (function () {
|
|
|
11796
11680
|
* @deprecated
|
|
11797
11681
|
*/
|
|
11798
11682
|
logPurchase: function logPurchase(transactionAttributes, product, clearCart, attrs, customFlags) {
|
|
11799
|
-
|
|
11683
|
+
logDeprecatedMethodUsage({
|
|
11684
|
+
methodName: 'mParticle.logPurchase',
|
|
11685
|
+
warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead'
|
|
11686
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11800
11687
|
if (!self._Store.isInitialized) {
|
|
11801
11688
|
self.ready(function () {
|
|
11802
11689
|
self.eCommerce.logPurchase(transactionAttributes, product, clearCart, attrs, customFlags);
|
|
@@ -11857,7 +11744,10 @@ var mParticle = (function () {
|
|
|
11857
11744
|
* @deprecated
|
|
11858
11745
|
*/
|
|
11859
11746
|
logRefund: function logRefund(transactionAttributes, product, clearCart, attrs, customFlags) {
|
|
11860
|
-
|
|
11747
|
+
logDeprecatedMethodUsage({
|
|
11748
|
+
methodName: 'mParticle.logRefund',
|
|
11749
|
+
warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead'
|
|
11750
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11861
11751
|
if (!self._Store.isInitialized) {
|
|
11862
11752
|
self.ready(function () {
|
|
11863
11753
|
self.eCommerce.logRefund(transactionAttributes, product, clearCart, attrs, customFlags);
|
|
@@ -12530,6 +12420,7 @@ var mParticle = (function () {
|
|
|
12530
12420
|
this.CommerceEventType = CommerceEventType;
|
|
12531
12421
|
this.PromotionType = PromotionActionType;
|
|
12532
12422
|
this.ProductActionType = ProductActionType;
|
|
12423
|
+
this.RoktEvents = RoktEvents;
|
|
12533
12424
|
this.MPSideloadedKit = MPSideloadedKit;
|
|
12534
12425
|
if (typeof window !== 'undefined') {
|
|
12535
12426
|
this.isIOS = window.mParticle && window.mParticle.isIOS ? window.mParticle.isIOS : false;
|