@mparticle/web-sdk 2.18.0 → 2.18.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 +34 -22
- package/dist/mparticle.esm.js +34 -22
- package/dist/mparticle.js +377 -245
- package/package.json +2 -2
- package/src/batchUploader.ts +23 -8
- package/src/configAPIClient.ts +141 -0
- package/src/mockBatchCreator.ts +86 -10
- package/src/mp-instance.js +20 -0
- package/src/mparticle-instance-manager.js +3 -0
- package/src/sdkRuntimeModels.ts +42 -12
- package/src/{serverModel.js → serverModel.ts} +260 -75
- package/src/store.ts +19 -4
- package/src/utils.ts +4 -0
- package/src/validators.ts +1 -0
- package/src/configAPIClient.js +0 -67
package/dist/mparticle.js
CHANGED
|
@@ -725,7 +725,7 @@ var mParticle = (function () {
|
|
|
725
725
|
Environment: Environment
|
|
726
726
|
};
|
|
727
727
|
|
|
728
|
-
var version = "2.18.
|
|
728
|
+
var version = "2.18.2";
|
|
729
729
|
|
|
730
730
|
var Constants = {
|
|
731
731
|
sdkVersion: version,
|
|
@@ -1935,6 +1935,173 @@ var mParticle = (function () {
|
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
1937
|
|
|
1938
|
+
var slugify$1 = {exports: {}};
|
|
1939
|
+
|
|
1940
|
+
(function (module, exports) {
|
|
1941
|
+
(function (name, root, factory) {
|
|
1942
|
+
{
|
|
1943
|
+
module.exports = factory();
|
|
1944
|
+
module.exports['default'] = factory();
|
|
1945
|
+
}
|
|
1946
|
+
}('slugify', commonjsGlobal, function () {
|
|
1947
|
+
var charMap = JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E\'","Ը":"Y\'","Թ":"T\'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C\'","Կ":"K","Հ":"H","Ձ":"D\'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R\'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P\'","Ք":"Q\'","Օ":"O\'\'","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"\'","’":"\'","“":"\\\"","”":"\\\"","„":"\\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}');
|
|
1948
|
+
var locales = JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');
|
|
1949
|
+
|
|
1950
|
+
function replace (string, options) {
|
|
1951
|
+
if (typeof string !== 'string') {
|
|
1952
|
+
throw new Error('slugify: string argument expected')
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
options = (typeof options === 'string')
|
|
1956
|
+
? {replacement: options}
|
|
1957
|
+
: options || {};
|
|
1958
|
+
|
|
1959
|
+
var locale = locales[options.locale] || {};
|
|
1960
|
+
|
|
1961
|
+
var replacement = options.replacement === undefined ? '-' : options.replacement;
|
|
1962
|
+
|
|
1963
|
+
var trim = options.trim === undefined ? true : options.trim;
|
|
1964
|
+
|
|
1965
|
+
var slug = string.normalize().split('')
|
|
1966
|
+
// replace characters based on charMap
|
|
1967
|
+
.reduce(function (result, ch) {
|
|
1968
|
+
var appendChar = locale[ch] || charMap[ch] || ch;
|
|
1969
|
+
if (appendChar === replacement) {
|
|
1970
|
+
appendChar = ' ';
|
|
1971
|
+
}
|
|
1972
|
+
return result + appendChar
|
|
1973
|
+
// remove not allowed characters
|
|
1974
|
+
.replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '')
|
|
1975
|
+
}, '');
|
|
1976
|
+
|
|
1977
|
+
if (options.strict) {
|
|
1978
|
+
slug = slug.replace(/[^A-Za-z0-9\s]/g, '');
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
if (trim) {
|
|
1982
|
+
slug = slug.trim();
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
// Replace spaces with replacement character, treating multiple consecutive
|
|
1986
|
+
// spaces as a single space.
|
|
1987
|
+
slug = slug.replace(/\s+/g, replacement);
|
|
1988
|
+
|
|
1989
|
+
if (options.lower) {
|
|
1990
|
+
slug = slug.toLowerCase();
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
return slug
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
replace.extend = function (customMap) {
|
|
1997
|
+
Object.assign(charMap, customMap);
|
|
1998
|
+
};
|
|
1999
|
+
|
|
2000
|
+
return replace
|
|
2001
|
+
}));
|
|
2002
|
+
} (slugify$1));
|
|
2003
|
+
|
|
2004
|
+
var slugify = slugify$1.exports;
|
|
2005
|
+
|
|
2006
|
+
var inArray = function inArray(items, name) {
|
|
2007
|
+
var i = 0;
|
|
2008
|
+
|
|
2009
|
+
if (Array.prototype.indexOf) {
|
|
2010
|
+
return items.indexOf(name, 0) >= 0;
|
|
2011
|
+
} else {
|
|
2012
|
+
for (var n = items.length; i < n; i++) {
|
|
2013
|
+
if (i in items && items[i] === name) {
|
|
2014
|
+
return true;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
return false;
|
|
2020
|
+
};
|
|
2021
|
+
|
|
2022
|
+
var findKeyInObject = function findKeyInObject(obj, key) {
|
|
2023
|
+
if (key && obj) {
|
|
2024
|
+
for (var prop in obj) {
|
|
2025
|
+
if (obj.hasOwnProperty(prop) && prop.toLowerCase() === key.toLowerCase()) {
|
|
2026
|
+
return prop;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
return null;
|
|
2032
|
+
};
|
|
2033
|
+
|
|
2034
|
+
var isObject = function isObject(value) {
|
|
2035
|
+
var objType = Object.prototype.toString.call(value);
|
|
2036
|
+
return objType === '[object Object]' || objType === '[object Error]';
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
var parseNumber = function parseNumber(value) {
|
|
2040
|
+
if (isNaN(value) || !isFinite(value)) {
|
|
2041
|
+
return 0;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
var floatValue = parseFloat(value);
|
|
2045
|
+
return isNaN(floatValue) ? 0 : floatValue;
|
|
2046
|
+
};
|
|
2047
|
+
|
|
2048
|
+
var parseStringOrNumber = function parseStringOrNumber(value) {
|
|
2049
|
+
if (isStringOrNumber(value)) {
|
|
2050
|
+
return value;
|
|
2051
|
+
} else {
|
|
2052
|
+
return null;
|
|
2053
|
+
}
|
|
2054
|
+
}; // FIXME: REFACTOR for V3
|
|
2055
|
+
// only used in store.js to sanitize server-side formatting of
|
|
2056
|
+
// booleans when checking for `isDevelopmentMode`
|
|
2057
|
+
// Should be removed in v3
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
var returnConvertedBoolean = function returnConvertedBoolean(data) {
|
|
2061
|
+
if (data === 'false' || data === '0') {
|
|
2062
|
+
return false;
|
|
2063
|
+
} else {
|
|
2064
|
+
return Boolean(data);
|
|
2065
|
+
}
|
|
2066
|
+
};
|
|
2067
|
+
|
|
2068
|
+
var decoded = function decoded(s) {
|
|
2069
|
+
return decodeURIComponent(s.replace(/\+/g, ' '));
|
|
2070
|
+
};
|
|
2071
|
+
|
|
2072
|
+
var converted = function converted(s) {
|
|
2073
|
+
if (s.indexOf('"') === 0) {
|
|
2074
|
+
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
return s;
|
|
2078
|
+
};
|
|
2079
|
+
|
|
2080
|
+
var isString = function isString(value) {
|
|
2081
|
+
return typeof value === 'string';
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
var isNumber = function isNumber(value) {
|
|
2085
|
+
return typeof value === 'number';
|
|
2086
|
+
};
|
|
2087
|
+
|
|
2088
|
+
var isFunction = function isFunction(fn) {
|
|
2089
|
+
return typeof fn === 'function';
|
|
2090
|
+
}; // TODO: Refactor this to a regex
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
var isDataPlanSlug = function isDataPlanSlug(str) {
|
|
2094
|
+
return isString(str) && str === slugify(str);
|
|
2095
|
+
};
|
|
2096
|
+
|
|
2097
|
+
var isStringOrNumber = function isStringOrNumber(value) {
|
|
2098
|
+
return isString(value) || isNumber(value);
|
|
2099
|
+
};
|
|
2100
|
+
|
|
2101
|
+
var isEmpty = function isEmpty(value) {
|
|
2102
|
+
return value == null || !(Object.keys(value) || value).length;
|
|
2103
|
+
};
|
|
2104
|
+
|
|
1938
2105
|
var BatchUploader =
|
|
1939
2106
|
/** @class */
|
|
1940
2107
|
function () {
|
|
@@ -1987,7 +2154,7 @@ var mParticle = (function () {
|
|
|
1987
2154
|
};
|
|
1988
2155
|
|
|
1989
2156
|
BatchUploader.prototype.queueEvent = function (event) {
|
|
1990
|
-
if (event) {
|
|
2157
|
+
if (!isEmpty(event)) {
|
|
1991
2158
|
this.pendingEvents.push(event);
|
|
1992
2159
|
this.mpInstance.Logger.verbose("Queuing event: ".concat(JSON.stringify(event)));
|
|
1993
2160
|
this.mpInstance.Logger.verbose("Queued event count: ".concat(this.pendingEvents.length));
|
|
@@ -2133,13 +2300,17 @@ var mParticle = (function () {
|
|
|
2133
2300
|
});
|
|
2134
2301
|
};
|
|
2135
2302
|
|
|
2136
|
-
BatchUploader.prototype.upload = function (logger,
|
|
2303
|
+
BatchUploader.prototype.upload = function (logger, _uploads, useBeacon) {
|
|
2137
2304
|
return __awaiter(this, void 0, void 0, function () {
|
|
2138
|
-
var uploader, i, fetchPayload, blob, response, e_1;
|
|
2305
|
+
var uploader, uploads, i, fetchPayload, blob, response, e_1;
|
|
2139
2306
|
return __generator(this, function (_a) {
|
|
2140
2307
|
switch (_a.label) {
|
|
2141
2308
|
case 0:
|
|
2142
|
-
|
|
2309
|
+
uploads = _uploads.filter(function (upload) {
|
|
2310
|
+
return !isEmpty(upload.events);
|
|
2311
|
+
});
|
|
2312
|
+
|
|
2313
|
+
if (isEmpty(uploads)) {
|
|
2143
2314
|
return [2
|
|
2144
2315
|
/*return*/
|
|
2145
2316
|
, null];
|
|
@@ -2560,175 +2731,13 @@ var mParticle = (function () {
|
|
|
2560
2731
|
};
|
|
2561
2732
|
}
|
|
2562
2733
|
|
|
2563
|
-
var slugify$1 = {exports: {}};
|
|
2564
|
-
|
|
2565
|
-
(function (module, exports) {
|
|
2566
|
-
(function (name, root, factory) {
|
|
2567
|
-
{
|
|
2568
|
-
module.exports = factory();
|
|
2569
|
-
module.exports['default'] = factory();
|
|
2570
|
-
}
|
|
2571
|
-
}('slugify', commonjsGlobal, function () {
|
|
2572
|
-
var charMap = JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E\'","Ը":"Y\'","Թ":"T\'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C\'","Կ":"K","Հ":"H","Ձ":"D\'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R\'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P\'","Ք":"Q\'","Օ":"O\'\'","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"\'","’":"\'","“":"\\\"","”":"\\\"","„":"\\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}');
|
|
2573
|
-
var locales = JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');
|
|
2574
|
-
|
|
2575
|
-
function replace (string, options) {
|
|
2576
|
-
if (typeof string !== 'string') {
|
|
2577
|
-
throw new Error('slugify: string argument expected')
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
options = (typeof options === 'string')
|
|
2581
|
-
? {replacement: options}
|
|
2582
|
-
: options || {};
|
|
2583
|
-
|
|
2584
|
-
var locale = locales[options.locale] || {};
|
|
2585
|
-
|
|
2586
|
-
var replacement = options.replacement === undefined ? '-' : options.replacement;
|
|
2587
|
-
|
|
2588
|
-
var trim = options.trim === undefined ? true : options.trim;
|
|
2589
|
-
|
|
2590
|
-
var slug = string.normalize().split('')
|
|
2591
|
-
// replace characters based on charMap
|
|
2592
|
-
.reduce(function (result, ch) {
|
|
2593
|
-
var appendChar = locale[ch] || charMap[ch] || ch;
|
|
2594
|
-
if (appendChar === replacement) {
|
|
2595
|
-
appendChar = ' ';
|
|
2596
|
-
}
|
|
2597
|
-
return result + appendChar
|
|
2598
|
-
// remove not allowed characters
|
|
2599
|
-
.replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, '')
|
|
2600
|
-
}, '');
|
|
2601
|
-
|
|
2602
|
-
if (options.strict) {
|
|
2603
|
-
slug = slug.replace(/[^A-Za-z0-9\s]/g, '');
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
if (trim) {
|
|
2607
|
-
slug = slug.trim();
|
|
2608
|
-
}
|
|
2609
|
-
|
|
2610
|
-
// Replace spaces with replacement character, treating multiple consecutive
|
|
2611
|
-
// spaces as a single space.
|
|
2612
|
-
slug = slug.replace(/\s+/g, replacement);
|
|
2613
|
-
|
|
2614
|
-
if (options.lower) {
|
|
2615
|
-
slug = slug.toLowerCase();
|
|
2616
|
-
}
|
|
2617
|
-
|
|
2618
|
-
return slug
|
|
2619
|
-
}
|
|
2620
|
-
|
|
2621
|
-
replace.extend = function (customMap) {
|
|
2622
|
-
Object.assign(charMap, customMap);
|
|
2623
|
-
};
|
|
2624
|
-
|
|
2625
|
-
return replace
|
|
2626
|
-
}));
|
|
2627
|
-
} (slugify$1));
|
|
2628
|
-
|
|
2629
|
-
var slugify = slugify$1.exports;
|
|
2630
|
-
|
|
2631
|
-
var inArray = function inArray(items, name) {
|
|
2632
|
-
var i = 0;
|
|
2633
|
-
|
|
2634
|
-
if (Array.prototype.indexOf) {
|
|
2635
|
-
return items.indexOf(name, 0) >= 0;
|
|
2636
|
-
} else {
|
|
2637
|
-
for (var n = items.length; i < n; i++) {
|
|
2638
|
-
if (i in items && items[i] === name) {
|
|
2639
|
-
return true;
|
|
2640
|
-
}
|
|
2641
|
-
}
|
|
2642
|
-
}
|
|
2643
|
-
|
|
2644
|
-
return false;
|
|
2645
|
-
};
|
|
2646
|
-
|
|
2647
|
-
var findKeyInObject = function findKeyInObject(obj, key) {
|
|
2648
|
-
if (key && obj) {
|
|
2649
|
-
for (var prop in obj) {
|
|
2650
|
-
if (obj.hasOwnProperty(prop) && prop.toLowerCase() === key.toLowerCase()) {
|
|
2651
|
-
return prop;
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
return null;
|
|
2657
|
-
};
|
|
2658
|
-
|
|
2659
|
-
var isObject = function isObject(value) {
|
|
2660
|
-
var objType = Object.prototype.toString.call(value);
|
|
2661
|
-
return objType === '[object Object]' || objType === '[object Error]';
|
|
2662
|
-
};
|
|
2663
|
-
|
|
2664
|
-
var parseNumber = function parseNumber(value) {
|
|
2665
|
-
if (isNaN(value) || !isFinite(value)) {
|
|
2666
|
-
return 0;
|
|
2667
|
-
}
|
|
2668
|
-
|
|
2669
|
-
var floatValue = parseFloat(value);
|
|
2670
|
-
return isNaN(floatValue) ? 0 : floatValue;
|
|
2671
|
-
};
|
|
2672
|
-
|
|
2673
|
-
var parseStringOrNumber = function parseStringOrNumber(value) {
|
|
2674
|
-
if (isStringOrNumber(value)) {
|
|
2675
|
-
return value;
|
|
2676
|
-
} else {
|
|
2677
|
-
return null;
|
|
2678
|
-
}
|
|
2679
|
-
}; // FIXME: REFACTOR for V3
|
|
2680
|
-
// only used in store.js to sanitize server-side formatting of
|
|
2681
|
-
// booleans when checking for `isDevelopmentMode`
|
|
2682
|
-
// Should be removed in v3
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
var returnConvertedBoolean = function returnConvertedBoolean(data) {
|
|
2686
|
-
if (data === 'false' || data === '0') {
|
|
2687
|
-
return false;
|
|
2688
|
-
} else {
|
|
2689
|
-
return Boolean(data);
|
|
2690
|
-
}
|
|
2691
|
-
};
|
|
2692
|
-
|
|
2693
|
-
var decoded = function decoded(s) {
|
|
2694
|
-
return decodeURIComponent(s.replace(/\+/g, ' '));
|
|
2695
|
-
};
|
|
2696
|
-
|
|
2697
|
-
var converted = function converted(s) {
|
|
2698
|
-
if (s.indexOf('"') === 0) {
|
|
2699
|
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
|
2700
|
-
}
|
|
2701
|
-
|
|
2702
|
-
return s;
|
|
2703
|
-
};
|
|
2704
|
-
|
|
2705
|
-
var isString = function isString(value) {
|
|
2706
|
-
return typeof value === 'string';
|
|
2707
|
-
};
|
|
2708
|
-
|
|
2709
|
-
var isNumber = function isNumber(value) {
|
|
2710
|
-
return typeof value === 'number';
|
|
2711
|
-
};
|
|
2712
|
-
|
|
2713
|
-
var isFunction = function isFunction(fn) {
|
|
2714
|
-
return typeof fn === 'function';
|
|
2715
|
-
}; // TODO: Refactor this to a regex
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
var isDataPlanSlug = function isDataPlanSlug(str) {
|
|
2719
|
-
return isString(str) && str === slugify(str);
|
|
2720
|
-
};
|
|
2721
|
-
|
|
2722
|
-
var isStringOrNumber = function isStringOrNumber(value) {
|
|
2723
|
-
return isString(value) || isNumber(value);
|
|
2724
|
-
};
|
|
2725
|
-
|
|
2726
2734
|
var Validators = {
|
|
2727
2735
|
// From ./utils
|
|
2728
2736
|
// Utility Functions for backwards compatability
|
|
2729
2737
|
isNumber: isNumber,
|
|
2730
2738
|
isFunction: isFunction,
|
|
2731
2739
|
isStringOrNumber: isStringOrNumber,
|
|
2740
|
+
// Validator Functions
|
|
2732
2741
|
isValidAttributeValue: function isValidAttributeValue(value) {
|
|
2733
2742
|
return value !== undefined && !isObject(value) && !Array.isArray(value);
|
|
2734
2743
|
},
|
|
@@ -4179,7 +4188,8 @@ var mParticle = (function () {
|
|
|
4179
4188
|
}
|
|
4180
4189
|
|
|
4181
4190
|
return sdkConfig;
|
|
4182
|
-
}
|
|
4191
|
+
} // TODO: Merge this with SDKStoreApi in sdkRuntimeModels
|
|
4192
|
+
|
|
4183
4193
|
|
|
4184
4194
|
function Store(config, mpInstance) {
|
|
4185
4195
|
var defaultStore = {
|
|
@@ -4220,7 +4230,12 @@ var mParticle = (function () {
|
|
|
4220
4230
|
activeForwarders: [],
|
|
4221
4231
|
kits: {},
|
|
4222
4232
|
configuredForwarders: [],
|
|
4223
|
-
pixelConfigurations: []
|
|
4233
|
+
pixelConfigurations: [],
|
|
4234
|
+
wrapperSDKInfo: {
|
|
4235
|
+
name: 'none',
|
|
4236
|
+
version: null,
|
|
4237
|
+
isInfoSet: false
|
|
4238
|
+
}
|
|
4224
4239
|
};
|
|
4225
4240
|
|
|
4226
4241
|
for (var key in defaultStore) {
|
|
@@ -6506,35 +6521,65 @@ var mParticle = (function () {
|
|
|
6506
6521
|
};
|
|
6507
6522
|
}
|
|
6508
6523
|
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
function
|
|
6512
|
-
var self = this;
|
|
6524
|
+
// TODO: This file is no longer the server model because the web SDK payload
|
|
6525
|
+
var MessageType = Types.MessageType;
|
|
6526
|
+
var ApplicationTransitionType = Types.ApplicationTransitionType; // TODO: Make this a pure function that returns a new object
|
|
6513
6527
|
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6528
|
+
function convertCustomFlags(event, dto) {
|
|
6529
|
+
var valueArray = [];
|
|
6530
|
+
dto.flags = {};
|
|
6517
6531
|
|
|
6518
|
-
|
|
6519
|
-
|
|
6532
|
+
for (var prop in event.CustomFlags) {
|
|
6533
|
+
valueArray = [];
|
|
6520
6534
|
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
}
|
|
6528
|
-
}
|
|
6529
|
-
|
|
6530
|
-
|
|
6535
|
+
if (event.CustomFlags.hasOwnProperty(prop)) {
|
|
6536
|
+
if (Array.isArray(event.CustomFlags[prop])) {
|
|
6537
|
+
event.CustomFlags[prop].forEach(function (customFlagProperty) {
|
|
6538
|
+
// TODO: Can we use our utility functions here?
|
|
6539
|
+
if (typeof customFlagProperty === 'number' || typeof customFlagProperty === 'string' || typeof customFlagProperty === 'boolean') {
|
|
6540
|
+
valueArray.push(customFlagProperty.toString());
|
|
6541
|
+
}
|
|
6542
|
+
});
|
|
6543
|
+
} else if ( // TODO: Can we use our utility functions here?
|
|
6544
|
+
typeof event.CustomFlags[prop] === 'number' || typeof event.CustomFlags[prop] === 'string' || typeof event.CustomFlags[prop] === 'boolean') {
|
|
6545
|
+
valueArray.push(event.CustomFlags[prop].toString());
|
|
6546
|
+
}
|
|
6531
6547
|
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
}
|
|
6548
|
+
if (valueArray.length) {
|
|
6549
|
+
dto.flags[prop] = valueArray;
|
|
6535
6550
|
}
|
|
6536
6551
|
}
|
|
6537
6552
|
}
|
|
6553
|
+
}
|
|
6554
|
+
|
|
6555
|
+
function convertProductToDTO(product) {
|
|
6556
|
+
return {
|
|
6557
|
+
id: parseStringOrNumber(product.Sku),
|
|
6558
|
+
nm: parseStringOrNumber(product.Name),
|
|
6559
|
+
pr: parseNumber(product.Price),
|
|
6560
|
+
qt: parseNumber(product.Quantity),
|
|
6561
|
+
br: parseStringOrNumber(product.Brand),
|
|
6562
|
+
va: parseStringOrNumber(product.Variant),
|
|
6563
|
+
ca: parseStringOrNumber(product.Category),
|
|
6564
|
+
ps: parseNumber(product.Position),
|
|
6565
|
+
cc: parseStringOrNumber(product.CouponCode),
|
|
6566
|
+
tpa: parseNumber(product.TotalAmount),
|
|
6567
|
+
attrs: product.Attributes
|
|
6568
|
+
};
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6571
|
+
function convertProductListToDTO(productList) {
|
|
6572
|
+
if (!productList) {
|
|
6573
|
+
return [];
|
|
6574
|
+
}
|
|
6575
|
+
|
|
6576
|
+
return productList.map(function (product) {
|
|
6577
|
+
return convertProductToDTO(product);
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
|
|
6581
|
+
function ServerModel(mpInstance) {
|
|
6582
|
+
var self = this; // TODO: Can we refactor this to not mutate the event?
|
|
6538
6583
|
|
|
6539
6584
|
this.appendUserInfo = function (user, event) {
|
|
6540
6585
|
if (!event) {
|
|
@@ -6583,32 +6628,6 @@ var mParticle = (function () {
|
|
|
6583
6628
|
event.UserIdentities = validUserIdentities;
|
|
6584
6629
|
};
|
|
6585
6630
|
|
|
6586
|
-
function convertProductListToDTO(productList) {
|
|
6587
|
-
if (!productList) {
|
|
6588
|
-
return [];
|
|
6589
|
-
}
|
|
6590
|
-
|
|
6591
|
-
return productList.map(function (product) {
|
|
6592
|
-
return convertProductToDTO(product);
|
|
6593
|
-
});
|
|
6594
|
-
}
|
|
6595
|
-
|
|
6596
|
-
function convertProductToDTO(product) {
|
|
6597
|
-
return {
|
|
6598
|
-
id: mpInstance._Helpers.parseStringOrNumber(product.Sku),
|
|
6599
|
-
nm: mpInstance._Helpers.parseStringOrNumber(product.Name),
|
|
6600
|
-
pr: mpInstance._Helpers.parseNumber(product.Price),
|
|
6601
|
-
qt: mpInstance._Helpers.parseNumber(product.Quantity),
|
|
6602
|
-
br: mpInstance._Helpers.parseStringOrNumber(product.Brand),
|
|
6603
|
-
va: mpInstance._Helpers.parseStringOrNumber(product.Variant),
|
|
6604
|
-
ca: mpInstance._Helpers.parseStringOrNumber(product.Category),
|
|
6605
|
-
ps: mpInstance._Helpers.parseNumber(product.Position),
|
|
6606
|
-
cc: mpInstance._Helpers.parseStringOrNumber(product.CouponCode),
|
|
6607
|
-
tpa: mpInstance._Helpers.parseNumber(product.TotalAmount),
|
|
6608
|
-
attrs: product.Attributes
|
|
6609
|
-
};
|
|
6610
|
-
}
|
|
6611
|
-
|
|
6612
6631
|
this.convertToConsentStateDTO = function (state) {
|
|
6613
6632
|
if (!state) {
|
|
6614
6633
|
return null;
|
|
@@ -6668,14 +6687,21 @@ var mParticle = (function () {
|
|
|
6668
6687
|
|
|
6669
6688
|
this.createEventObject = function (event, user) {
|
|
6670
6689
|
var uploadObject = {};
|
|
6671
|
-
var eventObject = {};
|
|
6672
|
-
|
|
6690
|
+
var eventObject = {}; // The `optOut` variable is passed later in this method to the `uploadObject`
|
|
6691
|
+
// so that it can be used to denote whether or not a user has "opted out" of being
|
|
6692
|
+
// tracked. If this is an `optOut` Event, we set `optOut` to the inverse of the SDK's
|
|
6693
|
+
// `isEnabled` boolean which is controlled via `MPInstanceManager.setOptOut`.
|
|
6694
|
+
|
|
6695
|
+
var optOut = event.messageType === Types.MessageType.OptOut ? !mpInstance._Store.isEnabled : null; // TODO: Why is Webview Bridge Enabled or Opt Out necessary here?
|
|
6673
6696
|
|
|
6674
|
-
if (mpInstance._Store.sessionId || event.messageType
|
|
6697
|
+
if (mpInstance._Store.sessionId || event.messageType === Types.MessageType.OptOut || mpInstance._Store.webviewBridgeEnabled) {
|
|
6675
6698
|
if (event.hasOwnProperty('toEventAPIObject')) {
|
|
6676
6699
|
eventObject = event.toEventAPIObject();
|
|
6677
6700
|
} else {
|
|
6678
6701
|
eventObject = {
|
|
6702
|
+
// This is an artifact from v2 events where SessionStart/End and AST event
|
|
6703
|
+
// names are numbers (1, 2, or 10), but going forward with v3, these lifecycle
|
|
6704
|
+
// events do not have names, but are denoted by their `event_type`
|
|
6679
6705
|
EventName: event.name || event.messageType,
|
|
6680
6706
|
EventCategory: event.eventType,
|
|
6681
6707
|
EventAttributes: mpInstance._Helpers.sanitizeAttributes(event.data, event.name),
|
|
@@ -6685,13 +6711,15 @@ var mParticle = (function () {
|
|
|
6685
6711
|
UserAttributeChanges: event.userAttributeChanges,
|
|
6686
6712
|
UserIdentityChanges: event.userIdentityChanges
|
|
6687
6713
|
};
|
|
6688
|
-
}
|
|
6714
|
+
} // TODO: Should we move this side effect outside of this method?
|
|
6715
|
+
|
|
6689
6716
|
|
|
6690
6717
|
if (event.messageType !== Types.MessageType.SessionEnd) {
|
|
6691
6718
|
mpInstance._Store.dateLastEventSent = new Date();
|
|
6692
6719
|
}
|
|
6693
6720
|
|
|
6694
6721
|
uploadObject = {
|
|
6722
|
+
// FIXME: Deprecate when we get rid of V2
|
|
6695
6723
|
Store: mpInstance._Store.serverSettings,
|
|
6696
6724
|
SDKVersion: Constants.sdkVersion,
|
|
6697
6725
|
SessionId: mpInstance._Store.sessionId,
|
|
@@ -6713,7 +6741,8 @@ var mParticle = (function () {
|
|
|
6713
6741
|
if (eventObject.EventDataType === MessageType.AppStateTransition) {
|
|
6714
6742
|
eventObject.IsFirstRun = mpInstance._Store.isFirstRun;
|
|
6715
6743
|
eventObject.LaunchReferral = window.location.href || null;
|
|
6716
|
-
}
|
|
6744
|
+
} // FIXME: Remove duplicate occurence
|
|
6745
|
+
|
|
6717
6746
|
|
|
6718
6747
|
eventObject.CurrencyCode = mpInstance._Store.currencyCode;
|
|
6719
6748
|
var currentUser = user || mpInstance.Identity.getCurrentUser();
|
|
@@ -6721,8 +6750,13 @@ var mParticle = (function () {
|
|
|
6721
6750
|
|
|
6722
6751
|
if (event.messageType === Types.MessageType.SessionEnd) {
|
|
6723
6752
|
eventObject.SessionLength = mpInstance._Store.dateLastEventSent.getTime() - mpInstance._Store.sessionStartDate.getTime();
|
|
6724
|
-
eventObject.currentSessionMPIDs = mpInstance._Store.currentSessionMPIDs;
|
|
6725
|
-
|
|
6753
|
+
eventObject.currentSessionMPIDs = mpInstance._Store.currentSessionMPIDs; // Session attributes are assigned on a session level, but only uploaded
|
|
6754
|
+
// when a session ends. As there is no way to attach event attributes to
|
|
6755
|
+
// a `SessionEnd` event, we are uploading the session level attributes
|
|
6756
|
+
// as event level attributes in a `SessionEnd` event.
|
|
6757
|
+
|
|
6758
|
+
eventObject.EventAttributes = mpInstance._Store.sessionAttributes; // TODO: We should move this out of here to avoid side effects
|
|
6759
|
+
|
|
6726
6760
|
mpInstance._Store.currentSessionMPIDs = [];
|
|
6727
6761
|
mpInstance._Store.sessionStartDate = null;
|
|
6728
6762
|
}
|
|
@@ -6778,7 +6812,9 @@ var mParticle = (function () {
|
|
|
6778
6812
|
dto.fr = event.IsFirstRun;
|
|
6779
6813
|
dto.iu = false;
|
|
6780
6814
|
dto.at = ApplicationTransitionType.AppInit;
|
|
6781
|
-
dto.lr = event.LaunchReferral;
|
|
6815
|
+
dto.lr = event.LaunchReferral; // Nullify Attributes in case AST Was logged manually or
|
|
6816
|
+
// via logBaseEvent. AST should not have any attributes
|
|
6817
|
+
|
|
6782
6818
|
dto.attrs = null;
|
|
6783
6819
|
}
|
|
6784
6820
|
|
|
@@ -6787,7 +6823,7 @@ var mParticle = (function () {
|
|
|
6787
6823
|
}
|
|
6788
6824
|
|
|
6789
6825
|
if (event.EventDataType === MessageType.Commerce) {
|
|
6790
|
-
dto.cu = event.CurrencyCode;
|
|
6826
|
+
dto.cu = event.CurrencyCode; // TODO: If Cart is deprecated, we should deprecate this too
|
|
6791
6827
|
|
|
6792
6828
|
if (event.ShoppingCart) {
|
|
6793
6829
|
dto.sc = {
|
|
@@ -9098,21 +9134,21 @@ var mParticle = (function () {
|
|
|
9098
9134
|
|
|
9099
9135
|
try {
|
|
9100
9136
|
var xhrCallback = function xhrCallback() {
|
|
9101
|
-
if (
|
|
9137
|
+
if (xhr_1.readyState === 4) {
|
|
9102
9138
|
// when a 200 returns, merge current config with what comes back from config, prioritizing user inputted config
|
|
9103
|
-
if (
|
|
9104
|
-
config = mpInstance._Helpers.extend({}, config, JSON.parse(
|
|
9139
|
+
if (xhr_1.status === 200) {
|
|
9140
|
+
config = mpInstance._Helpers.extend({}, config, JSON.parse(xhr_1.responseText));
|
|
9105
9141
|
completeSDKInitialization(apiKey, config, mpInstance);
|
|
9106
9142
|
mpInstance.Logger.verbose('Successfully received configuration from server');
|
|
9107
9143
|
} else {
|
|
9108
9144
|
// if for some reason a 200 doesn't return, then we initialize with the just the passed through config
|
|
9109
9145
|
completeSDKInitialization(apiKey, config, mpInstance);
|
|
9110
|
-
mpInstance.Logger.verbose('Issue with receiving configuration from server, received HTTP Code of ' +
|
|
9146
|
+
mpInstance.Logger.verbose('Issue with receiving configuration from server, received HTTP Code of ' + xhr_1.status);
|
|
9111
9147
|
}
|
|
9112
9148
|
}
|
|
9113
9149
|
};
|
|
9114
9150
|
|
|
9115
|
-
var
|
|
9151
|
+
var xhr_1 = mpInstance._Helpers.createXHR(xhrCallback);
|
|
9116
9152
|
|
|
9117
9153
|
url = 'https://' + mpInstance._Store.SDKConfig.configUrl + apiKey + '/config?env=';
|
|
9118
9154
|
|
|
@@ -9134,9 +9170,9 @@ var mParticle = (function () {
|
|
|
9134
9170
|
}
|
|
9135
9171
|
}
|
|
9136
9172
|
|
|
9137
|
-
if (
|
|
9138
|
-
|
|
9139
|
-
|
|
9173
|
+
if (xhr_1) {
|
|
9174
|
+
xhr_1.open('get', url);
|
|
9175
|
+
xhr_1.send(null);
|
|
9140
9176
|
}
|
|
9141
9177
|
} catch (e) {
|
|
9142
9178
|
completeSDKInitialization(apiKey, config, mpInstance);
|
|
@@ -10306,6 +10342,22 @@ var mParticle = (function () {
|
|
|
10306
10342
|
if (!hasIntegrationDelays) {
|
|
10307
10343
|
self._APIClient.processQueuedEvents();
|
|
10308
10344
|
}
|
|
10345
|
+
}; // Internal use only. Used by our wrapper SDKs to identify themselves during initialization.
|
|
10346
|
+
|
|
10347
|
+
|
|
10348
|
+
this._setWrapperSDKInfo = function (name, version) {
|
|
10349
|
+
var queued = queueIfNotInitialized(function () {
|
|
10350
|
+
self._setWrapperSDKInfo(name, version);
|
|
10351
|
+
}, self);
|
|
10352
|
+
if (queued) return;
|
|
10353
|
+
|
|
10354
|
+
if (self._Store.wrapperSDKInfo === undefined || !self._Store.wrapperSDKInfo.isInfoSet) {
|
|
10355
|
+
self._Store.wrapperSDKInfo = {
|
|
10356
|
+
name: name,
|
|
10357
|
+
version: version,
|
|
10358
|
+
isInfoSet: true
|
|
10359
|
+
};
|
|
10360
|
+
}
|
|
10309
10361
|
};
|
|
10310
10362
|
} // Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
|
|
10311
10363
|
|
|
@@ -10567,6 +10619,10 @@ var mParticle = (function () {
|
|
|
10567
10619
|
|
|
10568
10620
|
// This file is used ONLY for the mParticle ESLint plugin. It should NOT be used otherwise!
|
|
10569
10621
|
|
|
10622
|
+
var mockFunction = function mockFunction() {
|
|
10623
|
+
return null;
|
|
10624
|
+
};
|
|
10625
|
+
|
|
10570
10626
|
var _BatchValidator =
|
|
10571
10627
|
/** @class */
|
|
10572
10628
|
function () {
|
|
@@ -10580,23 +10636,95 @@ var mParticle = (function () {
|
|
|
10580
10636
|
generateUniqueId: function generateUniqueId() {
|
|
10581
10637
|
return 'mockId';
|
|
10582
10638
|
},
|
|
10583
|
-
extend: window.mParticle.getInstance()._Helpers.extend
|
|
10639
|
+
extend: window.mParticle.getInstance()._Helpers.extend,
|
|
10640
|
+
createServiceUrl: mockFunction,
|
|
10641
|
+
parseNumber: mockFunction,
|
|
10642
|
+
isObject: mockFunction,
|
|
10643
|
+
returnConvertedBoolean: mockFunction,
|
|
10644
|
+
Validators: null
|
|
10584
10645
|
},
|
|
10646
|
+
_resetForTests: mockFunction,
|
|
10647
|
+
_APIClient: null,
|
|
10648
|
+
_Consent: null,
|
|
10649
|
+
_ServerModel: null,
|
|
10650
|
+
_SessionManager: null,
|
|
10585
10651
|
_Store: {
|
|
10586
10652
|
sessionId: 'mockSessionId',
|
|
10587
|
-
|
|
10653
|
+
devToken: 'test_dev_token',
|
|
10654
|
+
isFirstRun: true,
|
|
10655
|
+
isEnabled: true,
|
|
10656
|
+
sessionAttributes: {},
|
|
10657
|
+
currentSessionMPIDs: [],
|
|
10658
|
+
consentState: null,
|
|
10659
|
+
clientId: null,
|
|
10660
|
+
deviceId: null,
|
|
10661
|
+
migrationData: {},
|
|
10662
|
+
serverSettings: {},
|
|
10663
|
+
dateLastEventSent: null,
|
|
10664
|
+
sessionStartDate: null,
|
|
10665
|
+
currentPosition: null,
|
|
10666
|
+
isTracking: false,
|
|
10667
|
+
watchPositionId: null,
|
|
10668
|
+
cartProducts: [],
|
|
10669
|
+
eventQueue: [],
|
|
10670
|
+
currencyCode: null,
|
|
10671
|
+
globalTimer: null,
|
|
10672
|
+
context: null,
|
|
10673
|
+
configurationLoaded: false,
|
|
10674
|
+
identityCallInFlight: false,
|
|
10675
|
+
migratingToIDSyncCookies: false,
|
|
10676
|
+
nonCurrentUserMPIDs: {},
|
|
10677
|
+
identifyCalled: false,
|
|
10678
|
+
isLoggedIn: false,
|
|
10679
|
+
cookieSyncDates: {},
|
|
10680
|
+
integrationAttributes: {},
|
|
10681
|
+
requireDelay: true,
|
|
10682
|
+
isLocalStorageAvailable: null,
|
|
10683
|
+
integrationDelayTimeoutStart: null,
|
|
10684
|
+
storageName: null,
|
|
10685
|
+
prodStorageName: null,
|
|
10686
|
+
activeForwarders: [],
|
|
10687
|
+
kits: {},
|
|
10688
|
+
configuredForwarders: [],
|
|
10689
|
+
pixelConfigurations: [],
|
|
10690
|
+
wrapperSDKInfo: {
|
|
10691
|
+
name: 'none',
|
|
10692
|
+
version: null,
|
|
10693
|
+
isInfoSet: false
|
|
10694
|
+
},
|
|
10695
|
+
SDKConfig: {
|
|
10696
|
+
isDevelopmentMode: false,
|
|
10697
|
+
onCreateBatch: mockFunction
|
|
10698
|
+
}
|
|
10588
10699
|
},
|
|
10700
|
+
config: null,
|
|
10701
|
+
eCommerce: null,
|
|
10589
10702
|
Identity: {
|
|
10590
|
-
getCurrentUser:
|
|
10591
|
-
|
|
10592
|
-
|
|
10703
|
+
getCurrentUser: mockFunction,
|
|
10704
|
+
IdentityAPI: {},
|
|
10705
|
+
identify: mockFunction,
|
|
10706
|
+
login: mockFunction,
|
|
10707
|
+
logout: mockFunction,
|
|
10708
|
+
modify: mockFunction
|
|
10593
10709
|
},
|
|
10594
|
-
|
|
10595
|
-
|
|
10710
|
+
Logger: {
|
|
10711
|
+
verbose: mockFunction,
|
|
10712
|
+
error: mockFunction,
|
|
10713
|
+
warning: mockFunction
|
|
10596
10714
|
},
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10715
|
+
ProductActionType: null,
|
|
10716
|
+
ServerModel: null,
|
|
10717
|
+
addForwarder: mockFunction,
|
|
10718
|
+
generateHash: mockFunction,
|
|
10719
|
+
getAppVersion: mockFunction,
|
|
10720
|
+
getAppName: mockFunction,
|
|
10721
|
+
getInstance: mockFunction,
|
|
10722
|
+
init: mockFunction,
|
|
10723
|
+
logBaseEvent: mockFunction,
|
|
10724
|
+
logEvent: mockFunction,
|
|
10725
|
+
logLevel: 'none',
|
|
10726
|
+
setPosition: mockFunction,
|
|
10727
|
+
upload: mockFunction
|
|
10600
10728
|
};
|
|
10601
10729
|
};
|
|
10602
10730
|
|
|
@@ -10942,6 +11070,10 @@ var mParticle = (function () {
|
|
|
10942
11070
|
this._getActiveForwarders = function () {
|
|
10943
11071
|
return self.getInstance()._getActiveForwarders();
|
|
10944
11072
|
};
|
|
11073
|
+
|
|
11074
|
+
this._setWrapperSDKInfo = function (name, version) {
|
|
11075
|
+
self.getInstance()._setWrapperSDKInfo(name, version);
|
|
11076
|
+
};
|
|
10945
11077
|
}
|
|
10946
11078
|
|
|
10947
11079
|
var mparticleInstance = new mParticle$1();
|