@mparticle/web-sdk 2.67.0 → 2.69.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 +85 -46
- package/dist/mparticle.esm.js +85 -46
- package/dist/mparticle.js +240 -21
- package/dist/types/src/ecommerce.d.ts +1 -1
- package/dist/types/src/identity-utils.d.ts +4 -0
- 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 +16 -7
- package/dist/types/src/stub/mparticle.stub.d.ts +1 -0
- package/dist/types/src/types.d.ts +47 -2
- package/package.json +2 -2
- package/src/consent.ts +8 -2
- package/src/ecommerce.js +28 -0
- package/src/events.js +7 -0
- package/src/identity-utils.ts +46 -4
- package/src/identity.js +89 -34
- 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 +15 -5
- package/src/sessionManager.ts +12 -6
- package/src/stub/mparticle.stub.js +1 -0
- package/src/types.ts +79 -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.69.0";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -1204,6 +1204,10 @@ var mParticle = (function () {
|
|
|
1204
1204
|
return IdentityType.PhoneNumber2;
|
|
1205
1205
|
case 'phone_number_3':
|
|
1206
1206
|
return IdentityType.PhoneNumber3;
|
|
1207
|
+
case 'email_sha256':
|
|
1208
|
+
return IdentityType.Other;
|
|
1209
|
+
case 'mobile_sha256':
|
|
1210
|
+
return IdentityType.Other2;
|
|
1207
1211
|
default:
|
|
1208
1212
|
return false;
|
|
1209
1213
|
}
|
|
@@ -1289,6 +1293,18 @@ var mParticle = (function () {
|
|
|
1289
1293
|
Refund: 8,
|
|
1290
1294
|
AddToWishlist: 9,
|
|
1291
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
|
+
},
|
|
1292
1308
|
getName: function getName(id) {
|
|
1293
1309
|
switch (id) {
|
|
1294
1310
|
case ProductActionType.AddToCart:
|
|
@@ -1311,6 +1327,22 @@ var mParticle = (function () {
|
|
|
1311
1327
|
return 'Add to Wishlist';
|
|
1312
1328
|
case ProductActionType.RemoveFromWishlist:
|
|
1313
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';
|
|
1314
1346
|
default:
|
|
1315
1347
|
return 'Unknown';
|
|
1316
1348
|
}
|
|
@@ -1338,11 +1370,40 @@ var mParticle = (function () {
|
|
|
1338
1370
|
return 'add_to_wishlist';
|
|
1339
1371
|
case ProductActionType.RemoveFromWishlist:
|
|
1340
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';
|
|
1341
1389
|
default:
|
|
1342
1390
|
return 'unknown';
|
|
1343
1391
|
}
|
|
1344
1392
|
}
|
|
1345
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
|
+
};
|
|
1346
1407
|
var PromotionActionType = {
|
|
1347
1408
|
Unknown: 0,
|
|
1348
1409
|
PromotionView: 1,
|
|
@@ -1514,6 +1575,7 @@ var mParticle = (function () {
|
|
|
1514
1575
|
ApplicationTransitionType: ApplicationTransitionType$1,
|
|
1515
1576
|
ProductActionType: ProductActionType,
|
|
1516
1577
|
PromotionActionType: PromotionActionType,
|
|
1578
|
+
RoktEvents: RoktEvents,
|
|
1517
1579
|
Environment: Constants.Environment
|
|
1518
1580
|
};
|
|
1519
1581
|
|
|
@@ -1530,6 +1592,14 @@ var mParticle = (function () {
|
|
|
1530
1592
|
SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund";
|
|
1531
1593
|
SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist";
|
|
1532
1594
|
SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist";
|
|
1595
|
+
SDKProductActionType[SDKProductActionType["ViewCart"] = 11] = "ViewCart";
|
|
1596
|
+
SDKProductActionType[SDKProductActionType["AddShippingInfo"] = 12] = "AddShippingInfo";
|
|
1597
|
+
SDKProductActionType[SDKProductActionType["AddPaymentInfo"] = 13] = "AddPaymentInfo";
|
|
1598
|
+
SDKProductActionType[SDKProductActionType["PaymentMethodSelected"] = 14] = "PaymentMethodSelected";
|
|
1599
|
+
SDKProductActionType[SDKProductActionType["PaymentAttempted"] = 15] = "PaymentAttempted";
|
|
1600
|
+
SDKProductActionType[SDKProductActionType["PaymentSucceeded"] = 16] = "PaymentSucceeded";
|
|
1601
|
+
SDKProductActionType[SDKProductActionType["PaymentFailed"] = 17] = "PaymentFailed";
|
|
1602
|
+
SDKProductActionType[SDKProductActionType["RefundInitiated"] = 18] = "RefundInitiated";
|
|
1533
1603
|
})(SDKProductActionType || (SDKProductActionType = {}));
|
|
1534
1604
|
var LogLevelType = {
|
|
1535
1605
|
None: 'none',
|
|
@@ -3124,7 +3194,8 @@ var mParticle = (function () {
|
|
|
3124
3194
|
UNHANDLED_EXCEPTION: 'UNHANDLED_EXCEPTION',
|
|
3125
3195
|
IDENTITY_REQUEST: 'IDENTITY_REQUEST',
|
|
3126
3196
|
IDENTITY_MISMATCH: 'IDENTITY_MISMATCH',
|
|
3127
|
-
ROKT_KIT_ATTACHED: 'ROKT_KIT_ATTACHED'
|
|
3197
|
+
ROKT_KIT_ATTACHED: 'ROKT_KIT_ATTACHED',
|
|
3198
|
+
MP_DEPRECATED_METHOD_USAGE: 'MP_DEPRECATED_METHOD_USAGE'
|
|
3128
3199
|
};
|
|
3129
3200
|
var WSDKErrorSeverity = {
|
|
3130
3201
|
ERROR: 'ERROR',
|
|
@@ -3535,13 +3606,40 @@ var mParticle = (function () {
|
|
|
3535
3606
|
var parseIdentityResponse = function parseIdentityResponse(responseText) {
|
|
3536
3607
|
return responseText ? JSON.parse(responseText) : {};
|
|
3537
3608
|
};
|
|
3609
|
+
var SHA256_IDENTITY_ALIASES = {
|
|
3610
|
+
email_sha256: 'other',
|
|
3611
|
+
mobile_sha256: 'other2'
|
|
3612
|
+
};
|
|
3613
|
+
var normalizeUserIdentityKeys = function normalizeUserIdentityKeys(userIdentities) {
|
|
3614
|
+
var normalized = __assign({}, userIdentities);
|
|
3615
|
+
Object.keys(SHA256_IDENTITY_ALIASES).forEach(function (alias) {
|
|
3616
|
+
if (alias in normalized) {
|
|
3617
|
+
var value = normalized[alias];
|
|
3618
|
+
delete normalized[alias];
|
|
3619
|
+
normalized[SHA256_IDENTITY_ALIASES[alias]] = value;
|
|
3620
|
+
}
|
|
3621
|
+
});
|
|
3622
|
+
return normalized;
|
|
3623
|
+
};
|
|
3624
|
+
// Compare two identity objects by key and value, independent of
|
|
3625
|
+
// object key insertion order. The two sides come from different sources
|
|
3626
|
+
// (numeric IdentityType iteration vs. partner-provided / alias-normalized
|
|
3627
|
+
// order)
|
|
3628
|
+
var identitiesEqual = function identitiesEqual(a, b) {
|
|
3629
|
+
var aKeys = Object.keys(a !== null && a !== void 0 ? a : {});
|
|
3630
|
+
var bKeys = Object.keys(b !== null && b !== void 0 ? b : {});
|
|
3631
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
3632
|
+
return aKeys.every(function (key) {
|
|
3633
|
+
return a[key] === b[key];
|
|
3634
|
+
});
|
|
3635
|
+
};
|
|
3538
3636
|
var hasIdentityRequestChanged = function hasIdentityRequestChanged(currentUser, newIdentityRequest) {
|
|
3539
3637
|
if (!currentUser || !(newIdentityRequest === null || newIdentityRequest === void 0 ? void 0 : newIdentityRequest.userIdentities)) {
|
|
3540
3638
|
return false;
|
|
3541
3639
|
}
|
|
3542
3640
|
var currentUserIdentities = currentUser.getUserIdentities().userIdentities;
|
|
3543
|
-
var newIdentities = newIdentityRequest.userIdentities;
|
|
3544
|
-
return
|
|
3641
|
+
var newIdentities = normalizeUserIdentityKeys(newIdentityRequest.userIdentities);
|
|
3642
|
+
return !identitiesEqual(currentUserIdentities, newIdentities);
|
|
3545
3643
|
};
|
|
3546
3644
|
/**
|
|
3547
3645
|
* Checks if deviceId or other user identifiers (like email) were explicitly provided
|
|
@@ -4247,6 +4345,14 @@ var mParticle = (function () {
|
|
|
4247
4345
|
return new Date().getTime() > new Date(lastSyncDate).getTime() + frequencyCap * DAYS_IN_MILLISECONDS;
|
|
4248
4346
|
};
|
|
4249
4347
|
|
|
4348
|
+
function logDeprecatedMethodUsage(usage, logger, loggingDispatcher) {
|
|
4349
|
+
logger.warning(usage.warningMessage);
|
|
4350
|
+
loggingDispatcher === null || loggingDispatcher === void 0 ? void 0 : loggingDispatcher.log({
|
|
4351
|
+
message: usage.methodName,
|
|
4352
|
+
code: ErrorCodes.MP_DEPRECATED_METHOD_USAGE
|
|
4353
|
+
});
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4250
4356
|
var Messages$6 = Constants.Messages;
|
|
4251
4357
|
function SessionManager(mpInstance) {
|
|
4252
4358
|
var self = this;
|
|
@@ -4277,7 +4383,10 @@ var mParticle = (function () {
|
|
|
4277
4383
|
}
|
|
4278
4384
|
};
|
|
4279
4385
|
this.getSession = function () {
|
|
4280
|
-
|
|
4386
|
+
logDeprecatedMethodUsage({
|
|
4387
|
+
methodName: 'SessionManager.getSession()',
|
|
4388
|
+
warningMessage: generateDeprecationMessage('SessionManager.getSession()', false, 'SessionManager.getSessionId()')
|
|
4389
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
4281
4390
|
return this.getSessionId();
|
|
4282
4391
|
};
|
|
4283
4392
|
this.getSessionId = function () {
|
|
@@ -4462,6 +4571,22 @@ var mParticle = (function () {
|
|
|
4462
4571
|
return 'RemoveFromWishlist';
|
|
4463
4572
|
case Types.ProductActionType.ViewDetail:
|
|
4464
4573
|
return 'ViewDetail';
|
|
4574
|
+
case Types.ProductActionType.ViewCart:
|
|
4575
|
+
return 'ViewCart';
|
|
4576
|
+
case Types.ProductActionType.AddShippingInfo:
|
|
4577
|
+
return 'AddShippingInfo';
|
|
4578
|
+
case Types.ProductActionType.AddPaymentInfo:
|
|
4579
|
+
return 'AddPaymentInfo';
|
|
4580
|
+
case Types.ProductActionType.PaymentMethodSelected:
|
|
4581
|
+
return 'PaymentMethodSelected';
|
|
4582
|
+
case Types.ProductActionType.PaymentAttempted:
|
|
4583
|
+
return 'PaymentAttempted';
|
|
4584
|
+
case Types.ProductActionType.PaymentSucceeded:
|
|
4585
|
+
return 'PaymentSucceeded';
|
|
4586
|
+
case Types.ProductActionType.PaymentFailed:
|
|
4587
|
+
return 'PaymentFailed';
|
|
4588
|
+
case Types.ProductActionType.RefundInitiated:
|
|
4589
|
+
return 'RefundInitiated';
|
|
4465
4590
|
case Types.ProductActionType.Unknown:
|
|
4466
4591
|
default:
|
|
4467
4592
|
return 'Unknown';
|
|
@@ -4503,6 +4628,17 @@ var mParticle = (function () {
|
|
|
4503
4628
|
return Types.EventType.Unknown;
|
|
4504
4629
|
case Types.ProductActionType.ViewDetail:
|
|
4505
4630
|
return Types.CommerceEventType.ProductViewDetail;
|
|
4631
|
+
|
|
4632
|
+
// Rokt Brain commerce-adjacent types map to Unknown on server
|
|
4633
|
+
case Types.ProductActionType.ViewCart:
|
|
4634
|
+
case Types.ProductActionType.AddShippingInfo:
|
|
4635
|
+
case Types.ProductActionType.AddPaymentInfo:
|
|
4636
|
+
case Types.ProductActionType.PaymentMethodSelected:
|
|
4637
|
+
case Types.ProductActionType.PaymentAttempted:
|
|
4638
|
+
case Types.ProductActionType.PaymentSucceeded:
|
|
4639
|
+
case Types.ProductActionType.PaymentFailed:
|
|
4640
|
+
case Types.ProductActionType.RefundInitiated:
|
|
4641
|
+
return Types.EventType.Unknown;
|
|
4506
4642
|
default:
|
|
4507
4643
|
mpInstance.Logger.error('Could not convert product action type ' + productActionType + ' to event type');
|
|
4508
4644
|
return null;
|
|
@@ -6302,6 +6438,10 @@ var mParticle = (function () {
|
|
|
6302
6438
|
ProductActionType: productActionType,
|
|
6303
6439
|
ProductList: productList
|
|
6304
6440
|
};
|
|
6441
|
+
if (Types.ProductActionType.isRoktCommerceType(productActionType)) {
|
|
6442
|
+
event.CustomFlags = event.CustomFlags || {};
|
|
6443
|
+
event.CustomFlags['Rokt.CommerceEventType'] = Types.ProductActionType.getExpansionName(productActionType);
|
|
6444
|
+
}
|
|
6305
6445
|
if (mpInstance._Helpers.isObject(transactionAttributes)) {
|
|
6306
6446
|
mpInstance._Ecommerce.convertTransactionAttributesToProductAction(transactionAttributes, event.ProductAction);
|
|
6307
6447
|
}
|
|
@@ -7831,6 +7971,37 @@ var mParticle = (function () {
|
|
|
7831
7971
|
}
|
|
7832
7972
|
}
|
|
7833
7973
|
|
|
7974
|
+
function _toPrimitive(input, hint) {
|
|
7975
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
7976
|
+
var prim = input[Symbol.toPrimitive];
|
|
7977
|
+
if (prim !== undefined) {
|
|
7978
|
+
var res = prim.call(input, hint || "default");
|
|
7979
|
+
if (_typeof$1(res) !== "object") return res;
|
|
7980
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7981
|
+
}
|
|
7982
|
+
return (hint === "string" ? String : Number)(input);
|
|
7983
|
+
}
|
|
7984
|
+
|
|
7985
|
+
function _toPropertyKey(arg) {
|
|
7986
|
+
var key = _toPrimitive(arg, "string");
|
|
7987
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
7988
|
+
}
|
|
7989
|
+
|
|
7990
|
+
function _defineProperty(obj, key, value) {
|
|
7991
|
+
key = _toPropertyKey(key);
|
|
7992
|
+
if (key in obj) {
|
|
7993
|
+
Object.defineProperty(obj, key, {
|
|
7994
|
+
value: value,
|
|
7995
|
+
enumerable: true,
|
|
7996
|
+
configurable: true,
|
|
7997
|
+
writable: true
|
|
7998
|
+
});
|
|
7999
|
+
} else {
|
|
8000
|
+
obj[key] = value;
|
|
8001
|
+
}
|
|
8002
|
+
return obj;
|
|
8003
|
+
}
|
|
8004
|
+
|
|
7834
8005
|
var AudienceManager = /** @class */function () {
|
|
7835
8006
|
function AudienceManager(userAudienceUrl, apiKey, logger) {
|
|
7836
8007
|
this.url = '';
|
|
@@ -7935,6 +8106,8 @@ var mParticle = (function () {
|
|
|
7935
8106
|
}
|
|
7936
8107
|
};
|
|
7937
8108
|
|
|
8109
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8110
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7938
8111
|
var Messages$2 = Constants.Messages,
|
|
7939
8112
|
HTTPCodes$2 = Constants.HTTPCodes,
|
|
7940
8113
|
FeatureFlags$1 = Constants.FeatureFlags,
|
|
@@ -7959,7 +8132,12 @@ var mParticle = (function () {
|
|
|
7959
8132
|
mpInstance.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent + ': ' + method);
|
|
7960
8133
|
|
|
7961
8134
|
// First, remove any falsy identity values and warn about them
|
|
7962
|
-
var
|
|
8135
|
+
var removedFalsyIdentityData = mpInstance._Helpers.Validators.removeFalsyIdentityValues(identityApiData, mpInstance.Logger);
|
|
8136
|
+
|
|
8137
|
+
// Normalize convenience aliases (email_sha256 → other, mobile_sha256 → other2)
|
|
8138
|
+
var cleanedIdentityApiData = removedFalsyIdentityData !== null && removedFalsyIdentityData !== void 0 && removedFalsyIdentityData.userIdentities ? _objectSpread(_objectSpread({}, removedFalsyIdentityData), {}, {
|
|
8139
|
+
userIdentities: normalizeUserIdentityKeys(removedFalsyIdentityData.userIdentities)
|
|
8140
|
+
}) : removedFalsyIdentityData;
|
|
7963
8141
|
var identityValidationResult = mpInstance._Helpers.Validators.validateIdentities(cleanedIdentityApiData, method);
|
|
7964
8142
|
if (!identityValidationResult.valid) {
|
|
7965
8143
|
mpInstance.Logger.error('ERROR: ' + identityValidationResult.error);
|
|
@@ -8701,7 +8879,10 @@ var mParticle = (function () {
|
|
|
8701
8879
|
* @return a cart object
|
|
8702
8880
|
*/
|
|
8703
8881
|
getCart: function getCart() {
|
|
8704
|
-
|
|
8882
|
+
logDeprecatedMethodUsage({
|
|
8883
|
+
methodName: 'Identity.getCurrentUser().getCart()',
|
|
8884
|
+
warningMessage: 'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases'
|
|
8885
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8705
8886
|
return self.mParticleUserCart();
|
|
8706
8887
|
},
|
|
8707
8888
|
/**
|
|
@@ -8765,7 +8946,10 @@ var mParticle = (function () {
|
|
|
8765
8946
|
* @deprecated
|
|
8766
8947
|
*/
|
|
8767
8948
|
add: function add() {
|
|
8768
|
-
|
|
8949
|
+
logDeprecatedMethodUsage({
|
|
8950
|
+
methodName: 'Identity.getCurrentUser().getCart().add()',
|
|
8951
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8952
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8769
8953
|
},
|
|
8770
8954
|
/**
|
|
8771
8955
|
* Removes a cart product from the current user cart
|
|
@@ -8773,7 +8957,10 @@ var mParticle = (function () {
|
|
|
8773
8957
|
* @deprecated
|
|
8774
8958
|
*/
|
|
8775
8959
|
remove: function remove() {
|
|
8776
|
-
|
|
8960
|
+
logDeprecatedMethodUsage({
|
|
8961
|
+
methodName: 'Identity.getCurrentUser().getCart().remove()',
|
|
8962
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8963
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8777
8964
|
},
|
|
8778
8965
|
/**
|
|
8779
8966
|
* Clears the user's cart
|
|
@@ -8781,7 +8968,10 @@ var mParticle = (function () {
|
|
|
8781
8968
|
* @deprecated
|
|
8782
8969
|
*/
|
|
8783
8970
|
clear: function clear() {
|
|
8784
|
-
|
|
8971
|
+
logDeprecatedMethodUsage({
|
|
8972
|
+
methodName: 'Identity.getCurrentUser().getCart().clear()',
|
|
8973
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8974
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8785
8975
|
},
|
|
8786
8976
|
/**
|
|
8787
8977
|
* Returns all cart products
|
|
@@ -8790,7 +8980,10 @@ var mParticle = (function () {
|
|
|
8790
8980
|
* @deprecated
|
|
8791
8981
|
*/
|
|
8792
8982
|
getCartProducts: function getCartProducts() {
|
|
8793
|
-
|
|
8983
|
+
logDeprecatedMethodUsage({
|
|
8984
|
+
methodName: 'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
8985
|
+
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8986
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8794
8987
|
return [];
|
|
8795
8988
|
}
|
|
8796
8989
|
};
|
|
@@ -8863,7 +9056,7 @@ var mParticle = (function () {
|
|
|
8863
9056
|
newUser = mpInstance.Identity.getCurrentUser();
|
|
8864
9057
|
|
|
8865
9058
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
8866
|
-
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger);
|
|
9059
|
+
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
8867
9060
|
var persistence = mpInstance._Persistence.getPersistence();
|
|
8868
9061
|
if (newUser) {
|
|
8869
9062
|
mpInstance._Persistence.storeDataInMemory(persistence, newUser.getMPID());
|
|
@@ -8996,10 +9189,13 @@ var mParticle = (function () {
|
|
|
8996
9189
|
}
|
|
8997
9190
|
|
|
8998
9191
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
8999
|
-
function tryOnUserAlias(previousUser, newUser, identityApiData, logger) {
|
|
9192
|
+
function tryOnUserAlias(previousUser, newUser, identityApiData, logger, loggingDispatcher) {
|
|
9000
9193
|
if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) {
|
|
9001
9194
|
try {
|
|
9002
|
-
|
|
9195
|
+
logDeprecatedMethodUsage({
|
|
9196
|
+
methodName: 'onUserAlias',
|
|
9197
|
+
warningMessage: generateDeprecationMessage('onUserAlias')
|
|
9198
|
+
}, logger, loggingDispatcher);
|
|
9003
9199
|
identityApiData.onUserAlias(previousUser, newUser);
|
|
9004
9200
|
} catch (e) {
|
|
9005
9201
|
logger.error('There was an error with your onUserAlias function - ' + e);
|
|
@@ -9280,7 +9476,10 @@ var mParticle = (function () {
|
|
|
9280
9476
|
}
|
|
9281
9477
|
// TODO: Can we remove this? It is deprecated.
|
|
9282
9478
|
function removeCCPAState() {
|
|
9283
|
-
|
|
9479
|
+
logDeprecatedMethodUsage({
|
|
9480
|
+
methodName: 'Consent.removeCCPAState',
|
|
9481
|
+
warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead'
|
|
9482
|
+
}, mpInstance.Logger, mpInstance._LoggingDispatcher);
|
|
9284
9483
|
// @ts-ignore
|
|
9285
9484
|
return removeCCPAConsentState();
|
|
9286
9485
|
}
|
|
@@ -11110,6 +11309,7 @@ var mParticle = (function () {
|
|
|
11110
11309
|
this.CommerceEventType = CommerceEventType;
|
|
11111
11310
|
this.PromotionType = PromotionActionType;
|
|
11112
11311
|
this.ProductActionType = ProductActionType;
|
|
11312
|
+
this.RoktEvents = RoktEvents;
|
|
11113
11313
|
this._Identity = new Identity(this);
|
|
11114
11314
|
this.Identity = this._Identity.IdentityAPI;
|
|
11115
11315
|
this.generateHash = this._Helpers.generateHash;
|
|
@@ -11582,7 +11782,10 @@ var mParticle = (function () {
|
|
|
11582
11782
|
* @deprecated
|
|
11583
11783
|
*/
|
|
11584
11784
|
add: function add(product, logEventBoolean) {
|
|
11585
|
-
|
|
11785
|
+
logDeprecatedMethodUsage({
|
|
11786
|
+
methodName: 'mPInstance.eCommerce.Cart.add()',
|
|
11787
|
+
warningMessage: generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11788
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11586
11789
|
},
|
|
11587
11790
|
/**
|
|
11588
11791
|
* Removes a product from the cart
|
|
@@ -11592,7 +11795,10 @@ var mParticle = (function () {
|
|
|
11592
11795
|
* @deprecated
|
|
11593
11796
|
*/
|
|
11594
11797
|
remove: function remove(product, logEventBoolean) {
|
|
11595
|
-
|
|
11798
|
+
logDeprecatedMethodUsage({
|
|
11799
|
+
methodName: 'mPInstance.eCommerce.Cart.remove()',
|
|
11800
|
+
warningMessage: generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11801
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11596
11802
|
},
|
|
11597
11803
|
/**
|
|
11598
11804
|
* Clears the cart
|
|
@@ -11600,7 +11806,10 @@ var mParticle = (function () {
|
|
|
11600
11806
|
* @deprecated
|
|
11601
11807
|
*/
|
|
11602
11808
|
clear: function clear() {
|
|
11603
|
-
|
|
11809
|
+
logDeprecatedMethodUsage({
|
|
11810
|
+
methodName: 'mPInstance.eCommerce.Cart.clear()',
|
|
11811
|
+
warningMessage: generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11812
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11604
11813
|
}
|
|
11605
11814
|
},
|
|
11606
11815
|
/**
|
|
@@ -11686,7 +11895,10 @@ var mParticle = (function () {
|
|
|
11686
11895
|
* @deprecated
|
|
11687
11896
|
*/
|
|
11688
11897
|
logCheckout: function logCheckout(step, option, attrs, customFlags) {
|
|
11689
|
-
|
|
11898
|
+
logDeprecatedMethodUsage({
|
|
11899
|
+
methodName: 'mParticle.logCheckout',
|
|
11900
|
+
warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead'
|
|
11901
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11690
11902
|
if (!self._Store.isInitialized) {
|
|
11691
11903
|
self.ready(function () {
|
|
11692
11904
|
self.eCommerce.logCheckout(step, option, attrs, customFlags);
|
|
@@ -11727,7 +11939,10 @@ var mParticle = (function () {
|
|
|
11727
11939
|
* @deprecated
|
|
11728
11940
|
*/
|
|
11729
11941
|
logPurchase: function logPurchase(transactionAttributes, product, clearCart, attrs, customFlags) {
|
|
11730
|
-
|
|
11942
|
+
logDeprecatedMethodUsage({
|
|
11943
|
+
methodName: 'mParticle.logPurchase',
|
|
11944
|
+
warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead'
|
|
11945
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11731
11946
|
if (!self._Store.isInitialized) {
|
|
11732
11947
|
self.ready(function () {
|
|
11733
11948
|
self.eCommerce.logPurchase(transactionAttributes, product, clearCart, attrs, customFlags);
|
|
@@ -11788,7 +12003,10 @@ var mParticle = (function () {
|
|
|
11788
12003
|
* @deprecated
|
|
11789
12004
|
*/
|
|
11790
12005
|
logRefund: function logRefund(transactionAttributes, product, clearCart, attrs, customFlags) {
|
|
11791
|
-
|
|
12006
|
+
logDeprecatedMethodUsage({
|
|
12007
|
+
methodName: 'mParticle.logRefund',
|
|
12008
|
+
warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead'
|
|
12009
|
+
}, self.Logger, self._LoggingDispatcher);
|
|
11792
12010
|
if (!self._Store.isInitialized) {
|
|
11793
12011
|
self.ready(function () {
|
|
11794
12012
|
self.eCommerce.logRefund(transactionAttributes, product, clearCart, attrs, customFlags);
|
|
@@ -12461,6 +12679,7 @@ var mParticle = (function () {
|
|
|
12461
12679
|
this.CommerceEventType = CommerceEventType;
|
|
12462
12680
|
this.PromotionType = PromotionActionType;
|
|
12463
12681
|
this.ProductActionType = ProductActionType;
|
|
12682
|
+
this.RoktEvents = RoktEvents;
|
|
12464
12683
|
this.MPSideloadedKit = MPSideloadedKit;
|
|
12465
12684
|
if (typeof window !== 'undefined') {
|
|
12466
12685
|
this.isIOS = window.mParticle && window.mParticle.isIOS ? window.mParticle.isIOS : false;
|
|
@@ -2,7 +2,7 @@ export default function Ecommerce(mpInstance: any): void;
|
|
|
2
2
|
export default class Ecommerce {
|
|
3
3
|
constructor(mpInstance: any);
|
|
4
4
|
convertTransactionAttributesToProductAction: (transactionAttributes: any, productAction: any) => void;
|
|
5
|
-
getProductActionEventName: (productActionType: any) => "AddToCart" | "AddToWishlist" | "Checkout" | "CheckoutOption" | "Click" | "Purchase" | "Refund" | "RemoveFromCart" | "RemoveFromWishlist" | "ViewDetail" | "Unknown";
|
|
5
|
+
getProductActionEventName: (productActionType: any) => "AddToCart" | "AddToWishlist" | "Checkout" | "CheckoutOption" | "Click" | "Purchase" | "Refund" | "RemoveFromCart" | "RemoveFromWishlist" | "ViewDetail" | "ViewCart" | "AddShippingInfo" | "AddPaymentInfo" | "PaymentMethodSelected" | "PaymentAttempted" | "PaymentSucceeded" | "PaymentFailed" | "RefundInitiated" | "Unknown";
|
|
6
6
|
getPromotionActionEventName: (promotionActionType: any) => "Unknown" | "PromotionClick" | "PromotionView";
|
|
7
7
|
convertProductActionToEventType: (productActionType: any) => 0 | 20 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21;
|
|
8
8
|
convertPromotionActionToEventType: (promotionActionType: any) => 18 | 19;
|
|
@@ -25,6 +25,9 @@ export declare const getCachedIdentity: (method: IdentityAPIMethod, proposedUser
|
|
|
25
25
|
export declare const createKnownIdentities: (identityApiData: IdentityApiData, deviceId: string) => IKnownIdentities;
|
|
26
26
|
export declare const removeExpiredIdentityCacheDates: (idCache: BaseVault<Dictionary<ICachedIdentityCall>>) => void;
|
|
27
27
|
export declare const tryCacheIdentity: (knownIdentities: IKnownIdentities, idCache: IdentityCache, parseIdentityResponse: IParseCachedIdentityResponse, mpid: string, callback: IdentityCallback, identityApiData: IdentityApiData, identityMethod: IdentityAPIMethod) => boolean;
|
|
28
|
+
type Sha256IdentityAlias = 'email_sha256' | 'mobile_sha256';
|
|
29
|
+
type UserIdentitiesWithAliases = UserIdentities & Partial<Record<Sha256IdentityAlias, string | null>>;
|
|
30
|
+
export declare const normalizeUserIdentityKeys: (userIdentities: UserIdentitiesWithAliases) => UserIdentities;
|
|
28
31
|
export declare const hasIdentityRequestChanged: (currentUser: IMParticleUser, newIdentityRequest: IdentityApiData) => boolean;
|
|
29
32
|
/**
|
|
30
33
|
* Checks if deviceId or other user identifiers (like email) were explicitly provided
|
|
@@ -50,3 +53,4 @@ export declare const buildIdentitySearchEnvelope: (environment: Environment) =>
|
|
|
50
53
|
* plumbing) is type-checked instead of being expressed in plain JS.
|
|
51
54
|
*/
|
|
52
55
|
export declare const executeSearchRequest: (mpInstance: IMParticleWebSDKInstance, workspaceApiKey: string, knownIdentities: UserIdentities, callback: IdentitySearchCallback) => void;
|
|
56
|
+
export {};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* natively defined in this SDK and the DT package is deprecated.
|
|
14
14
|
*/
|
|
15
15
|
export type { Batch, } from '@mparticle/event-models';
|
|
16
|
-
export type { EventType, CommerceEventType, IdentityType, ProductActionType, PromotionActionType, MessageType, } from './types';
|
|
16
|
+
export type { EventType, CommerceEventType, IdentityType, ProductActionType, PromotionActionType, MessageType, RoktEventName, RoktEvents, } from './types';
|
|
17
17
|
export type { SDKInitConfig, DataPlanConfig, BaseEvent, SDKEventCustomFlags, LogLevelType, MParticleWebSDK, } from './sdkRuntimeModels';
|
|
18
18
|
export type { IMParticleUser, IdentityCallback, IdentityResult, IdentityResultBody, IdentityModifyResultBody, ISDKUserIdentity, ISDKUserAttributes, } from './identity-user-interfaces';
|
|
19
19
|
export type { SDKIdentityApi, IAliasRequest, IAliasCallback, IAliasResult, SDKIdentityTypeEnum, IIdentitySearchResult, IIdentitySearchResponseBody, IdentitySearchCallback, IUserIdentities } from './identity.interfaces';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ILoggingService } from './types';
|
|
2
|
+
import { SDKLoggerApi } from '../sdkRuntimeModels';
|
|
3
|
+
interface DeprecatedMethodUsage {
|
|
4
|
+
methodName: string;
|
|
5
|
+
warningMessage: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function logDeprecatedMethodUsage(usage: DeprecatedMethodUsage, logger: Pick<SDKLoggerApi, 'warning'>, loggingDispatcher: ILoggingService | undefined): void;
|
|
8
|
+
export {};
|
|
@@ -5,6 +5,7 @@ export declare const ErrorCodes: {
|
|
|
5
5
|
readonly IDENTITY_REQUEST: "IDENTITY_REQUEST";
|
|
6
6
|
readonly IDENTITY_MISMATCH: "IDENTITY_MISMATCH";
|
|
7
7
|
readonly ROKT_KIT_ATTACHED: "ROKT_KIT_ATTACHED";
|
|
8
|
+
readonly MP_DEPRECATED_METHOD_USAGE: "MP_DEPRECATED_METHOD_USAGE";
|
|
8
9
|
};
|
|
9
10
|
export type ErrorCodes = valueof<typeof ErrorCodes>;
|
|
10
11
|
export declare const WSDKErrorSeverity: {
|
|
@@ -11,7 +11,7 @@ import { ISessionManager } from './sessionManager';
|
|
|
11
11
|
import { ConfiguredKit, MPForwarder, UnregisteredKit } from './forwarders.interfaces';
|
|
12
12
|
import { SDKIdentityApi, IAliasCallback } from './identity.interfaces';
|
|
13
13
|
import { ISDKUserAttributeChangeData, ISDKUserIdentityChanges, IMParticleUser, ISDKUserIdentity, IdentityCallback, ISDKUserAttributes } from './identity-user-interfaces';
|
|
14
|
-
import { CommerceEventType, EventType, IdentityType, ProductActionType, PromotionActionType } from './types';
|
|
14
|
+
import { CommerceEventType, EventType, IdentityType, ProductActionType, PromotionActionType, RoktEvents } from './types';
|
|
15
15
|
import { IPixelConfiguration } from './cookieSyncManager';
|
|
16
16
|
import _BatchValidator from './mockBatchCreator';
|
|
17
17
|
import { SDKECommerceAPI } from './ecommerce.interfaces';
|
|
@@ -103,7 +103,15 @@ export declare enum SDKProductActionType {
|
|
|
103
103
|
Purchase = 7,
|
|
104
104
|
Refund = 8,
|
|
105
105
|
AddToWishlist = 9,
|
|
106
|
-
RemoveFromWishlist = 10
|
|
106
|
+
RemoveFromWishlist = 10,
|
|
107
|
+
ViewCart = 11,
|
|
108
|
+
AddShippingInfo = 12,
|
|
109
|
+
AddPaymentInfo = 13,
|
|
110
|
+
PaymentMethodSelected = 14,
|
|
111
|
+
PaymentAttempted = 15,
|
|
112
|
+
PaymentSucceeded = 16,
|
|
113
|
+
PaymentFailed = 17,
|
|
114
|
+
RefundInitiated = 18
|
|
107
115
|
}
|
|
108
116
|
export interface SDKProductAction {
|
|
109
117
|
ProductActionType: SDKProductActionType;
|
|
@@ -118,9 +126,9 @@ export interface SDKProductAction {
|
|
|
118
126
|
TaxAmount?: number;
|
|
119
127
|
}
|
|
120
128
|
export interface SDKProduct {
|
|
121
|
-
Sku
|
|
122
|
-
Name
|
|
123
|
-
Price
|
|
129
|
+
Sku: string;
|
|
130
|
+
Name: string;
|
|
131
|
+
Price: number;
|
|
124
132
|
Quantity?: number;
|
|
125
133
|
Brand?: string;
|
|
126
134
|
Variant?: string;
|
|
@@ -128,7 +136,7 @@ export interface SDKProduct {
|
|
|
128
136
|
Position?: number;
|
|
129
137
|
CouponCode?: string;
|
|
130
138
|
TotalAmount?: number;
|
|
131
|
-
Attributes?: Record<string, unknown
|
|
139
|
+
Attributes?: Record<string, unknown>;
|
|
132
140
|
}
|
|
133
141
|
export interface MParticleWebSDK {
|
|
134
142
|
addForwarder(forwarder: UnregisteredKit): void;
|
|
@@ -137,6 +145,7 @@ export interface MParticleWebSDK {
|
|
|
137
145
|
EventType: typeof EventType;
|
|
138
146
|
PromotionType: typeof PromotionActionType;
|
|
139
147
|
ProductActionType: typeof ProductActionType;
|
|
148
|
+
RoktEvents: typeof RoktEvents;
|
|
140
149
|
Identity: SDKIdentityApi;
|
|
141
150
|
Logger: SDKLoggerApi;
|
|
142
151
|
Consent: SDKConsentApi;
|
|
@@ -203,7 +212,7 @@ export declare const LogLevelType: {
|
|
|
203
212
|
readonly Warning: "warning";
|
|
204
213
|
readonly Error: "error";
|
|
205
214
|
};
|
|
206
|
-
export interface SDKInitConfig extends Omit<MPConfiguration, 'dataPlan' | 'logLevel'> {
|
|
215
|
+
export interface SDKInitConfig extends Omit<MPConfiguration, 'dataPlan' | 'logLevel' | 'identityCallback'> {
|
|
207
216
|
dataPlan?: DataPlanConfig | KitBlockerDataPlan;
|
|
208
217
|
logLevel?: LogLevelType;
|
|
209
218
|
kitConfigs?: IKitConfigs[];
|
|
@@ -29,6 +29,7 @@ declare namespace mParticle {
|
|
|
29
29
|
export let IdentityType: {};
|
|
30
30
|
export let ProductActionType: {};
|
|
31
31
|
export let PromotionType: {};
|
|
32
|
+
export let RoktEvents: {};
|
|
32
33
|
export namespace eCommerce {
|
|
33
34
|
export { returnImpression as createImpression };
|
|
34
35
|
export { returnProduct as createProduct };
|