@bigbinary/neeto-commons-frontend 2.0.106 → 2.0.108
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/cypress-configs/plugins.js +2 -0
- package/cypress-utils.cjs.js +23 -11
- package/cypress-utils.cjs.js.map +1 -1
- package/cypress-utils.d.ts +19 -2
- package/cypress-utils.js +23 -12
- package/cypress-utils.js.map +1 -1
- package/initializers.cjs.js +435 -16
- package/initializers.cjs.js.map +1 -1
- package/initializers.js +435 -16
- package/initializers.js.map +1 -1
- package/package.json +2 -1
package/initializers.cjs.js
CHANGED
|
@@ -20,34 +20,34 @@ var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
|
20
20
|
var Logger__default = /*#__PURE__*/_interopDefaultLegacy(Logger);
|
|
21
21
|
var mixpanel__default = /*#__PURE__*/_interopDefaultLegacy(mixpanel);
|
|
22
22
|
|
|
23
|
-
function _typeof(obj) {
|
|
23
|
+
function _typeof$1(obj) {
|
|
24
24
|
"@babel/helpers - typeof";
|
|
25
25
|
|
|
26
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
26
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
27
27
|
return typeof obj;
|
|
28
28
|
} : function (obj) {
|
|
29
29
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
30
|
-
}, _typeof(obj);
|
|
30
|
+
}, _typeof$1(obj);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function _toPrimitive(input, hint) {
|
|
34
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
33
|
+
function _toPrimitive$1(input, hint) {
|
|
34
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
35
35
|
var prim = input[Symbol.toPrimitive];
|
|
36
36
|
if (prim !== undefined) {
|
|
37
37
|
var res = prim.call(input, hint || "default");
|
|
38
|
-
if (_typeof(res) !== "object") return res;
|
|
38
|
+
if (_typeof$1(res) !== "object") return res;
|
|
39
39
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
40
40
|
}
|
|
41
41
|
return (hint === "string" ? String : Number)(input);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function _toPropertyKey(arg) {
|
|
45
|
-
var key = _toPrimitive(arg, "string");
|
|
46
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
44
|
+
function _toPropertyKey$1(arg) {
|
|
45
|
+
var key = _toPrimitive$1(arg, "string");
|
|
46
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function _defineProperty(obj, key, value) {
|
|
50
|
-
key = _toPropertyKey(key);
|
|
50
|
+
key = _toPropertyKey$1(key);
|
|
51
51
|
if (key in obj) {
|
|
52
52
|
Object.defineProperty(obj, key, {
|
|
53
53
|
value: value,
|
|
@@ -70,10 +70,10 @@ var HEADERS_KEYS = {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
var shouldNot = function shouldNot(skip) {
|
|
73
|
-
return _typeof(skip) === "object" || !skip;
|
|
73
|
+
return _typeof$1(skip) === "object" || !skip;
|
|
74
74
|
};
|
|
75
75
|
var shouldShowToastr = function shouldShowToastr(response) {
|
|
76
|
-
return typeof response === "string" || _typeof(response) === "object" && ((response === null || response === void 0 ? void 0 : response.notice) || (response === null || response === void 0 ? void 0 : response.noticeCode));
|
|
76
|
+
return typeof response === "string" || _typeof$1(response) === "object" && ((response === null || response === void 0 ? void 0 : response.notice) || (response === null || response === void 0 ? void 0 : response.noticeCode));
|
|
77
77
|
};
|
|
78
78
|
var setAuthHeaders = function setAuthHeaders() {
|
|
79
79
|
var _document$querySelect, _axios$defaults$heade, _globalProps$user, _globalProps$user2;
|
|
@@ -1873,6 +1873,419 @@ function createDOMPurify() {
|
|
|
1873
1873
|
|
|
1874
1874
|
var purify = createDOMPurify();
|
|
1875
1875
|
|
|
1876
|
+
function _classCallCheck(instance, Constructor) {
|
|
1877
|
+
if (!(instance instanceof Constructor)) {
|
|
1878
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
function _typeof(obj) {
|
|
1883
|
+
"@babel/helpers - typeof";
|
|
1884
|
+
|
|
1885
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1886
|
+
return typeof obj;
|
|
1887
|
+
} : function (obj) {
|
|
1888
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1889
|
+
}, _typeof(obj);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
function _toPrimitive(input, hint) {
|
|
1893
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
1894
|
+
var prim = input[Symbol.toPrimitive];
|
|
1895
|
+
if (prim !== undefined) {
|
|
1896
|
+
var res = prim.call(input, hint || "default");
|
|
1897
|
+
if (_typeof(res) !== "object") return res;
|
|
1898
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1899
|
+
}
|
|
1900
|
+
return (hint === "string" ? String : Number)(input);
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
function _toPropertyKey(arg) {
|
|
1904
|
+
var key = _toPrimitive(arg, "string");
|
|
1905
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
function _defineProperties(target, props) {
|
|
1909
|
+
for (var i = 0; i < props.length; i++) {
|
|
1910
|
+
var descriptor = props[i];
|
|
1911
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1912
|
+
descriptor.configurable = true;
|
|
1913
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1914
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
1918
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1919
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1920
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
1921
|
+
writable: false
|
|
1922
|
+
});
|
|
1923
|
+
return Constructor;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
var arr = [];
|
|
1927
|
+
var each = arr.forEach;
|
|
1928
|
+
var slice = arr.slice;
|
|
1929
|
+
function defaults(obj) {
|
|
1930
|
+
each.call(slice.call(arguments, 1), function (source) {
|
|
1931
|
+
if (source) {
|
|
1932
|
+
for (var prop in source) {
|
|
1933
|
+
if (obj[prop] === undefined) obj[prop] = source[prop];
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
});
|
|
1937
|
+
return obj;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
// eslint-disable-next-line no-control-regex
|
|
1941
|
+
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
1942
|
+
var serializeCookie = function serializeCookie(name, val, options) {
|
|
1943
|
+
var opt = options || {};
|
|
1944
|
+
opt.path = opt.path || '/';
|
|
1945
|
+
var value = encodeURIComponent(val);
|
|
1946
|
+
var str = "".concat(name, "=").concat(value);
|
|
1947
|
+
if (opt.maxAge > 0) {
|
|
1948
|
+
var maxAge = opt.maxAge - 0;
|
|
1949
|
+
if (Number.isNaN(maxAge)) throw new Error('maxAge should be a Number');
|
|
1950
|
+
str += "; Max-Age=".concat(Math.floor(maxAge));
|
|
1951
|
+
}
|
|
1952
|
+
if (opt.domain) {
|
|
1953
|
+
if (!fieldContentRegExp.test(opt.domain)) {
|
|
1954
|
+
throw new TypeError('option domain is invalid');
|
|
1955
|
+
}
|
|
1956
|
+
str += "; Domain=".concat(opt.domain);
|
|
1957
|
+
}
|
|
1958
|
+
if (opt.path) {
|
|
1959
|
+
if (!fieldContentRegExp.test(opt.path)) {
|
|
1960
|
+
throw new TypeError('option path is invalid');
|
|
1961
|
+
}
|
|
1962
|
+
str += "; Path=".concat(opt.path);
|
|
1963
|
+
}
|
|
1964
|
+
if (opt.expires) {
|
|
1965
|
+
if (typeof opt.expires.toUTCString !== 'function') {
|
|
1966
|
+
throw new TypeError('option expires is invalid');
|
|
1967
|
+
}
|
|
1968
|
+
str += "; Expires=".concat(opt.expires.toUTCString());
|
|
1969
|
+
}
|
|
1970
|
+
if (opt.httpOnly) str += '; HttpOnly';
|
|
1971
|
+
if (opt.secure) str += '; Secure';
|
|
1972
|
+
if (opt.sameSite) {
|
|
1973
|
+
var sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
1974
|
+
switch (sameSite) {
|
|
1975
|
+
case true:
|
|
1976
|
+
str += '; SameSite=Strict';
|
|
1977
|
+
break;
|
|
1978
|
+
case 'lax':
|
|
1979
|
+
str += '; SameSite=Lax';
|
|
1980
|
+
break;
|
|
1981
|
+
case 'strict':
|
|
1982
|
+
str += '; SameSite=Strict';
|
|
1983
|
+
break;
|
|
1984
|
+
case 'none':
|
|
1985
|
+
str += '; SameSite=None';
|
|
1986
|
+
break;
|
|
1987
|
+
default:
|
|
1988
|
+
throw new TypeError('option sameSite is invalid');
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
return str;
|
|
1992
|
+
};
|
|
1993
|
+
var cookie = {
|
|
1994
|
+
create: function create(name, value, minutes, domain) {
|
|
1995
|
+
var cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
1996
|
+
path: '/',
|
|
1997
|
+
sameSite: 'strict'
|
|
1998
|
+
};
|
|
1999
|
+
if (minutes) {
|
|
2000
|
+
cookieOptions.expires = new Date();
|
|
2001
|
+
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1000);
|
|
2002
|
+
}
|
|
2003
|
+
if (domain) cookieOptions.domain = domain;
|
|
2004
|
+
document.cookie = serializeCookie(name, encodeURIComponent(value), cookieOptions);
|
|
2005
|
+
},
|
|
2006
|
+
read: function read(name) {
|
|
2007
|
+
var nameEQ = "".concat(name, "=");
|
|
2008
|
+
var ca = document.cookie.split(';');
|
|
2009
|
+
for (var i = 0; i < ca.length; i++) {
|
|
2010
|
+
var c = ca[i];
|
|
2011
|
+
while (c.charAt(0) === ' ') {
|
|
2012
|
+
c = c.substring(1, c.length);
|
|
2013
|
+
}
|
|
2014
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
2015
|
+
}
|
|
2016
|
+
return null;
|
|
2017
|
+
},
|
|
2018
|
+
remove: function remove(name) {
|
|
2019
|
+
this.create(name, '', -1);
|
|
2020
|
+
}
|
|
2021
|
+
};
|
|
2022
|
+
var cookie$1 = {
|
|
2023
|
+
name: 'cookie',
|
|
2024
|
+
lookup: function lookup(options) {
|
|
2025
|
+
var found;
|
|
2026
|
+
if (options.lookupCookie && typeof document !== 'undefined') {
|
|
2027
|
+
var c = cookie.read(options.lookupCookie);
|
|
2028
|
+
if (c) found = c;
|
|
2029
|
+
}
|
|
2030
|
+
return found;
|
|
2031
|
+
},
|
|
2032
|
+
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
2033
|
+
if (options.lookupCookie && typeof document !== 'undefined') {
|
|
2034
|
+
cookie.create(options.lookupCookie, lng, options.cookieMinutes, options.cookieDomain, options.cookieOptions);
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
var querystring = {
|
|
2040
|
+
name: 'querystring',
|
|
2041
|
+
lookup: function lookup(options) {
|
|
2042
|
+
var found;
|
|
2043
|
+
if (typeof window !== 'undefined') {
|
|
2044
|
+
var search = window.location.search;
|
|
2045
|
+
if (!window.location.search && window.location.hash && window.location.hash.indexOf('?') > -1) {
|
|
2046
|
+
search = window.location.hash.substring(window.location.hash.indexOf('?'));
|
|
2047
|
+
}
|
|
2048
|
+
var query = search.substring(1);
|
|
2049
|
+
var params = query.split('&');
|
|
2050
|
+
for (var i = 0; i < params.length; i++) {
|
|
2051
|
+
var pos = params[i].indexOf('=');
|
|
2052
|
+
if (pos > 0) {
|
|
2053
|
+
var key = params[i].substring(0, pos);
|
|
2054
|
+
if (key === options.lookupQuerystring) {
|
|
2055
|
+
found = params[i].substring(pos + 1);
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
return found;
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
|
|
2064
|
+
var hasLocalStorageSupport = null;
|
|
2065
|
+
var localStorageAvailable = function localStorageAvailable() {
|
|
2066
|
+
if (hasLocalStorageSupport !== null) return hasLocalStorageSupport;
|
|
2067
|
+
try {
|
|
2068
|
+
hasLocalStorageSupport = window !== 'undefined' && window.localStorage !== null;
|
|
2069
|
+
var testKey = 'i18next.translate.boo';
|
|
2070
|
+
window.localStorage.setItem(testKey, 'foo');
|
|
2071
|
+
window.localStorage.removeItem(testKey);
|
|
2072
|
+
} catch (e) {
|
|
2073
|
+
hasLocalStorageSupport = false;
|
|
2074
|
+
}
|
|
2075
|
+
return hasLocalStorageSupport;
|
|
2076
|
+
};
|
|
2077
|
+
var localStorage = {
|
|
2078
|
+
name: 'localStorage',
|
|
2079
|
+
lookup: function lookup(options) {
|
|
2080
|
+
var found;
|
|
2081
|
+
if (options.lookupLocalStorage && localStorageAvailable()) {
|
|
2082
|
+
var lng = window.localStorage.getItem(options.lookupLocalStorage);
|
|
2083
|
+
if (lng) found = lng;
|
|
2084
|
+
}
|
|
2085
|
+
return found;
|
|
2086
|
+
},
|
|
2087
|
+
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
2088
|
+
if (options.lookupLocalStorage && localStorageAvailable()) {
|
|
2089
|
+
window.localStorage.setItem(options.lookupLocalStorage, lng);
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
};
|
|
2093
|
+
|
|
2094
|
+
var hasSessionStorageSupport = null;
|
|
2095
|
+
var sessionStorageAvailable = function sessionStorageAvailable() {
|
|
2096
|
+
if (hasSessionStorageSupport !== null) return hasSessionStorageSupport;
|
|
2097
|
+
try {
|
|
2098
|
+
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
|
|
2099
|
+
var testKey = 'i18next.translate.boo';
|
|
2100
|
+
window.sessionStorage.setItem(testKey, 'foo');
|
|
2101
|
+
window.sessionStorage.removeItem(testKey);
|
|
2102
|
+
} catch (e) {
|
|
2103
|
+
hasSessionStorageSupport = false;
|
|
2104
|
+
}
|
|
2105
|
+
return hasSessionStorageSupport;
|
|
2106
|
+
};
|
|
2107
|
+
var sessionStorage = {
|
|
2108
|
+
name: 'sessionStorage',
|
|
2109
|
+
lookup: function lookup(options) {
|
|
2110
|
+
var found;
|
|
2111
|
+
if (options.lookupSessionStorage && sessionStorageAvailable()) {
|
|
2112
|
+
var lng = window.sessionStorage.getItem(options.lookupSessionStorage);
|
|
2113
|
+
if (lng) found = lng;
|
|
2114
|
+
}
|
|
2115
|
+
return found;
|
|
2116
|
+
},
|
|
2117
|
+
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
2118
|
+
if (options.lookupSessionStorage && sessionStorageAvailable()) {
|
|
2119
|
+
window.sessionStorage.setItem(options.lookupSessionStorage, lng);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
|
|
2124
|
+
var navigator$1 = {
|
|
2125
|
+
name: 'navigator',
|
|
2126
|
+
lookup: function lookup(options) {
|
|
2127
|
+
var found = [];
|
|
2128
|
+
if (typeof navigator !== 'undefined') {
|
|
2129
|
+
if (navigator.languages) {
|
|
2130
|
+
// chrome only; not an array, so can't use .push.apply instead of iterating
|
|
2131
|
+
for (var i = 0; i < navigator.languages.length; i++) {
|
|
2132
|
+
found.push(navigator.languages[i]);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
if (navigator.userLanguage) {
|
|
2136
|
+
found.push(navigator.userLanguage);
|
|
2137
|
+
}
|
|
2138
|
+
if (navigator.language) {
|
|
2139
|
+
found.push(navigator.language);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
return found.length > 0 ? found : undefined;
|
|
2143
|
+
}
|
|
2144
|
+
};
|
|
2145
|
+
|
|
2146
|
+
var htmlTag = {
|
|
2147
|
+
name: 'htmlTag',
|
|
2148
|
+
lookup: function lookup(options) {
|
|
2149
|
+
var found;
|
|
2150
|
+
var htmlTag = options.htmlTag || (typeof document !== 'undefined' ? document.documentElement : null);
|
|
2151
|
+
if (htmlTag && typeof htmlTag.getAttribute === 'function') {
|
|
2152
|
+
found = htmlTag.getAttribute('lang');
|
|
2153
|
+
}
|
|
2154
|
+
return found;
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
var path = {
|
|
2159
|
+
name: 'path',
|
|
2160
|
+
lookup: function lookup(options) {
|
|
2161
|
+
var found;
|
|
2162
|
+
if (typeof window !== 'undefined') {
|
|
2163
|
+
var language = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
2164
|
+
if (language instanceof Array) {
|
|
2165
|
+
if (typeof options.lookupFromPathIndex === 'number') {
|
|
2166
|
+
if (typeof language[options.lookupFromPathIndex] !== 'string') {
|
|
2167
|
+
return undefined;
|
|
2168
|
+
}
|
|
2169
|
+
found = language[options.lookupFromPathIndex].replace('/', '');
|
|
2170
|
+
} else {
|
|
2171
|
+
found = language[0].replace('/', '');
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
return found;
|
|
2176
|
+
}
|
|
2177
|
+
};
|
|
2178
|
+
|
|
2179
|
+
var subdomain = {
|
|
2180
|
+
name: 'subdomain',
|
|
2181
|
+
lookup: function lookup(options) {
|
|
2182
|
+
// If given get the subdomain index else 1
|
|
2183
|
+
var lookupFromSubdomainIndex = typeof options.lookupFromSubdomainIndex === 'number' ? options.lookupFromSubdomainIndex + 1 : 1;
|
|
2184
|
+
// get all matches if window.location. is existing
|
|
2185
|
+
// first item of match is the match itself and the second is the first group macht which sould be the first subdomain match
|
|
2186
|
+
// is the hostname no public domain get the or option of localhost
|
|
2187
|
+
var language = typeof window !== 'undefined' && window.location && window.location.hostname && window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
2188
|
+
|
|
2189
|
+
// if there is no match (null) return undefined
|
|
2190
|
+
if (!language) return undefined;
|
|
2191
|
+
// return the given group match
|
|
2192
|
+
return language[lookupFromSubdomainIndex];
|
|
2193
|
+
}
|
|
2194
|
+
};
|
|
2195
|
+
|
|
2196
|
+
function getDefaults() {
|
|
2197
|
+
return {
|
|
2198
|
+
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
|
|
2199
|
+
lookupQuerystring: 'lng',
|
|
2200
|
+
lookupCookie: 'i18next',
|
|
2201
|
+
lookupLocalStorage: 'i18nextLng',
|
|
2202
|
+
lookupSessionStorage: 'i18nextLng',
|
|
2203
|
+
// cache user language
|
|
2204
|
+
caches: ['localStorage'],
|
|
2205
|
+
excludeCacheFor: ['cimode'],
|
|
2206
|
+
// cookieMinutes: 10,
|
|
2207
|
+
// cookieDomain: 'myDomain'
|
|
2208
|
+
|
|
2209
|
+
convertDetectedLanguage: function convertDetectedLanguage(l) {
|
|
2210
|
+
return l;
|
|
2211
|
+
}
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
var Browser = /*#__PURE__*/function () {
|
|
2215
|
+
function Browser(services) {
|
|
2216
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2217
|
+
_classCallCheck(this, Browser);
|
|
2218
|
+
this.type = 'languageDetector';
|
|
2219
|
+
this.detectors = {};
|
|
2220
|
+
this.init(services, options);
|
|
2221
|
+
}
|
|
2222
|
+
_createClass(Browser, [{
|
|
2223
|
+
key: "init",
|
|
2224
|
+
value: function init(services) {
|
|
2225
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2226
|
+
var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2227
|
+
this.services = services || {
|
|
2228
|
+
languageUtils: {}
|
|
2229
|
+
}; // this way the language detector can be used without i18next
|
|
2230
|
+
this.options = defaults(options, this.options || {}, getDefaults());
|
|
2231
|
+
if (typeof this.options.convertDetectedLanguage === 'string' && this.options.convertDetectedLanguage.indexOf('15897') > -1) {
|
|
2232
|
+
this.options.convertDetectedLanguage = function (l) {
|
|
2233
|
+
return l.replace('-', '_');
|
|
2234
|
+
};
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
// backwards compatibility
|
|
2238
|
+
if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex;
|
|
2239
|
+
this.i18nOptions = i18nOptions;
|
|
2240
|
+
this.addDetector(cookie$1);
|
|
2241
|
+
this.addDetector(querystring);
|
|
2242
|
+
this.addDetector(localStorage);
|
|
2243
|
+
this.addDetector(sessionStorage);
|
|
2244
|
+
this.addDetector(navigator$1);
|
|
2245
|
+
this.addDetector(htmlTag);
|
|
2246
|
+
this.addDetector(path);
|
|
2247
|
+
this.addDetector(subdomain);
|
|
2248
|
+
}
|
|
2249
|
+
}, {
|
|
2250
|
+
key: "addDetector",
|
|
2251
|
+
value: function addDetector(detector) {
|
|
2252
|
+
this.detectors[detector.name] = detector;
|
|
2253
|
+
}
|
|
2254
|
+
}, {
|
|
2255
|
+
key: "detect",
|
|
2256
|
+
value: function detect(detectionOrder) {
|
|
2257
|
+
var _this = this;
|
|
2258
|
+
if (!detectionOrder) detectionOrder = this.options.order;
|
|
2259
|
+
var detected = [];
|
|
2260
|
+
detectionOrder.forEach(function (detectorName) {
|
|
2261
|
+
if (_this.detectors[detectorName]) {
|
|
2262
|
+
var lookup = _this.detectors[detectorName].lookup(_this.options);
|
|
2263
|
+
if (lookup && typeof lookup === 'string') lookup = [lookup];
|
|
2264
|
+
if (lookup) detected = detected.concat(lookup);
|
|
2265
|
+
}
|
|
2266
|
+
});
|
|
2267
|
+
detected = detected.map(function (d) {
|
|
2268
|
+
return _this.options.convertDetectedLanguage(d);
|
|
2269
|
+
});
|
|
2270
|
+
if (this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0
|
|
2271
|
+
return detected.length > 0 ? detected[0] : null; // a little backward compatibility
|
|
2272
|
+
}
|
|
2273
|
+
}, {
|
|
2274
|
+
key: "cacheUserLanguage",
|
|
2275
|
+
value: function cacheUserLanguage(lng, caches) {
|
|
2276
|
+
var _this2 = this;
|
|
2277
|
+
if (!caches) caches = this.options.caches;
|
|
2278
|
+
if (!caches) return;
|
|
2279
|
+
if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return;
|
|
2280
|
+
caches.forEach(function (cacheName) {
|
|
2281
|
+
if (_this2.detectors[cacheName]) _this2.detectors[cacheName].cacheUserLanguage(lng, _this2.options);
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
}]);
|
|
2285
|
+
return Browser;
|
|
2286
|
+
}();
|
|
2287
|
+
Browser.type = 'languageDetector';
|
|
2288
|
+
|
|
1876
2289
|
var generic = {
|
|
1877
2290
|
error: "Something went wrong. Please try again later."
|
|
1878
2291
|
};
|
|
@@ -2006,17 +2419,23 @@ var packageEnTranslations = getPackageTranslations("en", packageNames);
|
|
|
2006
2419
|
var en = ramda.mergeDeepLeft(commonsEn, packageEnTranslations);
|
|
2007
2420
|
var initializeI18n = function initializeI18n(resources) {
|
|
2008
2421
|
var _i18n$services$format;
|
|
2009
|
-
i18n__default["default"].use(reactI18next.initReactI18next).init({
|
|
2422
|
+
i18n__default["default"].use(Browser).use(reactI18next.initReactI18next).init({
|
|
2010
2423
|
resources: ramda.mergeDeepLeft(resources, {
|
|
2011
2424
|
en: {
|
|
2012
2425
|
translation: en
|
|
2013
2426
|
}
|
|
2014
2427
|
}),
|
|
2015
|
-
|
|
2428
|
+
supportedLngs: ["en", "de"],
|
|
2016
2429
|
fallbackLng: "en",
|
|
2017
2430
|
interpolation: {
|
|
2018
2431
|
escapeValue: false,
|
|
2019
2432
|
skipOnVariables: false
|
|
2433
|
+
},
|
|
2434
|
+
detection: {
|
|
2435
|
+
order: ["querystring", "cookie", "navigator", "path"],
|
|
2436
|
+
caches: ["cookie"],
|
|
2437
|
+
lookupQuerystring: "lang",
|
|
2438
|
+
lookupCookie: "lang"
|
|
2020
2439
|
}
|
|
2021
2440
|
});
|
|
2022
2441
|
(_i18n$services$format = i18n__default["default"].services.formatter) === null || _i18n$services$format === void 0 ? void 0 : _i18n$services$format.addCached("boldList", function (language, options) {
|
|
@@ -2060,7 +2479,7 @@ function initializeMixPanel() {
|
|
|
2060
2479
|
}
|
|
2061
2480
|
|
|
2062
2481
|
var isObjectOrFunction = function isObjectOrFunction(object) {
|
|
2063
|
-
var type = _typeof(object);
|
|
2482
|
+
var type = _typeof$1(object);
|
|
2064
2483
|
return type === "function" || type === "object" && !!object;
|
|
2065
2484
|
};
|
|
2066
2485
|
function disableReactDevTools() {
|
|
@@ -2088,7 +2507,7 @@ function initializeApplication(_ref) {
|
|
|
2088
2507
|
exports.globalProps = window.globalProps;
|
|
2089
2508
|
}
|
|
2090
2509
|
if (!(skip !== null && skip !== void 0 && skip.mixpanel)) initializeMixPanel();
|
|
2091
|
-
if (_typeof(skip === null || skip === void 0 ? void 0 : skip.axios) === "object" || !(skip !== null && skip !== void 0 && skip.axios)) {
|
|
2510
|
+
if (_typeof$1(skip === null || skip === void 0 ? void 0 : skip.axios) === "object" || !(skip !== null && skip !== void 0 && skip.axios)) {
|
|
2092
2511
|
initializeAxios(skip === null || skip === void 0 ? void 0 : skip.axios);
|
|
2093
2512
|
}
|
|
2094
2513
|
if (!(skip !== null && skip !== void 0 && skip.i18n)) initializeI18n(translationResources);
|