@sitecore-content-sdk/analytics-core 2.1.0-canary.1 → 2.1.0-canary.11

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.
@@ -7,8 +7,9 @@
7
7
  "url": "https://github.com/sitecore/content-sdk/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@sitecore-content-sdk/core": "2.1.0-canary.1",
11
- "debug": "^4.4.3"
10
+ "@sitecore-content-sdk/core": "2.1.0-canary.11",
11
+ "debug": "^4.4.3",
12
+ "isbot": "^5.1.39"
12
13
  },
13
14
  "description": "Provides shared logic and runtime initialization. Required for the Content SDK 'events' and 'personalize' packages to function.",
14
15
  "devDependencies": {
@@ -73,6 +74,6 @@
73
74
  "api-extractor": "npm run build && api-extractor run --local --verbose",
74
75
  "api-extractor:verify": "api-extractor run"
75
76
  },
76
- "version": "2.1.0-canary.1",
77
- "gitHead": "59794666566c6d47740b8e505ad8186c09363d64"
77
+ "version": "2.1.0-canary.11",
78
+ "gitHead": "c9e3b397b4f0402f6044dafd3dfd300070cd9dc1"
78
79
  }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBotServerSide = exports.isBotClientSide = exports.isBot = exports.BOT_DETECTION_COOKIE = void 0;
4
+ exports.getBotCookieClientSide = getBotCookieClientSide;
5
+ exports.getBotCookieServerSide = getBotCookieServerSide;
6
+ const isbot_1 = require("isbot");
7
+ const utils_1 = require("../utils");
8
+ /**
9
+ * The cookie name for bot detection.
10
+ * @internal
11
+ */
12
+ exports.BOT_DETECTION_COOKIE = 'sc_bot';
13
+ /**
14
+ * A function that checks if visitor is a bot.
15
+ * Performs a check based on the user agent.
16
+ * @param {string} userAgent - The user agent of the visitor
17
+ * @returns {boolean} True if the visitor is a bot, false otherwise
18
+ * @internal
19
+ */
20
+ const isBot = (userAgent) => {
21
+ return (0, isbot_1.isbot)(userAgent);
22
+ };
23
+ exports.isBot = isBot;
24
+ /**
25
+ * A function that checks if visitor is a bot.
26
+ * Performs a check based on the bot cookie and the user agent.
27
+ * Only available on the client-side.
28
+ * @returns {boolean} True if the visitor is a bot, false otherwise
29
+ * @internal
30
+ */
31
+ const isBotClientSide = () => {
32
+ return !!getBotCookieClientSide() || (0, isbot_1.isbot)(navigator.userAgent);
33
+ };
34
+ exports.isBotClientSide = isBotClientSide;
35
+ /**
36
+ * A function that checks if visitor is a bot.
37
+ * Performs a check based on the bot cookie and the user agent.
38
+ * Only available on the server-side.
39
+ * @param {string} cookie - The cookie string.
40
+ * @param {string} userAgent - The user agent of the visitor
41
+ * @returns {boolean} True if the visitor is a bot, false otherwise
42
+ * @internal
43
+ */
44
+ const isBotServerSide = (cookie, userAgent) => {
45
+ return !!getBotCookieServerSide(cookie) || (0, isbot_1.isbot)(userAgent);
46
+ };
47
+ exports.isBotServerSide = isBotServerSide;
48
+ /**
49
+ * A function that gets the bot cookie.
50
+ * @returns {string | undefined} The value of the bot cookie, or undefined if the cookie is not found.
51
+ * Only available on the client-side.
52
+ * @internal
53
+ */
54
+ function getBotCookieClientSide() {
55
+ return (0, utils_1.getCookieValueClientSide)(exports.BOT_DETECTION_COOKIE);
56
+ }
57
+ /**
58
+ * A function that gets the bot cookie.
59
+ * @param {string} cookie - The cookie string.
60
+ * @returns {string | undefined} The value of the bot cookie, or undefined if the cookie is not found.
61
+ * @internal
62
+ */
63
+ function getBotCookieServerSide(cookie) {
64
+ var _a;
65
+ return (_a = (0, utils_1.getCookieServerSide)(cookie, exports.BOT_DETECTION_COOKIE)) === null || _a === void 0 ? void 0 : _a.value;
66
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.analyticsBrowserAdapter = analyticsBrowserAdapter;
4
+ const bot_detection_1 = require("../bot-detection/bot-detection");
4
5
  const internal_1 = require("../internal");
5
6
  const utils_1 = require("../utils");
6
7
  const delete_cookie_1 = require("../utils/cookies/delete-cookie");
@@ -16,6 +17,9 @@ const core_1 = require("@sitecore-content-sdk/core");
16
17
  function analyticsBrowserAdapter() {
17
18
  return {
18
19
  type: 'browser',
20
+ isBot: () => {
21
+ return (0, bot_detection_1.isBotClientSide)();
22
+ },
19
23
  getClientId: () => {
20
24
  return (0, utils_1.getCookieValueClientSide)((0, plugin_1.getAnalyticsPlugin)().options.cookies.name);
21
25
  },
@@ -39,6 +39,7 @@ function analyticsPlugin(params) {
39
39
  * @internal
40
40
  */
41
41
  async function init() {
42
+ var _a;
42
43
  debugInit(`Initializing ${const_1.ANALYTICS_PLUGIN_NAME}`);
43
44
  const coreContext = (0, core_1.getCoreContext)();
44
45
  const analyticsPlugin = getAnalyticsPlugin();
@@ -47,7 +48,8 @@ async function init() {
47
48
  return;
48
49
  }
49
50
  const adapter = analyticsPlugin.adapter;
50
- if (!adapter.getClientId() || analyticsPlugin.adapter.type !== 'browser') {
51
+ const isBot = (_a = adapter.isBot) === null || _a === void 0 ? void 0 : _a.call(adapter);
52
+ if (!isBot && (!adapter.getClientId() || analyticsPlugin.adapter.type !== 'browser')) {
51
53
  await adapter.setClientId();
52
54
  debugInit(`Cookie set for ${const_1.ANALYTICS_PLUGIN_NAME}`);
53
55
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.analyticsServerAdapter = analyticsServerAdapter;
4
+ const bot_detection_1 = require("../bot-detection/bot-detection");
4
5
  const internal_1 = require("../internal");
5
6
  const utils_1 = require("../utils");
6
7
  const plugin_1 = require("./plugin");
@@ -19,6 +20,9 @@ const core_1 = require("@sitecore-content-sdk/core");
19
20
  function analyticsServerAdapter(request, response) {
20
21
  return {
21
22
  type: 'server',
23
+ isBot: () => {
24
+ return (0, bot_detection_1.isBotServerSide)(request.headers.cookie, request.headers['user-agent']);
25
+ },
22
26
  getClientId: () => {
23
27
  return getClientId(request);
24
28
  },
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ANALYTICS_PLUGIN_NAME = exports.getAnalyticsPlugin = exports.fetchClientIdFromEdgeProxy = exports.CLIENT_ID_COOKIE_NAME = exports.CORRELATION_ID_HEADER = exports.LIBRARY_VERSION = exports.DEFAULT_COOKIE_EXPIRY_DAYS = exports.DAILY_SECONDS = exports.COOKIE_NAME_PREFIX = exports.API_VERSION = exports.generateCorrelationId = exports.pageName = exports.language = exports.getDefaultCookieAttributes = void 0;
3
+ exports.BOT_DETECTION_COOKIE = exports.isBotServerSide = exports.isBotClientSide = exports.isBot = exports.ANALYTICS_PLUGIN_NAME = exports.getAnalyticsPlugin = exports.fetchClientIdFromEdgeProxy = exports.CLIENT_ID_COOKIE_NAME = exports.CORRELATION_ID_HEADER = exports.LIBRARY_VERSION = exports.DEFAULT_COOKIE_EXPIRY_DAYS = exports.DAILY_SECONDS = exports.COOKIE_NAME_PREFIX = exports.API_VERSION = exports.generateCorrelationId = exports.pageName = exports.language = exports.getDefaultCookieAttributes = void 0;
4
4
  var get_default_cookie_attributes_1 = require("./cookie/get-default-cookie-attributes");
5
5
  Object.defineProperty(exports, "getDefaultCookieAttributes", { enumerable: true, get: function () { return get_default_cookie_attributes_1.getDefaultCookieAttributes; } });
6
6
  var infer_1 = require("./infer/infer");
@@ -22,3 +22,8 @@ var plugin_1 = require("./initialization/plugin");
22
22
  Object.defineProperty(exports, "getAnalyticsPlugin", { enumerable: true, get: function () { return plugin_1.getAnalyticsPlugin; } });
23
23
  var const_1 = require("./initialization/const");
24
24
  Object.defineProperty(exports, "ANALYTICS_PLUGIN_NAME", { enumerable: true, get: function () { return const_1.ANALYTICS_PLUGIN_NAME; } });
25
+ var bot_detection_1 = require("./bot-detection/bot-detection");
26
+ Object.defineProperty(exports, "isBot", { enumerable: true, get: function () { return bot_detection_1.isBot; } });
27
+ Object.defineProperty(exports, "isBotClientSide", { enumerable: true, get: function () { return bot_detection_1.isBotClientSide; } });
28
+ Object.defineProperty(exports, "isBotServerSide", { enumerable: true, get: function () { return bot_detection_1.isBotServerSide; } });
29
+ Object.defineProperty(exports, "BOT_DETECTION_COOKIE", { enumerable: true, get: function () { return bot_detection_1.BOT_DETECTION_COOKIE; } });
@@ -7,8 +7,9 @@
7
7
  "url": "https://github.com/sitecore/content-sdk/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@sitecore-content-sdk/core": "2.1.0-canary.1",
11
- "debug": "^4.4.3"
10
+ "@sitecore-content-sdk/core": "2.1.0-canary.11",
11
+ "debug": "^4.4.3",
12
+ "isbot": "^5.1.39"
12
13
  },
13
14
  "description": "Provides shared logic and runtime initialization. Required for the Content SDK 'events' and 'personalize' packages to function.",
14
15
  "devDependencies": {
@@ -73,6 +74,6 @@
73
74
  "api-extractor": "npm run build && api-extractor run --local --verbose",
74
75
  "api-extractor:verify": "api-extractor run"
75
76
  },
76
- "version": "2.1.0-canary.1",
77
- "gitHead": "59794666566c6d47740b8e505ad8186c09363d64"
77
+ "version": "2.1.0-canary.11",
78
+ "gitHead": "c9e3b397b4f0402f6044dafd3dfd300070cd9dc1"
78
79
  }
@@ -0,0 +1,58 @@
1
+ import { isbot } from 'isbot';
2
+ import { getCookieServerSide, getCookieValueClientSide } from '../utils';
3
+ /**
4
+ * The cookie name for bot detection.
5
+ * @internal
6
+ */
7
+ export const BOT_DETECTION_COOKIE = 'sc_bot';
8
+ /**
9
+ * A function that checks if visitor is a bot.
10
+ * Performs a check based on the user agent.
11
+ * @param {string} userAgent - The user agent of the visitor
12
+ * @returns {boolean} True if the visitor is a bot, false otherwise
13
+ * @internal
14
+ */
15
+ export const isBot = (userAgent) => {
16
+ return isbot(userAgent);
17
+ };
18
+ /**
19
+ * A function that checks if visitor is a bot.
20
+ * Performs a check based on the bot cookie and the user agent.
21
+ * Only available on the client-side.
22
+ * @returns {boolean} True if the visitor is a bot, false otherwise
23
+ * @internal
24
+ */
25
+ export const isBotClientSide = () => {
26
+ return !!getBotCookieClientSide() || isbot(navigator.userAgent);
27
+ };
28
+ /**
29
+ * A function that checks if visitor is a bot.
30
+ * Performs a check based on the bot cookie and the user agent.
31
+ * Only available on the server-side.
32
+ * @param {string} cookie - The cookie string.
33
+ * @param {string} userAgent - The user agent of the visitor
34
+ * @returns {boolean} True if the visitor is a bot, false otherwise
35
+ * @internal
36
+ */
37
+ export const isBotServerSide = (cookie, userAgent) => {
38
+ return !!getBotCookieServerSide(cookie) || isbot(userAgent);
39
+ };
40
+ /**
41
+ * A function that gets the bot cookie.
42
+ * @returns {string | undefined} The value of the bot cookie, or undefined if the cookie is not found.
43
+ * Only available on the client-side.
44
+ * @internal
45
+ */
46
+ export function getBotCookieClientSide() {
47
+ return getCookieValueClientSide(BOT_DETECTION_COOKIE);
48
+ }
49
+ /**
50
+ * A function that gets the bot cookie.
51
+ * @param {string} cookie - The cookie string.
52
+ * @returns {string | undefined} The value of the bot cookie, or undefined if the cookie is not found.
53
+ * @internal
54
+ */
55
+ export function getBotCookieServerSide(cookie) {
56
+ var _a;
57
+ return (_a = getCookieServerSide(cookie, BOT_DETECTION_COOKIE)) === null || _a === void 0 ? void 0 : _a.value;
58
+ }
@@ -1,3 +1,4 @@
1
+ import { isBotClientSide } from '../bot-detection/bot-detection';
1
2
  import { COOKIE_NAME_PREFIX, fetchClientIdFromEdgeProxy, getDefaultCookieAttributes, } from '../internal';
2
3
  import { createCookieString, getCookieValueClientSide } from '../utils';
3
4
  import { deleteCookie } from '../utils/cookies/delete-cookie';
@@ -13,6 +14,9 @@ import { getCoreContext } from '@sitecore-content-sdk/core';
13
14
  export function analyticsBrowserAdapter() {
14
15
  return {
15
16
  type: 'browser',
17
+ isBot: () => {
18
+ return isBotClientSide();
19
+ },
16
20
  getClientId: () => {
17
21
  return getCookieValueClientSide(getAnalyticsPlugin().options.cookies.name);
18
22
  },
@@ -35,6 +35,7 @@ export function analyticsPlugin(params) {
35
35
  * @internal
36
36
  */
37
37
  async function init() {
38
+ var _a;
38
39
  debugInit(`Initializing ${ANALYTICS_PLUGIN_NAME}`);
39
40
  const coreContext = getCoreContext();
40
41
  const analyticsPlugin = getAnalyticsPlugin();
@@ -43,7 +44,8 @@ async function init() {
43
44
  return;
44
45
  }
45
46
  const adapter = analyticsPlugin.adapter;
46
- if (!adapter.getClientId() || analyticsPlugin.adapter.type !== 'browser') {
47
+ const isBot = (_a = adapter.isBot) === null || _a === void 0 ? void 0 : _a.call(adapter);
48
+ if (!isBot && (!adapter.getClientId() || analyticsPlugin.adapter.type !== 'browser')) {
47
49
  await adapter.setClientId();
48
50
  debugInit(`Cookie set for ${ANALYTICS_PLUGIN_NAME}`);
49
51
  }
@@ -1,3 +1,4 @@
1
+ import { isBotServerSide } from '../bot-detection/bot-detection';
1
2
  import { COOKIE_NAME_PREFIX, fetchClientIdFromEdgeProxy, getDefaultCookieAttributes, } from '../internal';
2
3
  import { createCookieString, getCookieServerSide } from '../utils';
3
4
  import { getAnalyticsPlugin } from './plugin';
@@ -16,6 +17,9 @@ import { getCoreContext } from '@sitecore-content-sdk/core';
16
17
  export function analyticsServerAdapter(request, response) {
17
18
  return {
18
19
  type: 'server',
20
+ isBot: () => {
21
+ return isBotServerSide(request.headers.cookie, request.headers['user-agent']);
22
+ },
19
23
  getClientId: () => {
20
24
  return getClientId(request);
21
25
  },
@@ -5,3 +5,4 @@ export { API_VERSION, COOKIE_NAME_PREFIX, DAILY_SECONDS, DEFAULT_COOKIE_EXPIRY_D
5
5
  export { fetchClientIdFromEdgeProxy } from './client-id/fetch-client-id-from-edge-proxy';
6
6
  export { getAnalyticsPlugin } from './initialization/plugin';
7
7
  export { ANALYTICS_PLUGIN_NAME } from './initialization/const';
8
+ export { isBot, isBotClientSide, isBotServerSide, BOT_DETECTION_COOKIE } from './bot-detection/bot-detection';
package/package.json CHANGED
@@ -7,8 +7,9 @@
7
7
  "url": "https://github.com/sitecore/content-sdk/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@sitecore-content-sdk/core": "2.1.0-canary.1",
11
- "debug": "^4.4.3"
10
+ "@sitecore-content-sdk/core": "2.1.0-canary.11",
11
+ "debug": "^4.4.3",
12
+ "isbot": "^5.1.39"
12
13
  },
13
14
  "description": "Provides shared logic and runtime initialization. Required for the Content SDK 'events' and 'personalize' packages to function.",
14
15
  "devDependencies": {
@@ -73,6 +74,6 @@
73
74
  "api-extractor": "npm run build && api-extractor run --local --verbose",
74
75
  "api-extractor:verify": "api-extractor run"
75
76
  },
76
- "version": "2.1.0-canary.1",
77
- "gitHead": "59794666566c6d47740b8e505ad8186c09363d64"
77
+ "version": "2.1.0-canary.11",
78
+ "gitHead": "c9e3b397b4f0402f6044dafd3dfd300070cd9dc1"
78
79
  }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The cookie name for bot detection.
3
+ * @internal
4
+ */
5
+ export declare const BOT_DETECTION_COOKIE = "sc_bot";
6
+ /**
7
+ * A function that checks if visitor is a bot.
8
+ * Performs a check based on the user agent.
9
+ * @param {string} userAgent - The user agent of the visitor
10
+ * @returns {boolean} True if the visitor is a bot, false otherwise
11
+ * @internal
12
+ */
13
+ export declare const isBot: (userAgent?: string | null) => boolean;
14
+ /**
15
+ * A function that checks if visitor is a bot.
16
+ * Performs a check based on the bot cookie and the user agent.
17
+ * Only available on the client-side.
18
+ * @returns {boolean} True if the visitor is a bot, false otherwise
19
+ * @internal
20
+ */
21
+ export declare const isBotClientSide: () => boolean;
22
+ /**
23
+ * A function that checks if visitor is a bot.
24
+ * Performs a check based on the bot cookie and the user agent.
25
+ * Only available on the server-side.
26
+ * @param {string} cookie - The cookie string.
27
+ * @param {string} userAgent - The user agent of the visitor
28
+ * @returns {boolean} True if the visitor is a bot, false otherwise
29
+ * @internal
30
+ */
31
+ export declare const isBotServerSide: (cookie?: string, userAgent?: string | null) => boolean;
32
+ /**
33
+ * A function that gets the bot cookie.
34
+ * @returns {string | undefined} The value of the bot cookie, or undefined if the cookie is not found.
35
+ * Only available on the client-side.
36
+ * @internal
37
+ */
38
+ export declare function getBotCookieClientSide(): string | undefined;
39
+ /**
40
+ * A function that gets the bot cookie.
41
+ * @param {string} cookie - The cookie string.
42
+ * @returns {string | undefined} The value of the bot cookie, or undefined if the cookie is not found.
43
+ * @internal
44
+ */
45
+ export declare function getBotCookieServerSide(cookie?: string): string | undefined;
46
+ //# sourceMappingURL=bot-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-detection.d.ts","sourceRoot":"","sources":["../../../src/bot-detection/bot-detection.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,YAAY,MAAM,GAAG,IAAI,KAAG,OAEjD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,QAAO,OAElC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,EAAE,YAAY,MAAM,GAAG,IAAI,KAAG,OAE5E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"browser-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/browser-adapter.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,uBAAuB,CA8CjE"}
1
+ {"version":3,"file":"browser-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/browser-adapter.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C;;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version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/initialization/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQ5D,OAAO,EAAyB,WAAW,EAAa,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB;;WAEG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;WAEG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAoB9E;AAyCD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAOpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAa;QACrB,WAAW,EAAE,OAAO,WAAW,CAAC;QAChC,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,EAAE,MAAM,CAAC;KACjB;IACD,UAAU,YAAY;QACpB,cAAc,EAAE,aAAa,CAAC;KAC/B;IAED,UAAU,MAAM;QACd,YAAY,EAAE,YAAY,CAAC;KAC5B;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"server-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/server-adapter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,SAAS,eAAe,EAC/B,QAAQ,SAAS,eAAe,EAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,sBAAsB,CAiF9D"}
1
+ {"version":3,"file":"server-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/server-adapter.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,SAAS,eAAe,EAC/B,QAAQ,SAAS,eAAe,EAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,sBAAsB,CAoF9D"}
@@ -6,6 +6,11 @@ import { ANALYTICS_PLUGIN_NAME } from './const';
6
6
  * @public
7
7
  */
8
8
  export interface AnalyticsAdapter extends PluginAdapter {
9
+ /**
10
+ * Checks if the current request is a bot.
11
+ * @returns {boolean} True if the current request is a bot, false otherwise.
12
+ */
13
+ isBot?: () => boolean;
9
14
  /**
10
15
  * Gets the client ID.
11
16
  * @returns {string | null} The client ID, or null if it is not set.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/initialization/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,4BAA4B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,EAAE,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACjC;;;OAGG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE;QACR;;;WAGG;QACH,eAAe,EAAE,MAAM,MAAM,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE;QACP;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;OAEG;IACH,IAAI,EAAE,OAAO,qBAAqB,CAAC;CACpC"}
@@ -9,4 +9,5 @@ export { ANALYTICS_PLUGIN_NAME } from './initialization/const';
9
9
  export type { AnalyticsPlugin } from './initialization/types';
10
10
  export { AnalyticsAdapter, AnalyticsOptions } from './initialization/types';
11
11
  export type { VisitorIds } from './interfaces';
12
+ export { isBot, isBotClientSide, isBotServerSide, BOT_DETECTION_COOKIE } from './bot-detection/bot-detection';
12
13
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,YAAY,EAAE,UAAU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