@databiosphere/findable-ui 49.2.0 → 49.4.0

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "49.2.0"
2
+ ".": "49.4.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [49.4.0](https://github.com/DataBiosphere/findable-ui/compare/v49.3.0...v49.4.0) (2026-03-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * add tracking to research mode submit ([#812](https://github.com/DataBiosphere/findable-ui/issues/812)) ([#813](https://github.com/DataBiosphere/findable-ui/issues/813)) ([de4fac9](https://github.com/DataBiosphere/findable-ui/commit/de4fac9690dadd441fa14b5edafe8691f0bc5ebb))
9
+
10
+ ## [49.3.0](https://github.com/DataBiosphere/findable-ui/compare/v49.2.0...v49.3.0) (2026-03-02)
11
+
12
+
13
+ ### Features
14
+
15
+ * render the research toggle button after the search toggle ([#809](https://github.com/DataBiosphere/findable-ui/issues/809)) ([#810](https://github.com/DataBiosphere/findable-ui/issues/810)) ([88ae5e5](https://github.com/DataBiosphere/findable-ui/commit/88ae5e5887b75cec3729a556bc7672c7842aa340))
16
+
3
17
  ## [49.2.0](https://github.com/DataBiosphere/findable-ui/compare/v49.1.0...v49.2.0) (2026-03-02)
4
18
 
5
19
 
@@ -10,8 +10,15 @@ export declare function getDataLayer(): DataLayer | undefined;
10
10
  */
11
11
  export declare function getGTMId(): string | undefined;
12
12
  /**
13
- * Send custom event to GTM.
13
+ * Sends a custom event to GTM without params.
14
+ * @param eventName - Event name.
15
+ * @returns void.
16
+ */
17
+ export declare function track(eventName: Exclude<EVENT_NAME, keyof EventParams>): void;
18
+ /**
19
+ * Sends a custom event to GTM with params.
14
20
  * @param eventName - Event name.
15
21
  * @param params - Event params.
22
+ * @returns void.
16
23
  */
17
- export declare function track(eventName: EVENT_NAME, params: EventParams[typeof eventName]): void;
24
+ export declare function track<E extends keyof EventParams>(eventName: E, params: EventParams[E]): void;
@@ -20,15 +20,10 @@ export function getGTMId() {
20
20
  function isTrackingEnabled() {
21
21
  return !!getDataLayer();
22
22
  }
23
- /**
24
- * Send custom event to GTM.
25
- * @param eventName - Event name.
26
- * @param params - Event params.
27
- */
28
23
  export function track(eventName, params) {
29
24
  if (!isTrackingEnabled()) {
30
25
  return;
31
26
  }
32
- const event = { event: eventName, params: params };
27
+ const event = { event: eventName, params };
33
28
  getDataLayer().push(event);
34
29
  }
@@ -4,6 +4,7 @@ export type DataLayer = any;
4
4
  */
5
5
  export declare enum EVENT_NAME {
6
6
  BULK_DOWNLOAD_REQUESTED = "bulk_download_requested",
7
+ CHAT_SUBMITTED = "chat_submitted",
7
8
  ENTITY_SELECTED = "entity_selected",
8
9
  ENTITY_TABLE_PAGINATED = "entity_table_paginated",
9
10
  ENTITY_TABLE_SORTED = "entity_table_sorted",
@@ -4,6 +4,7 @@
4
4
  export var EVENT_NAME;
5
5
  (function (EVENT_NAME) {
6
6
  EVENT_NAME["BULK_DOWNLOAD_REQUESTED"] = "bulk_download_requested";
7
+ EVENT_NAME["CHAT_SUBMITTED"] = "chat_submitted";
7
8
  EVENT_NAME["ENTITY_SELECTED"] = "entity_selected";
8
9
  EVENT_NAME["ENTITY_TABLE_PAGINATED"] = "entity_table_paginated";
9
10
  EVENT_NAME["ENTITY_TABLE_SORTED"] = "entity_table_sorted";
@@ -13,5 +13,5 @@ export const ToggleButtonGroup = () => {
13
13
  const { routes } = useAiRoutes() || {};
14
14
  if (!routes)
15
15
  return null;
16
- return (_jsx(StyledBox, { children: _jsxs(StyledToggleButtonGroup, { exclusive: true, children: [_jsxs(ToggleButton, { component: Link, href: routes.research, value: "research", children: ["Research ", _jsx(Beta, {})] }), _jsx(ToggleButton, { component: Link, href: routes.search, selected: true, value: "search", children: "Search" })] }) }));
16
+ return (_jsx(StyledBox, { children: _jsxs(StyledToggleButtonGroup, { exclusive: true, children: [_jsx(ToggleButton, { component: Link, href: routes.search, selected: true, value: "search", children: "Search" }), _jsxs(ToggleButton, { component: Link, href: routes.research, value: "research", children: ["Research ", _jsx(Beta, {})] })] }) }));
17
17
  };
@@ -12,5 +12,5 @@ export const ToggleButtonGroup = () => {
12
12
  const { routes } = useAiRoutes() || {};
13
13
  if (!routes)
14
14
  return null;
15
- return (_jsx(StyledBox, { children: _jsxs(StyledToggleButtonGroup, { exclusive: true, children: [_jsxs(ToggleButton, { component: Link, href: routes.research, selected: true, value: "research", children: ["Research ", _jsx(Beta, {})] }), _jsx(ToggleButton, { component: Link, href: routes.search, value: "search", children: "Search" })] }) }));
15
+ return (_jsx(StyledBox, { children: _jsxs(StyledToggleButtonGroup, { exclusive: true, children: [_jsx(ToggleButton, { component: Link, href: routes.search, value: "search", children: "Search" }), _jsxs(ToggleButton, { component: Link, href: routes.research, selected: true, value: "research", children: ["Research ", _jsx(Beta, {})] })] }) }));
16
16
  };
@@ -1,6 +1,8 @@
1
1
  import { useCallback, useRef } from "react";
2
2
  import { fetchResponse } from "../../../../query/fetch";
3
3
  import { useChatDispatch } from "../../../hooks/UseChatDispatch/hook";
4
+ import { track } from "../../../../../../common/analytics/analytics";
5
+ import { EVENT_NAME } from "../../../../../../common/analytics/entities";
4
6
  /**
5
7
  * Hook that manages query submission and abort lifecycle.
6
8
  * @param url - The API URL to send queries to.
@@ -16,6 +18,8 @@ export const useSubmit = (url) => {
16
18
  const { query } = payload;
17
19
  if (!query)
18
20
  return;
21
+ // Tracking chat submission event.
22
+ track(EVENT_NAME.CHAT_SUBMITTED);
19
23
  const form = e.currentTarget;
20
24
  // Dispatch query and loading state.
21
25
  dispatch.onSetQuery(query);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "49.2.0",
3
+ "version": "49.4.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -26,17 +26,25 @@ function isTrackingEnabled(): boolean {
26
26
  }
27
27
 
28
28
  /**
29
- * Send custom event to GTM.
29
+ * Sends a custom event to GTM without params.
30
+ * @param eventName - Event name.
31
+ * @returns void.
32
+ */
33
+ export function track(eventName: Exclude<EVENT_NAME, keyof EventParams>): void;
34
+ /**
35
+ * Sends a custom event to GTM with params.
30
36
  * @param eventName - Event name.
31
37
  * @param params - Event params.
38
+ * @returns void.
32
39
  */
33
- export function track(
34
- eventName: EVENT_NAME,
35
- params: EventParams[typeof eventName],
36
- ): void {
40
+ export function track<E extends keyof EventParams>(
41
+ eventName: E,
42
+ params: EventParams[E],
43
+ ): void;
44
+ export function track(eventName: EVENT_NAME, params?: unknown): void {
37
45
  if (!isTrackingEnabled()) {
38
46
  return;
39
47
  }
40
- const event = { event: eventName, params: params };
48
+ const event = { event: eventName, params };
41
49
  getDataLayer().push(event);
42
50
  }
@@ -6,6 +6,7 @@ export type DataLayer = any;
6
6
  */
7
7
  export enum EVENT_NAME {
8
8
  BULK_DOWNLOAD_REQUESTED = "bulk_download_requested",
9
+ CHAT_SUBMITTED = "chat_submitted",
9
10
  ENTITY_SELECTED = "entity_selected",
10
11
  ENTITY_TABLE_PAGINATED = "entity_table_paginated",
11
12
  ENTITY_TABLE_SORTED = "entity_table_sorted",
@@ -18,9 +18,6 @@ export const ToggleButtonGroup = (): JSX.Element | null => {
18
18
  return (
19
19
  <StyledBox>
20
20
  <StyledToggleButtonGroup exclusive>
21
- <ToggleButton component={Link} href={routes.research} value="research">
22
- Research <Beta />
23
- </ToggleButton>
24
21
  <ToggleButton
25
22
  component={Link}
26
23
  href={routes.search}
@@ -29,6 +26,9 @@ export const ToggleButtonGroup = (): JSX.Element | null => {
29
26
  >
30
27
  Search
31
28
  </ToggleButton>
29
+ <ToggleButton component={Link} href={routes.research} value="research">
30
+ Research <Beta />
31
+ </ToggleButton>
32
32
  </StyledToggleButtonGroup>
33
33
  </StyledBox>
34
34
  );
@@ -17,6 +17,9 @@ export const ToggleButtonGroup = (): JSX.Element | null => {
17
17
  return (
18
18
  <StyledBox>
19
19
  <StyledToggleButtonGroup exclusive>
20
+ <ToggleButton component={Link} href={routes.search} value="search">
21
+ Search
22
+ </ToggleButton>
20
23
  <ToggleButton
21
24
  component={Link}
22
25
  href={routes.research}
@@ -25,9 +28,6 @@ export const ToggleButtonGroup = (): JSX.Element | null => {
25
28
  >
26
29
  Research <Beta />
27
30
  </ToggleButton>
28
- <ToggleButton component={Link} href={routes.search} value="search">
29
- Search
30
- </ToggleButton>
31
31
  </StyledToggleButtonGroup>
32
32
  </StyledBox>
33
33
  );
@@ -7,6 +7,8 @@ import {
7
7
  OnSubmitPayload,
8
8
  QueryContextValue,
9
9
  } from "../../types";
10
+ import { track } from "../../../../../../common/analytics/analytics";
11
+ import { EVENT_NAME } from "../../../../../../common/analytics/entities";
10
12
 
11
13
  /**
12
14
  * Hook that manages query submission and abort lifecycle.
@@ -30,6 +32,9 @@ export const useSubmit = (url: string): Pick<QueryContextValue, "onSubmit"> => {
30
32
  const { query } = payload;
31
33
  if (!query) return;
32
34
 
35
+ // Tracking chat submission event.
36
+ track(EVENT_NAME.CHAT_SUBMITTED);
37
+
33
38
  const form = e.currentTarget;
34
39
 
35
40
  // Dispatch query and loading state.