@databiosphere/findable-ui 11.0.0 → 13.0.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.
Files changed (101) hide show
  1. package/.github/workflows/release-please.yml +48 -0
  2. package/.github/workflows/run-checks.yml +41 -15
  3. package/.prettierignore +1 -0
  4. package/CHANGELOG.md +25 -0
  5. package/jest.config.js +1 -1
  6. package/lib/common/analytics/entities.d.ts +0 -2
  7. package/lib/common/analytics/entities.js +0 -1
  8. package/lib/components/Export/common/tracking.js +0 -1
  9. package/lib/components/Export/components/ExportMethod/exportMethod.d.ts +2 -1
  10. package/lib/components/Export/components/ExportMethod/exportMethod.js +2 -3
  11. package/lib/components/Index/components/Hero/components/ExportButton/exportButton.js +1 -1
  12. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.d.ts +2 -1
  13. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.js +3 -2
  14. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.styles.js +3 -3
  15. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.d.ts +6 -0
  16. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.js +5 -0
  17. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.styles.d.ts +4 -0
  18. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.styles.js +13 -0
  19. package/lib/components/Layout/components/Header/common/entities.d.ts +1 -0
  20. package/lib/components/Layout/components/Header/common/utils.d.ts +9 -1
  21. package/lib/components/Layout/components/Header/common/utils.js +16 -1
  22. package/lib/components/Layout/components/Header/hooks/useHeaderVisibility.js +2 -1
  23. package/lib/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.js +1 -3
  24. package/lib/components/TempError/tempError.d.ts +2 -2
  25. package/lib/components/TempError/tempError.js +4 -4
  26. package/lib/components/common/Button/components/CallToActionButton/callToActionButton.d.ts +3 -1
  27. package/lib/components/common/Button/components/CallToActionButton/callToActionButton.js +2 -2
  28. package/lib/components/common/Markdown/markdown.d.ts +3 -1
  29. package/lib/components/common/Markdown/markdown.js +3 -2
  30. package/lib/config/entities.d.ts +0 -1
  31. package/lib/entity/api/service.js +16 -18
  32. package/lib/entity/common/client.d.ts +6 -10
  33. package/lib/entity/common/client.js +21 -31
  34. package/lib/entity/common/service.js +6 -8
  35. package/lib/entity/common/utils.d.ts +4 -4
  36. package/lib/entity/common/utils.js +3 -3
  37. package/lib/shared/utils.d.ts +0 -5
  38. package/lib/shared/utils.js +0 -8
  39. package/lib/theme/common/palette.d.ts +35 -129
  40. package/lib/theme/common/palette.js +57 -69
  41. package/package.json +8 -7
  42. package/src/common/analytics/entities.ts +0 -2
  43. package/src/common/analytics/readme-analytics.md +17 -7
  44. package/src/components/Export/common/tracking.ts +0 -1
  45. package/src/components/Export/components/ExportMethod/exportMethod.tsx +14 -4
  46. package/src/components/Index/components/Hero/components/ExportButton/exportButton.tsx +5 -1
  47. package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.styles.ts +3 -3
  48. package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.tsx +5 -1
  49. package/src/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.styles.ts +14 -0
  50. package/src/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.tsx +13 -0
  51. package/src/components/Layout/components/Header/common/entities.ts +1 -0
  52. package/src/components/Layout/components/Header/common/utils.ts +23 -1
  53. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +1 -1
  54. package/src/components/Layout/components/Header/hooks/useHeaderVisibility.ts +3 -1
  55. package/src/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.tsx +1 -2
  56. package/src/components/TempError/tempError.tsx +10 -9
  57. package/src/components/common/Button/components/CallToActionButton/callToActionButton.tsx +5 -0
  58. package/src/components/common/Code/code.tsx +1 -1
  59. package/src/components/common/CopyToClipboard/copyToClipboard.tsx +1 -1
  60. package/src/components/common/Markdown/markdown.tsx +8 -2
  61. package/src/components/common/Section/components/CollapsableSection/collapsableSection.tsx +1 -1
  62. package/src/config/entities.ts +0 -1
  63. package/src/entity/api/service.ts +24 -27
  64. package/src/entity/common/client.ts +22 -40
  65. package/src/entity/common/service.ts +8 -10
  66. package/src/entity/common/utils.ts +4 -6
  67. package/src/hooks/useFileManifest/useRequestFileManifest.ts +1 -1
  68. package/src/hooks/useRequestFileLocation.ts +1 -1
  69. package/src/hooks/useResizeObserver.ts +1 -1
  70. package/src/hooks/useWindowResize.ts +1 -1
  71. package/src/shared/utils.ts +0 -9
  72. package/src/theme/common/palette.ts +57 -57
  73. package/tests/authentication.test.ts +7 -1
  74. package/tests/azulFileDownload.test.tsx +9 -3
  75. package/tests/fetchApi.test.ts +93 -0
  76. package/tests/tsconfig.json +1 -0
  77. package/tests/useFileLocation.test.ts +6 -2
  78. package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +0 -8
  79. package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +0 -36
  80. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +0 -6
  81. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +0 -13
  82. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +0 -36
  83. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +0 -9
  84. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +0 -5
  85. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +0 -10
  86. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +0 -36
  87. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +0 -9
  88. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +0 -2
  89. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +0 -37
  90. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +0 -5
  91. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +0 -10
  92. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +0 -3
  93. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +0 -9
  94. package/lib/hooks/useCategoryConfigs.d.ts +0 -6
  95. package/lib/hooks/useCategoryConfigs.js +0 -17
  96. package/lib/hooks/useEntityListRelatedView.d.ts +0 -15
  97. package/lib/hooks/useEntityListRelatedView.js +0 -62
  98. package/lib/hooks/useMenu.d.ts +0 -10
  99. package/lib/hooks/useMenu.js +0 -17
  100. package/lib/hooks/useMenuWithPosition.d.ts +0 -14
  101. package/lib/hooks/useMenuWithPosition.js +0 -33
@@ -0,0 +1,48 @@
1
+ on:
2
+ push:
3
+ branches:
4
+ - main
5
+
6
+ permissions:
7
+ contents: write
8
+ pull-requests: write
9
+
10
+ name: release-please
11
+
12
+ jobs:
13
+ release-please:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: googleapis/release-please-action@v4
17
+ id: release
18
+ with:
19
+ # this assumes that you have created a personal access token
20
+ # (PAT) and configured it as a GitHub action secret named
21
+ # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
22
+ token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
23
+ # This is a built-in strategy in release-please, see "Action Inputs" for more options
24
+ release-type: node
25
+
26
+ # The logic below handles the npm publication:
27
+ - uses: actions/checkout@v4
28
+
29
+ # These if statements ensure that a publication only occurs when a new release is created:
30
+ - uses: actions/setup-node@v4
31
+ if: ${{ steps.release.outputs.release_created }}
32
+ with:
33
+ node-version: 20
34
+ registry-url: "https://registry.npmjs.org"
35
+
36
+ - name: Install dependencies
37
+ if: ${{ steps.release.outputs.release_created }}
38
+ run: npm ci
39
+
40
+ - name: Compile
41
+ if: ${{ steps.release.outputs.release_created }}
42
+ run: npx tsc
43
+
44
+ - name: Publish to NPM
45
+ if: ${{ steps.release.outputs.release_created }}
46
+ run: npm publish
47
+ env:
48
+ NODE_AUTH_TOKEN: ${{ secrets.DATABIOSPHERE_FINDABLE_UI_NPM_PUBLISH_TOKEN }} # Ensure this token is scoped to only the permissions required for npm publication to limit security risks.
@@ -1,31 +1,57 @@
1
1
  name: Run checks
2
- on: [pull_request]
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - "**"
3
6
 
4
7
  jobs:
5
8
  build:
6
9
  runs-on: ubuntu-latest
7
10
  steps:
8
- - uses: actions/checkout@v2
9
- - uses: actions/setup-node@v2
11
+ - name: Checkout repository
12
+ uses: actions/checkout@v4
13
+
14
+ - name: Set up Node.js
15
+ uses: actions/setup-node@v4
10
16
  with:
11
17
  node-version: "20.10.0"
18
+ cache: "npm"
19
+
20
+ - name: Install dependencies
21
+ run: npm ci
22
+
23
+ - name: Check code format
24
+ run: npm run check-format
25
+
26
+ - name: Run linter
27
+ run: npm run lint
28
+
29
+ - name: Run tests
30
+ run: npm run test
12
31
 
13
- - run: |
14
- npm ci
15
- npm run check-format
16
- npm run lint
17
- npm run test
18
- npm run test-compile
32
+ - name: Test compilation
33
+ run: npm run test-compile
19
34
 
20
35
  install-without-lock:
21
36
  runs-on: ubuntu-latest
22
37
  steps:
23
- - uses: actions/checkout@v2
24
- - uses: actions/setup-node@v2
38
+ - name: Checkout repository
39
+ uses: actions/checkout@v4
40
+
41
+ - name: Set up Node.js
42
+ uses: actions/setup-node@v4
25
43
  with:
26
44
  node-version: "20.10.0"
45
+ cache: "npm"
46
+
47
+ - name: Remove package lock
48
+ run: rm package-lock.json
49
+
50
+ - name: Install dependencies without lock
51
+ run: npm install
52
+
53
+ - name: Run tests
54
+ run: npm run test
27
55
 
28
- - run: |
29
- rm package-lock.json
30
- npm install
31
- npm run test-compile
56
+ - name: Test compilation
57
+ run: npm run test-compile
package/.prettierignore CHANGED
@@ -1,5 +1,6 @@
1
1
  # general
2
2
  README.md
3
+ CHANGELOG.md
3
4
 
4
5
  # testing
5
6
  coverage
package/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## [13.0.1](https://github.com/DataBiosphere/findable-ui/compare/v13.0.0...v13.0.1) (2024-10-18)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * give release-please workflow step an id ([#235](https://github.com/DataBiosphere/findable-ui/issues/235)) ([#236](https://github.com/DataBiosphere/findable-ui/issues/236)) ([420733f](https://github.com/DataBiosphere/findable-ui/commit/420733f3d6dc51f44301b06476550f499b4ffbd3))
9
+
10
+ ## [13.0.0](https://github.com/DataBiosphere/findable-ui/compare/v12.0.0...v13.0.0) (2024-10-18)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * use ky with limited retries instead of axios ([#203](https://github.com/DataBiosphere/findable-ui/issues/203)) (#216)
16
+
17
+ ### Features
18
+
19
+ * remove dry run from npm publish ([#231](https://github.com/DataBiosphere/findable-ui/issues/231)) ([#234](https://github.com/DataBiosphere/findable-ui/issues/234)) ([f44d0c3](https://github.com/DataBiosphere/findable-ui/commit/f44d0c3cb2859af6b87d33f5f6e16673db77ec52))
20
+ * use ky with limited retries instead of axios ([#203](https://github.com/DataBiosphere/findable-ui/issues/203)) ([#216](https://github.com/DataBiosphere/findable-ui/issues/216)) ([ec18080](https://github.com/DataBiosphere/findable-ui/commit/ec18080e3191f99a88e9ddec174c9f953d9e3a41))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * add changelog to gitignore ([#232](https://github.com/DataBiosphere/findable-ui/issues/232)) ([#233](https://github.com/DataBiosphere/findable-ui/issues/233)) ([b99ba34](https://github.com/DataBiosphere/findable-ui/commit/b99ba34088199b561b38493888206ed475a209e4))
package/jest.config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** @type {import('ts-jest').JestConfigWithTsJest} */
2
2
  module.exports = {
3
- preset: "ts-jest",
3
+ preset: "ts-jest/presets/js-with-ts-esm",
4
4
  testEnvironment: "jest-environment-jsdom",
5
5
  };
@@ -17,7 +17,6 @@ export declare enum EVENT_PARAM {
17
17
  COLUMN_NAME = "column_name",
18
18
  CURRENT_QUERY = "current_query",
19
19
  ENTITY_NAME = "entity_name",
20
- ENTITY_TYPE = "entity_type",
21
20
  FILTER_NAME = "filter_name",
22
21
  FILTER_VALUE = "filter_value",
23
22
  INDEX = "index",
@@ -46,7 +45,6 @@ export type EventParams = {
46
45
  [EVENT_NAME.BULK_DOWNLOAD_REQUESTED]: {
47
46
  [EVENT_PARAM.CATALOG]: string;
48
47
  [EVENT_PARAM.CURRENT_QUERY]: string;
49
- [EVENT_PARAM.ENTITY_TYPE]: string;
50
48
  [EVENT_PARAM.INDEX]: string;
51
49
  [EVENT_PARAM.TOOL_NAME]: string;
52
50
  };
@@ -18,7 +18,6 @@ export var EVENT_PARAM;
18
18
  EVENT_PARAM["COLUMN_NAME"] = "column_name";
19
19
  EVENT_PARAM["CURRENT_QUERY"] = "current_query";
20
20
  EVENT_PARAM["ENTITY_NAME"] = "entity_name";
21
- EVENT_PARAM["ENTITY_TYPE"] = "entity_type";
22
21
  EVENT_PARAM["FILTER_NAME"] = "filter_name";
23
22
  EVENT_PARAM["FILTER_VALUE"] = "filter_value";
24
23
  EVENT_PARAM["INDEX"] = "index";
@@ -17,7 +17,6 @@ export function bulkDownloadTracking(index, toolName, requestParams) {
17
17
  track(EVENT_NAME.BULK_DOWNLOAD_REQUESTED, {
18
18
  [EVENT_PARAM.CATALOG]: catalog,
19
19
  [EVENT_PARAM.CURRENT_QUERY]: currentQuery,
20
- [EVENT_PARAM.ENTITY_TYPE]: "Bulk Download",
21
20
  [EVENT_PARAM.INDEX]: index,
22
21
  [EVENT_PARAM.TOOL_NAME]: toolName,
23
22
  });
@@ -6,5 +6,6 @@ export interface ExportMethodProps {
6
6
  isAccessible?: boolean;
7
7
  route: string;
8
8
  title: string;
9
+ trackingId?: string;
9
10
  }
10
- export declare const ExportMethod: ({ buttonLabel, description, footnote, isAccessible, route, title, }: ExportMethodProps) => JSX.Element;
11
+ export declare const ExportMethod: ({ buttonLabel, description, footnote, isAccessible, route, title, trackingId, }: ExportMethodProps) => JSX.Element;
@@ -6,7 +6,7 @@ import { FluidPaper } from "../../../common/Paper/paper.styles";
6
6
  import { SectionTitle } from "../../../common/Section/components/SectionTitle/sectionTitle";
7
7
  import { Section, SectionActions, SectionContent, } from "../../../common/Section/section.styles";
8
8
  import { ExportButton, SectionFootnote } from "./exportMethod.styles";
9
- export const ExportMethod = ({ buttonLabel, description, footnote, isAccessible = true, route, title, }) => {
9
+ export const ExportMethod = ({ buttonLabel, description, footnote, isAccessible = true, route, title, trackingId, }) => {
10
10
  const { disabled, message } = useDownloadStatus();
11
11
  return (React.createElement(FluidPaper, null,
12
12
  React.createElement(Section, null,
@@ -16,7 +16,6 @@ export const ExportMethod = ({ buttonLabel, description, footnote, isAccessible
16
16
  React.createElement(SectionActions, null,
17
17
  React.createElement(Tooltip, { arrow: true, title: message },
18
18
  React.createElement("span", null,
19
- React.createElement(Link, { href: route, legacyBehavior: true, passHref: true },
20
- React.createElement(ExportButton, { disabled: disabled || !isAccessible }, buttonLabel))))),
19
+ React.createElement(Link, { href: route, legacyBehavior: true, passHref: true }, trackingId ? (React.createElement(ExportButton, { disabled: disabled || !isAccessible, id: trackingId }, buttonLabel)) : (React.createElement(ExportButton, { disabled: disabled || !isAccessible }, buttonLabel)))))),
21
20
  footnote && React.createElement(SectionFootnote, null, footnote))));
22
21
  };
@@ -8,5 +8,5 @@ export const ExportButton = () => {
8
8
  return (React.createElement(Tooltip, { arrow: true, title: message },
9
9
  React.createElement("span", null,
10
10
  React.createElement(Link, { href: "/export", legacyBehavior: true, passHref: true },
11
- React.createElement(Button, { disabled: disabled || isLoading, href: "passHref" }, "Export")))));
11
+ React.createElement(Button, { disabled: disabled || isLoading, href: "passHref", id: "button-cohort-export" }, "Export")))));
12
12
  };
@@ -5,10 +5,11 @@ import { CallToAction } from "../../../../../common/Button/components/CallToActi
5
5
  * Back page hero component comprising breadcrumbs, title, status and tabs.
6
6
  */
7
7
  export interface BackPageHeroProps {
8
+ actions?: ReactNode;
8
9
  breadcrumbs?: Breadcrumb[];
9
10
  callToAction?: CallToAction;
10
11
  children?: ReactNode;
11
12
  subTitle?: ReactNode;
12
13
  title?: ReactNode;
13
14
  }
14
- export declare const BackPageHero: ({ breadcrumbs, callToAction, children, subTitle, title, }: BackPageHeroProps) => JSX.Element;
15
+ export declare const BackPageHero: ({ actions, breadcrumbs, callToAction, children, subTitle, title, }: BackPageHeroProps) => JSX.Element;
@@ -3,14 +3,15 @@ import { Breadcrumbs, } from "../../../../../common/Breadcrumbs/breadcrumbs";
3
3
  import { Title } from "../../../../../common/Title/title";
4
4
  import { BackPageHeroHeadline, CallToActionButton, HeroHeader, } from "./backPageHero.styles";
5
5
  import { SubTitle } from "./components/SubTitle/subTitle";
6
- export const BackPageHero = ({ breadcrumbs, callToAction, children, subTitle, title, }) => {
7
- const HeroHeadline = callToAction ? BackPageHeroHeadline : Fragment;
6
+ export const BackPageHero = ({ actions, breadcrumbs, callToAction, children, subTitle, title, }) => {
7
+ const HeroHeadline = actions || callToAction ? BackPageHeroHeadline : Fragment;
8
8
  return (React.createElement(React.Fragment, null,
9
9
  (breadcrumbs || title) && (React.createElement(HeroHeadline, null,
10
10
  React.createElement(HeroHeader, { gap: 1 },
11
11
  breadcrumbs && React.createElement(Breadcrumbs, { breadcrumbs: breadcrumbs }),
12
12
  title && React.createElement(Title, { title: title }),
13
13
  React.createElement(SubTitle, { subTitle: subTitle })),
14
+ actions,
14
15
  callToAction && React.createElement(CallToActionButton, { callToAction: callToAction }))),
15
16
  children));
16
17
  };
@@ -1,6 +1,6 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Stack } from "@mui/material";
3
- import { TABLET } from "../../../../../../theme/common/breakpoints";
3
+ import { mediaTabletUp } from "../../../../../../styles/common/mixins/breakpoints";
4
4
  import { CallToActionButton as CTAButton } from "../../../../../common/Button/components/CallToActionButton/callToActionButton";
5
5
  export const BackPageHeroHeadline = styled.div `
6
6
  display: contents;
@@ -9,7 +9,7 @@ export const BackPageHeroHeadline = styled.div `
9
9
  grid-column: 1 / -1; // Title and breadcrumbs consume full width of available grid.
10
10
  }
11
11
 
12
- ${({ theme }) => theme.breakpoints.up(TABLET)} {
12
+ ${mediaTabletUp} {
13
13
  display: flex;
14
14
  flex: 1;
15
15
  gap: 88px;
@@ -26,7 +26,7 @@ export const CallToActionButton = styled(CTAButton) `
26
26
  align-self: center;
27
27
  justify-self: flex-start;
28
28
 
29
- ${({ theme }) => theme.breakpoints.up(TABLET)} {
29
+ ${mediaTabletUp} {
30
30
  justify-self: flex-end;
31
31
  }
32
32
  `;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ export interface ActionsProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const Actions: ({ children, className }: ActionsProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { BackPageHeroActions } from "./actions.styles";
3
+ export const Actions = ({ children, className }) => {
4
+ return (React.createElement(BackPageHeroActions, { className: className }, children));
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const BackPageHeroActions: import("@emotion/styled").StyledComponent<{
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
4
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,13 @@
1
+ import styled from "@emotion/styled";
2
+ import { mediaTabletUp } from "../../../../../../../../styles/common/mixins/breakpoints";
3
+ export const BackPageHeroActions = styled.div `
4
+ align-items: center;
5
+ align-self: center;
6
+ display: flex;
7
+ gap: 16px;
8
+ justify-self: flex-start;
9
+
10
+ ${mediaTabletUp} {
11
+ justify-self: flex-end;
12
+ }
13
+ `;
@@ -13,4 +13,5 @@ export declare enum SELECTED_MATCH {
13
13
  }
14
14
  export interface SocialMedia {
15
15
  socials: Social[];
16
+ visible?: Partial<Record<BreakpointKey, boolean>>;
16
17
  }
@@ -1,6 +1,7 @@
1
1
  import { Breakpoint } from "@mui/material";
2
+ import { UseBreakpoint } from "../../../../../hooks/useBreakpoint";
2
3
  import { NavLinkItem } from "../components/Content/components/Navigation/navigation";
3
- import { Navigation } from "./entities";
4
+ import { Navigation, SocialMedia } from "./entities";
4
5
  /**
5
6
  * Returns the configured menu navigation links.
6
7
  * @param navigation - Navigation links.
@@ -14,3 +15,10 @@ export declare function getMenuNavigationLinks(navigation?: Navigation): NavLink
14
15
  * @returns navigation links.
15
16
  */
16
17
  export declare function getNavigationLinks(navigationLinks?: NavLinkItem[], breakpoint?: Breakpoint): NavLinkItem[];
18
+ /**
19
+ * Returns true if the social media is visible at the current breakpoint.
20
+ * @param bp - Breakpoint.
21
+ * @param socialMedia - Social media.
22
+ * @returns true.
23
+ */
24
+ export declare function isSocialsVisible(bp: Pick<UseBreakpoint, "breakpoint" | "lgUp">, socialMedia?: SocialMedia): boolean;
@@ -1,5 +1,5 @@
1
1
  import { isClientSideNavigation } from "../../../../Links/common/utils";
2
- import { SELECTED_MATCH } from "./entities";
2
+ import { SELECTED_MATCH, } from "./entities";
3
3
  /**
4
4
  * Adds to the set of selected patterns, for the navigation link, at the current breakpoint.
5
5
  * @param setOfPatterns - Set of selected patterns.
@@ -126,6 +126,21 @@ function isLinkVisible(navLinkItem, breakpoint) {
126
126
  return true; // Default is visible.
127
127
  return navLinkItem.visible[breakpoint] !== false;
128
128
  }
129
+ /**
130
+ * Returns true if the social media is visible at the current breakpoint.
131
+ * @param bp - Breakpoint.
132
+ * @param socialMedia - Social media.
133
+ * @returns true.
134
+ */
135
+ export function isSocialsVisible(bp, socialMedia) {
136
+ if (!socialMedia)
137
+ return false;
138
+ if (!bp.breakpoint)
139
+ return false;
140
+ if (!socialMedia.visible)
141
+ return bp.lgUp;
142
+ return socialMedia.visible[bp.breakpoint] !== false;
143
+ }
129
144
  /**
130
145
  * Returns the navigation link with the selected matches, for the current breakpoint.
131
146
  * @param navLinkItem - Navigation link.
@@ -1,4 +1,5 @@
1
1
  import { useBreakpoint } from "../../../../../hooks/useBreakpoint";
2
+ import { isSocialsVisible } from "../common/utils";
2
3
  /**
3
4
  * Returns header component visibility for header related rendering logic.
4
5
  * @param headerProps - Header component props.
@@ -25,7 +26,7 @@ export const useHeaderVisibility = (headerProps) => {
25
26
  const isNavigationIn = smUp;
26
27
  const isMenuIn = hasMenu;
27
28
  const isSloganIn = hasSlogan && mdUp;
28
- const isSocialsIn = hasSocials && lgUp;
29
+ const isSocialsIn = hasSocials && isSocialsVisible({ breakpoint, lgUp }, socialMedia);
29
30
  // Determines navigation visibility.
30
31
  const isCenterNavigationIn = isNavigationIn && hasNavItemsC;
31
32
  const isLeftNavigationIn = isNavigationIn && hasNavItemsL;
@@ -105,8 +105,6 @@ export const SupportRequestForm = ({ setFormSubmitted, supportRequest, }) => {
105
105
  submitting: false,
106
106
  }));
107
107
  setFormSubmitted(true); // Shows form submitted message.
108
- // Execute GTM tracking.
109
- // TODO(cc) add GTM tracking.
110
108
  }
111
109
  catch (error) {
112
110
  setFormState((formState) => ({
@@ -131,7 +129,7 @@ export const SupportRequestForm = ({ setFormSubmitted, supportRequest, }) => {
131
129
  React.createElement(UploadFile, { isDragActive: isDragActive, label: FORM_CONTROL_LABEL.ATTACHMENT_TOKEN, onAttachmentDeleted: onAttachmentDeleted, open: open, ...formState })),
132
130
  React.createElement(Section, null,
133
131
  React.createElement(SectionActions, null,
134
- React.createElement(ButtonPrimary, { disabled: Boolean(errors) || formState.submitting, fullWidth: true, onClick: onSupportRequestSubmitted }, "Send")))))));
132
+ React.createElement(ButtonPrimary, { disabled: Boolean(errors) || formState.submitting, fullWidth: true, onClick: onSupportRequestSubmitted, id: "button-support-request" }, "Send")))))));
135
133
  };
136
134
  /**
137
135
  * Build support request model from form values.
@@ -1,6 +1,6 @@
1
- import { AxiosError } from "axios";
1
+ import { HTTPError } from "ky";
2
2
  interface TempErrorProps {
3
- error: Error | AxiosError;
3
+ error: Error | HTTPError;
4
4
  }
5
5
  export declare const TempError: ({ error }: TempErrorProps) => JSX.Element;
6
6
  export {};
@@ -1,12 +1,12 @@
1
- import { isAxiosError } from "axios";
1
+ import { HTTPError } from "ky";
2
2
  import React from "react";
3
3
  import { ErrorBox } from "./components/errorBox";
4
4
  export const TempError = ({ error }) => {
5
- const { code, request } = isAxiosError(error)
5
+ const { code, request } = error instanceof HTTPError
6
6
  ? {
7
7
  ...error,
8
- code: error.response?.status,
9
- request: error.request.responseURL,
8
+ code: error.response.status,
9
+ request: error.response.url,
10
10
  }
11
11
  : { ...error, code: null, request: null };
12
12
  return (React.createElement("div", null,
@@ -1,3 +1,4 @@
1
+ import { ButtonProps } from "@mui/material";
1
2
  import { ElementType } from "react";
2
3
  import { ANCHOR_TARGET } from "../../../../Links/common/entities";
3
4
  export interface CallToAction {
@@ -7,8 +8,9 @@ export interface CallToAction {
7
8
  }
8
9
  export interface CallToActionButtonProps {
9
10
  ButtonElType?: ElementType;
11
+ buttonProps?: Partial<ButtonProps>;
10
12
  callToAction: CallToAction;
11
13
  className?: string;
12
14
  disabled?: boolean;
13
15
  }
14
- export declare const CallToActionButton: ({ ButtonElType: Button, callToAction, className, disabled, }: CallToActionButtonProps) => JSX.Element;
16
+ export declare const CallToActionButton: ({ ButtonElType: Button, buttonProps, callToAction, className, disabled, }: CallToActionButtonProps) => JSX.Element;
@@ -3,9 +3,9 @@ import React from "react";
3
3
  import { ANCHOR_TARGET, REL_ATTRIBUTE, } from "../../../../Links/common/entities";
4
4
  import { isClientSideNavigation } from "../../../../Links/common/utils";
5
5
  import { ButtonPrimary } from "../ButtonPrimary/buttonPrimary";
6
- export const CallToActionButton = ({ ButtonElType: Button = ButtonPrimary, callToAction, className, disabled = false, }) => {
6
+ export const CallToActionButton = ({ ButtonElType: Button = ButtonPrimary, buttonProps, callToAction, className, disabled = false, }) => {
7
7
  const { label, target, url } = callToAction;
8
8
  const isInternal = isClientSideNavigation(url);
9
9
  return isInternal ? (React.createElement(NLink, { href: url, legacyBehavior: true, passHref: true },
10
- React.createElement(Button, { className: className, disabled: disabled, href: "passHref", rel: REL_ATTRIBUTE.NO_OPENER, target: target || ANCHOR_TARGET.SELF }, label))) : (React.createElement(Button, { className: className, disabled: disabled, href: url, rel: REL_ATTRIBUTE.NO_OPENER_NO_REFERRER, target: target || ANCHOR_TARGET.BLANK }, label));
10
+ React.createElement(Button, { className: className, disabled: disabled, href: "passHref", rel: REL_ATTRIBUTE.NO_OPENER, target: target || ANCHOR_TARGET.SELF, ...buttonProps }, label))) : (React.createElement(Button, { className: className, disabled: disabled, href: url, rel: REL_ATTRIBUTE.NO_OPENER_NO_REFERRER, target: target || ANCHOR_TARGET.BLANK, ...buttonProps }, label));
11
11
  };
@@ -1,4 +1,6 @@
1
+ import { BoxProps as MBoxProps } from "@mui/material";
1
2
  export interface MarkdownProps {
2
3
  content: string;
4
+ sx?: MBoxProps["sx"];
3
5
  }
4
- export declare const Markdown: ({ content }: MarkdownProps) => JSX.Element;
6
+ export declare const Markdown: ({ content, sx }: MarkdownProps) => JSX.Element;
@@ -1,6 +1,7 @@
1
1
  // TODO deprecate component if possible (see MDXMarkdown)
2
+ import { Box as MBox } from "@mui/material";
2
3
  import DOMPurify from "isomorphic-dompurify";
3
4
  import React from "react";
4
- export const Markdown = ({ content }) => {
5
- return (React.createElement("div", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(content) } }));
5
+ export const Markdown = ({ content, sx }) => {
6
+ return (React.createElement(MBox, { component: "div", dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(content) }, sx: { minWidth: 0, wordBreak: "break-word", ...sx } }));
6
7
  };
@@ -111,7 +111,6 @@ export interface DataSourceConfig {
111
111
  defaultParams?: {
112
112
  catalog: string;
113
113
  };
114
- entityURL?: string;
115
114
  url: string;
116
115
  }
117
116
  /**
@@ -5,11 +5,11 @@
5
5
  import { APIEndpoints, AZUL_PARAM, } from "../../apis/azul/common/entities";
6
6
  import { transformFilters } from "../../apis/azul/common/filterTransformer";
7
7
  import { getConfig } from "../../config/config";
8
- import { getDefaultDetailParams, getDefaultListParams, getEntityURL, } from "../../shared/utils";
8
+ import { getDefaultDetailParams, getDefaultListParams, } from "../../shared/utils";
9
9
  import { convertUrlParams } from "../../utils/url";
10
- import { api } from "../common/client";
10
+ import { fetchApi } from "../common/client";
11
11
  import { fetchEntitiesFromURL } from "../common/service";
12
- import { getAxiosRequestOptions } from "../common/utils";
12
+ import { getKyRequestOptions } from "../common/utils";
13
13
  /**
14
14
  * Make a GET or POST request for a list of entities
15
15
  * @param apiPath - Path that will be used to compose the API url
@@ -38,7 +38,7 @@ export const fetchAllEntities = async (apiPath, accessToken, catalog, listParams
38
38
  let hits = result.hits;
39
39
  let nextPage = result.pagination.next;
40
40
  while (nextPage) {
41
- const { data: nextPageJson } = await api().get(nextPage);
41
+ const nextPageJson = await (await fetchApi(nextPage)).json();
42
42
  nextPage = nextPageJson.pagination.next;
43
43
  hits = [...hits, ...nextPageJson.hits];
44
44
  }
@@ -49,8 +49,8 @@ export const fetchAllEntities = async (apiPath, accessToken, catalog, listParams
49
49
  * @returns name of the default catalog and all available catalogs.
50
50
  */
51
51
  export const fetchCatalog = async () => {
52
- const res = await api().get(APIEndpoints.CATALOGS);
53
- return res.data;
52
+ const res = await fetchApi(APIEndpoints.CATALOGS);
53
+ return await res.json();
54
54
  };
55
55
  /**
56
56
  * Request to get a single project.
@@ -66,15 +66,13 @@ export const fetchEntityDetail = async (id, apiPath, catalog, accessToken, defau
66
66
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- this response type can't be determined beforehand
67
67
  ) => {
68
68
  const catalogParam = catalog ? { [AZUL_PARAM.CATALOG]: catalog } : undefined;
69
- const options = getAxiosRequestOptions(accessToken);
70
- const baseURL = getEntityURL();
71
- return await api(baseURL)
72
- .get(`${apiPath}/${id}?${convertUrlParams({
69
+ const options = getKyRequestOptions(accessToken);
70
+ return await fetchApi(`${apiPath}/${id}?${convertUrlParams({
73
71
  ...defaultParams,
74
72
  ...catalogParam,
75
73
  })}`, options)
76
74
  .then((res) => {
77
- return res.data;
75
+ return res.json();
78
76
  })
79
77
  .catch((error) => {
80
78
  if (swallow404) {
@@ -109,9 +107,9 @@ export const fetchSummary = async (filterState, catalog, accessToken) => {
109
107
  [AZUL_PARAM.FILTERS]: filtersParam,
110
108
  };
111
109
  }
112
- const options = getAxiosRequestOptions(accessToken);
113
- const res = await api().get(`${apiPath}?${convertUrlParams({ ...summaryParams })}`, options);
114
- return res.data;
110
+ const options = getKyRequestOptions(accessToken);
111
+ const res = await fetchApi(`${apiPath}?${convertUrlParams({ ...summaryParams })}`, options);
112
+ return await res.json();
115
113
  };
116
114
  /**
117
115
  * Fetch summary from given URL.
@@ -120,8 +118,8 @@ export const fetchSummary = async (filterState, catalog, accessToken) => {
120
118
  * @returns summary response.
121
119
  */
122
120
  export const fetchSummaryFromURL = async (path, accessToken) => {
123
- const res = await api().get(path, getAxiosRequestOptions(accessToken));
124
- return res.data;
121
+ const res = await fetchApi(path, getKyRequestOptions(accessToken));
122
+ return await res.json();
125
123
  };
126
124
  /**
127
125
  * Fetch system status from given URL.
@@ -129,6 +127,6 @@ export const fetchSummaryFromURL = async (path, accessToken) => {
129
127
  * @returns system status.
130
128
  */
131
129
  export const fetchSystemStatusFromURL = async (URL) => {
132
- const res = await api().get(URL);
133
- return res.data;
130
+ const res = await fetchApi(URL);
131
+ return await res.json();
134
132
  };
@@ -1,12 +1,8 @@
1
- import { AxiosInstance } from "axios";
1
+ import { Options, ResponsePromise } from "ky";
2
2
  /**
3
- * Adding response interceptors to axios instances.
4
- * @param api - AxiosInstance.
3
+ * Makes an HTTP request with the API URL as a base.
4
+ * @param url - URL to fetch.
5
+ * @param options - Ky options.
6
+ * @returns Ky response.
5
7
  */
6
- export declare const configureInterceptors: (api: AxiosInstance) => void;
7
- /**
8
- * Returns a singleton Axios instance configured for making HTTP requests to a specified base URL.
9
- * @param baseURL - The base URL to use for the AxiosInstance.
10
- * @returns axios instance.
11
- */
12
- export declare const api: (baseURL?: string) => AxiosInstance;
8
+ export declare function fetchApi<T>(url: string, options?: Options): ResponsePromise<T>;