@mparticle/web-sdk 2.25.3 → 2.26.1
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 +72 -48
- package/dist/mparticle.esm.js +72 -48
- package/dist/mparticle.js +360 -184
- package/package.json +1 -1
- package/src/apiClient.ts +2 -1
- package/src/audience.ts +9 -0
- package/src/audienceManager.ts +88 -0
- package/src/batchUploader.ts +11 -66
- package/src/constants.ts +4 -0
- package/src/helpers.js +0 -1
- package/src/identity.js +32 -2
- package/src/mockBatchCreator.ts +1 -2
- package/src/mp-instance.js +110 -173
- package/src/nativeSdkHelpers.js +18 -0
- package/src/sdkRuntimeModels.ts +18 -4
- package/src/sessionManager.ts +1 -0
- package/src/store.ts +152 -14
- package/src/uploaders.ts +59 -0
package/dist/mparticle.js
CHANGED
|
@@ -608,7 +608,7 @@ var mParticle = (function () {
|
|
|
608
608
|
Environment: Environment
|
|
609
609
|
};
|
|
610
610
|
|
|
611
|
-
var version = "2.
|
|
611
|
+
var version = "2.26.1";
|
|
612
612
|
|
|
613
613
|
var Constants = {
|
|
614
614
|
sdkVersion: version,
|
|
@@ -633,7 +633,8 @@ var mParticle = (function () {
|
|
|
633
633
|
PromotionIdRequired: 'Promotion ID is required',
|
|
634
634
|
BadAttribute: 'Attribute value cannot be object or array',
|
|
635
635
|
BadKey: 'Key value cannot be object or array',
|
|
636
|
-
BadLogPurchase: 'Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions'
|
|
636
|
+
BadLogPurchase: 'Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions',
|
|
637
|
+
AudienceAPINotEnabled: 'Your workspace is not enabled to retrieve user audiences.'
|
|
637
638
|
},
|
|
638
639
|
InformationMessages: {
|
|
639
640
|
CookieSearch: 'Searching for cookie',
|
|
@@ -730,7 +731,8 @@ var mParticle = (function () {
|
|
|
730
731
|
v3SecureServiceUrl: 'jssdks.mparticle.com/v3/JS/',
|
|
731
732
|
configUrl: 'jssdkcdns.mparticle.com/JS/v2/',
|
|
732
733
|
identityUrl: 'identity.mparticle.com/v1/',
|
|
733
|
-
aliasUrl: 'jssdks.mparticle.com/v1/identity/'
|
|
734
|
+
aliasUrl: 'jssdks.mparticle.com/v1/identity/',
|
|
735
|
+
userAudienceUrl: 'nativesdks.mparticle.com/v1/'
|
|
734
736
|
},
|
|
735
737
|
Base64CookieKeys: {
|
|
736
738
|
csm: 1,
|
|
@@ -764,7 +766,8 @@ var mParticle = (function () {
|
|
|
764
766
|
EventBatchingIntervalMillis: 'eventBatchingIntervalMillis',
|
|
765
767
|
OfflineStorage: 'offlineStorage',
|
|
766
768
|
DirectUrlRouting: 'directURLRouting',
|
|
767
|
-
CacheIdentity: 'cacheIdentity'
|
|
769
|
+
CacheIdentity: 'cacheIdentity',
|
|
770
|
+
AudienceAPI: 'audienceAPI'
|
|
768
771
|
},
|
|
769
772
|
DefaultInstance: 'default_instance',
|
|
770
773
|
CCPAPurpose: 'data_sale_opt_out',
|
|
@@ -1988,6 +1991,76 @@ var mParticle = (function () {
|
|
|
1988
1991
|
return SessionStorageVault;
|
|
1989
1992
|
}(BaseVault);
|
|
1990
1993
|
|
|
1994
|
+
var AsyncUploader = /** @class */function () {
|
|
1995
|
+
function AsyncUploader(url) {
|
|
1996
|
+
this.url = url;
|
|
1997
|
+
}
|
|
1998
|
+
return AsyncUploader;
|
|
1999
|
+
}();
|
|
2000
|
+
var FetchUploader = /** @class */function (_super) {
|
|
2001
|
+
__extends(FetchUploader, _super);
|
|
2002
|
+
function FetchUploader() {
|
|
2003
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2004
|
+
}
|
|
2005
|
+
FetchUploader.prototype.upload = function (fetchPayload, _url) {
|
|
2006
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2007
|
+
var url;
|
|
2008
|
+
return __generator(this, function (_a) {
|
|
2009
|
+
switch (_a.label) {
|
|
2010
|
+
case 0:
|
|
2011
|
+
url = _url || this.url;
|
|
2012
|
+
return [4 /*yield*/, fetch(url, fetchPayload)];
|
|
2013
|
+
case 1:
|
|
2014
|
+
return [2 /*return*/, _a.sent()];
|
|
2015
|
+
}
|
|
2016
|
+
});
|
|
2017
|
+
});
|
|
2018
|
+
};
|
|
2019
|
+
return FetchUploader;
|
|
2020
|
+
}(AsyncUploader);
|
|
2021
|
+
var XHRUploader = /** @class */function (_super) {
|
|
2022
|
+
__extends(XHRUploader, _super);
|
|
2023
|
+
function XHRUploader() {
|
|
2024
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2025
|
+
}
|
|
2026
|
+
XHRUploader.prototype.upload = function (fetchPayload) {
|
|
2027
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2028
|
+
var response;
|
|
2029
|
+
return __generator(this, function (_a) {
|
|
2030
|
+
switch (_a.label) {
|
|
2031
|
+
case 0:
|
|
2032
|
+
return [4 /*yield*/, this.makeRequest(this.url, fetchPayload.body)];
|
|
2033
|
+
case 1:
|
|
2034
|
+
response = _a.sent();
|
|
2035
|
+
return [2 /*return*/, response];
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
});
|
|
2039
|
+
};
|
|
2040
|
+
XHRUploader.prototype.makeRequest = function (url, data) {
|
|
2041
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2042
|
+
var xhr;
|
|
2043
|
+
return __generator(this, function (_a) {
|
|
2044
|
+
xhr = new XMLHttpRequest();
|
|
2045
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
2046
|
+
xhr.onreadystatechange = function () {
|
|
2047
|
+
if (xhr.readyState !== 4) return;
|
|
2048
|
+
// Process the response
|
|
2049
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
2050
|
+
resolve(xhr);
|
|
2051
|
+
} else {
|
|
2052
|
+
reject(xhr);
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
xhr.open('post', url);
|
|
2056
|
+
xhr.send(data);
|
|
2057
|
+
})];
|
|
2058
|
+
});
|
|
2059
|
+
});
|
|
2060
|
+
};
|
|
2061
|
+
return XHRUploader;
|
|
2062
|
+
}(AsyncUploader);
|
|
2063
|
+
|
|
1991
2064
|
/**
|
|
1992
2065
|
* BatchUploader contains all the logic to store/retrieve events and batches
|
|
1993
2066
|
* to/from persistence, and upload batches to mParticle.
|
|
@@ -2050,6 +2123,7 @@ var mParticle = (function () {
|
|
|
2050
2123
|
var _a = this.mpInstance,
|
|
2051
2124
|
getFeatureFlag = _a._Helpers.getFeatureFlag,
|
|
2052
2125
|
deviceId = _a._Store.deviceId;
|
|
2126
|
+
// https://go.mparticle.com/work/SQDSDKS-6317
|
|
2053
2127
|
var offlineStorageFeatureFlagValue = getFeatureFlag(Constants.FeatureFlags.OfflineStorage);
|
|
2054
2128
|
var offlineStoragePercentage = parseInt(offlineStorageFeatureFlagValue, 10);
|
|
2055
2129
|
var rampNumber = getRampNumber(deviceId);
|
|
@@ -2313,81 +2387,13 @@ var mParticle = (function () {
|
|
|
2313
2387
|
BatchUploader.MINIMUM_INTERVAL_MILLIS = 500;
|
|
2314
2388
|
return BatchUploader;
|
|
2315
2389
|
}();
|
|
2316
|
-
var AsyncUploader = /** @class */function () {
|
|
2317
|
-
function AsyncUploader(url) {
|
|
2318
|
-
this.url = url;
|
|
2319
|
-
}
|
|
2320
|
-
return AsyncUploader;
|
|
2321
|
-
}();
|
|
2322
|
-
var FetchUploader = /** @class */function (_super) {
|
|
2323
|
-
__extends(FetchUploader, _super);
|
|
2324
|
-
function FetchUploader() {
|
|
2325
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2326
|
-
}
|
|
2327
|
-
FetchUploader.prototype.upload = function (fetchPayload) {
|
|
2328
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2329
|
-
var response;
|
|
2330
|
-
return __generator(this, function (_a) {
|
|
2331
|
-
switch (_a.label) {
|
|
2332
|
-
case 0:
|
|
2333
|
-
return [4 /*yield*/, fetch(this.url, fetchPayload)];
|
|
2334
|
-
case 1:
|
|
2335
|
-
response = _a.sent();
|
|
2336
|
-
return [2 /*return*/, response];
|
|
2337
|
-
}
|
|
2338
|
-
});
|
|
2339
|
-
});
|
|
2340
|
-
};
|
|
2341
|
-
return FetchUploader;
|
|
2342
|
-
}(AsyncUploader);
|
|
2343
|
-
var XHRUploader = /** @class */function (_super) {
|
|
2344
|
-
__extends(XHRUploader, _super);
|
|
2345
|
-
function XHRUploader() {
|
|
2346
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2347
|
-
}
|
|
2348
|
-
XHRUploader.prototype.upload = function (fetchPayload) {
|
|
2349
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2350
|
-
var response;
|
|
2351
|
-
return __generator(this, function (_a) {
|
|
2352
|
-
switch (_a.label) {
|
|
2353
|
-
case 0:
|
|
2354
|
-
return [4 /*yield*/, this.makeRequest(this.url, fetchPayload.body)];
|
|
2355
|
-
case 1:
|
|
2356
|
-
response = _a.sent();
|
|
2357
|
-
return [2 /*return*/, response];
|
|
2358
|
-
}
|
|
2359
|
-
});
|
|
2360
|
-
});
|
|
2361
|
-
};
|
|
2362
|
-
XHRUploader.prototype.makeRequest = function (url, data) {
|
|
2363
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2364
|
-
var xhr;
|
|
2365
|
-
return __generator(this, function (_a) {
|
|
2366
|
-
xhr = new XMLHttpRequest();
|
|
2367
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
2368
|
-
xhr.onreadystatechange = function () {
|
|
2369
|
-
if (xhr.readyState !== 4) return;
|
|
2370
|
-
// Process the response
|
|
2371
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
2372
|
-
resolve(xhr);
|
|
2373
|
-
} else {
|
|
2374
|
-
reject(xhr);
|
|
2375
|
-
}
|
|
2376
|
-
};
|
|
2377
|
-
xhr.open('post', url);
|
|
2378
|
-
xhr.send(data);
|
|
2379
|
-
})];
|
|
2380
|
-
});
|
|
2381
|
-
});
|
|
2382
|
-
};
|
|
2383
|
-
return XHRUploader;
|
|
2384
|
-
}(AsyncUploader);
|
|
2385
2390
|
|
|
2386
2391
|
function APIClient(mpInstance, kitBlocker) {
|
|
2387
2392
|
this.uploader = null;
|
|
2388
2393
|
var self = this;
|
|
2389
2394
|
this.queueEventForBatchUpload = function (event) {
|
|
2390
2395
|
if (!this.uploader) {
|
|
2396
|
+
// https://go.mparticle.com/work/SQDSDKS-6317
|
|
2391
2397
|
var millis = parseNumber(mpInstance._Helpers.getFeatureFlag(Constants.FeatureFlags.EventBatchingIntervalMillis));
|
|
2392
2398
|
this.uploader = new BatchUploader(mpInstance, millis);
|
|
2393
2399
|
}
|
|
@@ -2971,7 +2977,6 @@ var mParticle = (function () {
|
|
|
2971
2977
|
this.inArray = inArray;
|
|
2972
2978
|
this.isObject = isObject;
|
|
2973
2979
|
this.decoded = decoded;
|
|
2974
|
-
this.returnConvertedBoolean = returnConvertedBoolean;
|
|
2975
2980
|
this.parseStringOrNumber = parseStringOrNumber;
|
|
2976
2981
|
this.generateHash = generateHash;
|
|
2977
2982
|
this.generateUniqueId = generateUniqueId;
|
|
@@ -2985,6 +2990,21 @@ var mParticle = (function () {
|
|
|
2985
2990
|
var iosBridgeNameBase = 'mParticle';
|
|
2986
2991
|
function NativeSdkHelpers(mpInstance) {
|
|
2987
2992
|
var self = this;
|
|
2993
|
+
this.initializeSessionAttributes = function (apiKey) {
|
|
2994
|
+
var SetSessionAttribute = Constants.NativeSdkPaths.SetSessionAttribute;
|
|
2995
|
+
var env = JSON.stringify({
|
|
2996
|
+
key: '$src_env',
|
|
2997
|
+
value: 'webview'
|
|
2998
|
+
});
|
|
2999
|
+
var key = JSON.stringify({
|
|
3000
|
+
key: '$src_key',
|
|
3001
|
+
value: apiKey
|
|
3002
|
+
});
|
|
3003
|
+
self.sendToNative(SetSessionAttribute, env);
|
|
3004
|
+
if (apiKey) {
|
|
3005
|
+
self.sendToNative(SetSessionAttribute, key);
|
|
3006
|
+
}
|
|
3007
|
+
};
|
|
2988
3008
|
this.isBridgeV2Available = function (bridgeName) {
|
|
2989
3009
|
if (!bridgeName) {
|
|
2990
3010
|
return false;
|
|
@@ -3226,6 +3246,7 @@ var mParticle = (function () {
|
|
|
3226
3246
|
// https://go.mparticle.com/work/SQDSDKS-6045
|
|
3227
3247
|
var persistence = mpInstance._Persistence.getPersistence();
|
|
3228
3248
|
if (persistence && !persistence.cu) {
|
|
3249
|
+
// https://go.mparticle.com/work/SQDSDKS-6323
|
|
3229
3250
|
mpInstance.Identity.identify(mpInstance._Store.SDKConfig.identifyRequest, mpInstance._Store.SDKConfig.identityCallback);
|
|
3230
3251
|
mpInstance._Store.identifyCalled = true;
|
|
3231
3252
|
mpInstance._Store.SDKConfig.identityCallback = null;
|
|
@@ -3770,6 +3791,10 @@ var mParticle = (function () {
|
|
|
3770
3791
|
// TODO: Merge this with SDKStoreApi in sdkRuntimeModels
|
|
3771
3792
|
function Store(config, mpInstance, apiKey) {
|
|
3772
3793
|
var _this = this;
|
|
3794
|
+
var _a = mpInstance._Helpers,
|
|
3795
|
+
createMainStorageName = _a.createMainStorageName,
|
|
3796
|
+
createProductStorageName = _a.createProductStorageName;
|
|
3797
|
+
var isWebviewEnabled = mpInstance._NativeSdkHelpers.isWebviewEnabled;
|
|
3773
3798
|
var defaultStore = {
|
|
3774
3799
|
isEnabled: true,
|
|
3775
3800
|
sessionAttributes: {},
|
|
@@ -3845,12 +3870,16 @@ var mParticle = (function () {
|
|
|
3845
3870
|
if (!config.hasOwnProperty('flags')) {
|
|
3846
3871
|
this.SDKConfig.flags = {};
|
|
3847
3872
|
}
|
|
3848
|
-
|
|
3873
|
+
// We process the initial config that is passed via the SDK init
|
|
3874
|
+
// and then we will reprocess the config within the processConfig
|
|
3875
|
+
// function when the config is updated from the server
|
|
3876
|
+
// https://go.mparticle.com/work/SQDSDKS-6317
|
|
3877
|
+
this.SDKConfig.flags = processFlags(config);
|
|
3849
3878
|
if (config.deviceId) {
|
|
3850
3879
|
this.deviceId = config.deviceId;
|
|
3851
3880
|
}
|
|
3852
3881
|
if (config.hasOwnProperty('isDevelopmentMode')) {
|
|
3853
|
-
this.SDKConfig.isDevelopmentMode =
|
|
3882
|
+
this.SDKConfig.isDevelopmentMode = returnConvertedBoolean(config.isDevelopmentMode);
|
|
3854
3883
|
} else {
|
|
3855
3884
|
this.SDKConfig.isDevelopmentMode = false;
|
|
3856
3885
|
}
|
|
@@ -3971,6 +4000,10 @@ var mParticle = (function () {
|
|
|
3971
4000
|
}
|
|
3972
4001
|
}
|
|
3973
4002
|
}
|
|
4003
|
+
this.hasInvalidIdentifyRequest = function () {
|
|
4004
|
+
var identifyRequest = _this.SDKConfig.identifyRequest;
|
|
4005
|
+
return isObject(identifyRequest) && isObject(identifyRequest.userIdentities) && isEmpty(identifyRequest.userIdentities) || !identifyRequest;
|
|
4006
|
+
};
|
|
3974
4007
|
this.getDeviceId = function () {
|
|
3975
4008
|
return _this.deviceId;
|
|
3976
4009
|
};
|
|
@@ -3979,24 +4012,101 @@ var mParticle = (function () {
|
|
|
3979
4012
|
_this.persistenceData.gs.das = deviceId;
|
|
3980
4013
|
mpInstance._Persistence.update();
|
|
3981
4014
|
};
|
|
4015
|
+
this.getFirstSeenTime = function (mpid) {
|
|
4016
|
+
if (!mpid) {
|
|
4017
|
+
return null;
|
|
4018
|
+
}
|
|
4019
|
+
if (_this.persistenceData && _this.persistenceData[mpid] && _this.persistenceData[mpid].fst) {
|
|
4020
|
+
return _this.persistenceData[mpid].fst;
|
|
4021
|
+
} else {
|
|
4022
|
+
return null;
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
this.setFirstSeenTime = function (mpid, _time) {
|
|
4026
|
+
if (!mpid) {
|
|
4027
|
+
return;
|
|
4028
|
+
}
|
|
4029
|
+
var time = _time || new Date().getTime();
|
|
4030
|
+
if (_this.persistenceData) {
|
|
4031
|
+
if (!_this.persistenceData[mpid]) {
|
|
4032
|
+
_this.persistenceData[mpid] = {};
|
|
4033
|
+
}
|
|
4034
|
+
if (!_this.persistenceData[mpid].fst) {
|
|
4035
|
+
_this.persistenceData[mpid].fst = time;
|
|
4036
|
+
mpInstance._Persistence.savePersistence(_this.persistenceData);
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4039
|
+
};
|
|
4040
|
+
this.getLastSeenTime = function (mpid) {
|
|
4041
|
+
if (!mpid) {
|
|
4042
|
+
return null;
|
|
4043
|
+
}
|
|
4044
|
+
// // https://go.mparticle.com/work/SQDSDKS-6315
|
|
4045
|
+
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
4046
|
+
if (mpid === (currentUser === null || currentUser === void 0 ? void 0 : currentUser.getMPID())) {
|
|
4047
|
+
// if the mpid is the current user, its last seen time is the current time
|
|
4048
|
+
return new Date().getTime();
|
|
4049
|
+
} else if (_this.persistenceData && _this.persistenceData[mpid] && _this.persistenceData[mpid].lst) {
|
|
4050
|
+
return _this.persistenceData[mpid].lst;
|
|
4051
|
+
} else {
|
|
4052
|
+
return null;
|
|
4053
|
+
}
|
|
4054
|
+
};
|
|
4055
|
+
this.setLastSeenTime = function (mpid, _time) {
|
|
4056
|
+
if (!mpid) {
|
|
4057
|
+
return;
|
|
4058
|
+
}
|
|
4059
|
+
var time = _time || new Date().getTime();
|
|
4060
|
+
if (_this.persistenceData) {
|
|
4061
|
+
if (!_this.persistenceData[mpid]) {
|
|
4062
|
+
_this.persistenceData[mpid] = {};
|
|
4063
|
+
}
|
|
4064
|
+
if (!_this.persistenceData[mpid].lst) {
|
|
4065
|
+
_this.persistenceData[mpid].lst = time;
|
|
4066
|
+
mpInstance._Persistence.savePersistence(_this.persistenceData);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
};
|
|
3982
4070
|
this.nullifySession = function () {
|
|
3983
4071
|
_this.sessionId = null;
|
|
3984
4072
|
_this.dateLastEventSent = null;
|
|
3985
4073
|
_this.sessionAttributes = {};
|
|
3986
4074
|
mpInstance._Persistence.update();
|
|
3987
4075
|
};
|
|
4076
|
+
this.processConfig = function (config) {
|
|
4077
|
+
var workspaceToken = config.workspaceToken,
|
|
4078
|
+
requiredWebviewBridgeName = config.requiredWebviewBridgeName;
|
|
4079
|
+
// We should reprocess the flags in case they have changed when we request an updated config
|
|
4080
|
+
// such as if the SDK is being self-hosted and the flags are different on the server config
|
|
4081
|
+
// https://go.mparticle.com/work/SQDSDKS-6317
|
|
4082
|
+
_this.SDKConfig.flags = processFlags(config);
|
|
4083
|
+
if (workspaceToken) {
|
|
4084
|
+
_this.SDKConfig.workspaceToken = workspaceToken;
|
|
4085
|
+
} else {
|
|
4086
|
+
mpInstance.Logger.warning('You should have a workspaceToken on your config object for security purposes.');
|
|
4087
|
+
}
|
|
4088
|
+
// add a new function to apply items to the store that require config to be returned
|
|
4089
|
+
_this.storageName = createMainStorageName(workspaceToken);
|
|
4090
|
+
_this.prodStorageName = createProductStorageName(workspaceToken);
|
|
4091
|
+
_this.SDKConfig.requiredWebviewBridgeName = requiredWebviewBridgeName || workspaceToken;
|
|
4092
|
+
_this.webviewBridgeEnabled = isWebviewEnabled(_this.SDKConfig.requiredWebviewBridgeName, _this.SDKConfig.minWebviewBridgeVersion);
|
|
4093
|
+
_this.configurationLoaded = true;
|
|
4094
|
+
};
|
|
3988
4095
|
}
|
|
3989
|
-
|
|
4096
|
+
// https://go.mparticle.com/work/SQDSDKS-6317
|
|
4097
|
+
function processFlags(config) {
|
|
3990
4098
|
var flags = {};
|
|
3991
4099
|
var _a = Constants.FeatureFlags,
|
|
3992
4100
|
ReportBatching = _a.ReportBatching,
|
|
3993
4101
|
EventBatchingIntervalMillis = _a.EventBatchingIntervalMillis,
|
|
3994
4102
|
OfflineStorage = _a.OfflineStorage,
|
|
3995
4103
|
DirectUrlRouting = _a.DirectUrlRouting,
|
|
3996
|
-
CacheIdentity = _a.CacheIdentity
|
|
4104
|
+
CacheIdentity = _a.CacheIdentity,
|
|
4105
|
+
AudienceAPI = _a.AudienceAPI;
|
|
3997
4106
|
if (!config.flags) {
|
|
3998
4107
|
return {};
|
|
3999
4108
|
}
|
|
4109
|
+
// https://go.mparticle.com/work/SQDSDKS-6317
|
|
4000
4110
|
// Passed in config flags take priority over defaults
|
|
4001
4111
|
flags[ReportBatching] = config.flags[ReportBatching] || false;
|
|
4002
4112
|
// The server returns stringified numbers, sowe need to parse
|
|
@@ -4004,6 +4114,7 @@ var mParticle = (function () {
|
|
|
4004
4114
|
flags[OfflineStorage] = config.flags[OfflineStorage] || '0';
|
|
4005
4115
|
flags[DirectUrlRouting] = config.flags[DirectUrlRouting] === 'True';
|
|
4006
4116
|
flags[CacheIdentity] = config.flags[CacheIdentity] === 'True';
|
|
4117
|
+
flags[AudienceAPI] = config.flags[AudienceAPI] === 'True';
|
|
4007
4118
|
return flags;
|
|
4008
4119
|
}
|
|
4009
4120
|
function processBaseUrls(config, flags, apiKey) {
|
|
@@ -6272,8 +6383,76 @@ var mParticle = (function () {
|
|
|
6272
6383
|
return false;
|
|
6273
6384
|
};
|
|
6274
6385
|
|
|
6386
|
+
var AudienceManager = /** @class */function () {
|
|
6387
|
+
function AudienceManager(userAudienceUrl, apiKey, logger) {
|
|
6388
|
+
this.url = '';
|
|
6389
|
+
this.logger = logger;
|
|
6390
|
+
this.url = "https://".concat(userAudienceUrl).concat(apiKey, "/audience");
|
|
6391
|
+
this.userAudienceAPI = window.fetch ? new FetchUploader(this.url) : new XHRUploader(this.url);
|
|
6392
|
+
}
|
|
6393
|
+
AudienceManager.prototype.sendGetUserAudienceRequest = function (mpid, callback) {
|
|
6394
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6395
|
+
var fetchPayload, audienceURLWithMPID, userAudiencePromise, userAudienceMembershipsServerResponse, parsedUserAudienceMemberships, e_1;
|
|
6396
|
+
return __generator(this, function (_a) {
|
|
6397
|
+
switch (_a.label) {
|
|
6398
|
+
case 0:
|
|
6399
|
+
this.logger.verbose('Fetching user audiences from server');
|
|
6400
|
+
fetchPayload = {
|
|
6401
|
+
method: 'GET',
|
|
6402
|
+
headers: {
|
|
6403
|
+
Accept: '*/*'
|
|
6404
|
+
}
|
|
6405
|
+
};
|
|
6406
|
+
audienceURLWithMPID = "".concat(this.url, "?mpid=").concat(mpid);
|
|
6407
|
+
_a.label = 1;
|
|
6408
|
+
case 1:
|
|
6409
|
+
_a.trys.push([1, 6,, 7]);
|
|
6410
|
+
return [4 /*yield*/, this.userAudienceAPI.upload(fetchPayload, audienceURLWithMPID)];
|
|
6411
|
+
case 2:
|
|
6412
|
+
userAudiencePromise = _a.sent();
|
|
6413
|
+
if (!(userAudiencePromise.status >= 200 && userAudiencePromise.status < 300)) return [3 /*break*/, 4];
|
|
6414
|
+
this.logger.verbose("User Audiences successfully received");
|
|
6415
|
+
return [4 /*yield*/, userAudiencePromise.json()];
|
|
6416
|
+
case 3:
|
|
6417
|
+
userAudienceMembershipsServerResponse = _a.sent();
|
|
6418
|
+
parsedUserAudienceMemberships = {
|
|
6419
|
+
currentAudienceMemberships: userAudienceMembershipsServerResponse === null || userAudienceMembershipsServerResponse === void 0 ? void 0 : userAudienceMembershipsServerResponse.audience_memberships
|
|
6420
|
+
};
|
|
6421
|
+
try {
|
|
6422
|
+
callback(parsedUserAudienceMemberships);
|
|
6423
|
+
} catch (e) {
|
|
6424
|
+
throw new Error('Error invoking callback on user audience response.');
|
|
6425
|
+
}
|
|
6426
|
+
return [3 /*break*/, 5];
|
|
6427
|
+
case 4:
|
|
6428
|
+
if (userAudiencePromise.status === 401) {
|
|
6429
|
+
throw new Error('`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`');
|
|
6430
|
+
} else if (userAudiencePromise.status === 403) {
|
|
6431
|
+
throw new Error('`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`');
|
|
6432
|
+
} else {
|
|
6433
|
+
// In case there is an HTTP error we did not anticipate.
|
|
6434
|
+
throw new Error("Uncaught HTTP Error ".concat(userAudiencePromise.status, "."));
|
|
6435
|
+
}
|
|
6436
|
+
case 5:
|
|
6437
|
+
return [3 /*break*/, 7];
|
|
6438
|
+
case 6:
|
|
6439
|
+
e_1 = _a.sent();
|
|
6440
|
+
this.logger.error("Error retrieving audiences. ".concat(e_1));
|
|
6441
|
+
return [3 /*break*/, 7];
|
|
6442
|
+
case 7:
|
|
6443
|
+
return [2 /*return*/];
|
|
6444
|
+
}
|
|
6445
|
+
});
|
|
6446
|
+
});
|
|
6447
|
+
};
|
|
6448
|
+
|
|
6449
|
+
return AudienceManager;
|
|
6450
|
+
}();
|
|
6451
|
+
|
|
6275
6452
|
var Messages$2 = Constants.Messages,
|
|
6276
|
-
HTTPCodes$2 = Constants.HTTPCodes
|
|
6453
|
+
HTTPCodes$2 = Constants.HTTPCodes,
|
|
6454
|
+
FeatureFlags$1 = Constants.FeatureFlags;
|
|
6455
|
+
var ErrorMessages = Messages$2.ErrorMessages;
|
|
6277
6456
|
var _Constants$IdentityMe = Constants.IdentityMethods,
|
|
6278
6457
|
Identify = _Constants$IdentityMe.Identify,
|
|
6279
6458
|
Modify$1 = _Constants$IdentityMe.Modify,
|
|
@@ -6282,6 +6461,7 @@ var mParticle = (function () {
|
|
|
6282
6461
|
function Identity(mpInstance) {
|
|
6283
6462
|
var self = this;
|
|
6284
6463
|
this.idCache = null;
|
|
6464
|
+
this.audienceManager = null;
|
|
6285
6465
|
this.checkIdentitySwap = function (previousMPID, currentMPID, currentSessionMPIDs) {
|
|
6286
6466
|
if (previousMPID && currentMPID && previousMPID !== currentMPID) {
|
|
6287
6467
|
var persistence = mpInstance._Persistence.getPersistence();
|
|
@@ -7037,6 +7217,22 @@ var mParticle = (function () {
|
|
|
7037
7217
|
},
|
|
7038
7218
|
getFirstSeenTime: function getFirstSeenTime() {
|
|
7039
7219
|
return mpInstance._Persistence.getFirstSeenTime(mpid);
|
|
7220
|
+
},
|
|
7221
|
+
/**
|
|
7222
|
+
* Get user audiences
|
|
7223
|
+
* @method getuserAudiences
|
|
7224
|
+
* @param {Function} [callback] A callback function that is invoked when the user audience request completes
|
|
7225
|
+
*/
|
|
7226
|
+
getUserAudiences: function getUserAudiences(callback) {
|
|
7227
|
+
// user audience API is feature flagged
|
|
7228
|
+
if (!mpInstance._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)) {
|
|
7229
|
+
mpInstance.Logger.error(ErrorMessages.AudienceAPINotEnabled);
|
|
7230
|
+
return;
|
|
7231
|
+
}
|
|
7232
|
+
if (self.audienceManager === null) {
|
|
7233
|
+
self.audienceManager = new AudienceManager(mpInstance._Store.SDKConfig.userAudienceUrl, mpInstance._Store.devToken, mpInstance.Logger, mpid);
|
|
7234
|
+
}
|
|
7235
|
+
self.audienceManager.sendGetUserAudienceRequest(mpid, callback);
|
|
7040
7236
|
}
|
|
7041
7237
|
};
|
|
7042
7238
|
};
|
|
@@ -8212,7 +8408,10 @@ var mParticle = (function () {
|
|
|
8212
8408
|
}
|
|
8213
8409
|
|
|
8214
8410
|
var Messages = Constants.Messages,
|
|
8215
|
-
HTTPCodes = Constants.HTTPCodes
|
|
8411
|
+
HTTPCodes = Constants.HTTPCodes,
|
|
8412
|
+
FeatureFlags = Constants.FeatureFlags;
|
|
8413
|
+
var ReportBatching = FeatureFlags.ReportBatching;
|
|
8414
|
+
var StartingInitialization = Messages.InformationMessages.StartingInitialization;
|
|
8216
8415
|
|
|
8217
8416
|
/**
|
|
8218
8417
|
* <p>All of the following methods can be called on the primary mParticle class. In version 2.10.0, we introduced <a href="https://docs.mparticle.com/developers/sdk/web/multiple-instances/">multiple instances</a>. If you are using multiple instances (self hosted environments only), you should call these methods on each instance.</p>
|
|
@@ -8437,7 +8636,7 @@ var mParticle = (function () {
|
|
|
8437
8636
|
* @param {Function} [callback] A callback function that is called when the location is either allowed or rejected by the user. A position object of schema {coords: {latitude: number, longitude: number}} is passed to the callback
|
|
8438
8637
|
*/
|
|
8439
8638
|
this.startTrackingLocation = function (callback) {
|
|
8440
|
-
if (!
|
|
8639
|
+
if (!isFunction(callback)) {
|
|
8441
8640
|
self.Logger.warning('Warning: Location tracking is triggered, but not including a callback into the `startTrackingLocation` may result in events logged too quickly and not being associated with a location.');
|
|
8442
8641
|
}
|
|
8443
8642
|
self._SessionManager.resetSessionTimer();
|
|
@@ -9155,118 +9354,48 @@ var mParticle = (function () {
|
|
|
9155
9354
|
var kitBlocker = createKitBlocker(config, mpInstance);
|
|
9156
9355
|
mpInstance._APIClient = new APIClient(mpInstance, kitBlocker);
|
|
9157
9356
|
mpInstance._Forwarders = new Forwarders(mpInstance, kitBlocker);
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
mpInstance._Store.SDKConfig.flags[Constants.FeatureFlags.EventBatchingIntervalMillis] = config.flags[Constants.FeatureFlags.EventBatchingIntervalMillis];
|
|
9161
|
-
}
|
|
9162
|
-
}
|
|
9163
|
-
|
|
9164
|
-
// add a new function to apply items to the store that require config to be returned
|
|
9165
|
-
mpInstance._Store.storageName = mpInstance._Helpers.createMainStorageName(config.workspaceToken);
|
|
9166
|
-
mpInstance._Store.prodStorageName = mpInstance._Helpers.createProductStorageName(config.workspaceToken);
|
|
9167
|
-
|
|
9168
|
-
// idCache is instantiated here as opposed to when _Identity is instantiated
|
|
9169
|
-
// because it depends on _Store.storageName, which is not sent until above
|
|
9170
|
-
// because it is a setting on config which returns asyncronously
|
|
9171
|
-
// in self hosted mode
|
|
9172
|
-
mpInstance._Identity.idCache = new LocalStorageVault("".concat(mpInstance._Store.storageName, "-id-cache"), {
|
|
9173
|
-
logger: mpInstance.Logger
|
|
9174
|
-
});
|
|
9357
|
+
mpInstance._Store.processConfig(config);
|
|
9358
|
+
mpInstance._Identity.idCache = createIdentityCache(mpInstance);
|
|
9175
9359
|
removeExpiredIdentityCacheDates(mpInstance._Identity.idCache);
|
|
9176
|
-
|
|
9177
|
-
|
|
9360
|
+
|
|
9361
|
+
// Web View Bridge is used for cases where the Web SDK is loaded within an iOS or Android device's
|
|
9362
|
+
// Web View. The Web SDK simply acts as a passthrough to the mParticle Native SDK. It is not
|
|
9363
|
+
// responsible for sending events directly to mParticle's servers. The Web SDK will not initialize
|
|
9364
|
+
// persistence or Identity directly.
|
|
9365
|
+
if (mpInstance._Store.webviewBridgeEnabled) {
|
|
9366
|
+
mpInstance._NativeSdkHelpers.initializeSessionAttributes(apiKey);
|
|
9178
9367
|
} else {
|
|
9179
|
-
|
|
9180
|
-
}
|
|
9181
|
-
if (config.hasOwnProperty('requiredWebviewBridgeName')) {
|
|
9182
|
-
mpInstance._Store.SDKConfig.requiredWebviewBridgeName = config.requiredWebviewBridgeName;
|
|
9183
|
-
} else if (config.hasOwnProperty('workspaceToken')) {
|
|
9184
|
-
mpInstance._Store.SDKConfig.requiredWebviewBridgeName = config.workspaceToken;
|
|
9185
|
-
}
|
|
9186
|
-
mpInstance._Store.webviewBridgeEnabled = mpInstance._NativeSdkHelpers.isWebviewEnabled(mpInstance._Store.SDKConfig.requiredWebviewBridgeName, mpInstance._Store.SDKConfig.minWebviewBridgeVersion);
|
|
9187
|
-
mpInstance._Store.configurationLoaded = true;
|
|
9368
|
+
// Main SDK initialization flow
|
|
9188
9369
|
|
|
9189
|
-
// https://go.mparticle.com/work/SQDSDKS-6044
|
|
9190
|
-
if (!mpInstance._Store.webviewBridgeEnabled) {
|
|
9191
9370
|
// Load any settings/identities/attributes from cookie or localStorage
|
|
9192
9371
|
mpInstance._Persistence.initializeStorage();
|
|
9193
|
-
}
|
|
9194
|
-
if (mpInstance._Store.webviewBridgeEnabled) {
|
|
9195
|
-
mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute, JSON.stringify({
|
|
9196
|
-
key: '$src_env',
|
|
9197
|
-
value: 'webview'
|
|
9198
|
-
}));
|
|
9199
|
-
if (apiKey) {
|
|
9200
|
-
mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute, JSON.stringify({
|
|
9201
|
-
key: '$src_key',
|
|
9202
|
-
value: apiKey
|
|
9203
|
-
}));
|
|
9204
|
-
}
|
|
9205
|
-
} else {
|
|
9206
|
-
var currentUser;
|
|
9207
9372
|
|
|
9208
|
-
//
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
modifiedUIforIdentityRequest[identityKey] = identities[identityKey];
|
|
9217
|
-
}
|
|
9218
|
-
}
|
|
9219
|
-
}
|
|
9220
|
-
mpInstance._Store.SDKConfig.identifyRequest = {
|
|
9221
|
-
userIdentities: modifiedUIforIdentityRequest
|
|
9222
|
-
};
|
|
9223
|
-
}
|
|
9224
|
-
currentUser = mpInstance.Identity.getCurrentUser();
|
|
9225
|
-
if (mpInstance._Helpers.getFeatureFlag(Constants.FeatureFlags.ReportBatching)) {
|
|
9373
|
+
// Set up user identitiy variables for later use
|
|
9374
|
+
var currentUser = mpInstance.Identity.getCurrentUser();
|
|
9375
|
+
var currentUserMPID = currentUser ? currentUser.getMPID() : null;
|
|
9376
|
+
var currentUserIdentities = currentUser ? currentUser.getUserIdentities().userIdentities : {};
|
|
9377
|
+
mpInstance._Store.SDKConfig.identifyRequest = mpInstance._Store.hasInvalidIdentifyRequest() ? {
|
|
9378
|
+
userIdentities: currentUserIdentities
|
|
9379
|
+
} : mpInstance._Store.SDKConfig.identifyRequest;
|
|
9380
|
+
if (mpInstance._Helpers.getFeatureFlag(ReportBatching)) {
|
|
9226
9381
|
mpInstance._ForwardingStatsUploader.startForwardingStatsTimer();
|
|
9227
9382
|
}
|
|
9228
9383
|
mpInstance._Forwarders.processForwarders(config, mpInstance._APIClient.prepareForwardingStats);
|
|
9229
9384
|
mpInstance._Forwarders.processPixelConfigs(config);
|
|
9385
|
+
|
|
9386
|
+
// Checks if session is created, resumed, or needs to be ended
|
|
9387
|
+
// Logs a session start or session end event accordingly
|
|
9230
9388
|
mpInstance._SessionManager.initialize();
|
|
9231
9389
|
mpInstance._Events.logAST();
|
|
9232
|
-
|
|
9233
|
-
// Call mParticle._Store.SDKConfig.identityCallback when identify was not called due to a reload or a sessionId already existing
|
|
9234
|
-
// Any identity callback should always be ran regardless if an identity call is made
|
|
9235
|
-
if (!mpInstance._Store.identifyCalled && mpInstance._Store.SDKConfig.identityCallback && currentUser && currentUser.getMPID()) {
|
|
9236
|
-
mpInstance._Store.SDKConfig.identityCallback({
|
|
9237
|
-
httpCode: HTTPCodes.activeSession,
|
|
9238
|
-
getUser: function getUser() {
|
|
9239
|
-
return mpInstance._Identity.mParticleUser(currentUser.getMPID());
|
|
9240
|
-
},
|
|
9241
|
-
getPreviousUser: function getPreviousUser() {
|
|
9242
|
-
var users = mpInstance.Identity.getUsers();
|
|
9243
|
-
var mostRecentUser = users.shift();
|
|
9244
|
-
if (mostRecentUser && currentUser && mostRecentUser.getMPID() === currentUser.getMPID()) {
|
|
9245
|
-
mostRecentUser = users.shift();
|
|
9246
|
-
}
|
|
9247
|
-
return mostRecentUser || null;
|
|
9248
|
-
},
|
|
9249
|
-
body: {
|
|
9250
|
-
mpid: currentUser.getMPID(),
|
|
9251
|
-
is_logged_in: mpInstance._Store.isLoggedIn,
|
|
9252
|
-
matched_identities: currentUser.getUserIdentities().userIdentities,
|
|
9253
|
-
context: null,
|
|
9254
|
-
is_ephemeral: false
|
|
9255
|
-
}
|
|
9256
|
-
});
|
|
9257
|
-
}
|
|
9390
|
+
processIdentityCallback(mpInstance, currentUser, currentUserMPID, currentUserIdentities);
|
|
9258
9391
|
}
|
|
9259
9392
|
mpInstance._Store.isInitialized = true;
|
|
9393
|
+
|
|
9260
9394
|
// Call any functions that are waiting for the library to be initialized
|
|
9261
|
-
|
|
9262
|
-
mpInstance._preInit.readyQueue
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
} else if (Array.isArray(readyQueueItem)) {
|
|
9266
|
-
processPreloadedItem(readyQueueItem, mpInstance);
|
|
9267
|
-
}
|
|
9268
|
-
});
|
|
9269
|
-
mpInstance._preInit.readyQueue = [];
|
|
9395
|
+
try {
|
|
9396
|
+
mpInstance._preInit.readyQueue = processReadyQueue(mpInstance._preInit.readyQueue);
|
|
9397
|
+
} catch (error) {
|
|
9398
|
+
mpInstance.Logger.error(error);
|
|
9270
9399
|
}
|
|
9271
9400
|
|
|
9272
9401
|
// https://go.mparticle.com/work/SQDSDKS-6040
|
|
@@ -9331,11 +9460,16 @@ var mParticle = (function () {
|
|
|
9331
9460
|
}
|
|
9332
9461
|
return kitBlocker;
|
|
9333
9462
|
}
|
|
9463
|
+
function createIdentityCache(mpInstance) {
|
|
9464
|
+
return new LocalStorageVault("".concat(mpInstance._Store.storageName, "-id-cache"), {
|
|
9465
|
+
logger: mpInstance.Logger
|
|
9466
|
+
});
|
|
9467
|
+
}
|
|
9334
9468
|
function runPreConfigFetchInitialization(mpInstance, apiKey, config) {
|
|
9335
9469
|
mpInstance.Logger = new Logger(config);
|
|
9336
9470
|
mpInstance._Store = new Store(config, mpInstance, apiKey);
|
|
9337
9471
|
window.mParticle.Store = mpInstance._Store;
|
|
9338
|
-
mpInstance.Logger.verbose(
|
|
9472
|
+
mpInstance.Logger.verbose(StartingInitialization);
|
|
9339
9473
|
|
|
9340
9474
|
// Check to see if localStorage is available before main configuration runs
|
|
9341
9475
|
// since we will need this for the current implementation of user persistence
|
|
@@ -9347,9 +9481,40 @@ var mParticle = (function () {
|
|
|
9347
9481
|
mpInstance._Store.isLocalStorageAvailable = false;
|
|
9348
9482
|
}
|
|
9349
9483
|
}
|
|
9350
|
-
function
|
|
9351
|
-
|
|
9352
|
-
|
|
9484
|
+
function processIdentityCallback(mpInstance, currentUser, currentUserMPID, currentUserIdentities) {
|
|
9485
|
+
// https://go.mparticle.com/work/SQDSDKS-6323
|
|
9486
|
+
// Call mParticle._Store.SDKConfig.identityCallback when identify was not called
|
|
9487
|
+
// due to a reload or a sessionId already existing
|
|
9488
|
+
// Any identity callback should always be ran regardless if an identity call
|
|
9489
|
+
// is made
|
|
9490
|
+
if (!mpInstance._Store.identifyCalled && mpInstance._Store.SDKConfig.identityCallback && currentUser && currentUserMPID) {
|
|
9491
|
+
mpInstance._Store.SDKConfig.identityCallback({
|
|
9492
|
+
httpCode: HTTPCodes.activeSession,
|
|
9493
|
+
getUser: function getUser() {
|
|
9494
|
+
return mpInstance._Identity.mParticleUser(currentUserMPID);
|
|
9495
|
+
},
|
|
9496
|
+
getPreviousUser: function getPreviousUser() {
|
|
9497
|
+
var users = mpInstance.Identity.getUsers();
|
|
9498
|
+
var mostRecentUser = users.shift();
|
|
9499
|
+
var mostRecentUserMPID = mostRecentUser.getMPID();
|
|
9500
|
+
if (mostRecentUser && mostRecentUserMPID === currentUserMPID) {
|
|
9501
|
+
mostRecentUser = users.shift();
|
|
9502
|
+
}
|
|
9503
|
+
return mostRecentUser || null;
|
|
9504
|
+
},
|
|
9505
|
+
body: {
|
|
9506
|
+
mpid: currentUserMPID,
|
|
9507
|
+
is_logged_in: mpInstance._Store.isLoggedIn,
|
|
9508
|
+
matched_identities: currentUserIdentities,
|
|
9509
|
+
context: null,
|
|
9510
|
+
is_ephemeral: false
|
|
9511
|
+
}
|
|
9512
|
+
});
|
|
9513
|
+
}
|
|
9514
|
+
}
|
|
9515
|
+
function processPreloadedItem(readyQueueItem) {
|
|
9516
|
+
var args = readyQueueItem;
|
|
9517
|
+
var method = args.splice(0, 1)[0];
|
|
9353
9518
|
// if the first argument is a method on the base mParticle object, run it
|
|
9354
9519
|
if (mParticle[args[0]]) {
|
|
9355
9520
|
mParticle[method].apply(this, args);
|
|
@@ -9364,10 +9529,22 @@ var mParticle = (function () {
|
|
|
9364
9529
|
}
|
|
9365
9530
|
computedMPFunction.apply(this, args);
|
|
9366
9531
|
} catch (e) {
|
|
9367
|
-
|
|
9532
|
+
throw new Error('Unable to compute proper mParticle function ' + e);
|
|
9368
9533
|
}
|
|
9369
9534
|
}
|
|
9370
9535
|
}
|
|
9536
|
+
function processReadyQueue(readyQueue) {
|
|
9537
|
+
if (!isEmpty(readyQueue)) {
|
|
9538
|
+
readyQueue.forEach(function (readyQueueItem) {
|
|
9539
|
+
if (isFunction(readyQueueItem)) {
|
|
9540
|
+
readyQueueItem();
|
|
9541
|
+
} else if (Array.isArray(readyQueueItem)) {
|
|
9542
|
+
processPreloadedItem(readyQueueItem);
|
|
9543
|
+
}
|
|
9544
|
+
});
|
|
9545
|
+
return [];
|
|
9546
|
+
}
|
|
9547
|
+
}
|
|
9371
9548
|
function queueIfNotInitialized(func, self) {
|
|
9372
9549
|
if (!self.isInitialized()) {
|
|
9373
9550
|
self.ready(function () {
|
|
@@ -9399,7 +9576,6 @@ var mParticle = (function () {
|
|
|
9399
9576
|
createServiceUrl: mockFunction,
|
|
9400
9577
|
parseNumber: mockFunction,
|
|
9401
9578
|
isObject: mockFunction,
|
|
9402
|
-
returnConvertedBoolean: mockFunction,
|
|
9403
9579
|
Validators: null
|
|
9404
9580
|
},
|
|
9405
9581
|
_resetForTests: mockFunction,
|