diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5637f7f8f15..d90d844538f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,8 +18,8 @@ updates: versions: ["*"] - dependency-name: "@chainlink/local" versions: ["*"] - - dependency-name: "chainlink-algolia-search" - versions: ["*"] + - dependency-name: "@chainlink/cl-search-frontend" + update-types: ["version-update:semver-patch"] # For all deps - dependency-name: "*" # ignore all major updates diff --git a/package-lock.json b/package-lock.json index 090ef6cdb16..9eb5915a11a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@astrojs/react": "^4.3.0", "@astrojs/sitemap": "^3.4.1", "@astrojs/vercel": "^8.1.5", + "@chainlink/cl-search-frontend": "^0.11.1", "@chainlink/components": "^0.4.18", "@chainlink/contracts": "1.4.0", "@chainlink/contracts-ccip": "1.6.0", @@ -32,7 +33,6 @@ "@openzeppelin/contracts": "^4.9.6", "astro": "^5.9.2", "bignumber.js": "^9.3.0", - "chainlink-algolia-search": "^0.10.1", "clipboard": "^2.0.11", "dotenv": "^16.5.0", "ethers": "^6.14.3", @@ -1744,6 +1744,34 @@ "fontkit": "^2.0.2" } }, + "node_modules/@chainlink/cl-search-frontend": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@chainlink/cl-search-frontend/-/cl-search-frontend-0.11.1.tgz", + "integrity": "sha512-NOZUVISZL31FAIl9T8hYld9cLqGFXivyUOnJ/PQrDMpYggoxIWHHkFE80OiHIp4SwptpcZvKeKhyeSIIaL24QQ==", + "dependencies": { + "@algolia/client-search": "^5.17.1", + "dompurify": "^3.2.6", + "hast-util-sanitize": "^5.0.2", + "react-markdown": "^10.1.0", + "rehype-autolink-headings": "^7.1.0", + "rehype-prism-plus": "^2.0.0", + "rehype-sanitize": "^6.0.0", + "rehype-slug": "^6.0.0", + "remark-gfm": "^4.0.1" + }, + "peerDependencies": { + "react": ">=18.0.0", + "react-dom": ">=18.0.0" + } + }, + "node_modules/@chainlink/cl-search-frontend/node_modules/dompurify": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz", + "integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, "node_modules/@chainlink/components": { "version": "0.4.18", "resolved": "https://registry.npmjs.org/@chainlink/components/-/components-0.4.18.tgz", @@ -11988,7 +12016,6 @@ "version": "1.26.5", "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.5.tgz", "integrity": "sha512-AUZTa7hQ2KY5L7AmtSiqxlhWxb4ina0yd8hNbl4TWuqnv/pFP0nDMb3YrfSBf4hJVGLh2YEIBfKaBW/9UEl6IQ==", - "dev": true, "license": "MIT" }, "node_modules/@types/qs": { @@ -14543,18 +14570,6 @@ "node": ">=4" } }, - "node_modules/chainlink-algolia-search": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/chainlink-algolia-search/-/chainlink-algolia-search-0.10.1.tgz", - "integrity": "sha512-BzIdI747/BmHm+FjUF9OYGrVkakBqBK9HvrCyuCoNNnq44U7rK5+d9Xh6FiJa9WwI/j0C+Nv8KGFTvVV3u7kBA==", - "dependencies": { - "@algolia/client-search": "^5.17.1" - }, - "peerDependencies": { - "react": ">=18.0.0", - "react-dom": ">=18.0.0" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -20347,6 +20362,20 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-sanitize": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-5.0.2.tgz", + "integrity": "sha512-3yTWghByc50aGS7JlGhk61SPenfE/p1oaFeNwkOOyrscaOkMGrcW9+Cy/QAIOBpZxP1yqDIzFMR0+Np0i0+usg==", + "dependencies": { + "@types/hast": "^3.0.0", + "@ungap/structured-clone": "^1.0.0", + "unist-util-position": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-select": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/hast-util-select/-/hast-util-select-4.0.2.tgz", @@ -20765,6 +20794,15 @@ "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==", "license": "MIT" }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/html-void-elements": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", @@ -26933,6 +26971,11 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/parse-numeric-range": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/parse-numeric-range/-/parse-numeric-range-1.3.0.tgz", + "integrity": "sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ==" + }, "node_modules/parse5": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", @@ -28137,6 +28180,32 @@ "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==", "license": "MIT" }, + "node_modules/react-markdown": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", + "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, "node_modules/react-modal": { "version": "3.16.1", "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.1.tgz", @@ -28854,6 +28923,84 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/rehype-prism-plus": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/rehype-prism-plus/-/rehype-prism-plus-2.0.1.tgz", + "integrity": "sha512-Wglct0OW12tksTUseAPyWPo3srjBOY7xKlql/DPKi7HbsdZTyaLCAoO58QBKSczFQxElTsQlOY3JDOFzB/K++Q==", + "dependencies": { + "hast-util-to-string": "^3.0.0", + "parse-numeric-range": "^1.3.0", + "refractor": "^4.8.0", + "rehype-parse": "^9.0.0", + "unist-util-filter": "^5.0.0", + "unist-util-visit": "^5.0.0" + } + }, + "node_modules/rehype-prism-plus/node_modules/@types/hast": { + "version": "2.3.10", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.10.tgz", + "integrity": "sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==", + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/rehype-prism-plus/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==" + }, + "node_modules/rehype-prism-plus/node_modules/hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "dependencies": { + "@types/hast": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-prism-plus/node_modules/hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-prism-plus/node_modules/property-information": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/rehype-prism-plus/node_modules/refractor": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/refractor/-/refractor-4.9.0.tgz", + "integrity": "sha512-nEG1SPXFoGGx+dcjftjv8cAjEusIh6ED1xhf5DG3C0x/k+rmZ2duKnc3QLpt6qeHv5fPb8uwN3VWN2BT7fr3Og==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/prismjs": "^1.0.0", + "hastscript": "^7.0.0", + "parse-entities": "^4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/rehype-raw": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", @@ -28884,6 +29031,19 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/rehype-sanitize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/rehype-sanitize/-/rehype-sanitize-6.0.0.tgz", + "integrity": "sha512-CsnhKNsyI8Tub6L4sm5ZFsme4puGfc6pYylvXo1AeqaGbjOYyzNv3qZPwvs0oMJ39eryyeOdmxwUIo94IpEhqg==", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-sanitize": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/rehype-slug": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/rehype-slug/-/rehype-slug-6.0.0.tgz", @@ -32997,6 +33157,16 @@ "ohash": "^2.0.0" } }, + "node_modules/unist-util-filter": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/unist-util-filter/-/unist-util-filter-5.0.1.tgz", + "integrity": "sha512-pHx7D4Zt6+TsfwylH9+lYhBhzyhEnCXs/lbq/Hstxno5z4gVdyc2WEW0asfjGKPyG4pEKrnBv5hdkO6+aRnQJw==", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + } + }, "node_modules/unist-util-find-after": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", diff --git a/package.json b/package.json index 3ea8e1420b9..7898e84da3f 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "@astrojs/react": "^4.3.0", "@astrojs/sitemap": "^3.4.1", "@astrojs/vercel": "^8.1.5", + "@chainlink/cl-search-frontend": "^0.11.1", "@chainlink/components": "^0.4.18", "@chainlink/contracts": "1.4.0", "@chainlink/contracts-ccip": "1.6.0", @@ -62,7 +63,6 @@ "@openzeppelin/contracts": "^4.9.6", "astro": "^5.9.2", "bignumber.js": "^9.3.0", - "chainlink-algolia-search": "^0.10.1", "clipboard": "^2.0.11", "dotenv": "^16.5.0", "ethers": "^6.14.3", diff --git a/src/components/Header/Nav/NavBar.tsx b/src/components/Header/Nav/NavBar.tsx index e84b22c948a..f81fd076345 100644 --- a/src/components/Header/Nav/NavBar.tsx +++ b/src/components/Header/Nav/NavBar.tsx @@ -7,11 +7,13 @@ import { useScrollPosition } from "./useScrollPosition.tsx" import { ProductNavigation } from "./ProductNavigation/ProductNavigation.tsx" import { useHideHeader } from "./useHideHeader.tsx" import ProductChainTable from "../../QuickLinks/sections/ProductChainTable.tsx" +import AlgoliaSearch from "../aiSearch/Search.tsx" export type SearchTrigger = React.ReactNode export type NavBarProps = { - searchTrigger?: SearchTrigger + showSearch: boolean + algoliaVars: { algoliaAppId: string; algoliaPublicApiKey: string } path: string onHideChange?: (hidden: boolean) => void productsNav: ProductsNav @@ -21,14 +23,7 @@ export type NavBarProps = { export const navBarHeight = 64 -export const NavBar = ({ - path, - searchTrigger, - onHideChange, - productsNav, - subProductsNav, - doubleNavbar, -}: NavBarProps) => { +export const NavBar = ({ path, algoliaVars, onHideChange, productsNav, subProductsNav, doubleNavbar }: NavBarProps) => { const [isMenuOpen, setIsMenuOpen] = useState(false) const [isModalOpen, setIsModalOpen] = useState(false) const [isMegaMenuOpen, setShowMegaMenu] = useState(false) @@ -76,7 +71,6 @@ export const NavBar = ({