@cloudcare/browser-core 3.1.3 → 3.1.5
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/cjs/browser/cookie.js +18 -2
- package/cjs/browser/cookie.js.map +1 -1
- package/cjs/configuration/configuration.js +18 -0
- package/cjs/configuration/configuration.js.map +1 -1
- package/cjs/configuration/transportConfiguration.js +15 -6
- package/cjs/configuration/transportConfiguration.js.map +1 -1
- package/cjs/helper/deviceInfo.js +23 -21
- package/cjs/helper/deviceInfo.js.map +1 -1
- package/cjs/helper/tools.js +66 -18
- package/cjs/helper/tools.js.map +1 -1
- package/esm/browser/cookie.js +17 -3
- package/esm/browser/cookie.js.map +1 -1
- package/esm/configuration/configuration.js +17 -0
- package/esm/configuration/configuration.js.map +1 -1
- package/esm/configuration/transportConfiguration.js +15 -6
- package/esm/configuration/transportConfiguration.js.map +1 -1
- package/esm/helper/deviceInfo.js +23 -21
- package/esm/helper/deviceInfo.js.map +1 -1
- package/esm/helper/tools.js +62 -17
- package/esm/helper/tools.js.map +1 -1
- package/package.json +2 -2
- package/src/browser/cookie.js +22 -3
- package/src/configuration/configuration.js +27 -1
- package/src/configuration/transportConfiguration.js +19 -13
- package/src/helper/deviceInfo.js +23 -20
- package/src/helper/tools.js +70 -18
- package/src/.DS_Store +0 -0
package/cjs/helper/tools.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ONE_YEAR = exports.ONE_SECOND = exports.ONE_MINUTE = exports.ONE_HOUR = exports.ONE_DAY = void 0;
|
|
6
|
+
exports.ONE_YEAR = exports.ONE_SECOND = exports.ONE_MINUTE = exports.ONE_HOUR = exports.ONE_DAY = exports.Browser = void 0;
|
|
7
7
|
exports.UUID = UUID;
|
|
8
8
|
exports._URL = void 0;
|
|
9
9
|
exports.addDuration = addDuration;
|
|
@@ -19,6 +19,7 @@ exports.dateNow = dateNow;
|
|
|
19
19
|
exports.decodeURIComponent = void 0;
|
|
20
20
|
exports.deepClone = deepClone;
|
|
21
21
|
exports.deepSnakeCase = deepSnakeCase;
|
|
22
|
+
exports.detectBrowser = detectBrowser;
|
|
22
23
|
exports.each = void 0;
|
|
23
24
|
exports.elapsed = elapsed;
|
|
24
25
|
exports.elementMatches = elementMatches;
|
|
@@ -28,6 +29,7 @@ exports.filter = exports.extend2Lev = exports.extend = exports.every = void 0;
|
|
|
28
29
|
exports.find = find;
|
|
29
30
|
exports.findByPath = findByPath;
|
|
30
31
|
exports.findCommaSeparatedValue = findCommaSeparatedValue;
|
|
32
|
+
exports.findCommaSeparatedValues = findCommaSeparatedValues;
|
|
31
33
|
exports.findLast = findLast;
|
|
32
34
|
exports.getHostname = exports.getCurrentDomain = exports.getCookieTopLevelDomain = exports.formatJsonString = exports.formatDate = void 0;
|
|
33
35
|
exports.getLinkElementOrigin = getLinkElementOrigin;
|
|
@@ -1507,9 +1509,34 @@ function getNavigationStart() {
|
|
|
1507
1509
|
}
|
|
1508
1510
|
return navigationStart;
|
|
1509
1511
|
}
|
|
1512
|
+
var COMMA_SEPARATED_KEY_VALUE = /([\w-]+)\s*=\s*([^;]+)/g;
|
|
1510
1513
|
function findCommaSeparatedValue(rawString, name) {
|
|
1511
|
-
|
|
1512
|
-
|
|
1514
|
+
COMMA_SEPARATED_KEY_VALUE.lastIndex = 0;
|
|
1515
|
+
// eslint-disable-next-line no-constant-condition
|
|
1516
|
+
while (true) {
|
|
1517
|
+
var match = COMMA_SEPARATED_KEY_VALUE.exec(rawString);
|
|
1518
|
+
if (match) {
|
|
1519
|
+
if (match[1] === name) {
|
|
1520
|
+
return match[2];
|
|
1521
|
+
}
|
|
1522
|
+
} else {
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
function findCommaSeparatedValues(rawString) {
|
|
1528
|
+
var result = new Map();
|
|
1529
|
+
COMMA_SEPARATED_KEY_VALUE.lastIndex = 0;
|
|
1530
|
+
// eslint-disable-next-line no-constant-condition
|
|
1531
|
+
while (true) {
|
|
1532
|
+
var match = COMMA_SEPARATED_KEY_VALUE.exec(rawString);
|
|
1533
|
+
if (match) {
|
|
1534
|
+
result.set(match[1], match[2]);
|
|
1535
|
+
} else {
|
|
1536
|
+
break;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return result;
|
|
1513
1540
|
}
|
|
1514
1541
|
function findByPath(source, path) {
|
|
1515
1542
|
var pathArr = path.split('.');
|
|
@@ -1579,27 +1606,48 @@ function isPercentage(value) {
|
|
|
1579
1606
|
function getLocationOrigin() {
|
|
1580
1607
|
return getLinkElementOrigin(window.location);
|
|
1581
1608
|
}
|
|
1582
|
-
var
|
|
1609
|
+
var Browser = {
|
|
1610
|
+
IE: 0,
|
|
1611
|
+
CHROMIUM: 1,
|
|
1612
|
+
SAFARI: 2,
|
|
1613
|
+
OTHER: 3
|
|
1614
|
+
};
|
|
1615
|
+
exports.Browser = Browser;
|
|
1583
1616
|
function isIE() {
|
|
1584
|
-
|
|
1585
|
-
browserIsIE = Boolean(document.documentMode);
|
|
1586
|
-
}
|
|
1587
|
-
return browserIsIE;
|
|
1617
|
+
return detectBrowserCached() === Browser.IE;
|
|
1588
1618
|
}
|
|
1589
|
-
var browserIsChromium;
|
|
1590
1619
|
function isChromium() {
|
|
1591
|
-
|
|
1592
|
-
browserIsChromium = !!window.chrome || /HeadlessChrome/.test(window.navigator.userAgent);
|
|
1593
|
-
}
|
|
1594
|
-
return browserIsChromium;
|
|
1620
|
+
return detectBrowserCached() === Browser.CHROMIUM;
|
|
1595
1621
|
}
|
|
1596
|
-
var browserIsSafari;
|
|
1597
1622
|
function isSafari() {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1623
|
+
return detectBrowserCached() === Browser.SAFARI;
|
|
1624
|
+
}
|
|
1625
|
+
var browserCache;
|
|
1626
|
+
function detectBrowserCached() {
|
|
1627
|
+
return isNullUndefinedDefaultValue(browserCache, browserCache = detectBrowser());
|
|
1602
1628
|
}
|
|
1629
|
+
function detectBrowser(browserWindow) {
|
|
1630
|
+
var _browserWindow$naviga;
|
|
1631
|
+
if (typeof browserWindow === 'undefined') {
|
|
1632
|
+
browserWindow = window;
|
|
1633
|
+
}
|
|
1634
|
+
var userAgent = browserWindow.navigator.userAgent;
|
|
1635
|
+
if (browserWindow.chrome || /HeadlessChrome/.test(userAgent)) {
|
|
1636
|
+
return Browser.CHROMIUM;
|
|
1637
|
+
}
|
|
1638
|
+
if (
|
|
1639
|
+
// navigator.vendor is deprecated, but it is the most resilient way we found to detect
|
|
1640
|
+
// "Apple maintained browsers" (AKA Safari). If one day it gets removed, we still have the
|
|
1641
|
+
// useragent test as a semi-working fallback.
|
|
1642
|
+
((_browserWindow$naviga = browserWindow.navigator.vendor) === null || _browserWindow$naviga === void 0 ? void 0 : _browserWindow$naviga.indexOf('Apple')) === 0 || /safari/i.test(userAgent) && !/chrome|android/i.test(userAgent)) {
|
|
1643
|
+
return Browser.SAFARI;
|
|
1644
|
+
}
|
|
1645
|
+
if (browserWindow.document.documentMode) {
|
|
1646
|
+
return Browser.IE;
|
|
1647
|
+
}
|
|
1648
|
+
return Browser.OTHER;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1603
1651
|
/**
|
|
1604
1652
|
* IE fallback
|
|
1605
1653
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin
|