@cloudcare/browser-core 3.2.16 → 3.2.17
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
CHANGED
|
@@ -76,7 +76,9 @@ function getCurrentSite() {
|
|
|
76
76
|
var testCookieValue = 'test';
|
|
77
77
|
var domainLevels = window.location.hostname.split('.');
|
|
78
78
|
var candidateDomain = domainLevels.pop();
|
|
79
|
-
while (domainLevels.length && !getCookie(testCookieName
|
|
79
|
+
while (domainLevels.length && !getCookie(testCookieName, {
|
|
80
|
+
domain: candidateDomain
|
|
81
|
+
})) {
|
|
80
82
|
candidateDomain = "".concat(domainLevels.pop(), ".").concat(candidateDomain);
|
|
81
83
|
setCookie(testCookieName, testCookieValue, _tools.ONE_SECOND, {
|
|
82
84
|
domain: candidateDomain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.js","names":["_tools","require","getCookieName","name","options","concat","crossSite","domain","secure","partitioned","setCookie","value","expireDelay","date","Date","setTime","getTime","expires","toUTCString","sameSite","document","cookie","getCookie","findCommaSeparatedValue","initCookieParsed","getInitCookie","findCommaSeparatedValues","get","resetInitCookies","undefined","deleteCookie","areCookiesAuthorized","testCookieName","UUID","testCookieValue","ONE_MINUTE","isCookieCorrectlySet","error","getCurrentSiteCache","getCurrentSite","domainLevels","window","location","hostname","split","candidateDomain","pop","length","ONE_SECOND"],"sources":["../../src/browser/cookie.js"],"sourcesContent":["import {\n findCommaSeparatedValue,\n UUID,\n ONE_SECOND,\n ONE_MINUTE,\n findCommaSeparatedValues\n} from '../helper/tools'\n\nfunction getCookieName(name, options) {\n return `${name}_${options && options.crossSite ? 'cs1' : 'cs0'}_${\n options && options.domain ? 'd1' : 'd0'\n }_${options && options.secure ? 'sec1' : 'sec0'}_${\n options && options.partitioned ? 'part1' : 'part0'\n }`\n}\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date()\n date.setTime(date.getTime() + expireDelay)\n var expires = 'expires=' + date.toUTCString()\n var sameSite = options && options.crossSite ? 'none' : 'strict'\n var domain = options && options.domain ? ';domain=' + options.domain : ''\n var secure = options && options.secure ? ';secure' : ''\n var partitioned = options && options.partitioned ? ';partitioned' : ''\n\n document.cookie =\n getCookieName(name, options) +\n '=' +\n value +\n ';' +\n expires +\n ';path=/;samesite=' +\n sameSite +\n domain +\n secure +\n partitioned\n}\n\nexport function getCookie(name, options) {\n return findCommaSeparatedValue(document.cookie, getCookieName(name, options))\n}\nvar initCookieParsed\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie)\n }\n return initCookieParsed.get(name)\n}\n\nexport function resetInitCookies() {\n initCookieParsed = undefined\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options)\n}\n\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_cookie_test_${UUID()}`\n var testCookieValue = 'test'\n setCookie(testCookieName, testCookieValue, ONE_MINUTE, options)\n const isCookieCorrectlySet =\n getCookie(testCookieName, options) === testCookieValue\n deleteCookie(testCookieName, options)\n return isCookieCorrectlySet\n } catch (error) {\n return false\n }\n}\n\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n const testCookieName = `gc_site_test_${UUID()}`\n const testCookieValue = 'test'\n
|
|
1
|
+
{"version":3,"file":"cookie.js","names":["_tools","require","getCookieName","name","options","concat","crossSite","domain","secure","partitioned","setCookie","value","expireDelay","date","Date","setTime","getTime","expires","toUTCString","sameSite","document","cookie","getCookie","findCommaSeparatedValue","initCookieParsed","getInitCookie","findCommaSeparatedValues","get","resetInitCookies","undefined","deleteCookie","areCookiesAuthorized","testCookieName","UUID","testCookieValue","ONE_MINUTE","isCookieCorrectlySet","error","getCurrentSiteCache","getCurrentSite","domainLevels","window","location","hostname","split","candidateDomain","pop","length","ONE_SECOND"],"sources":["../../src/browser/cookie.js"],"sourcesContent":["import {\n findCommaSeparatedValue,\n UUID,\n ONE_SECOND,\n ONE_MINUTE,\n findCommaSeparatedValues\n} from '../helper/tools'\n\nfunction getCookieName(name, options) {\n return `${name}_${options && options.crossSite ? 'cs1' : 'cs0'}_${\n options && options.domain ? 'd1' : 'd0'\n }_${options && options.secure ? 'sec1' : 'sec0'}_${\n options && options.partitioned ? 'part1' : 'part0'\n }`\n}\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date()\n date.setTime(date.getTime() + expireDelay)\n var expires = 'expires=' + date.toUTCString()\n var sameSite = options && options.crossSite ? 'none' : 'strict'\n var domain = options && options.domain ? ';domain=' + options.domain : ''\n var secure = options && options.secure ? ';secure' : ''\n var partitioned = options && options.partitioned ? ';partitioned' : ''\n\n document.cookie =\n getCookieName(name, options) +\n '=' +\n value +\n ';' +\n expires +\n ';path=/;samesite=' +\n sameSite +\n domain +\n secure +\n partitioned\n}\n\nexport function getCookie(name, options) {\n return findCommaSeparatedValue(document.cookie, getCookieName(name, options))\n}\nvar initCookieParsed\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie)\n }\n return initCookieParsed.get(name)\n}\n\nexport function resetInitCookies() {\n initCookieParsed = undefined\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options)\n}\n\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_cookie_test_${UUID()}`\n var testCookieValue = 'test'\n setCookie(testCookieName, testCookieValue, ONE_MINUTE, options)\n const isCookieCorrectlySet =\n getCookie(testCookieName, options) === testCookieValue\n deleteCookie(testCookieName, options)\n return isCookieCorrectlySet\n } catch (error) {\n return false\n }\n}\n\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n const testCookieName = `gc_site_test_${UUID()}`\n const testCookieValue = 'test'\n const domainLevels = window.location.hostname.split('.')\n let candidateDomain = domainLevels.pop()\n while (\n domainLevels.length &&\n !getCookie(testCookieName, {\n domain: candidateDomain\n })\n ) {\n candidateDomain = `${domainLevels.pop()}.${candidateDomain}`\n setCookie(testCookieName, testCookieValue, ONE_SECOND, {\n domain: candidateDomain\n })\n }\n deleteCookie(testCookieName, { domain: candidateDomain })\n getCurrentSiteCache = candidateDomain\n }\n return getCurrentSiteCache\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,SAASC,aAAaA,CAACC,IAAI,EAAEC,OAAO,EAAE;EACpC,UAAAC,MAAA,CAAUF,IAAI,OAAAE,MAAA,CAAID,OAAO,IAAIA,OAAO,CAACE,SAAS,GAAG,KAAK,GAAG,KAAK,OAAAD,MAAA,CAC5DD,OAAO,IAAIA,OAAO,CAACG,MAAM,GAAG,IAAI,GAAG,IAAI,OAAAF,MAAA,CACrCD,OAAO,IAAIA,OAAO,CAACI,MAAM,GAAG,MAAM,GAAG,MAAM,OAAAH,MAAA,CAC7CD,OAAO,IAAIA,OAAO,CAACK,WAAW,GAAG,OAAO,GAAG,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AS,CAACU,cAAc,EAAE;MACzBzB,MAAM,EAAEsC;IACV,CAAC,CAAC,EACF;MACAA,eAAe,MAAAxC,MAAA,CAAMmC,YAAY,CAACM,GAAG,CAAC,CAAC,OAAAzC,MAAA,CAAIwC,eAAe,CAAE;MAC5DnC,SAAS,CAACsB,cAAc,EAAEE,eAAe,EAAEc,iBAAU,EAAE;QACrDzC,MAAM,EAAEsC;MACV,CAAC,CAAC;IACJ;IACAf,YAAY,CAACE,cAAc,EAAE;MAAEzB,MAAM,EAAEsC;IAAgB,CAAC,CAAC;IACzDP,mBAAmB,GAAGO,eAAe;EACvC;EACA,OAAOP,mBAAmB;AAC5B","ignoreList":[]}
|
package/esm/browser/cookie.js
CHANGED
|
@@ -64,7 +64,9 @@ export function getCurrentSite() {
|
|
|
64
64
|
var testCookieValue = 'test';
|
|
65
65
|
var domainLevels = window.location.hostname.split('.');
|
|
66
66
|
var candidateDomain = domainLevels.pop();
|
|
67
|
-
while (domainLevels.length && !getCookie(testCookieName
|
|
67
|
+
while (domainLevels.length && !getCookie(testCookieName, {
|
|
68
|
+
domain: candidateDomain
|
|
69
|
+
})) {
|
|
68
70
|
candidateDomain = "".concat(domainLevels.pop(), ".").concat(candidateDomain);
|
|
69
71
|
setCookie(testCookieName, testCookieValue, ONE_SECOND, {
|
|
70
72
|
domain: candidateDomain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.js","names":["findCommaSeparatedValue","UUID","ONE_SECOND","ONE_MINUTE","findCommaSeparatedValues","getCookieName","name","options","concat","crossSite","domain","secure","partitioned","setCookie","value","expireDelay","date","Date","setTime","getTime","expires","toUTCString","sameSite","document","cookie","getCookie","initCookieParsed","getInitCookie","get","resetInitCookies","undefined","deleteCookie","areCookiesAuthorized","testCookieName","testCookieValue","isCookieCorrectlySet","error","getCurrentSiteCache","getCurrentSite","domainLevels","window","location","hostname","split","candidateDomain","pop","length"],"sources":["../../src/browser/cookie.js"],"sourcesContent":["import {\n findCommaSeparatedValue,\n UUID,\n ONE_SECOND,\n ONE_MINUTE,\n findCommaSeparatedValues\n} from '../helper/tools'\n\nfunction getCookieName(name, options) {\n return `${name}_${options && options.crossSite ? 'cs1' : 'cs0'}_${\n options && options.domain ? 'd1' : 'd0'\n }_${options && options.secure ? 'sec1' : 'sec0'}_${\n options && options.partitioned ? 'part1' : 'part0'\n }`\n}\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date()\n date.setTime(date.getTime() + expireDelay)\n var expires = 'expires=' + date.toUTCString()\n var sameSite = options && options.crossSite ? 'none' : 'strict'\n var domain = options && options.domain ? ';domain=' + options.domain : ''\n var secure = options && options.secure ? ';secure' : ''\n var partitioned = options && options.partitioned ? ';partitioned' : ''\n\n document.cookie =\n getCookieName(name, options) +\n '=' +\n value +\n ';' +\n expires +\n ';path=/;samesite=' +\n sameSite +\n domain +\n secure +\n partitioned\n}\n\nexport function getCookie(name, options) {\n return findCommaSeparatedValue(document.cookie, getCookieName(name, options))\n}\nvar initCookieParsed\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie)\n }\n return initCookieParsed.get(name)\n}\n\nexport function resetInitCookies() {\n initCookieParsed = undefined\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options)\n}\n\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_cookie_test_${UUID()}`\n var testCookieValue = 'test'\n setCookie(testCookieName, testCookieValue, ONE_MINUTE, options)\n const isCookieCorrectlySet =\n getCookie(testCookieName, options) === testCookieValue\n deleteCookie(testCookieName, options)\n return isCookieCorrectlySet\n } catch (error) {\n return false\n }\n}\n\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n const testCookieName = `gc_site_test_${UUID()}`\n const testCookieValue = 'test'\n
|
|
1
|
+
{"version":3,"file":"cookie.js","names":["findCommaSeparatedValue","UUID","ONE_SECOND","ONE_MINUTE","findCommaSeparatedValues","getCookieName","name","options","concat","crossSite","domain","secure","partitioned","setCookie","value","expireDelay","date","Date","setTime","getTime","expires","toUTCString","sameSite","document","cookie","getCookie","initCookieParsed","getInitCookie","get","resetInitCookies","undefined","deleteCookie","areCookiesAuthorized","testCookieName","testCookieValue","isCookieCorrectlySet","error","getCurrentSiteCache","getCurrentSite","domainLevels","window","location","hostname","split","candidateDomain","pop","length"],"sources":["../../src/browser/cookie.js"],"sourcesContent":["import {\n findCommaSeparatedValue,\n UUID,\n ONE_SECOND,\n ONE_MINUTE,\n findCommaSeparatedValues\n} from '../helper/tools'\n\nfunction getCookieName(name, options) {\n return `${name}_${options && options.crossSite ? 'cs1' : 'cs0'}_${\n options && options.domain ? 'd1' : 'd0'\n }_${options && options.secure ? 'sec1' : 'sec0'}_${\n options && options.partitioned ? 'part1' : 'part0'\n }`\n}\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date()\n date.setTime(date.getTime() + expireDelay)\n var expires = 'expires=' + date.toUTCString()\n var sameSite = options && options.crossSite ? 'none' : 'strict'\n var domain = options && options.domain ? ';domain=' + options.domain : ''\n var secure = options && options.secure ? ';secure' : ''\n var partitioned = options && options.partitioned ? ';partitioned' : ''\n\n document.cookie =\n getCookieName(name, options) +\n '=' +\n value +\n ';' +\n expires +\n ';path=/;samesite=' +\n sameSite +\n domain +\n secure +\n partitioned\n}\n\nexport function getCookie(name, options) {\n return findCommaSeparatedValue(document.cookie, getCookieName(name, options))\n}\nvar initCookieParsed\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie)\n }\n return initCookieParsed.get(name)\n}\n\nexport function resetInitCookies() {\n initCookieParsed = undefined\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options)\n}\n\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = `gc_cookie_test_${UUID()}`\n var testCookieValue = 'test'\n setCookie(testCookieName, testCookieValue, ONE_MINUTE, options)\n const isCookieCorrectlySet =\n getCookie(testCookieName, options) === testCookieValue\n deleteCookie(testCookieName, options)\n return isCookieCorrectlySet\n } catch (error) {\n return false\n }\n}\n\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n const testCookieName = `gc_site_test_${UUID()}`\n const testCookieValue = 'test'\n const domainLevels = window.location.hostname.split('.')\n let candidateDomain = domainLevels.pop()\n while (\n domainLevels.length &&\n !getCookie(testCookieName, {\n domain: candidateDomain\n })\n ) {\n candidateDomain = `${domainLevels.pop()}.${candidateDomain}`\n setCookie(testCookieName, testCookieValue, ONE_SECOND, {\n domain: candidateDomain\n })\n }\n deleteCookie(testCookieName, { domain: candidateDomain })\n getCurrentSiteCache = candidateDomain\n }\n return getCurrentSiteCache\n}\n"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,IAAI,EACJC,UAAU,EACVC,UAAU,EACVC,wBAAwB,QACnB,iBAAiB;AAExB,SAASC,aAAaA,CAACC,IAAI,EAAEC,OAAO,EAAE;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AC/B,IAAID,mBAAmB,KAAKP,SAAS,EAAE;IACrC;IACA;IACA,IAAMG,cAAc,mBAAAzB,MAAA,CAAmBP,IAAI,CAAC,CAAC,CAAE;IAC/C,IAAMiC,eAAe,GAAG,MAAM;IAC9B,IAAMK,YAAY,GAAGC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC;IACxD,IAAIC,eAAe,GAAGL,YAAY,CAACM,GAAG,CAAC,CAAC;IACxC,OACEN,YAAY,CAACO,MAAM,IACnB,CAACrB,SAAS,CAACQ,cAAc,EAAE;MACzBvB,MAAM,EAAEkC;IACV,CAAC,CAAC,EACF;MACAA,eAAe,MAAApC,MAAA,CAAM+B,YAAY,CAACM,GAAG,CAAC,CAAC,OAAArC,MAAA,CAAIoC,eAAe,CAAE;MAC5D/B,SAAS,CAACoB,cAAc,EAAEC,eAAe,EAAEhC,UAAU,EAAE;QACrDQ,MAAM,EAAEkC;MACV,CAAC,CAAC;IACJ;IACAb,YAAY,CAACE,cAAc,EAAE;MAAEvB,MAAM,EAAEkC;IAAgB,CAAC,CAAC;IACzDP,mBAAmB,GAAGO,eAAe;EACvC;EACA,OAAOP,mBAAmB;AAC5B","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.17",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"author": "dataflux",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "60003f265fb83789998c95893f5f2bd0455994ba"
|
|
26
26
|
}
|
package/src/browser/cookie.js
CHANGED
|
@@ -88,10 +88,14 @@ export function getCurrentSite() {
|
|
|
88
88
|
// the test cookie lifetime
|
|
89
89
|
const testCookieName = `gc_site_test_${UUID()}`
|
|
90
90
|
const testCookieValue = 'test'
|
|
91
|
-
|
|
92
91
|
const domainLevels = window.location.hostname.split('.')
|
|
93
92
|
let candidateDomain = domainLevels.pop()
|
|
94
|
-
while (
|
|
93
|
+
while (
|
|
94
|
+
domainLevels.length &&
|
|
95
|
+
!getCookie(testCookieName, {
|
|
96
|
+
domain: candidateDomain
|
|
97
|
+
})
|
|
98
|
+
) {
|
|
95
99
|
candidateDomain = `${domainLevels.pop()}.${candidateDomain}`
|
|
96
100
|
setCookie(testCookieName, testCookieValue, ONE_SECOND, {
|
|
97
101
|
domain: candidateDomain
|