@mparticle/web-sdk 2.80.0 → 2.81.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 +75 -488
- package/dist/mparticle.esm.js +75 -488
- package/dist/mparticle.js +244 -673
- package/dist/types/src/configAPIClient.d.ts +1 -0
- package/dist/types/src/ecommerce.d.ts +3 -53
- package/dist/types/src/ecommerce.interfaces.d.ts +11 -12
- package/dist/types/src/events.interfaces.d.ts +1 -1
- package/dist/types/src/forwarders.d.ts +4 -26
- package/dist/types/src/forwarders.interfaces.d.ts +41 -10
- package/dist/types/src/identity-utils.d.ts +3 -3
- package/dist/types/src/identity.d.ts +3 -0
- package/dist/types/src/identity.interfaces.d.ts +45 -11
- package/dist/types/src/identityApiClient.d.ts +5 -4
- package/dist/types/src/mp-instance.d.ts +2 -2
- package/dist/types/src/persistence.interfaces.d.ts +2 -3
- package/dist/types/src/roktManager.d.ts +18 -0
- package/dist/types/src/sdkRuntimeModels.d.ts +2 -2
- package/dist/types/src/store.d.ts +4 -3
- package/package.json +1 -1
- package/src/configAPIClient.ts +1 -0
- package/src/ecommerce.interfaces.ts +12 -21
- package/src/{ecommerce.js → ecommerce.ts} +144 -73
- package/src/events.interfaces.ts +1 -1
- package/src/events.ts +1 -1
- package/src/forwarders.interfaces.ts +73 -10
- package/src/{forwarders.js → forwarders.ts} +214 -176
- package/src/helpers.ts +7 -3
- package/src/identity-utils.ts +2 -2
- package/src/identity.interfaces.ts +58 -14
- package/src/{identity.js → identity.ts} +237 -192
- package/src/identityApiClient.ts +9 -9
- package/src/mp-instance.ts +2 -2
- package/src/persistence.interfaces.ts +2 -3
- package/src/roktManager.ts +37 -0
- package/src/sdkRuntimeModels.ts +2 -1
- package/src/store.ts +4 -3
package/dist/mparticle.js
CHANGED
|
@@ -204,7 +204,7 @@ var mParticle = (function () {
|
|
|
204
204
|
Base64: Base64$1
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
var version = "2.
|
|
207
|
+
var version = "2.81.0";
|
|
208
208
|
|
|
209
209
|
var Constants = {
|
|
210
210
|
sdkVersion: version,
|
|
@@ -422,14 +422,14 @@ var mParticle = (function () {
|
|
|
422
422
|
var HTTP_NOT_FOUND = 404;
|
|
423
423
|
var HTTP_SERVER_ERROR = 500;
|
|
424
424
|
|
|
425
|
-
function _typeof
|
|
425
|
+
function _typeof(o) {
|
|
426
426
|
"@babel/helpers - typeof";
|
|
427
427
|
|
|
428
|
-
return _typeof
|
|
428
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
429
429
|
return typeof o;
|
|
430
430
|
} : function (o) {
|
|
431
431
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
432
|
-
}, _typeof
|
|
432
|
+
}, _typeof(o);
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
/******************************************************************************
|
|
@@ -923,7 +923,7 @@ var mParticle = (function () {
|
|
|
923
923
|
return obfuscated;
|
|
924
924
|
}
|
|
925
925
|
// For primitives and other types, return the type as a string
|
|
926
|
-
return _typeof
|
|
926
|
+
return _typeof(value);
|
|
927
927
|
};
|
|
928
928
|
/**
|
|
929
929
|
* For verbose logging: returns raw data when isDevelopmentMode is true, else obfuscated data.
|
|
@@ -996,7 +996,7 @@ var mParticle = (function () {
|
|
|
996
996
|
target = args[1] || {};
|
|
997
997
|
i = 2;
|
|
998
998
|
}
|
|
999
|
-
if (_typeof
|
|
999
|
+
if (_typeof(target) !== 'object' && !objectHelper.isFunction(target)) {
|
|
1000
1000
|
target = {};
|
|
1001
1001
|
}
|
|
1002
1002
|
if (length === i) {
|
|
@@ -1044,7 +1044,7 @@ var mParticle = (function () {
|
|
|
1044
1044
|
return e;
|
|
1045
1045
|
}
|
|
1046
1046
|
// fetch-mock and some network libs reject with { message } rather than Error
|
|
1047
|
-
if (e && _typeof
|
|
1047
|
+
if (e && _typeof(e) === 'object' && typeof e.message === 'string') {
|
|
1048
1048
|
return e.message;
|
|
1049
1049
|
}
|
|
1050
1050
|
return fallback;
|
|
@@ -1519,10 +1519,6 @@ var mParticle = (function () {
|
|
|
1519
1519
|
Error: 'error'
|
|
1520
1520
|
};
|
|
1521
1521
|
|
|
1522
|
-
function getDefaultExportFromCjs (x) {
|
|
1523
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
1522
|
var dist = {};
|
|
1527
1523
|
|
|
1528
1524
|
(function (exports) {
|
|
@@ -3385,11 +3381,11 @@ var mParticle = (function () {
|
|
|
3385
3381
|
});
|
|
3386
3382
|
};
|
|
3387
3383
|
|
|
3388
|
-
var _a = Constants.IdentityMethods,
|
|
3389
|
-
Identify$2 = _a.Identify,
|
|
3390
|
-
Modify$3 = _a.Modify,
|
|
3391
|
-
Login$2 = _a.Login,
|
|
3392
|
-
Logout$2 = _a.Logout;
|
|
3384
|
+
var _a$1 = Constants.IdentityMethods,
|
|
3385
|
+
Identify$2 = _a$1.Identify,
|
|
3386
|
+
Modify$3 = _a$1.Modify,
|
|
3387
|
+
Login$2 = _a$1.Login,
|
|
3388
|
+
Logout$2 = _a$1.Logout;
|
|
3393
3389
|
var HTTPCodes$3 = Constants.HTTPCodes,
|
|
3394
3390
|
Messages$9 = Constants.Messages;
|
|
3395
3391
|
var CACHE_HEADER = 'x-mp-max-age';
|
|
@@ -4474,7 +4470,6 @@ var mParticle = (function () {
|
|
|
4474
4470
|
var Messages$5 = Constants.Messages;
|
|
4475
4471
|
function Ecommerce(mpInstance) {
|
|
4476
4472
|
var self = this;
|
|
4477
|
-
|
|
4478
4473
|
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
4479
4474
|
this.convertTransactionAttributesToProductAction = function (transactionAttributes, productAction) {
|
|
4480
4475
|
if (transactionAttributes.hasOwnProperty('Id')) {
|
|
@@ -4502,7 +4497,6 @@ var mParticle = (function () {
|
|
|
4502
4497
|
productAction.CheckoutOptions = transactionAttributes.Option;
|
|
4503
4498
|
}
|
|
4504
4499
|
};
|
|
4505
|
-
|
|
4506
4500
|
// When the caller does not supply a transaction-level total via
|
|
4507
4501
|
// transactionAttributes.Revenue, derive it from the product list
|
|
4508
4502
|
// (quantity * price) plus shipping and tax. A total that the caller provided
|
|
@@ -4594,13 +4588,11 @@ var mParticle = (function () {
|
|
|
4594
4588
|
return Types.CommerceEventType.ProductRemoveFromCart;
|
|
4595
4589
|
case Types.ProductActionType.RemoveFromWishlist:
|
|
4596
4590
|
return Types.CommerceEventType.ProductRemoveFromWishlist;
|
|
4597
|
-
|
|
4598
4591
|
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
4599
4592
|
case Types.ProductActionType.Unknown:
|
|
4600
4593
|
return Types.EventType.Unknown;
|
|
4601
4594
|
case Types.ProductActionType.ViewDetail:
|
|
4602
4595
|
return Types.CommerceEventType.ProductViewDetail;
|
|
4603
|
-
|
|
4604
4596
|
// Rokt Brain commerce-adjacent types map to Unknown on server
|
|
4605
4597
|
case Types.ProductActionType.ViewCart:
|
|
4606
4598
|
case Types.ProductActionType.AddShippingInfo:
|
|
@@ -4630,7 +4622,6 @@ var mParticle = (function () {
|
|
|
4630
4622
|
this.generateExpandedEcommerceName = function (eventName, plusOne) {
|
|
4631
4623
|
return 'eCommerce - ' + eventName + ' - ' + (plusOne ? 'Total' : 'Item');
|
|
4632
4624
|
};
|
|
4633
|
-
|
|
4634
4625
|
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
4635
4626
|
this.extractProductAttributes = function (attributes, product) {
|
|
4636
4627
|
if (product.CouponCode) {
|
|
@@ -4662,14 +4653,12 @@ var mParticle = (function () {
|
|
|
4662
4653
|
}
|
|
4663
4654
|
attributes['Total Product Amount'] = product.TotalAmount || 0;
|
|
4664
4655
|
};
|
|
4665
|
-
|
|
4666
4656
|
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
4667
4657
|
this.extractTransactionId = function (attributes, productAction) {
|
|
4668
4658
|
if (productAction.TransactionId) {
|
|
4669
4659
|
attributes['Transaction Id'] = productAction.TransactionId;
|
|
4670
4660
|
}
|
|
4671
4661
|
};
|
|
4672
|
-
|
|
4673
4662
|
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
4674
4663
|
this.extractActionAttributes = function (attributes, productAction) {
|
|
4675
4664
|
self.extractTransactionId(attributes, productAction);
|
|
@@ -4695,7 +4684,6 @@ var mParticle = (function () {
|
|
|
4695
4684
|
attributes['Checkout Step'] = productAction.CheckoutStep;
|
|
4696
4685
|
}
|
|
4697
4686
|
};
|
|
4698
|
-
|
|
4699
4687
|
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
4700
4688
|
this.extractPromotionAttributes = function (attributes, promotion) {
|
|
4701
4689
|
if (promotion.Id) {
|
|
@@ -4919,15 +4907,13 @@ var mParticle = (function () {
|
|
|
4919
4907
|
}
|
|
4920
4908
|
return null;
|
|
4921
4909
|
};
|
|
4922
|
-
|
|
4923
4910
|
// sanitizes any non number, non string value to 0
|
|
4924
4911
|
this.sanitizeAmount = function (amount, category) {
|
|
4925
4912
|
if (!mpInstance._Helpers.Validators.isStringOrNumber(amount)) {
|
|
4926
|
-
var message = [category, 'must be of type number. A', _typeof
|
|
4913
|
+
var message = [category, 'must be of type number. A', _typeof(amount), 'was passed. Converting to 0'].join(' ');
|
|
4927
4914
|
mpInstance.Logger.warning(message);
|
|
4928
4915
|
return 0;
|
|
4929
4916
|
}
|
|
4930
|
-
|
|
4931
4917
|
// if amount is a string, it will be parsed into a number if possible, or set to 0
|
|
4932
4918
|
return mpInstance._Helpers.parseNumber(amount);
|
|
4933
4919
|
};
|
|
@@ -5199,7 +5185,7 @@ var mParticle = (function () {
|
|
|
5199
5185
|
if (mpInstance._Helpers.Validators.isFunction(callback)) {
|
|
5200
5186
|
this.SDKConfig.identityCallback = config.identityCallback;
|
|
5201
5187
|
} else {
|
|
5202
|
-
mpInstance.Logger.warning('The optional callback must be a function. You tried entering a(n) ' + _typeof
|
|
5188
|
+
mpInstance.Logger.warning('The optional callback must be a function. You tried entering a(n) ' + _typeof(callback) + ' . Callback not set. Please set your callback again.');
|
|
5203
5189
|
}
|
|
5204
5190
|
}
|
|
5205
5191
|
if (config.hasOwnProperty('appVersion')) {
|
|
@@ -7116,386 +7102,6 @@ var mParticle = (function () {
|
|
|
7116
7102
|
};
|
|
7117
7103
|
}
|
|
7118
7104
|
|
|
7119
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
7120
|
-
try {
|
|
7121
|
-
var info = gen[key](arg);
|
|
7122
|
-
var value = info.value;
|
|
7123
|
-
} catch (error) {
|
|
7124
|
-
reject(error);
|
|
7125
|
-
return;
|
|
7126
|
-
}
|
|
7127
|
-
if (info.done) {
|
|
7128
|
-
resolve(value);
|
|
7129
|
-
} else {
|
|
7130
|
-
Promise.resolve(value).then(_next, _throw);
|
|
7131
|
-
}
|
|
7132
|
-
}
|
|
7133
|
-
function _asyncToGenerator(fn) {
|
|
7134
|
-
return function () {
|
|
7135
|
-
var self = this,
|
|
7136
|
-
args = arguments;
|
|
7137
|
-
return new Promise(function (resolve, reject) {
|
|
7138
|
-
var gen = fn.apply(self, args);
|
|
7139
|
-
function _next(value) {
|
|
7140
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
7141
|
-
}
|
|
7142
|
-
function _throw(err) {
|
|
7143
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
7144
|
-
}
|
|
7145
|
-
_next(undefined);
|
|
7146
|
-
});
|
|
7147
|
-
};
|
|
7148
|
-
}
|
|
7149
|
-
|
|
7150
|
-
var regeneratorRuntime$1 = {exports: {}};
|
|
7151
|
-
|
|
7152
|
-
var _typeof = {exports: {}};
|
|
7153
|
-
|
|
7154
|
-
_typeof.exports;
|
|
7155
|
-
|
|
7156
|
-
(function (module) {
|
|
7157
|
-
function _typeof(o) {
|
|
7158
|
-
"@babel/helpers - typeof";
|
|
7159
|
-
|
|
7160
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7161
|
-
return typeof o;
|
|
7162
|
-
} : function (o) {
|
|
7163
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7164
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
|
|
7165
|
-
}
|
|
7166
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
7167
|
-
} (_typeof));
|
|
7168
|
-
|
|
7169
|
-
var _typeofExports = _typeof.exports;
|
|
7170
|
-
|
|
7171
|
-
regeneratorRuntime$1.exports;
|
|
7172
|
-
|
|
7173
|
-
(function (module) {
|
|
7174
|
-
var _typeof = _typeofExports["default"];
|
|
7175
|
-
function _regeneratorRuntime() {
|
|
7176
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
7177
|
-
return e;
|
|
7178
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
7179
|
-
var t,
|
|
7180
|
-
e = {},
|
|
7181
|
-
r = Object.prototype,
|
|
7182
|
-
n = r.hasOwnProperty,
|
|
7183
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
7184
|
-
t[e] = r.value;
|
|
7185
|
-
},
|
|
7186
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
7187
|
-
a = i.iterator || "@@iterator",
|
|
7188
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
7189
|
-
u = i.toStringTag || "@@toStringTag";
|
|
7190
|
-
function define(t, e, r) {
|
|
7191
|
-
return Object.defineProperty(t, e, {
|
|
7192
|
-
value: r,
|
|
7193
|
-
enumerable: !0,
|
|
7194
|
-
configurable: !0,
|
|
7195
|
-
writable: !0
|
|
7196
|
-
}), t[e];
|
|
7197
|
-
}
|
|
7198
|
-
try {
|
|
7199
|
-
define({}, "");
|
|
7200
|
-
} catch (t) {
|
|
7201
|
-
define = function define(t, e, r) {
|
|
7202
|
-
return t[e] = r;
|
|
7203
|
-
};
|
|
7204
|
-
}
|
|
7205
|
-
function wrap(t, e, r, n) {
|
|
7206
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
7207
|
-
a = Object.create(i.prototype),
|
|
7208
|
-
c = new Context(n || []);
|
|
7209
|
-
return o(a, "_invoke", {
|
|
7210
|
-
value: makeInvokeMethod(t, r, c)
|
|
7211
|
-
}), a;
|
|
7212
|
-
}
|
|
7213
|
-
function tryCatch(t, e, r) {
|
|
7214
|
-
try {
|
|
7215
|
-
return {
|
|
7216
|
-
type: "normal",
|
|
7217
|
-
arg: t.call(e, r)
|
|
7218
|
-
};
|
|
7219
|
-
} catch (t) {
|
|
7220
|
-
return {
|
|
7221
|
-
type: "throw",
|
|
7222
|
-
arg: t
|
|
7223
|
-
};
|
|
7224
|
-
}
|
|
7225
|
-
}
|
|
7226
|
-
e.wrap = wrap;
|
|
7227
|
-
var h = "suspendedStart",
|
|
7228
|
-
l = "suspendedYield",
|
|
7229
|
-
f = "executing",
|
|
7230
|
-
s = "completed",
|
|
7231
|
-
y = {};
|
|
7232
|
-
function Generator() {}
|
|
7233
|
-
function GeneratorFunction() {}
|
|
7234
|
-
function GeneratorFunctionPrototype() {}
|
|
7235
|
-
var p = {};
|
|
7236
|
-
define(p, a, function () {
|
|
7237
|
-
return this;
|
|
7238
|
-
});
|
|
7239
|
-
var d = Object.getPrototypeOf,
|
|
7240
|
-
v = d && d(d(values([])));
|
|
7241
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
7242
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
7243
|
-
function defineIteratorMethods(t) {
|
|
7244
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
7245
|
-
define(t, e, function (t) {
|
|
7246
|
-
return this._invoke(e, t);
|
|
7247
|
-
});
|
|
7248
|
-
});
|
|
7249
|
-
}
|
|
7250
|
-
function AsyncIterator(t, e) {
|
|
7251
|
-
function invoke(r, o, i, a) {
|
|
7252
|
-
var c = tryCatch(t[r], t, o);
|
|
7253
|
-
if ("throw" !== c.type) {
|
|
7254
|
-
var u = c.arg,
|
|
7255
|
-
h = u.value;
|
|
7256
|
-
return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
7257
|
-
invoke("next", t, i, a);
|
|
7258
|
-
}, function (t) {
|
|
7259
|
-
invoke("throw", t, i, a);
|
|
7260
|
-
}) : e.resolve(h).then(function (t) {
|
|
7261
|
-
u.value = t, i(u);
|
|
7262
|
-
}, function (t) {
|
|
7263
|
-
return invoke("throw", t, i, a);
|
|
7264
|
-
});
|
|
7265
|
-
}
|
|
7266
|
-
a(c.arg);
|
|
7267
|
-
}
|
|
7268
|
-
var r;
|
|
7269
|
-
o(this, "_invoke", {
|
|
7270
|
-
value: function value(t, n) {
|
|
7271
|
-
function callInvokeWithMethodAndArg() {
|
|
7272
|
-
return new e(function (e, r) {
|
|
7273
|
-
invoke(t, n, e, r);
|
|
7274
|
-
});
|
|
7275
|
-
}
|
|
7276
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
7277
|
-
}
|
|
7278
|
-
});
|
|
7279
|
-
}
|
|
7280
|
-
function makeInvokeMethod(e, r, n) {
|
|
7281
|
-
var o = h;
|
|
7282
|
-
return function (i, a) {
|
|
7283
|
-
if (o === f) throw new Error("Generator is already running");
|
|
7284
|
-
if (o === s) {
|
|
7285
|
-
if ("throw" === i) throw a;
|
|
7286
|
-
return {
|
|
7287
|
-
value: t,
|
|
7288
|
-
done: !0
|
|
7289
|
-
};
|
|
7290
|
-
}
|
|
7291
|
-
for (n.method = i, n.arg = a;;) {
|
|
7292
|
-
var c = n.delegate;
|
|
7293
|
-
if (c) {
|
|
7294
|
-
var u = maybeInvokeDelegate(c, n);
|
|
7295
|
-
if (u) {
|
|
7296
|
-
if (u === y) continue;
|
|
7297
|
-
return u;
|
|
7298
|
-
}
|
|
7299
|
-
}
|
|
7300
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
7301
|
-
if (o === h) throw o = s, n.arg;
|
|
7302
|
-
n.dispatchException(n.arg);
|
|
7303
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
7304
|
-
o = f;
|
|
7305
|
-
var p = tryCatch(e, r, n);
|
|
7306
|
-
if ("normal" === p.type) {
|
|
7307
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
7308
|
-
return {
|
|
7309
|
-
value: p.arg,
|
|
7310
|
-
done: n.done
|
|
7311
|
-
};
|
|
7312
|
-
}
|
|
7313
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
7314
|
-
}
|
|
7315
|
-
};
|
|
7316
|
-
}
|
|
7317
|
-
function maybeInvokeDelegate(e, r) {
|
|
7318
|
-
var n = r.method,
|
|
7319
|
-
o = e.iterator[n];
|
|
7320
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
7321
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
7322
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
7323
|
-
var a = i.arg;
|
|
7324
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
7325
|
-
}
|
|
7326
|
-
function pushTryEntry(t) {
|
|
7327
|
-
var e = {
|
|
7328
|
-
tryLoc: t[0]
|
|
7329
|
-
};
|
|
7330
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
7331
|
-
}
|
|
7332
|
-
function resetTryEntry(t) {
|
|
7333
|
-
var e = t.completion || {};
|
|
7334
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
7335
|
-
}
|
|
7336
|
-
function Context(t) {
|
|
7337
|
-
this.tryEntries = [{
|
|
7338
|
-
tryLoc: "root"
|
|
7339
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
7340
|
-
}
|
|
7341
|
-
function values(e) {
|
|
7342
|
-
if (e || "" === e) {
|
|
7343
|
-
var r = e[a];
|
|
7344
|
-
if (r) return r.call(e);
|
|
7345
|
-
if ("function" == typeof e.next) return e;
|
|
7346
|
-
if (!isNaN(e.length)) {
|
|
7347
|
-
var o = -1,
|
|
7348
|
-
i = function next() {
|
|
7349
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
7350
|
-
return next.value = t, next.done = !0, next;
|
|
7351
|
-
};
|
|
7352
|
-
return i.next = i;
|
|
7353
|
-
}
|
|
7354
|
-
}
|
|
7355
|
-
throw new TypeError(_typeof(e) + " is not iterable");
|
|
7356
|
-
}
|
|
7357
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
7358
|
-
value: GeneratorFunctionPrototype,
|
|
7359
|
-
configurable: !0
|
|
7360
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
7361
|
-
value: GeneratorFunction,
|
|
7362
|
-
configurable: !0
|
|
7363
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
7364
|
-
var e = "function" == typeof t && t.constructor;
|
|
7365
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
7366
|
-
}, e.mark = function (t) {
|
|
7367
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
7368
|
-
}, e.awrap = function (t) {
|
|
7369
|
-
return {
|
|
7370
|
-
__await: t
|
|
7371
|
-
};
|
|
7372
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
7373
|
-
return this;
|
|
7374
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
7375
|
-
void 0 === i && (i = Promise);
|
|
7376
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
7377
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
7378
|
-
return t.done ? t.value : a.next();
|
|
7379
|
-
});
|
|
7380
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
7381
|
-
return this;
|
|
7382
|
-
}), define(g, "toString", function () {
|
|
7383
|
-
return "[object Generator]";
|
|
7384
|
-
}), e.keys = function (t) {
|
|
7385
|
-
var e = Object(t),
|
|
7386
|
-
r = [];
|
|
7387
|
-
for (var n in e) r.push(n);
|
|
7388
|
-
return r.reverse(), function next() {
|
|
7389
|
-
for (; r.length;) {
|
|
7390
|
-
var t = r.pop();
|
|
7391
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
7392
|
-
}
|
|
7393
|
-
return next.done = !0, next;
|
|
7394
|
-
};
|
|
7395
|
-
}, e.values = values, Context.prototype = {
|
|
7396
|
-
constructor: Context,
|
|
7397
|
-
reset: function reset(e) {
|
|
7398
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
7399
|
-
},
|
|
7400
|
-
stop: function stop() {
|
|
7401
|
-
this.done = !0;
|
|
7402
|
-
var t = this.tryEntries[0].completion;
|
|
7403
|
-
if ("throw" === t.type) throw t.arg;
|
|
7404
|
-
return this.rval;
|
|
7405
|
-
},
|
|
7406
|
-
dispatchException: function dispatchException(e) {
|
|
7407
|
-
if (this.done) throw e;
|
|
7408
|
-
var r = this;
|
|
7409
|
-
function handle(n, o) {
|
|
7410
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
7411
|
-
}
|
|
7412
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
7413
|
-
var i = this.tryEntries[o],
|
|
7414
|
-
a = i.completion;
|
|
7415
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
7416
|
-
if (i.tryLoc <= this.prev) {
|
|
7417
|
-
var c = n.call(i, "catchLoc"),
|
|
7418
|
-
u = n.call(i, "finallyLoc");
|
|
7419
|
-
if (c && u) {
|
|
7420
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
7421
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
7422
|
-
} else if (c) {
|
|
7423
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
7424
|
-
} else {
|
|
7425
|
-
if (!u) throw new Error("try statement without catch or finally");
|
|
7426
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
7427
|
-
}
|
|
7428
|
-
}
|
|
7429
|
-
}
|
|
7430
|
-
},
|
|
7431
|
-
abrupt: function abrupt(t, e) {
|
|
7432
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
7433
|
-
var o = this.tryEntries[r];
|
|
7434
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
7435
|
-
var i = o;
|
|
7436
|
-
break;
|
|
7437
|
-
}
|
|
7438
|
-
}
|
|
7439
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
7440
|
-
var a = i ? i.completion : {};
|
|
7441
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
7442
|
-
},
|
|
7443
|
-
complete: function complete(t, e) {
|
|
7444
|
-
if ("throw" === t.type) throw t.arg;
|
|
7445
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
7446
|
-
},
|
|
7447
|
-
finish: function finish(t) {
|
|
7448
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
7449
|
-
var r = this.tryEntries[e];
|
|
7450
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
7451
|
-
}
|
|
7452
|
-
},
|
|
7453
|
-
"catch": function _catch(t) {
|
|
7454
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
7455
|
-
var r = this.tryEntries[e];
|
|
7456
|
-
if (r.tryLoc === t) {
|
|
7457
|
-
var n = r.completion;
|
|
7458
|
-
if ("throw" === n.type) {
|
|
7459
|
-
var o = n.arg;
|
|
7460
|
-
resetTryEntry(r);
|
|
7461
|
-
}
|
|
7462
|
-
return o;
|
|
7463
|
-
}
|
|
7464
|
-
}
|
|
7465
|
-
throw new Error("illegal catch attempt");
|
|
7466
|
-
},
|
|
7467
|
-
delegateYield: function delegateYield(e, r, n) {
|
|
7468
|
-
return this.delegate = {
|
|
7469
|
-
iterator: values(e),
|
|
7470
|
-
resultName: r,
|
|
7471
|
-
nextLoc: n
|
|
7472
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
7473
|
-
}
|
|
7474
|
-
}, e;
|
|
7475
|
-
}
|
|
7476
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
7477
|
-
} (regeneratorRuntime$1));
|
|
7478
|
-
|
|
7479
|
-
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
7480
|
-
|
|
7481
|
-
// TODO(Babel 8): Remove this file.
|
|
7482
|
-
|
|
7483
|
-
var runtime = regeneratorRuntimeExports();
|
|
7484
|
-
var regenerator = runtime;
|
|
7485
|
-
|
|
7486
|
-
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
7487
|
-
try {
|
|
7488
|
-
regeneratorRuntime = runtime;
|
|
7489
|
-
} catch (accidentalStrictMode) {
|
|
7490
|
-
if (typeof globalThis === "object") {
|
|
7491
|
-
globalThis.regeneratorRuntime = runtime;
|
|
7492
|
-
} else {
|
|
7493
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
7494
|
-
}
|
|
7495
|
-
}
|
|
7496
|
-
|
|
7497
|
-
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
7498
|
-
|
|
7499
7105
|
function isAttributeKeyAllowed(kitBlocker, key) {
|
|
7500
7106
|
return !(kitBlocker === null || kitBlocker === void 0 ? void 0 : kitBlocker.isAttributeKeyBlocked(key));
|
|
7501
7107
|
}
|
|
@@ -7640,11 +7246,27 @@ var mParticle = (function () {
|
|
|
7640
7246
|
});
|
|
7641
7247
|
}
|
|
7642
7248
|
|
|
7643
|
-
var
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7249
|
+
var _a;
|
|
7250
|
+
var _b = Constants.IdentityMethods,
|
|
7251
|
+
Modify$2 = _b.Modify,
|
|
7252
|
+
Identify$1 = _b.Identify,
|
|
7253
|
+
Login$1 = _b.Login,
|
|
7254
|
+
Logout$1 = _b.Logout;
|
|
7255
|
+
// Maps an identity method to the kit callback that reports its completion.
|
|
7256
|
+
var identityCompleteKitMethods = (_a = {}, _a[Identify$1] = 'onIdentifyComplete', _a[Login$1] = 'onLoginComplete', _a[Logout$1] = 'onLogoutComplete', _a[Modify$2] = 'onModifyComplete', _a);
|
|
7257
|
+
function userAttributesMatchFilter(userAttributes, filterObject) {
|
|
7258
|
+
for (var attrName in userAttributes) {
|
|
7259
|
+
if (!userAttributes.hasOwnProperty(attrName)) {
|
|
7260
|
+
continue;
|
|
7261
|
+
}
|
|
7262
|
+
var attrHash = KitFilterHelper.hashAttributeConditionalForwarding(attrName);
|
|
7263
|
+
var valueHash = KitFilterHelper.hashAttributeConditionalForwarding(userAttributes[attrName]);
|
|
7264
|
+
if (attrHash === filterObject.userAttributeName && valueHash === filterObject.userAttributeValue) {
|
|
7265
|
+
return true;
|
|
7266
|
+
}
|
|
7267
|
+
}
|
|
7268
|
+
return false;
|
|
7269
|
+
}
|
|
7648
7270
|
function Forwarders(mpInstance, kitBlocker) {
|
|
7649
7271
|
var _this = this;
|
|
7650
7272
|
var self = this;
|
|
@@ -7687,31 +7309,14 @@ var mParticle = (function () {
|
|
|
7687
7309
|
if (!filterObject || !mpInstance._Helpers.isObject(filterObject) || !Object.keys(filterObject).length) {
|
|
7688
7310
|
return true;
|
|
7689
7311
|
}
|
|
7690
|
-
var attrHash, valueHash, userAttributes;
|
|
7691
7312
|
if (!user) {
|
|
7692
7313
|
return false;
|
|
7693
|
-
} else {
|
|
7694
|
-
userAttributes = user.getAllUserAttributes();
|
|
7695
7314
|
}
|
|
7696
|
-
var
|
|
7315
|
+
var userAttributes = user.getAllUserAttributes();
|
|
7697
7316
|
try {
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
attrHash = KitFilterHelper.hashAttributeConditionalForwarding(attrName);
|
|
7702
|
-
valueHash = KitFilterHelper.hashAttributeConditionalForwarding(userAttributes[attrName]);
|
|
7703
|
-
if (attrHash === filterObject.userAttributeName && valueHash === filterObject.userAttributeValue) {
|
|
7704
|
-
isMatch = true;
|
|
7705
|
-
break;
|
|
7706
|
-
}
|
|
7707
|
-
}
|
|
7708
|
-
}
|
|
7709
|
-
}
|
|
7710
|
-
if (filterObject) {
|
|
7711
|
-
return filterObject.includeOnMatch === isMatch;
|
|
7712
|
-
} else {
|
|
7713
|
-
return true;
|
|
7714
|
-
}
|
|
7317
|
+
var hasUserAttributes = userAttributes && mpInstance._Helpers.isObject(userAttributes) && Object.keys(userAttributes).length > 0;
|
|
7318
|
+
var isMatch = hasUserAttributes ? userAttributesMatchFilter(userAttributes, filterObject) : false;
|
|
7319
|
+
return filterObject.includeOnMatch === isMatch;
|
|
7715
7320
|
} catch (e) {
|
|
7716
7321
|
// in any error scenario, err on side of returning true and forwarding event
|
|
7717
7322
|
return true;
|
|
@@ -7743,39 +7348,38 @@ var mParticle = (function () {
|
|
|
7743
7348
|
}
|
|
7744
7349
|
};
|
|
7745
7350
|
this.sendEventToForwarders = function (event) {
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
var hashedEventType;
|
|
7749
|
-
if (!mpInstance._Store.webviewBridgeEnabled && mpInstance._Store.activeForwarders) {
|
|
7750
|
-
hashedEventName = KitFilterHelper.hashEventName(event.EventName, event.EventCategory);
|
|
7751
|
-
hashedEventType = KitFilterHelper.hashEventType(event.EventCategory);
|
|
7752
|
-
for (var i = 0; i < mpInstance._Store.activeForwarders.length; i++) {
|
|
7753
|
-
var forwarder = mpInstance._Store.activeForwarders[i];
|
|
7754
|
-
if (isBlockedByForwardingRule(event.EventDataType, event.EventAttributes, forwarder)) {
|
|
7755
|
-
continue;
|
|
7756
|
-
}
|
|
7757
|
-
|
|
7758
|
-
// Clone the event object, as we could be sending different attributes to each forwarder
|
|
7759
|
-
clonedEvent = extend(true, {}, event);
|
|
7760
|
-
if (isBlockedByEventFilter(event.EventDataType, hashedEventName, hashedEventType, forwarder)) {
|
|
7761
|
-
continue;
|
|
7762
|
-
}
|
|
7763
|
-
clonedEvent.EventAttributes = filterEventAttributes(event.EventDataType, event.EventCategory, event.EventName, clonedEvent.EventAttributes, forwarder);
|
|
7764
|
-
|
|
7765
|
-
// Check user identity filtering rules
|
|
7766
|
-
clonedEvent.UserIdentities = filterUserIdentities(clonedEvent.UserIdentities, forwarder.userIdentityFilters);
|
|
7767
|
-
|
|
7768
|
-
// Check user attribute filtering rules
|
|
7769
|
-
clonedEvent.UserAttributes = KitFilterHelper.filterUserAttributes(clonedEvent.UserAttributes, forwarder.userAttributeFilters);
|
|
7770
|
-
if (forwarder.process) {
|
|
7771
|
-
mpInstance.Logger.verbose('Sending message to forwarder: ' + forwarder.name);
|
|
7772
|
-
var result = forwarder.process(clonedEvent);
|
|
7773
|
-
if (result) {
|
|
7774
|
-
mpInstance.Logger.verbose(result);
|
|
7775
|
-
}
|
|
7776
|
-
}
|
|
7777
|
-
}
|
|
7351
|
+
if (mpInstance._Store.webviewBridgeEnabled || !mpInstance._Store.activeForwarders) {
|
|
7352
|
+
return;
|
|
7778
7353
|
}
|
|
7354
|
+
var hashedEventName = KitFilterHelper.hashEventName(event.EventName, event.EventCategory);
|
|
7355
|
+
var hashedEventType = KitFilterHelper.hashEventType(event.EventCategory);
|
|
7356
|
+
var forwardEvent = function forwardEvent(forwarder) {
|
|
7357
|
+
if (isBlockedByForwardingRule(event.EventDataType, event.EventAttributes, forwarder)) {
|
|
7358
|
+
return;
|
|
7359
|
+
}
|
|
7360
|
+
// Clone the event object, as we could be sending different attributes to each forwarder
|
|
7361
|
+
var clonedEvent = extend(true, {}, event);
|
|
7362
|
+
if (isBlockedByEventFilter(event.EventDataType, hashedEventName, hashedEventType, forwarder)) {
|
|
7363
|
+
return;
|
|
7364
|
+
}
|
|
7365
|
+
clonedEvent.EventAttributes = filterEventAttributes(event.EventDataType, event.EventCategory, event.EventName, clonedEvent.EventAttributes, forwarder);
|
|
7366
|
+
// Check user identity filtering rules
|
|
7367
|
+
clonedEvent.UserIdentities = filterUserIdentities(clonedEvent.UserIdentities, forwarder.userIdentityFilters);
|
|
7368
|
+
// Check user attribute filtering rules
|
|
7369
|
+
clonedEvent.UserAttributes = KitFilterHelper.filterUserAttributes(clonedEvent.UserAttributes, forwarder.userAttributeFilters);
|
|
7370
|
+
if (!forwarder.process) {
|
|
7371
|
+
return;
|
|
7372
|
+
}
|
|
7373
|
+
mpInstance.Logger.verbose('Sending message to forwarder: ' + forwarder.name);
|
|
7374
|
+
var result = forwarder.process(clonedEvent);
|
|
7375
|
+
if (result) {
|
|
7376
|
+
mpInstance.Logger.verbose(result);
|
|
7377
|
+
}
|
|
7378
|
+
};
|
|
7379
|
+
// Not for...of: the downleveled loop is miscompiled in cjs/esm builds.
|
|
7380
|
+
mpInstance._Store.activeForwarders.forEach(function (forwarder) {
|
|
7381
|
+
forwardEvent(forwarder);
|
|
7382
|
+
});
|
|
7779
7383
|
};
|
|
7780
7384
|
this.handleForwarderUserAttributes = function (functionNameKey, key, value) {
|
|
7781
7385
|
if (kitBlocker && kitBlocker.isAttributeKeyBlocked(key) || !mpInstance._Store.activeForwarders.length) {
|
|
@@ -7787,7 +7391,7 @@ var mParticle = (function () {
|
|
|
7787
7391
|
return;
|
|
7788
7392
|
}
|
|
7789
7393
|
try {
|
|
7790
|
-
var result;
|
|
7394
|
+
var result = void 0;
|
|
7791
7395
|
if (functionNameKey === UserAttributeActionTypes.setUserAttribute) {
|
|
7792
7396
|
result = forwarder.setUserAttribute(key, value);
|
|
7793
7397
|
} else if (functionNameKey === UserAttributeActionTypes.removeUserAttribute) {
|
|
@@ -7801,7 +7405,6 @@ var mParticle = (function () {
|
|
|
7801
7405
|
}
|
|
7802
7406
|
});
|
|
7803
7407
|
};
|
|
7804
|
-
|
|
7805
7408
|
// TODO: https://go.mparticle.com/work/SQDSDKS-6036
|
|
7806
7409
|
this.setForwarderUserIdentities = function (userIdentities) {
|
|
7807
7410
|
mpInstance._Store.activeForwarders.forEach(function (forwarder) {
|
|
@@ -7828,38 +7431,19 @@ var mParticle = (function () {
|
|
|
7828
7431
|
});
|
|
7829
7432
|
};
|
|
7830
7433
|
this.setForwarderOnIdentityComplete = function (user, identityMethod) {
|
|
7831
|
-
var
|
|
7434
|
+
var kitMethodName = identityCompleteKitMethods[identityMethod];
|
|
7435
|
+
if (!kitMethodName) {
|
|
7436
|
+
return;
|
|
7437
|
+
}
|
|
7832
7438
|
mpInstance._Store.activeForwarders.forEach(function (forwarder) {
|
|
7439
|
+
var onIdentityComplete = forwarder[kitMethodName];
|
|
7440
|
+
if (!onIdentityComplete) {
|
|
7441
|
+
return;
|
|
7442
|
+
}
|
|
7833
7443
|
var filteredUser = filteredMparticleUser(user.getMPID(), forwarder, mpInstance, kitBlocker);
|
|
7834
|
-
var
|
|
7835
|
-
if (
|
|
7836
|
-
|
|
7837
|
-
result = forwarder.onIdentifyComplete(filteredUser, filteredUserIdentities);
|
|
7838
|
-
if (result) {
|
|
7839
|
-
mpInstance.Logger.verbose(result);
|
|
7840
|
-
}
|
|
7841
|
-
}
|
|
7842
|
-
} else if (identityMethod === Login$1) {
|
|
7843
|
-
if (forwarder.onLoginComplete) {
|
|
7844
|
-
result = forwarder.onLoginComplete(filteredUser, filteredUserIdentities);
|
|
7845
|
-
if (result) {
|
|
7846
|
-
mpInstance.Logger.verbose(result);
|
|
7847
|
-
}
|
|
7848
|
-
}
|
|
7849
|
-
} else if (identityMethod === Logout$1) {
|
|
7850
|
-
if (forwarder.onLogoutComplete) {
|
|
7851
|
-
result = forwarder.onLogoutComplete(filteredUser, filteredUserIdentities);
|
|
7852
|
-
if (result) {
|
|
7853
|
-
mpInstance.Logger.verbose(result);
|
|
7854
|
-
}
|
|
7855
|
-
}
|
|
7856
|
-
} else if (identityMethod === Modify$2) {
|
|
7857
|
-
if (forwarder.onModifyComplete) {
|
|
7858
|
-
result = forwarder.onModifyComplete(filteredUser, filteredUserIdentities);
|
|
7859
|
-
if (result) {
|
|
7860
|
-
mpInstance.Logger.verbose(result);
|
|
7861
|
-
}
|
|
7862
|
-
}
|
|
7444
|
+
var result = onIdentityComplete.call(forwarder, filteredUser, filteredUser.getUserIdentities());
|
|
7445
|
+
if (result) {
|
|
7446
|
+
mpInstance.Logger.verbose(result);
|
|
7863
7447
|
}
|
|
7864
7448
|
});
|
|
7865
7449
|
};
|
|
@@ -7869,7 +7453,6 @@ var mParticle = (function () {
|
|
|
7869
7453
|
this.setForwarderStatsQueue = function (queue) {
|
|
7870
7454
|
mpInstance._Persistence.forwardingStatsBatches.forwardingStatsEventQueue = queue;
|
|
7871
7455
|
};
|
|
7872
|
-
|
|
7873
7456
|
// Processing forwarders is a 2 step process:
|
|
7874
7457
|
// 1. Configure the kit
|
|
7875
7458
|
// 2. Initialize the kit
|
|
@@ -7885,7 +7468,6 @@ var mParticle = (function () {
|
|
|
7885
7468
|
self.initForwarders(mpInstance._Store.SDKConfig.identifyRequest.userIdentities, forwardingStatsCallback);
|
|
7886
7469
|
}
|
|
7887
7470
|
};
|
|
7888
|
-
|
|
7889
7471
|
// These are kits that are enabled via the mParticle UI.
|
|
7890
7472
|
// A kit that is UI-enabled will have a kit configuration that returns from
|
|
7891
7473
|
// the server, or in rare cases, is passed in by the developer.
|
|
@@ -7932,25 +7514,23 @@ var mParticle = (function () {
|
|
|
7932
7514
|
this.configureUIEnabledKit = function (configuration, kits) {
|
|
7933
7515
|
var newKit = null;
|
|
7934
7516
|
var config = configuration;
|
|
7935
|
-
for (var
|
|
7517
|
+
for (var name_1 in kits) {
|
|
7936
7518
|
// Configs are returned with suffixes also. We need to consider the
|
|
7937
7519
|
// config suffix here to match the constructor suffix
|
|
7938
7520
|
var kitNameWithConfigSuffix = void 0;
|
|
7939
7521
|
if (config.suffix) {
|
|
7940
7522
|
kitNameWithConfigSuffix = "".concat(config.name, "-").concat(config.suffix);
|
|
7941
7523
|
}
|
|
7942
|
-
if (
|
|
7524
|
+
if (name_1 === kitNameWithConfigSuffix || name_1 === config.name) {
|
|
7943
7525
|
if (config.isDebug === mpInstance._Store.SDKConfig.isDevelopmentMode || config.isSandbox === mpInstance._Store.SDKConfig.isDevelopmentMode) {
|
|
7944
|
-
newKit = this.returnConfiguredKit(kits[
|
|
7526
|
+
newKit = this.returnConfiguredKit(kits[name_1], config);
|
|
7945
7527
|
mpInstance._Store.configuredForwarders.push(newKit);
|
|
7946
7528
|
break;
|
|
7947
7529
|
}
|
|
7948
7530
|
}
|
|
7949
7531
|
}
|
|
7950
7532
|
};
|
|
7951
|
-
|
|
7952
7533
|
// Unlike UI enabled kits, sideloaded kits are always added to active forwarders.
|
|
7953
|
-
|
|
7954
7534
|
// TODO: Sideloading kits currently require the use of a register method
|
|
7955
7535
|
// which requires an object on which to be registered.
|
|
7956
7536
|
// In the future, when all kits are moved to the mpConfig rather than
|
|
@@ -7959,7 +7539,7 @@ var mParticle = (function () {
|
|
|
7959
7539
|
this.processSideloadedKits = function (mpConfig) {
|
|
7960
7540
|
try {
|
|
7961
7541
|
if (Array.isArray(mpConfig.sideloadedKits)) {
|
|
7962
|
-
var
|
|
7542
|
+
var registeredSideloadedKits_1 = {
|
|
7963
7543
|
kits: {}
|
|
7964
7544
|
};
|
|
7965
7545
|
var unregisteredSideloadedKits = mpConfig.sideloadedKits;
|
|
@@ -7967,25 +7547,23 @@ var mParticle = (function () {
|
|
|
7967
7547
|
try {
|
|
7968
7548
|
// Register each sideloaded kit, which adds a key of the sideloaded kit name
|
|
7969
7549
|
// and a value of the sideloaded kit constructor.
|
|
7970
|
-
unregisteredKit.kitInstance.register(
|
|
7550
|
+
unregisteredKit.kitInstance.register(registeredSideloadedKits_1);
|
|
7971
7551
|
var kitName = unregisteredKit.kitInstance.name;
|
|
7972
7552
|
// Then add the kit filters to each registered kit.
|
|
7973
|
-
|
|
7553
|
+
registeredSideloadedKits_1.kits[kitName].filters = unregisteredKit.filterDictionary;
|
|
7974
7554
|
} catch (e) {
|
|
7975
7555
|
console.error('Error registering sideloaded kit ' + unregisteredKit.kitInstance.name);
|
|
7976
7556
|
}
|
|
7977
7557
|
});
|
|
7978
|
-
|
|
7979
7558
|
// Then configure each registered kit
|
|
7980
|
-
for (var registeredKitKey in
|
|
7981
|
-
var registeredKit =
|
|
7559
|
+
for (var registeredKitKey in registeredSideloadedKits_1.kits) {
|
|
7560
|
+
var registeredKit = registeredSideloadedKits_1.kits[registeredKitKey];
|
|
7982
7561
|
self.configureSideloadedKit(registeredKit);
|
|
7983
7562
|
}
|
|
7984
|
-
|
|
7985
7563
|
// If Sideloaded Kits are successfully registered,
|
|
7986
7564
|
// record this in the Store.
|
|
7987
|
-
if (!isEmpty(
|
|
7988
|
-
var kitKeys = Object.keys(
|
|
7565
|
+
if (!isEmpty(registeredSideloadedKits_1.kits)) {
|
|
7566
|
+
var kitKeys = Object.keys(registeredSideloadedKits_1.kits);
|
|
7989
7567
|
mpInstance._Store.sideloadedKitsCount = kitKeys.length;
|
|
7990
7568
|
}
|
|
7991
7569
|
}
|
|
@@ -7993,16 +7571,16 @@ var mParticle = (function () {
|
|
|
7993
7571
|
mpInstance.Logger.error('Sideloaded Kits not configured propertly. Kits may not be initialized. ' + e);
|
|
7994
7572
|
}
|
|
7995
7573
|
};
|
|
7996
|
-
|
|
7997
7574
|
// kits can be included via mParticle UI, or via sideloaded kit config API
|
|
7998
7575
|
this.configureSideloadedKit = function (kitConstructor) {
|
|
7999
7576
|
mpInstance._Store.configuredForwarders.push(this.returnConfiguredKit(kitConstructor, kitConstructor.filters));
|
|
8000
7577
|
};
|
|
8001
|
-
this.returnConfiguredKit = function (forwarder) {
|
|
8002
|
-
|
|
7578
|
+
this.returnConfiguredKit = function (forwarder, config) {
|
|
7579
|
+
if (config === void 0) {
|
|
7580
|
+
config = {};
|
|
7581
|
+
}
|
|
8003
7582
|
var newForwarder = new forwarder.constructor();
|
|
8004
7583
|
newForwarder.id = config.moduleId;
|
|
8005
|
-
|
|
8006
7584
|
// TODO: isSandbox, hasSandbox is never used in any kit or in core SDK.
|
|
8007
7585
|
// isVisible. Investigate is only used in 1 place. It is always true if
|
|
8008
7586
|
// it is sent to JS. Investigate further to determine if these can be removed.
|
|
@@ -8041,14 +7619,13 @@ var mParticle = (function () {
|
|
|
8041
7619
|
mpInstance.Logger.error('Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. ' + e);
|
|
8042
7620
|
}
|
|
8043
7621
|
};
|
|
8044
|
-
this.sendSingleForwardingStatsToServer =
|
|
8045
|
-
|
|
8046
|
-
var _mpInstance$Logger;
|
|
7622
|
+
this.sendSingleForwardingStatsToServer = function (forwardingStatsData) {
|
|
7623
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
8047
7624
|
var fetchPayload, response, message;
|
|
8048
|
-
|
|
8049
|
-
|
|
7625
|
+
var _a;
|
|
7626
|
+
return __generator(this, function (_b) {
|
|
7627
|
+
switch (_b.label) {
|
|
8050
7628
|
case 0:
|
|
8051
|
-
// https://go.mparticle.com/work/SQDSDKS-6568
|
|
8052
7629
|
fetchPayload = {
|
|
8053
7630
|
method: 'post',
|
|
8054
7631
|
body: JSON.stringify(forwardingStatsData),
|
|
@@ -8057,10 +7634,9 @@ var mParticle = (function () {
|
|
|
8057
7634
|
'Content-Type': 'text/plain;charset=UTF-8'
|
|
8058
7635
|
}
|
|
8059
7636
|
};
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
response = _context.sent;
|
|
7637
|
+
return [4 /*yield*/, this.forwarderStatsUploader.upload(fetchPayload)];
|
|
7638
|
+
case 1:
|
|
7639
|
+
response = _b.sent();
|
|
8064
7640
|
// This is a fire and forget, so we only need to log the response based on the code, and not return any response body
|
|
8065
7641
|
if (response.status === 202) {
|
|
8066
7642
|
// https://go.mparticle.com/work/SQDSDKS-6670
|
|
@@ -8068,17 +7644,12 @@ var mParticle = (function () {
|
|
|
8068
7644
|
} else {
|
|
8069
7645
|
message = 'Issue with forwarding stats to mParticle Servers, received HTTP Code of ' + response.statusText;
|
|
8070
7646
|
}
|
|
8071
|
-
mpInstance === null || mpInstance === void 0
|
|
8072
|
-
|
|
8073
|
-
case "end":
|
|
8074
|
-
return _context.stop();
|
|
7647
|
+
(_a = mpInstance === null || mpInstance === void 0 ? void 0 : mpInstance.Logger) === null || _a === void 0 ? void 0 : _a.verbose(message);
|
|
7648
|
+
return [2 /*return*/];
|
|
8075
7649
|
}
|
|
8076
|
-
}
|
|
8077
|
-
})
|
|
8078
|
-
|
|
8079
|
-
return _ref.apply(this, arguments);
|
|
8080
|
-
};
|
|
8081
|
-
}();
|
|
7650
|
+
});
|
|
7651
|
+
});
|
|
7652
|
+
};
|
|
8082
7653
|
}
|
|
8083
7654
|
|
|
8084
7655
|
// TODO: This file is no longer the server model because the web SDK payload
|
|
@@ -8413,37 +7984,6 @@ var mParticle = (function () {
|
|
|
8413
7984
|
}
|
|
8414
7985
|
}
|
|
8415
7986
|
|
|
8416
|
-
function _toPrimitive(input, hint) {
|
|
8417
|
-
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
8418
|
-
var prim = input[Symbol.toPrimitive];
|
|
8419
|
-
if (prim !== undefined) {
|
|
8420
|
-
var res = prim.call(input, hint || "default");
|
|
8421
|
-
if (_typeof$1(res) !== "object") return res;
|
|
8422
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
8423
|
-
}
|
|
8424
|
-
return (hint === "string" ? String : Number)(input);
|
|
8425
|
-
}
|
|
8426
|
-
|
|
8427
|
-
function _toPropertyKey(arg) {
|
|
8428
|
-
var key = _toPrimitive(arg, "string");
|
|
8429
|
-
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
8430
|
-
}
|
|
8431
|
-
|
|
8432
|
-
function _defineProperty(obj, key, value) {
|
|
8433
|
-
key = _toPropertyKey(key);
|
|
8434
|
-
if (key in obj) {
|
|
8435
|
-
Object.defineProperty(obj, key, {
|
|
8436
|
-
value: value,
|
|
8437
|
-
enumerable: true,
|
|
8438
|
-
configurable: true,
|
|
8439
|
-
writable: true
|
|
8440
|
-
});
|
|
8441
|
-
} else {
|
|
8442
|
-
obj[key] = value;
|
|
8443
|
-
}
|
|
8444
|
-
return obj;
|
|
8445
|
-
}
|
|
8446
|
-
|
|
8447
7987
|
var AudienceManager = /** @class */function () {
|
|
8448
7988
|
function AudienceManager(userAudienceUrl, apiKey, logger) {
|
|
8449
7989
|
this.url = '';
|
|
@@ -8570,8 +8110,6 @@ var mParticle = (function () {
|
|
|
8570
8110
|
}
|
|
8571
8111
|
};
|
|
8572
8112
|
|
|
8573
|
-
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; }
|
|
8574
|
-
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; }
|
|
8575
8113
|
var Messages$2 = Constants.Messages,
|
|
8576
8114
|
HTTPCodes$2 = Constants.HTTPCodes,
|
|
8577
8115
|
FeatureFlags$1 = Constants.FeatureFlags,
|
|
@@ -8583,23 +8121,20 @@ var mParticle = (function () {
|
|
|
8583
8121
|
Login = IdentityMethods$1.Login,
|
|
8584
8122
|
Logout = IdentityMethods$1.Logout;
|
|
8585
8123
|
function Identity(mpInstance) {
|
|
8586
|
-
var
|
|
8587
|
-
getFeatureFlag =
|
|
8588
|
-
extend =
|
|
8124
|
+
var _a = mpInstance._Helpers,
|
|
8125
|
+
getFeatureFlag = _a.getFeatureFlag,
|
|
8126
|
+
extend = _a.extend;
|
|
8589
8127
|
var self = this;
|
|
8590
8128
|
this.idCache = null;
|
|
8591
8129
|
this.audienceManager = null;
|
|
8592
|
-
|
|
8593
8130
|
// https://go.mparticle.com/work/SQDSDKS-6353
|
|
8594
8131
|
this.IdentityRequest = {
|
|
8595
8132
|
preProcessIdentityRequest: function preProcessIdentityRequest(identityApiData, callback, method) {
|
|
8596
8133
|
mpInstance.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent + ': ' + method);
|
|
8597
|
-
|
|
8598
8134
|
// First, remove any falsy identity values and warn about them
|
|
8599
8135
|
var removedFalsyIdentityData = mpInstance._Helpers.Validators.removeFalsyIdentityValues(identityApiData, mpInstance.Logger);
|
|
8600
|
-
|
|
8601
8136
|
// Normalize convenience aliases (email_sha256 → other, mobile_sha256 → other2)
|
|
8602
|
-
var cleanedIdentityApiData = removedFalsyIdentityData
|
|
8137
|
+
var cleanedIdentityApiData = (removedFalsyIdentityData === null || removedFalsyIdentityData === void 0 ? void 0 : removedFalsyIdentityData.userIdentities) ? __assign(__assign({}, removedFalsyIdentityData), {
|
|
8603
8138
|
userIdentities: normalizeUserIdentityKeys(removedFalsyIdentityData.userIdentities)
|
|
8604
8139
|
}) : removedFalsyIdentityData;
|
|
8605
8140
|
var identityValidationResult = mpInstance._Helpers.Validators.validateIdentities(cleanedIdentityApiData, method);
|
|
@@ -8611,7 +8146,7 @@ var mParticle = (function () {
|
|
|
8611
8146
|
};
|
|
8612
8147
|
}
|
|
8613
8148
|
if (callback && !mpInstance._Helpers.Validators.isFunction(callback)) {
|
|
8614
|
-
var error = 'The optional callback must be a function. You tried entering a(n) ' + _typeof
|
|
8149
|
+
var error = 'The optional callback must be a function. You tried entering a(n) ' + _typeof(callback);
|
|
8615
8150
|
mpInstance.Logger.error(error);
|
|
8616
8151
|
return {
|
|
8617
8152
|
valid: false,
|
|
@@ -8655,9 +8190,8 @@ var mParticle = (function () {
|
|
|
8655
8190
|
},
|
|
8656
8191
|
createIdentityChanges: function createIdentityChanges(previousIdentities, newIdentities) {
|
|
8657
8192
|
var identityChanges = [];
|
|
8658
|
-
var key;
|
|
8659
8193
|
if (newIdentities && isObject(newIdentities) && previousIdentities && isObject(previousIdentities)) {
|
|
8660
|
-
for (key in newIdentities) {
|
|
8194
|
+
for (var key in newIdentities) {
|
|
8661
8195
|
identityChanges.push({
|
|
8662
8196
|
old_value: previousIdentities[key] || null,
|
|
8663
8197
|
new_value: newIdentities[key],
|
|
@@ -8707,7 +8241,7 @@ var mParticle = (function () {
|
|
|
8707
8241
|
},
|
|
8708
8242
|
convertToNative: function convertToNative(identityApiData) {
|
|
8709
8243
|
var nativeIdentityRequest = [];
|
|
8710
|
-
if (identityApiData
|
|
8244
|
+
if (identityApiData === null || identityApiData === void 0 ? void 0 : identityApiData.userIdentities) {
|
|
8711
8245
|
for (var key in identityApiData.userIdentities) {
|
|
8712
8246
|
if (identityApiData.userIdentities.hasOwnProperty(key)) {
|
|
8713
8247
|
nativeIdentityRequest.push({
|
|
@@ -8720,6 +8254,7 @@ var mParticle = (function () {
|
|
|
8720
8254
|
UserIdentities: nativeIdentityRequest
|
|
8721
8255
|
};
|
|
8722
8256
|
}
|
|
8257
|
+
return undefined;
|
|
8723
8258
|
}
|
|
8724
8259
|
};
|
|
8725
8260
|
/**
|
|
@@ -8737,9 +8272,9 @@ var mParticle = (function () {
|
|
|
8737
8272
|
*/
|
|
8738
8273
|
identify: function identify(identityApiData, callback) {
|
|
8739
8274
|
// https://go.mparticle.com/work/SQDSDKS-6337
|
|
8740
|
-
var mpid
|
|
8741
|
-
|
|
8742
|
-
|
|
8275
|
+
var mpid;
|
|
8276
|
+
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
8277
|
+
var preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Identify);
|
|
8743
8278
|
if (currentUser) {
|
|
8744
8279
|
mpid = currentUser.getMPID();
|
|
8745
8280
|
}
|
|
@@ -8775,29 +8310,30 @@ var mParticle = (function () {
|
|
|
8775
8310
|
*/
|
|
8776
8311
|
logout: function logout(identityApiData, callback) {
|
|
8777
8312
|
// https://go.mparticle.com/work/SQDSDKS-6337
|
|
8778
|
-
var mpid
|
|
8779
|
-
|
|
8780
|
-
|
|
8313
|
+
var mpid;
|
|
8314
|
+
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
8315
|
+
var preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Logout);
|
|
8781
8316
|
if (currentUser) {
|
|
8782
8317
|
mpid = currentUser.getMPID();
|
|
8783
8318
|
}
|
|
8784
8319
|
if (preProcessResult.valid) {
|
|
8785
|
-
var
|
|
8786
|
-
|
|
8320
|
+
var evt_1;
|
|
8321
|
+
var identityApiRequest = mpInstance._Identity.IdentityRequest.createIdentityRequest(preProcessResult.cleanedIdentities, Constants.platform, Constants.sdkVendor, Constants.sdkVersion, mpInstance._Store.deviceId, mpInstance._Store.context, mpid);
|
|
8787
8322
|
if (mpInstance._Helpers.canLog()) {
|
|
8788
8323
|
if (mpInstance._Store.webviewBridgeEnabled) {
|
|
8789
8324
|
mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Logout, JSON.stringify(mpInstance._Identity.IdentityRequest.convertToNative(identityApiData)));
|
|
8790
8325
|
mpInstance._Helpers.invokeCallback(callback, HTTPCodes$2.nativeIdentityRequest, 'Logout request sent to native sdk');
|
|
8791
8326
|
} else {
|
|
8792
8327
|
mpInstance._IdentityAPIClient.sendIdentityRequest(identityApiRequest, Logout, callback, identityApiData, self.parseIdentityResponse, mpid);
|
|
8793
|
-
|
|
8328
|
+
evt_1 = mpInstance._ServerModel.createEventObject({
|
|
8794
8329
|
messageType: Types.MessageType.Profile
|
|
8795
8330
|
});
|
|
8796
|
-
|
|
8331
|
+
evt_1.ProfileMessageType = Types.ProfileMessageType.Logout;
|
|
8797
8332
|
if (mpInstance._Store.activeForwarders.length) {
|
|
8798
8333
|
mpInstance._Store.activeForwarders.forEach(function (forwarder) {
|
|
8799
|
-
|
|
8800
|
-
|
|
8334
|
+
var kit = forwarder;
|
|
8335
|
+
if (kit.logOut) {
|
|
8336
|
+
kit.logOut(evt_1);
|
|
8801
8337
|
}
|
|
8802
8338
|
});
|
|
8803
8339
|
}
|
|
@@ -8819,9 +8355,9 @@ var mParticle = (function () {
|
|
|
8819
8355
|
*/
|
|
8820
8356
|
login: function login(identityApiData, callback) {
|
|
8821
8357
|
// https://go.mparticle.com/work/SQDSDKS-6337
|
|
8822
|
-
var mpid
|
|
8823
|
-
|
|
8824
|
-
|
|
8358
|
+
var mpid;
|
|
8359
|
+
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
8360
|
+
var preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Login);
|
|
8825
8361
|
if (currentUser) {
|
|
8826
8362
|
mpid = currentUser.getMPID();
|
|
8827
8363
|
}
|
|
@@ -8857,21 +8393,21 @@ var mParticle = (function () {
|
|
|
8857
8393
|
*/
|
|
8858
8394
|
modify: function modify(identityApiData, callback) {
|
|
8859
8395
|
// https://go.mparticle.com/work/SQDSDKS-6337
|
|
8860
|
-
var mpid
|
|
8861
|
-
|
|
8862
|
-
|
|
8396
|
+
var mpid;
|
|
8397
|
+
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
8398
|
+
var preProcessResult = mpInstance._Identity.IdentityRequest.preProcessIdentityRequest(identityApiData, callback, Modify$1);
|
|
8863
8399
|
if (currentUser) {
|
|
8864
8400
|
mpid = currentUser.getMPID();
|
|
8865
8401
|
}
|
|
8866
8402
|
if (preProcessResult.valid) {
|
|
8867
|
-
var newUserIdentities = identityApiData
|
|
8403
|
+
var newUserIdentities = (identityApiData === null || identityApiData === void 0 ? void 0 : identityApiData.userIdentities) ? preProcessResult.cleanedIdentities.userIdentities : {};
|
|
8868
8404
|
var identityApiRequest = mpInstance._Identity.IdentityRequest.createModifyIdentityRequest(currentUser ? currentUser.getUserIdentities().userIdentities : {}, newUserIdentities, Constants.platform, Constants.sdkVendor, Constants.sdkVersion, mpInstance._Store.context);
|
|
8869
8405
|
if (mpInstance._Helpers.canLog()) {
|
|
8870
8406
|
if (mpInstance._Store.webviewBridgeEnabled) {
|
|
8871
8407
|
mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Modify, JSON.stringify(mpInstance._Identity.IdentityRequest.convertToNative(identityApiData)));
|
|
8872
8408
|
mpInstance._Helpers.invokeCallback(callback, HTTPCodes$2.nativeIdentityRequest, 'Modify request sent to native sdk');
|
|
8873
8409
|
} else {
|
|
8874
|
-
mpInstance._IdentityAPIClient.sendIdentityRequest(identityApiRequest, Modify$1, callback, identityApiData, self.parseIdentityResponse, mpid
|
|
8410
|
+
mpInstance._IdentityAPIClient.sendIdentityRequest(identityApiRequest, Modify$1, callback, identityApiData, self.parseIdentityResponse, mpid);
|
|
8875
8411
|
}
|
|
8876
8412
|
} else {
|
|
8877
8413
|
mpInstance._Helpers.invokeCallback(callback, HTTPCodes$2.loggingDisabledOrMissingAPIKey, Messages$2.InformationMessages.AbandonLogEvent);
|
|
@@ -9012,15 +8548,15 @@ var mParticle = (function () {
|
|
|
9012
8548
|
using the sourceUser's firstSeenTime as the startTime, and its lastSeenTime as the endTime.
|
|
9013
8549
|
|
|
9014
8550
|
In the unlikely scenario that the sourceUser does not have a firstSeenTime, which will only
|
|
9015
|
-
be the case if they have not been the current user since this functionality was added, the
|
|
8551
|
+
be the case if they have not been the current user since this functionality was added, the
|
|
9016
8552
|
startTime will be populated with the earliest firstSeenTime out of any stored user. Similarly,
|
|
9017
8553
|
if the sourceUser does not have a lastSeenTime, the endTime will be populated with the current time
|
|
9018
8554
|
|
|
9019
8555
|
There is a limit to how old the startTime can be, represented by the config field 'aliasMaxWindow', in days.
|
|
9020
|
-
If the startTime falls before the limit, it will be adjusted to the oldest allowed startTime.
|
|
9021
|
-
In rare cases, where the sourceUser's lastSeenTime also falls outside of the aliasMaxWindow limit,
|
|
9022
|
-
after applying this adjustment it will be impossible to create an aliasRequest passes the aliasUsers()
|
|
9023
|
-
validation that the startTime must be less than the endTime
|
|
8556
|
+
If the startTime falls before the limit, it will be adjusted to the oldest allowed startTime.
|
|
8557
|
+
In rare cases, where the sourceUser's lastSeenTime also falls outside of the aliasMaxWindow limit,
|
|
8558
|
+
after applying this adjustment it will be impossible to create an aliasRequest passes the aliasUsers()
|
|
8559
|
+
validation that the startTime must be less than the endTime
|
|
9024
8560
|
*/
|
|
9025
8561
|
createAliasRequest: function createAliasRequest(sourceUser, destinationUser, scope) {
|
|
9026
8562
|
try {
|
|
@@ -9028,27 +8564,27 @@ var mParticle = (function () {
|
|
|
9028
8564
|
mpInstance.Logger.error("'destinationUser' and 'sourceUser' must both be present");
|
|
9029
8565
|
return null;
|
|
9030
8566
|
}
|
|
9031
|
-
var
|
|
9032
|
-
if (!
|
|
8567
|
+
var startTime_1 = sourceUser.getFirstSeenTime();
|
|
8568
|
+
if (!startTime_1) {
|
|
9033
8569
|
mpInstance.Identity.getUsers().forEach(function (user) {
|
|
9034
|
-
if (user.getFirstSeenTime() && (!
|
|
9035
|
-
|
|
8570
|
+
if (user.getFirstSeenTime() && (!startTime_1 || user.getFirstSeenTime() < startTime_1)) {
|
|
8571
|
+
startTime_1 = user.getFirstSeenTime();
|
|
9036
8572
|
}
|
|
9037
8573
|
});
|
|
9038
8574
|
}
|
|
9039
8575
|
var minFirstSeenTimeMs = new Date().getTime() - mpInstance._Store.SDKConfig.aliasMaxWindow * 24 * 60 * 60 * 1000;
|
|
9040
8576
|
var endTime = sourceUser.getLastSeenTime() || new Date().getTime();
|
|
9041
8577
|
//if the startTime is greater than $maxAliasWindow ago, adjust the startTime to the earliest allowed
|
|
9042
|
-
if (
|
|
9043
|
-
|
|
9044
|
-
if (endTime <
|
|
8578
|
+
if (startTime_1 < minFirstSeenTimeMs) {
|
|
8579
|
+
startTime_1 = minFirstSeenTimeMs;
|
|
8580
|
+
if (endTime < startTime_1) {
|
|
9045
8581
|
mpInstance.Logger.warning('Source User has not been seen in the last ' + mpInstance._Store.SDKConfig.maxAliasWindow + ' days, Alias Request will likely fail');
|
|
9046
8582
|
}
|
|
9047
8583
|
}
|
|
9048
8584
|
return {
|
|
9049
8585
|
destinationMpid: destinationUser.getMPID(),
|
|
9050
8586
|
sourceMpid: sourceUser.getMPID(),
|
|
9051
|
-
startTime:
|
|
8587
|
+
startTime: startTime_1,
|
|
9052
8588
|
endTime: endTime,
|
|
9053
8589
|
scope: scope || 'device'
|
|
9054
8590
|
};
|
|
@@ -9058,7 +8594,6 @@ var mParticle = (function () {
|
|
|
9058
8594
|
}
|
|
9059
8595
|
}
|
|
9060
8596
|
};
|
|
9061
|
-
|
|
9062
8597
|
// https://go.mparticle.com/work/SQDSDKS-6354
|
|
9063
8598
|
/**
|
|
9064
8599
|
* Invoke these methods on the mParticle.Identity.getCurrentUser() object.
|
|
@@ -9066,7 +8601,6 @@ var mParticle = (function () {
|
|
|
9066
8601
|
* @class mParticle.Identity.getCurrentUser()
|
|
9067
8602
|
*/
|
|
9068
8603
|
this.mParticleUser = function (mpid, _isLoggedIn) {
|
|
9069
|
-
var self = this;
|
|
9070
8604
|
return {
|
|
9071
8605
|
/**
|
|
9072
8606
|
* Get user identities for current user
|
|
@@ -9143,8 +8677,8 @@ var mParticle = (function () {
|
|
|
9143
8677
|
}));
|
|
9144
8678
|
} else {
|
|
9145
8679
|
var userAttributes = this.getAllUserAttributes();
|
|
9146
|
-
var previousUserAttributeValue;
|
|
9147
|
-
var isNewAttribute;
|
|
8680
|
+
var previousUserAttributeValue = void 0;
|
|
8681
|
+
var isNewAttribute = void 0;
|
|
9148
8682
|
var existingProp = mpInstance._Helpers.findKeyInObject(userAttributes, key);
|
|
9149
8683
|
if (existingProp) {
|
|
9150
8684
|
isNewAttribute = false;
|
|
@@ -9178,7 +8712,7 @@ var mParticle = (function () {
|
|
|
9178
8712
|
}
|
|
9179
8713
|
}
|
|
9180
8714
|
} else {
|
|
9181
|
-
mpInstance.Logger.error('Must pass an object into setUserAttributes. You passed a ' + _typeof
|
|
8715
|
+
mpInstance.Logger.error('Must pass an object into setUserAttributes. You passed a ' + _typeof(userAttributes));
|
|
9182
8716
|
}
|
|
9183
8717
|
},
|
|
9184
8718
|
/**
|
|
@@ -9187,7 +8721,8 @@ var mParticle = (function () {
|
|
|
9187
8721
|
* @param {String} key
|
|
9188
8722
|
*/
|
|
9189
8723
|
removeUserAttribute: function removeUserAttribute(key) {
|
|
9190
|
-
var cookies
|
|
8724
|
+
var cookies;
|
|
8725
|
+
var userAttributes;
|
|
9191
8726
|
mpInstance._SessionManager.resetSessionTimer();
|
|
9192
8727
|
if (!mpInstance._Helpers.Validators.isValidKeyValue(key)) {
|
|
9193
8728
|
mpInstance.Logger.error(Messages$2.ErrorMessages.BadKey);
|
|
@@ -9209,7 +8744,7 @@ var mParticle = (function () {
|
|
|
9209
8744
|
delete userAttributes[key];
|
|
9210
8745
|
if (cookies && cookies[mpid]) {
|
|
9211
8746
|
cookies[mpid].ua = userAttributes;
|
|
9212
|
-
mpInstance._Persistence.savePersistence(cookies
|
|
8747
|
+
mpInstance._Persistence.savePersistence(cookies);
|
|
9213
8748
|
}
|
|
9214
8749
|
self.sendUserAttributeChangeEvent(key, null, deletedUAKeyCopy, false, true, this);
|
|
9215
8750
|
mpInstance._Forwarders.initForwarders(self.IdentityAPI.getCurrentUser().getUserIdentities(), mpInstance._APIClient.prepareForwardingStats);
|
|
@@ -9230,7 +8765,7 @@ var mParticle = (function () {
|
|
|
9230
8765
|
return;
|
|
9231
8766
|
}
|
|
9232
8767
|
if (!Array.isArray(newValue)) {
|
|
9233
|
-
mpInstance.Logger.error('The value you passed in to setUserAttributeList must be an array. You passed in a ' +
|
|
8768
|
+
mpInstance.Logger.error('The value you passed in to setUserAttributeList must be an array. You passed in a ' + _typeof(newValue));
|
|
9234
8769
|
return;
|
|
9235
8770
|
}
|
|
9236
8771
|
var arrayCopy = newValue.slice();
|
|
@@ -9241,9 +8776,9 @@ var mParticle = (function () {
|
|
|
9241
8776
|
}));
|
|
9242
8777
|
} else {
|
|
9243
8778
|
var userAttributes = this.getAllUserAttributes();
|
|
9244
|
-
var previousUserAttributeValue;
|
|
9245
|
-
var isNewAttribute;
|
|
9246
|
-
var userAttributeChange;
|
|
8779
|
+
var previousUserAttributeValue = void 0;
|
|
8780
|
+
var isNewAttribute = void 0;
|
|
8781
|
+
var userAttributeChange = void 0;
|
|
9247
8782
|
var existingProp = mpInstance._Helpers.findKeyInObject(userAttributes, key);
|
|
9248
8783
|
if (existingProp) {
|
|
9249
8784
|
isNewAttribute = false;
|
|
@@ -9254,7 +8789,6 @@ var mParticle = (function () {
|
|
|
9254
8789
|
}
|
|
9255
8790
|
userAttributes[key] = arrayCopy;
|
|
9256
8791
|
mpInstance._Store.setUserAttributes(mpid, userAttributes);
|
|
9257
|
-
|
|
9258
8792
|
// If the new attributeList length is different than the previous, then there is a change event.
|
|
9259
8793
|
// Loop through new attributes list, see if they are all in the same index as previous user attributes list
|
|
9260
8794
|
// If there are any changes, break, and immediately send a userAttributeChangeEvent with full array as a value
|
|
@@ -9305,8 +8839,8 @@ var mParticle = (function () {
|
|
|
9305
8839
|
* @return {Object} an object of only keys with array values. Example: { attr1: [1, 2, 3], attr2: ['a', 'b', 'c'] }
|
|
9306
8840
|
*/
|
|
9307
8841
|
getUserAttributesLists: function getUserAttributesLists() {
|
|
9308
|
-
var userAttributes
|
|
9309
|
-
|
|
8842
|
+
var userAttributes;
|
|
8843
|
+
var userAttributesLists = {};
|
|
9310
8844
|
userAttributes = this.getAllUserAttributes();
|
|
9311
8845
|
for (var key in userAttributes) {
|
|
9312
8846
|
if (userAttributes.hasOwnProperty(key) && Array.isArray(userAttributes[key])) {
|
|
@@ -9327,10 +8861,11 @@ var mParticle = (function () {
|
|
|
9327
8861
|
if (userAttributes) {
|
|
9328
8862
|
for (var prop in userAttributes) {
|
|
9329
8863
|
if (userAttributes.hasOwnProperty(prop)) {
|
|
9330
|
-
|
|
9331
|
-
|
|
8864
|
+
var attrValue = userAttributes[prop];
|
|
8865
|
+
if (Array.isArray(attrValue)) {
|
|
8866
|
+
userAttributesCopy[prop] = attrValue.slice();
|
|
9332
8867
|
} else {
|
|
9333
|
-
userAttributesCopy[prop] =
|
|
8868
|
+
userAttributesCopy[prop] = attrValue;
|
|
9334
8869
|
}
|
|
9335
8870
|
}
|
|
9336
8871
|
}
|
|
@@ -9389,13 +8924,12 @@ var mParticle = (function () {
|
|
|
9389
8924
|
return;
|
|
9390
8925
|
}
|
|
9391
8926
|
if (self.audienceManager === null) {
|
|
9392
|
-
self.audienceManager = new AudienceManager(mpInstance._Store.SDKConfig.userAudienceUrl, mpInstance._Store.devToken, mpInstance.Logger
|
|
8927
|
+
self.audienceManager = new AudienceManager(mpInstance._Store.SDKConfig.userAudienceUrl, mpInstance._Store.devToken, mpInstance.Logger);
|
|
9393
8928
|
}
|
|
9394
8929
|
self.audienceManager.sendGetUserAudienceRequest(mpid, callback);
|
|
9395
8930
|
}
|
|
9396
8931
|
};
|
|
9397
8932
|
};
|
|
9398
|
-
|
|
9399
8933
|
/**
|
|
9400
8934
|
* Invoke these methods on the mParticle.Identity.getCurrentUser().getCart() object.
|
|
9401
8935
|
* Example: mParticle.Identity.getCurrentUser().getCart().add(...);
|
|
@@ -9452,9 +8986,9 @@ var mParticle = (function () {
|
|
|
9452
8986
|
}
|
|
9453
8987
|
};
|
|
9454
8988
|
};
|
|
9455
|
-
|
|
9456
8989
|
// https://go.mparticle.com/work/SQDSDKS-6355
|
|
9457
8990
|
this.parseIdentityResponse = function (identityResponse, previousMPID, callback, identityApiData, method, knownIdentities, parsingCachedResponse) {
|
|
8991
|
+
var _a, _b, _c;
|
|
9458
8992
|
var prevUser = mpInstance.Identity.getUser(previousMPID);
|
|
9459
8993
|
var prevUserMPID = prevUser ? prevUser.getMPID() : null;
|
|
9460
8994
|
var previousUIByName = prevUser ? prevUser.getUserIdentities().userIdentities : {};
|
|
@@ -9464,11 +8998,9 @@ var mParticle = (function () {
|
|
|
9464
8998
|
var newIdentitiesByType = {};
|
|
9465
8999
|
mpInstance._Store.identityCallInFlight = false;
|
|
9466
9000
|
try {
|
|
9467
|
-
var _identityResponse$res, _identityApiResult, _mpInstance$_APIClien;
|
|
9468
9001
|
mpInstance.Logger.verbose('Parsing "' + method + '" identity response from server');
|
|
9469
|
-
identityApiResult = (
|
|
9470
|
-
mpInstance._Store.isLoggedIn = (
|
|
9471
|
-
|
|
9002
|
+
identityApiResult = (_a = identityResponse.responseText) !== null && _a !== void 0 ? _a : null;
|
|
9003
|
+
mpInstance._Store.isLoggedIn = (identityApiResult === null || identityApiResult === void 0 ? void 0 : identityApiResult.is_logged_in) || false;
|
|
9472
9004
|
// https://go.mparticle.com/work/SQDSDKS-6504
|
|
9473
9005
|
// set currentUser
|
|
9474
9006
|
if (hasMPIDChanged(prevUser, identityApiResult)) {
|
|
@@ -9478,12 +9010,10 @@ var mParticle = (function () {
|
|
|
9478
9010
|
mpInstance._Persistence.setLastSeenTime(previousMPID);
|
|
9479
9011
|
}
|
|
9480
9012
|
mpidIsNotInCookies = !mpInstance._Persistence.getFirstSeenTime(identityApiResult.mpid);
|
|
9481
|
-
|
|
9482
9013
|
// https://go.mparticle.com/work/SQDSDKS-6329
|
|
9483
9014
|
mpInstance._Persistence.setFirstSeenTime(identityApiResult.mpid);
|
|
9484
9015
|
}
|
|
9485
9016
|
if (identityResponse.status === HTTP_OK) {
|
|
9486
|
-
var _mpInstance$_CookieCo;
|
|
9487
9017
|
if (getFeatureFlag(CacheIdentity)) {
|
|
9488
9018
|
cacheOrClearIdCache(method, knownIdentities, self.idCache, identityResponse, parsingCachedResponse);
|
|
9489
9019
|
}
|
|
@@ -9507,18 +9037,15 @@ var mParticle = (function () {
|
|
|
9507
9037
|
if (identityApiData && !isEmpty(identityApiData.userIdentities)) {
|
|
9508
9038
|
newIdentitiesByType = self.IdentityRequest.combineUserIdentities(incomingUIByName, identityApiData.userIdentities);
|
|
9509
9039
|
}
|
|
9510
|
-
|
|
9511
9040
|
// https://go.mparticle.com/work/SQDSDKS-6041
|
|
9512
9041
|
mpInstance._Store.setUserIdentities(identityApiResult.mpid, newIdentitiesByType);
|
|
9513
9042
|
mpInstance._Persistence.update();
|
|
9514
9043
|
mpInstance._Store.syncPersistenceData();
|
|
9515
9044
|
mpInstance._Persistence.findPrevCookiesBasedOnUI(identityApiData);
|
|
9516
|
-
|
|
9517
9045
|
// https://go.mparticle.com/work/SQDSDKS-6357
|
|
9518
9046
|
mpInstance._Store.context = identityApiResult.context || mpInstance._Store.context;
|
|
9519
9047
|
}
|
|
9520
9048
|
newUser = mpInstance.Identity.getCurrentUser();
|
|
9521
|
-
|
|
9522
9049
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
9523
9050
|
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
9524
9051
|
var persistence = mpInstance._Persistence.getPersistence();
|
|
@@ -9529,14 +9056,12 @@ var mParticle = (function () {
|
|
|
9529
9056
|
}
|
|
9530
9057
|
var newIdentitiesByName = IdentityType.getNewIdentitiesByName(newIdentitiesByType);
|
|
9531
9058
|
var uiByName = method === Modify$1 ? previousUIByName : incomingUIByName;
|
|
9532
|
-
|
|
9533
9059
|
// Sync $NoTargeting before sendUserIdentityChangeEvent
|
|
9534
9060
|
// because UIC events call sendEventToServer which triggers
|
|
9535
9061
|
// processQueuedEvents, draining the event queue. The
|
|
9536
9062
|
// attribute must be in the store before that happens so
|
|
9537
9063
|
// appendUserInfo picks it up.
|
|
9538
|
-
(
|
|
9539
|
-
|
|
9064
|
+
(_b = mpInstance._CookieConsentManager) === null || _b === void 0 ? void 0 : _b.syncNoTargetingAttribute(newUser);
|
|
9540
9065
|
// https://go.mparticle.com/work/SQDSDKS-6501
|
|
9541
9066
|
self.sendUserIdentityChangeEvent(newIdentitiesByName, method, identityApiResult.mpid, uiByName);
|
|
9542
9067
|
}
|
|
@@ -9548,9 +9073,8 @@ var mParticle = (function () {
|
|
|
9548
9073
|
mpInstance.Logger.error('Received HTTP response code of ' + identityResponse.status + ' - ' + identityApiResult.errors[0].message);
|
|
9549
9074
|
}
|
|
9550
9075
|
mpInstance.Logger.verbose('Successfully parsed Identity Response');
|
|
9551
|
-
|
|
9552
9076
|
// https://go.mparticle.com/work/SQDSDKS-6654
|
|
9553
|
-
(
|
|
9077
|
+
(_c = mpInstance._APIClient) === null || _c === void 0 ? void 0 : _c.processQueuedEvents();
|
|
9554
9078
|
} catch (e) {
|
|
9555
9079
|
if (callback) {
|
|
9556
9080
|
mpInstance._Helpers.invokeCallback(callback, identityResponse.status, identityApiResult || null);
|
|
@@ -9561,36 +9085,33 @@ var mParticle = (function () {
|
|
|
9561
9085
|
mpInstance._RoktManager.onIdentityComplete();
|
|
9562
9086
|
mpInstance._preInit.readyQueue = processReadyQueue(mpInstance._preInit.readyQueue, mpInstance.Logger);
|
|
9563
9087
|
};
|
|
9564
|
-
|
|
9565
9088
|
// send a user identity change request on identify, login, logout, modify when any values change.
|
|
9566
9089
|
// compare what identities exist vs what is previously was for the specific user if they were in memory before.
|
|
9567
9090
|
// if it's the first time the user is logging in, send a user identity change request with
|
|
9568
9091
|
this.sendUserIdentityChangeEvent = function (newUserIdentities, method, mpid, prevUserIdentities) {
|
|
9092
|
+
var _a;
|
|
9569
9093
|
if (!mpid) {
|
|
9570
9094
|
// https://go.mparticle.com/work/SQDSDKS-6501
|
|
9571
9095
|
if (method !== Modify$1) {
|
|
9572
9096
|
return;
|
|
9573
9097
|
}
|
|
9574
9098
|
}
|
|
9575
|
-
|
|
9576
9099
|
// https://go.mparticle.com/work/SQDSDKS-6354
|
|
9577
9100
|
var currentUserInMemory = this.IdentityAPI.getUser(mpid);
|
|
9578
9101
|
for (var identityType in newUserIdentities) {
|
|
9579
9102
|
// Verifies a change actually happened
|
|
9580
9103
|
if (prevUserIdentities[identityType] !== newUserIdentities[identityType]) {
|
|
9581
|
-
var _mpInstance$_APIClien2;
|
|
9582
9104
|
// If a new identity type was introduced when the identity changes
|
|
9583
9105
|
// we need to notify the server so that the user profile is updated in
|
|
9584
9106
|
// the mParticle UI.
|
|
9585
9107
|
var isNewUserIdentityType = !prevUserIdentities[identityType];
|
|
9586
9108
|
var userIdentityChangeEvent = self.createUserIdentityChange(identityType, newUserIdentities[identityType], prevUserIdentities[identityType], isNewUserIdentityType, currentUserInMemory);
|
|
9587
|
-
(
|
|
9109
|
+
(_a = mpInstance._APIClient) === null || _a === void 0 ? void 0 : _a.sendEventToServer(userIdentityChangeEvent);
|
|
9588
9110
|
}
|
|
9589
9111
|
}
|
|
9590
9112
|
};
|
|
9591
9113
|
this.createUserIdentityChange = function (identityType, newIdentity, oldIdentity, isIdentityTypeNewToBatch, userInMemory) {
|
|
9592
9114
|
var userIdentityChangeEvent;
|
|
9593
|
-
|
|
9594
9115
|
// https://go.mparticle.com/work/SQDSDKS-6439
|
|
9595
9116
|
userIdentityChangeEvent = mpInstance._ServerModel.createEventObject({
|
|
9596
9117
|
messageType: Types.MessageType.UserIdentityChange,
|
|
@@ -9611,10 +9132,10 @@ var mParticle = (function () {
|
|
|
9611
9132
|
return userIdentityChangeEvent;
|
|
9612
9133
|
};
|
|
9613
9134
|
this.sendUserAttributeChangeEvent = function (attributeKey, newUserAttributeValue, previousUserAttributeValue, isNewAttribute, deleted, user) {
|
|
9135
|
+
var _a;
|
|
9614
9136
|
var userAttributeChangeEvent = self.createUserAttributeChange(attributeKey, newUserAttributeValue, previousUserAttributeValue, isNewAttribute, deleted, user);
|
|
9615
9137
|
if (userAttributeChangeEvent) {
|
|
9616
|
-
|
|
9617
|
-
(_mpInstance$_APIClien3 = mpInstance._APIClient) === null || _mpInstance$_APIClien3 === void 0 || _mpInstance$_APIClien3.sendEventToServer(userAttributeChangeEvent);
|
|
9138
|
+
(_a = mpInstance._APIClient) === null || _a === void 0 ? void 0 : _a.sendEventToServer(userAttributeChangeEvent);
|
|
9618
9139
|
}
|
|
9619
9140
|
};
|
|
9620
9141
|
this.createUserAttributeChange = function (key, newValue, previousUserAttributeValue, isNewAttribute, deleted, user) {
|
|
@@ -9638,20 +9159,19 @@ var mParticle = (function () {
|
|
|
9638
9159
|
return userAttributeChangeEvent;
|
|
9639
9160
|
};
|
|
9640
9161
|
this.reinitForwardersOnUserChange = function (prevUser, newUser) {
|
|
9162
|
+
var _a;
|
|
9641
9163
|
if (hasMPIDAndUserLoginChanged(prevUser, newUser)) {
|
|
9642
|
-
|
|
9643
|
-
(_mpInstance$_Forwarde = mpInstance._Forwarders) === null || _mpInstance$_Forwarde === void 0 || _mpInstance$_Forwarde.initForwarders(newUser.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats);
|
|
9164
|
+
(_a = mpInstance._Forwarders) === null || _a === void 0 ? void 0 : _a.initForwarders(newUser.getUserIdentities().userIdentities, mpInstance._APIClient.prepareForwardingStats);
|
|
9644
9165
|
}
|
|
9645
9166
|
};
|
|
9646
9167
|
this.setForwarderCallbacks = function (user, method) {
|
|
9647
|
-
var
|
|
9168
|
+
var _a, _b, _c;
|
|
9648
9169
|
// https://go.mparticle.com/work/SQDSDKS-6036
|
|
9649
|
-
(
|
|
9650
|
-
(
|
|
9651
|
-
(
|
|
9170
|
+
(_a = mpInstance._Forwarders) === null || _a === void 0 ? void 0 : _a.setForwarderUserIdentities(user.getUserIdentities().userIdentities);
|
|
9171
|
+
(_b = mpInstance._Forwarders) === null || _b === void 0 ? void 0 : _b.setForwarderOnIdentityComplete(user, method);
|
|
9172
|
+
(_c = mpInstance._Forwarders) === null || _c === void 0 ? void 0 : _c.setForwarderOnUserIdentified(user);
|
|
9652
9173
|
};
|
|
9653
9174
|
}
|
|
9654
|
-
|
|
9655
9175
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
9656
9176
|
function tryOnUserAlias(previousUser, newUser, identityApiData, logger, errorReporter) {
|
|
9657
9177
|
if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) {
|
|
@@ -10369,7 +9889,7 @@ var mParticle = (function () {
|
|
|
10369
9889
|
if (typeof matchedAttributes === 'boolean' && matchedAttributes) {
|
|
10370
9890
|
return false;
|
|
10371
9891
|
}
|
|
10372
|
-
if (_typeof
|
|
9892
|
+
if (_typeof(matchedAttributes) === "object") {
|
|
10373
9893
|
if (matchedAttributes[key] === true) {
|
|
10374
9894
|
return false;
|
|
10375
9895
|
} else {
|
|
@@ -11316,7 +10836,7 @@ var mParticle = (function () {
|
|
|
11316
10836
|
switch (_b.label) {
|
|
11317
10837
|
case 0:
|
|
11318
10838
|
_b.trys.push([0, 2,, 3]);
|
|
11319
|
-
if (!attributes || _typeof
|
|
10839
|
+
if (!attributes || _typeof(attributes) !== 'object') {
|
|
11320
10840
|
return [2 /*return*/, {}];
|
|
11321
10841
|
}
|
|
11322
10842
|
keys = Object.keys(attributes);
|
|
@@ -11386,6 +10906,57 @@ var mParticle = (function () {
|
|
|
11386
10906
|
return Promise.reject(error instanceof Error ? error : new Error('Error using extension: ' + name));
|
|
11387
10907
|
}
|
|
11388
10908
|
};
|
|
10909
|
+
/**
|
|
10910
|
+
* Tears down the current Rokt launcher and removes the placements it rendered.
|
|
10911
|
+
*
|
|
10912
|
+
* Intended for hosts that cannot simply destroy the container element —
|
|
10913
|
+
* SPA route changes and confirmation pages, for example.
|
|
10914
|
+
*
|
|
10915
|
+
* Unlike the other proxied methods, a call made before the kit is ready is
|
|
10916
|
+
* *not* queued. Replaying a teardown against a launcher created later would
|
|
10917
|
+
* silently tear down placements the caller never asked to remove; with no
|
|
10918
|
+
* launcher there is nothing to terminate, so this resolves as a no-op.
|
|
10919
|
+
*
|
|
10920
|
+
* @example
|
|
10921
|
+
* await window.mParticle.Rokt.terminate();
|
|
10922
|
+
*
|
|
10923
|
+
* @returns {Promise<void>} Resolves once the launcher has torn down. Never rejects.
|
|
10924
|
+
*/
|
|
10925
|
+
RoktManager.prototype.terminate = function () {
|
|
10926
|
+
var _a, _b, _c;
|
|
10927
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
10928
|
+
var error_2;
|
|
10929
|
+
return __generator(this, function (_d) {
|
|
10930
|
+
switch (_d.label) {
|
|
10931
|
+
case 0:
|
|
10932
|
+
if (!this.isReady()) {
|
|
10933
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.verbose('mParticle.Rokt.terminate called before the Rokt kit was ready. Nothing to terminate.');
|
|
10934
|
+
return [2 /*return*/];
|
|
10935
|
+
}
|
|
10936
|
+
|
|
10937
|
+
if (!isFunction(this.kit.terminate)) {
|
|
10938
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.error('mParticle.Rokt.terminate is not supported by the attached Rokt Kit version.');
|
|
10939
|
+
return [2 /*return*/];
|
|
10940
|
+
}
|
|
10941
|
+
|
|
10942
|
+
_d.label = 1;
|
|
10943
|
+
case 1:
|
|
10944
|
+
_d.trys.push([1, 3,, 4]);
|
|
10945
|
+
return [4 /*yield*/, this.kit.terminate()];
|
|
10946
|
+
case 2:
|
|
10947
|
+
_d.sent();
|
|
10948
|
+
return [3 /*break*/, 4];
|
|
10949
|
+
case 3:
|
|
10950
|
+
error_2 = _d.sent();
|
|
10951
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.error("Failed to terminate the Rokt launcher: ".concat(getErrorMessage(error_2)));
|
|
10952
|
+
return [3 /*break*/, 4];
|
|
10953
|
+
case 4:
|
|
10954
|
+
return [2 /*return*/];
|
|
10955
|
+
}
|
|
10956
|
+
});
|
|
10957
|
+
});
|
|
10958
|
+
};
|
|
10959
|
+
|
|
11389
10960
|
RoktManager.prototype.onShoppableAdsReady = function (callback) {
|
|
11390
10961
|
if (!this.kit || !this.isShoppableAdsLoaded) {
|
|
11391
10962
|
this.deferredCall('onShoppableAdsReady', callback);
|
|
@@ -11422,7 +10993,7 @@ var mParticle = (function () {
|
|
|
11422
10993
|
*/
|
|
11423
10994
|
RoktManager.prototype.hashSha256 = function (attribute) {
|
|
11424
10995
|
return __awaiter(this, void 0, void 0, function () {
|
|
11425
|
-
var normalizedValue,
|
|
10996
|
+
var normalizedValue, error_3;
|
|
11426
10997
|
return __generator(this, function (_a) {
|
|
11427
10998
|
switch (_a.label) {
|
|
11428
10999
|
case 0:
|
|
@@ -11438,8 +11009,8 @@ var mParticle = (function () {
|
|
|
11438
11009
|
case 2:
|
|
11439
11010
|
return [2 /*return*/, _a.sent()];
|
|
11440
11011
|
case 3:
|
|
11441
|
-
|
|
11442
|
-
this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(
|
|
11012
|
+
error_3 = _a.sent();
|
|
11013
|
+
this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(error_3)));
|
|
11443
11014
|
return [2 /*return*/, undefined];
|
|
11444
11015
|
case 4:
|
|
11445
11016
|
return [2 /*return*/];
|
|
@@ -12165,11 +11736,11 @@ var mParticle = (function () {
|
|
|
12165
11736
|
title: window.document.title
|
|
12166
11737
|
};
|
|
12167
11738
|
} else if (!self._Helpers.isObject(attrs)) {
|
|
12168
|
-
self.Logger.error('The attributes argument must be an object. A ' + _typeof
|
|
11739
|
+
self.Logger.error('The attributes argument must be an object. A ' + _typeof(attrs) + ' was entered. Please correct and retry.');
|
|
12169
11740
|
return;
|
|
12170
11741
|
}
|
|
12171
11742
|
if (customFlags && !self._Helpers.isObject(customFlags)) {
|
|
12172
|
-
self.Logger.error('The customFlags argument must be an object. A ' + _typeof
|
|
11743
|
+
self.Logger.error('The customFlags argument must be an object. A ' + _typeof(customFlags) + ' was entered. Please correct and retry.');
|
|
12173
11744
|
return;
|
|
12174
11745
|
}
|
|
12175
11746
|
}
|
|
@@ -12599,17 +12170,17 @@ var mParticle = (function () {
|
|
|
12599
12170
|
self._Store.integrationAttributes[integrationId][key] = attrs[key];
|
|
12600
12171
|
}
|
|
12601
12172
|
} else {
|
|
12602
|
-
self.Logger.error('Values for integration attributes must be strings. You entered a ' + _typeof
|
|
12173
|
+
self.Logger.error('Values for integration attributes must be strings. You entered a ' + _typeof(attrs[key]));
|
|
12603
12174
|
continue;
|
|
12604
12175
|
}
|
|
12605
12176
|
} else {
|
|
12606
|
-
self.Logger.error('Keys must be strings, you entered a ' + _typeof
|
|
12177
|
+
self.Logger.error('Keys must be strings, you entered a ' + _typeof(key));
|
|
12607
12178
|
continue;
|
|
12608
12179
|
}
|
|
12609
12180
|
}
|
|
12610
12181
|
}
|
|
12611
12182
|
} else {
|
|
12612
|
-
self.Logger.error('Attrs must be an object with keys and values. You entered a ' + _typeof
|
|
12183
|
+
self.Logger.error('Attrs must be an object with keys and values. You entered a ' + _typeof(attrs));
|
|
12613
12184
|
return;
|
|
12614
12185
|
}
|
|
12615
12186
|
self._Persistence.update();
|