@mparticle/web-sdk 2.14.1 → 2.14.2
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 +11 -11
- package/dist/mparticle.esm.js +11 -11
- package/dist/mparticle.js +88 -75
- package/package.json +1 -1
- package/src/cookieSyncManager.js +7 -6
- package/src/mp-instance.js +130 -94
- package/CHANGELOG.md +0 -563
package/dist/mparticle.js
CHANGED
|
@@ -719,7 +719,7 @@ var mParticle = (function () {
|
|
|
719
719
|
TriggerUploadType: TriggerUploadType
|
|
720
720
|
};
|
|
721
721
|
|
|
722
|
-
var version = "2.14.
|
|
722
|
+
var version = "2.14.2";
|
|
723
723
|
|
|
724
724
|
var Constants = {
|
|
725
725
|
sdkVersion: version,
|
|
@@ -4448,10 +4448,14 @@ var mParticle = (function () {
|
|
|
4448
4448
|
if (mpInstance._Consent.isEnabledForUserConsent(filteringConsentRuleValues, mpInstance.Identity.getCurrentUser())) {
|
|
4449
4449
|
var img = document.createElement('img');
|
|
4450
4450
|
mpInstance.Logger.verbose(Messages$2.InformationMessages.CookieSync);
|
|
4451
|
-
img.src = url;
|
|
4452
|
-
cookieSyncDates[moduleId.toString()] = new Date().getTime();
|
|
4453
4451
|
|
|
4454
|
-
|
|
4452
|
+
img.onload = function () {
|
|
4453
|
+
cookieSyncDates[moduleId.toString()] = new Date().getTime();
|
|
4454
|
+
|
|
4455
|
+
mpInstance._Persistence.saveUserCookieSyncDatesToPersistence(mpid, cookieSyncDates);
|
|
4456
|
+
};
|
|
4457
|
+
|
|
4458
|
+
img.src = url;
|
|
4455
4459
|
}
|
|
4456
4460
|
};
|
|
4457
4461
|
}
|
|
@@ -10221,10 +10225,14 @@ var mParticle = (function () {
|
|
|
10221
10225
|
|
|
10222
10226
|
|
|
10223
10227
|
this.reset = function (instance) {
|
|
10224
|
-
|
|
10228
|
+
try {
|
|
10229
|
+
instance._Persistence.resetPersistence();
|
|
10225
10230
|
|
|
10226
|
-
|
|
10227
|
-
|
|
10231
|
+
if (instance._Store) {
|
|
10232
|
+
delete instance._Store;
|
|
10233
|
+
}
|
|
10234
|
+
} catch (error) {
|
|
10235
|
+
console.error('Cannot reset mParticle', error);
|
|
10228
10236
|
}
|
|
10229
10237
|
};
|
|
10230
10238
|
|
|
@@ -10260,7 +10268,7 @@ var mParticle = (function () {
|
|
|
10260
10268
|
|
|
10261
10269
|
|
|
10262
10270
|
this.ready = function (f) {
|
|
10263
|
-
if (self.
|
|
10271
|
+
if (self.isInitialized() && typeof f === 'function') {
|
|
10264
10272
|
f();
|
|
10265
10273
|
} else {
|
|
10266
10274
|
self._preInit.readyQueue.push(f);
|
|
@@ -10284,6 +10292,10 @@ var mParticle = (function () {
|
|
|
10284
10292
|
|
|
10285
10293
|
|
|
10286
10294
|
this.setAppVersion = function (version) {
|
|
10295
|
+
var queued = queueIfNotInitialized(function () {
|
|
10296
|
+
self.setAppVersion(version);
|
|
10297
|
+
}, self);
|
|
10298
|
+
if (queued) return;
|
|
10287
10299
|
self._Store.SDKConfig.appVersion = version;
|
|
10288
10300
|
|
|
10289
10301
|
self._Persistence.update();
|
|
@@ -10306,6 +10318,10 @@ var mParticle = (function () {
|
|
|
10306
10318
|
|
|
10307
10319
|
|
|
10308
10320
|
this.setAppName = function (name) {
|
|
10321
|
+
var queued = queueIfNotInitialized(function () {
|
|
10322
|
+
self.setAppName(name);
|
|
10323
|
+
}, self);
|
|
10324
|
+
if (queued) return;
|
|
10309
10325
|
self._Store.SDKConfig.appName = name;
|
|
10310
10326
|
};
|
|
10311
10327
|
/**
|
|
@@ -10354,6 +10370,11 @@ var mParticle = (function () {
|
|
|
10354
10370
|
|
|
10355
10371
|
|
|
10356
10372
|
this.setPosition = function (lat, lng) {
|
|
10373
|
+
var queued = queueIfNotInitialized(function () {
|
|
10374
|
+
self.setPosition(lat, lng);
|
|
10375
|
+
}, self);
|
|
10376
|
+
if (queued) return;
|
|
10377
|
+
|
|
10357
10378
|
self._SessionManager.resetSessionTimer();
|
|
10358
10379
|
|
|
10359
10380
|
if (typeof lat === 'number' && typeof lng === 'number') {
|
|
@@ -10392,12 +10413,10 @@ var mParticle = (function () {
|
|
|
10392
10413
|
|
|
10393
10414
|
|
|
10394
10415
|
this.logBaseEvent = function (event, eventOptions) {
|
|
10395
|
-
|
|
10396
|
-
self.
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
return;
|
|
10400
|
-
}
|
|
10416
|
+
var queued = queueIfNotInitialized(function () {
|
|
10417
|
+
self.logBaseEvent(event, eventOptions);
|
|
10418
|
+
}, self);
|
|
10419
|
+
if (queued) return;
|
|
10401
10420
|
|
|
10402
10421
|
self._SessionManager.resetSessionTimer();
|
|
10403
10422
|
|
|
@@ -10429,12 +10448,10 @@ var mParticle = (function () {
|
|
|
10429
10448
|
|
|
10430
10449
|
|
|
10431
10450
|
this.logEvent = function (eventName, eventType, eventInfo, customFlags, eventOptions) {
|
|
10432
|
-
|
|
10433
|
-
self.
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
return;
|
|
10437
|
-
}
|
|
10451
|
+
var queued = queueIfNotInitialized(function () {
|
|
10452
|
+
self.logEvent(eventName, eventType, eventInfo, customFlags, eventOptions);
|
|
10453
|
+
}, self);
|
|
10454
|
+
if (queued) return;
|
|
10438
10455
|
|
|
10439
10456
|
self._SessionManager.resetSessionTimer();
|
|
10440
10457
|
|
|
@@ -10475,12 +10492,10 @@ var mParticle = (function () {
|
|
|
10475
10492
|
|
|
10476
10493
|
|
|
10477
10494
|
this.logError = function (error, attrs) {
|
|
10478
|
-
|
|
10479
|
-
self.
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
return;
|
|
10483
|
-
}
|
|
10495
|
+
var queued = queueIfNotInitialized(function () {
|
|
10496
|
+
self.logError(error, attrs);
|
|
10497
|
+
}, self);
|
|
10498
|
+
if (queued) return;
|
|
10484
10499
|
|
|
10485
10500
|
self._SessionManager.resetSessionTimer();
|
|
10486
10501
|
|
|
@@ -10552,12 +10567,10 @@ var mParticle = (function () {
|
|
|
10552
10567
|
|
|
10553
10568
|
|
|
10554
10569
|
this.logPageView = function (eventName, attrs, customFlags, eventOptions) {
|
|
10555
|
-
|
|
10556
|
-
self.
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
return;
|
|
10560
|
-
}
|
|
10570
|
+
var queued = queueIfNotInitialized(function () {
|
|
10571
|
+
self.logPageView(eventName, attrs, customFlags, eventOptions);
|
|
10572
|
+
}, self);
|
|
10573
|
+
if (queued) return;
|
|
10561
10574
|
|
|
10562
10575
|
self._SessionManager.resetSessionTimer();
|
|
10563
10576
|
|
|
@@ -10725,12 +10738,10 @@ var mParticle = (function () {
|
|
|
10725
10738
|
* @param {String} code The currency code
|
|
10726
10739
|
*/
|
|
10727
10740
|
setCurrencyCode: function setCurrencyCode(code) {
|
|
10728
|
-
|
|
10729
|
-
self.
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
return;
|
|
10733
|
-
}
|
|
10741
|
+
var queued = queueIfNotInitialized(function () {
|
|
10742
|
+
self.eCommerce.setCurrencyCode(code);
|
|
10743
|
+
}, self);
|
|
10744
|
+
if (queued) return;
|
|
10734
10745
|
|
|
10735
10746
|
if (typeof code !== 'string') {
|
|
10736
10747
|
self.Logger.error('Code must be a string');
|
|
@@ -10837,12 +10848,10 @@ var mParticle = (function () {
|
|
|
10837
10848
|
* @param {Object} [eventOptions] For Event-level Configuration Options
|
|
10838
10849
|
*/
|
|
10839
10850
|
logProductAction: function logProductAction(productActionType, product, attrs, customFlags, transactionAttributes, eventOptions) {
|
|
10840
|
-
|
|
10841
|
-
self.
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
return;
|
|
10845
|
-
}
|
|
10851
|
+
var queued = queueIfNotInitialized(function () {
|
|
10852
|
+
self.eCommerce.logProductAction(productActionType, product, attrs, customFlags, transactionAttributes, eventOptions);
|
|
10853
|
+
}, self);
|
|
10854
|
+
if (queued) return;
|
|
10846
10855
|
|
|
10847
10856
|
self._SessionManager.resetSessionTimer();
|
|
10848
10857
|
|
|
@@ -10891,12 +10900,10 @@ var mParticle = (function () {
|
|
|
10891
10900
|
* @param {Object} [eventOptions] For Event-level Configuration Options
|
|
10892
10901
|
*/
|
|
10893
10902
|
logPromotion: function logPromotion(type, promotion, attrs, customFlags, eventOptions) {
|
|
10894
|
-
|
|
10895
|
-
self.
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
return;
|
|
10899
|
-
}
|
|
10903
|
+
var queued = queueIfNotInitialized(function () {
|
|
10904
|
+
self.eCommerce.logPromotion(type, promotion, attrs, customFlags, eventOptions);
|
|
10905
|
+
}, self);
|
|
10906
|
+
if (queued) return;
|
|
10900
10907
|
|
|
10901
10908
|
self._SessionManager.resetSessionTimer();
|
|
10902
10909
|
|
|
@@ -10913,12 +10920,10 @@ var mParticle = (function () {
|
|
|
10913
10920
|
* @param {Object} [eventOptions] For Event-level Configuration Options
|
|
10914
10921
|
*/
|
|
10915
10922
|
logImpression: function logImpression(impression, attrs, customFlags, eventOptions) {
|
|
10916
|
-
|
|
10917
|
-
self.
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
return;
|
|
10921
|
-
}
|
|
10923
|
+
var queued = queueIfNotInitialized(function () {
|
|
10924
|
+
self.eCommerce.logImpression(impression, attrs, customFlags, eventOptions);
|
|
10925
|
+
}, self);
|
|
10926
|
+
if (queued) return;
|
|
10922
10927
|
|
|
10923
10928
|
self._SessionManager.resetSessionTimer();
|
|
10924
10929
|
|
|
@@ -10962,16 +10967,13 @@ var mParticle = (function () {
|
|
|
10962
10967
|
*/
|
|
10963
10968
|
|
|
10964
10969
|
this.setSessionAttribute = function (key, value) {
|
|
10965
|
-
|
|
10966
|
-
self.
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
return;
|
|
10970
|
-
} // Logs to cookie
|
|
10970
|
+
var queued = queueIfNotInitialized(function () {
|
|
10971
|
+
self.setSessionAttribute(key, value);
|
|
10972
|
+
}, self);
|
|
10973
|
+
if (queued) return; // Logs to cookie
|
|
10971
10974
|
// And logs to in-memory object
|
|
10972
10975
|
// Example: mParticle.setSessionAttribute('location', '33431');
|
|
10973
10976
|
|
|
10974
|
-
|
|
10975
10977
|
if (self._Helpers.canLog()) {
|
|
10976
10978
|
if (!self._Helpers.Validators.isValidAttributeValue(value)) {
|
|
10977
10979
|
self.Logger.error(Messages$9.ErrorMessages.BadAttribute);
|
|
@@ -11011,12 +11013,10 @@ var mParticle = (function () {
|
|
|
11011
11013
|
|
|
11012
11014
|
|
|
11013
11015
|
this.setOptOut = function (isOptingOut) {
|
|
11014
|
-
|
|
11015
|
-
self.
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
return;
|
|
11019
|
-
}
|
|
11016
|
+
var queued = queueIfNotInitialized(function () {
|
|
11017
|
+
self.setOptOut(isOptingOut);
|
|
11018
|
+
}, self);
|
|
11019
|
+
if (queued) return;
|
|
11020
11020
|
|
|
11021
11021
|
self._SessionManager.resetSessionTimer();
|
|
11022
11022
|
|
|
@@ -11054,12 +11054,10 @@ var mParticle = (function () {
|
|
|
11054
11054
|
|
|
11055
11055
|
|
|
11056
11056
|
this.setIntegrationAttribute = function (integrationId, attrs) {
|
|
11057
|
-
|
|
11058
|
-
self.
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
return;
|
|
11062
|
-
}
|
|
11057
|
+
var queued = queueIfNotInitialized(function () {
|
|
11058
|
+
self.setIntegrationAttribute(integrationId, attrs);
|
|
11059
|
+
}, self);
|
|
11060
|
+
if (queued) return;
|
|
11063
11061
|
|
|
11064
11062
|
if (typeof integrationId !== 'number') {
|
|
11065
11063
|
self.Logger.error('integrationId must be a number');
|
|
@@ -11134,6 +11132,10 @@ var mParticle = (function () {
|
|
|
11134
11132
|
this._setIntegrationDelay = function (module, _boolean) {
|
|
11135
11133
|
self._preInit.integrationDelays[module] = _boolean;
|
|
11136
11134
|
};
|
|
11135
|
+
|
|
11136
|
+
this.isInitialized = function () {
|
|
11137
|
+
return self._Store ? self._Store.isInitialized : false;
|
|
11138
|
+
};
|
|
11137
11139
|
} // Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
|
|
11138
11140
|
|
|
11139
11141
|
function completeSDKInitialization(apiKey, config, mpInstance) {
|
|
@@ -11375,6 +11377,17 @@ var mParticle = (function () {
|
|
|
11375
11377
|
}
|
|
11376
11378
|
}
|
|
11377
11379
|
|
|
11380
|
+
function queueIfNotInitialized(func, self) {
|
|
11381
|
+
if (!self.isInitialized()) {
|
|
11382
|
+
self.ready(function () {
|
|
11383
|
+
func();
|
|
11384
|
+
});
|
|
11385
|
+
return true;
|
|
11386
|
+
}
|
|
11387
|
+
|
|
11388
|
+
return false;
|
|
11389
|
+
}
|
|
11390
|
+
|
|
11378
11391
|
var _BatchValidator = /*#__PURE__*/ function () {
|
|
11379
11392
|
function _BatchValidator() {
|
|
11380
11393
|
classCallCheck(this, _BatchValidator);
|
package/package.json
CHANGED
package/src/cookieSyncManager.js
CHANGED
|
@@ -144,13 +144,14 @@ export default function cookieSyncManager(mpInstance) {
|
|
|
144
144
|
var img = document.createElement('img');
|
|
145
145
|
|
|
146
146
|
mpInstance.Logger.verbose(Messages.InformationMessages.CookieSync);
|
|
147
|
-
|
|
147
|
+
img.onload = function() {
|
|
148
|
+
cookieSyncDates[moduleId.toString()] = new Date().getTime();
|
|
149
|
+
mpInstance._Persistence.saveUserCookieSyncDatesToPersistence(
|
|
150
|
+
mpid,
|
|
151
|
+
cookieSyncDates
|
|
152
|
+
);
|
|
153
|
+
};
|
|
148
154
|
img.src = url;
|
|
149
|
-
cookieSyncDates[moduleId.toString()] = new Date().getTime();
|
|
150
|
-
mpInstance._Persistence.saveUserCookieSyncDatesToPersistence(
|
|
151
|
-
mpid,
|
|
152
|
-
cookieSyncDates
|
|
153
|
-
);
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
157
|
}
|