@databiosphere/findable-ui 9.0.0 → 9.1.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.
@@ -4,7 +4,7 @@ import { ANCHOR_TARGET, REL_ATTRIBUTE, } from "../../../../../../../../../Links/
4
4
  import { FormStep } from "../../formStep";
5
5
  export const ConnectTerraToNIHAccount = ({ active, completed, step, }) => {
6
6
  const onGotoTutorial = () => {
7
- window.open("https://support.terra.bio/hc/en-us/articles/360038086332-Linking-authorization-accessing-controlled-data-on-external-servers", ANCHOR_TARGET.BLANK, REL_ATTRIBUTE.NO_OPENER_NO_REFERRER);
7
+ window.open("https://support.terra.bio/hc/en-us/articles/19124069598235-Access-controlled-data-files-by-linking-your-NIH-account-in-Terra", ANCHOR_TARGET.BLANK, REL_ATTRIBUTE.NO_OPENER_NO_REFERRER);
8
8
  };
9
9
  return (React.createElement(FormStep, { action: React.createElement(ButtonPrimary, { onClick: onGotoTutorial }, "Go to Tutorial"), active: active, completed: completed, step: step, text: React.createElement("p", null, "Next, connect your Terra account to your NIH account by following the tutorial below."), title: "Connect Terra to your NIH account" }));
10
10
  };
@@ -5,4 +5,4 @@ import { ReadonlyURLSearchParams } from "next/navigation";
5
5
  * @param searchStr - Search string.
6
6
  * @returns updated search params.
7
7
  */
8
- export declare function getSearchParams(searchParams: ReadonlyURLSearchParams, searchStr: string): URLSearchParams;
8
+ export declare function getSearchParams(searchParams: ReadonlyURLSearchParams | null, searchStr: string): URLSearchParams;
@@ -1,4 +1,14 @@
1
1
  import { SEARCH_PARAMETERS } from "./constants";
2
+ /**
3
+ * Return a new URLSearchParams object.
4
+ * @param searchParams - Search params.
5
+ * @returns new URLSearchParams object.
6
+ */
7
+ function getNewURLSearchParams(searchParams) {
8
+ if (!searchParams)
9
+ return new URLSearchParams();
10
+ return new URLSearchParams(searchParams.toString());
11
+ }
2
12
  /**
3
13
  * Return the search params, for the given search string.
4
14
  * @param searchParams - Current search params.
@@ -6,7 +16,7 @@ import { SEARCH_PARAMETERS } from "./constants";
6
16
  * @returns updated search params.
7
17
  */
8
18
  export function getSearchParams(searchParams, searchStr) {
9
- const params = new URLSearchParams(searchParams.toString());
19
+ const params = getNewURLSearchParams(searchParams);
10
20
  params.set(SEARCH_PARAMETERS.QUERY, searchStr);
11
21
  return params;
12
22
  }
@@ -22,7 +22,7 @@ export const AuthContext = createContext({
22
22
  authenticateUser: () => { },
23
23
  authenticationStatus: AUTHENTICATION_STATUS.INCOMPLETE,
24
24
  isAuthenticated: false,
25
- isEnabled: true,
25
+ isEnabled: false,
26
26
  // eslint-disable-next-line @typescript-eslint/no-empty-function -- allow dummy function for default state.
27
27
  requestAuthentication: () => { },
28
28
  terraNIHProfileLoginStatus: LOGIN_STATUS_NOT_STARTED,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -19,7 +19,7 @@ export const ConnectTerraToNIHAccount = ({
19
19
  }: ConnectTerraToNIHAccountProps): JSX.Element | null => {
20
20
  const onGotoTutorial = (): void => {
21
21
  window.open(
22
- "https://support.terra.bio/hc/en-us/articles/360038086332-Linking-authorization-accessing-controlled-data-on-external-servers",
22
+ "https://support.terra.bio/hc/en-us/articles/19124069598235-Access-controlled-data-files-by-linking-your-NIH-account-in-Terra",
23
23
  ANCHOR_TARGET.BLANK,
24
24
  REL_ATTRIBUTE.NO_OPENER_NO_REFERRER
25
25
  );
@@ -1,6 +1,18 @@
1
1
  import { ReadonlyURLSearchParams } from "next/navigation";
2
2
  import { SEARCH_PARAMETERS } from "./constants";
3
3
 
4
+ /**
5
+ * Return a new URLSearchParams object.
6
+ * @param searchParams - Search params.
7
+ * @returns new URLSearchParams object.
8
+ */
9
+ function getNewURLSearchParams(
10
+ searchParams: ReadonlyURLSearchParams | null
11
+ ): URLSearchParams {
12
+ if (!searchParams) return new URLSearchParams();
13
+ return new URLSearchParams(searchParams.toString());
14
+ }
15
+
4
16
  /**
5
17
  * Return the search params, for the given search string.
6
18
  * @param searchParams - Current search params.
@@ -8,10 +20,10 @@ import { SEARCH_PARAMETERS } from "./constants";
8
20
  * @returns updated search params.
9
21
  */
10
22
  export function getSearchParams(
11
- searchParams: ReadonlyURLSearchParams,
23
+ searchParams: ReadonlyURLSearchParams | null,
12
24
  searchStr: string
13
25
  ): URLSearchParams {
14
- const params = new URLSearchParams(searchParams.toString());
26
+ const params = getNewURLSearchParams(searchParams);
15
27
  params.set(SEARCH_PARAMETERS.QUERY, searchStr);
16
28
  return params;
17
29
  }
@@ -58,7 +58,7 @@ export const AuthContext = createContext<AuthContextProps>({
58
58
  authenticateUser: () => {},
59
59
  authenticationStatus: AUTHENTICATION_STATUS.INCOMPLETE,
60
60
  isAuthenticated: false,
61
- isEnabled: true,
61
+ isEnabled: false,
62
62
  // eslint-disable-next-line @typescript-eslint/no-empty-function -- allow dummy function for default state.
63
63
  requestAuthentication: () => {},
64
64
  terraNIHProfileLoginStatus: