coveo.analytics 2.33.0 → 2.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.mjs +32 -11
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +32 -11
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/version.d.ts +1 -1
- package/dist/esm/cookieutils.mjs +31 -10
- package/dist/library.cjs +60 -11452
- package/dist/library.es.js +32 -11
- package/dist/library.js +60 -11452
- package/dist/library.mjs +60 -11452
- package/dist/react-native.es.js +32 -11
- package/package.json +8 -8
- package/src/cookieutils.spec.ts +63 -8
- package/src/cookieutils.ts +32 -11
package/dist/coveoua.debug.js
CHANGED
|
@@ -164,20 +164,12 @@
|
|
|
164
164
|
function Cookie() {
|
|
165
165
|
}
|
|
166
166
|
Cookie.set = function (name, value, expire) {
|
|
167
|
-
var
|
|
167
|
+
var expirationDate;
|
|
168
168
|
if (expire) {
|
|
169
169
|
expirationDate = new Date();
|
|
170
170
|
expirationDate.setTime(expirationDate.getTime() + expire);
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
if (host.indexOf('.') === -1) {
|
|
174
|
-
writeCookie(name, value, expirationDate);
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
domainParts = host.split('.');
|
|
178
|
-
domain = domainParts[domainParts.length - 2] + '.' + domainParts[domainParts.length - 1];
|
|
179
|
-
writeCookie(name, value, expirationDate, domain);
|
|
180
|
-
}
|
|
172
|
+
writeCookie(name, value, expirationDate, getCookieDomain(window.location.hostname));
|
|
181
173
|
};
|
|
182
174
|
Cookie.get = function (name) {
|
|
183
175
|
var cookiePrefix = name + '=';
|
|
@@ -196,6 +188,35 @@
|
|
|
196
188
|
};
|
|
197
189
|
return Cookie;
|
|
198
190
|
}());
|
|
191
|
+
function getCookieDomain(host) {
|
|
192
|
+
if (host.indexOf('.') === -1) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
var domainParts = host.split('.');
|
|
196
|
+
for (var domainLength = 2; domainLength <= domainParts.length; domainLength++) {
|
|
197
|
+
var domain = domainParts.slice(-domainLength).join('.');
|
|
198
|
+
if (supportsCookieDomain(domain)) {
|
|
199
|
+
return domain;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
function supportsCookieDomain(domain) {
|
|
205
|
+
var name = "__coveo_cookie_domain_test_".concat(Math.random().toString(36).substring(2));
|
|
206
|
+
try {
|
|
207
|
+
writeCookie(name, '1', undefined, domain);
|
|
208
|
+
return Cookie.get(name) === '1';
|
|
209
|
+
}
|
|
210
|
+
catch (_a) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
try {
|
|
215
|
+
writeCookie(name, '', new Date(0), domain);
|
|
216
|
+
}
|
|
217
|
+
catch (_b) { }
|
|
218
|
+
}
|
|
219
|
+
}
|
|
199
220
|
function writeCookie(name, value, expirationDate, domain) {
|
|
200
221
|
document.cookie =
|
|
201
222
|
"".concat(name, "=").concat(value) +
|
|
@@ -664,7 +685,7 @@
|
|
|
664
685
|
v5.DNS = DNS;
|
|
665
686
|
v5.URL = URL$1;
|
|
666
687
|
|
|
667
|
-
var libVersion = "2.33.
|
|
688
|
+
var libVersion = "2.33.1";
|
|
668
689
|
|
|
669
690
|
var getFormattedLocation = function (location) {
|
|
670
691
|
return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
|