From e60881e8953f817eeabcc6a940dbd2c358f42703 Mon Sep 17 00:00:00 2001 From: Francis Gorman Date: Wed, 19 Feb 2025 00:27:49 -0500 Subject: [PATCH] SR-454: Improve developemnt env w/ Jekyll & Docker --- .gitignore | 10 ++ 404.html | 8 + Gemfile | 27 +++ README.md | 43 +++-- _config.yml | 29 +++- docker-compose.yml | 8 + index.html | 22 ++- package-lock.json | 295 +++++++++++++++----------------- test/demoted/v1_1_0_srb-en.html | 6 +- test/demoted/v1_1_0_srb-fr.html | 6 +- test/demoted/v1_1_0_src-en.html | 8 +- test/demoted/v1_1_0_src-fr.html | 6 +- test/qs-en.html | 45 +++++ test/qs-fr.html | 45 +++++ test/sra-en.html | 6 +- test/sra-fr.html | 6 +- test/srb-en.html | 6 +- test/srb-fr.html | 6 +- test/src-en.html | 8 +- test/src-fr.html | 6 +- test/tpl-en.html | 60 +++++++ test/tpl-fr.html | 60 +++++++ todo.md | 17 +- 23 files changed, 522 insertions(+), 211 deletions(-) create mode 100644 404.html create mode 100644 Gemfile create mode 100644 docker-compose.yml create mode 100644 test/qs-en.html create mode 100644 test/qs-fr.html create mode 100644 test/tpl-en.html create mode 100644 test/tpl-fr.html diff --git a/.gitignore b/.gitignore index d7f27d5..57f582d 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,13 @@ nbproject/* /.project .settings .vscode/* + +# Jekyll +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor +Gemfile.lock + +_data/token.yml diff --git a/404.html b/404.html new file mode 100644 index 0000000..f7b3a7b --- /dev/null +++ b/404.html @@ -0,0 +1,8 @@ +--- +permalink: /404.html +title: 404 +--- + +
+

Page not found | Page introuvable

+
diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..831c9ad --- /dev/null +++ b/Gemfile @@ -0,0 +1,27 @@ +source "https://rubygems.org" + +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +gem "jekyll", "~> 4.3.3" + +gem 'jekyll-remote-theme' + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] diff --git a/README.md b/README.md index 45b3281..bf1b1fc 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Search UI follows [Semantic Versioning 2.0.0](https://semver.org/) This rubric is for developers. -### Build files +### Build files for release or to test code quality before opening a Pull request 1. run: npm install -g grunt-cli 2. run: npm install @@ -51,19 +51,34 @@ This rubric is for developers. ### Test as end-user +#### Locally (with Docker) + +1. Install Docker +2. Add an API key to your site settings as described below in [Setting an API key](#setting-an-api-key). Otherwise, please see [Alternative to the API key by getting a token](#alternative-to-the-api-key-by-getting-a-token) below. +3. run `docker compose up --build` + +#### Through GitHub Pages + 1. Push to a branch in your origin remote, in a branch of your choice. It is recommended that you use a dedicated branch for testing, which is different from one where you would be opening a Pull request from. 2. Make sure your repository has GitHub Pages enabled, on that specific above-mentioned branch. -3. Since you need a token to communicate with the Coveo API, you can do the following to go to get a token valid for 24 hrs: - 1. Go to a search page on the Canada.ca preview such as: **/en/sr/srb.html**. - 2. Open the inspector (developer tool) and look for the `div` tag that has the attribute called `data-gc-search`. - 3. Inside this attribute, you'll find a Javascript object that has a field called `accessToken`. Grab the value of that token. - 4. Replace `XYZ` with the token on any page within the /test/ folder of this project, such as **srb-en.html**. - 5. If you are planning on opening a pull request with your changes, do not forget to put `XYZ` back into the files. - 6. If the token doesn't seem valid, take another one from the Canada.ca Preview server or you may have passed the 24 hours TTL of the token; get another one. + +#### Setting an API key + +1. Add a file named `token.yml` inside the `_data` folder. This file needs to simply have a key-value pair of `API_KEY: "[API KEY HERE]"` on line 1. The key value can be found at https://github.com/ServiceCanada/devops-documentation/blob/master/search/local-testing.md to replace the `[API KEY HERE]`. If you do not have access to the previous link, please see the next section on how to use a token as described below. + +#### Alternative to the API key by getting a token + +Since you need a token to communicate with the Coveo API, you can do the following to go to get a token valid for 24 hrs: + +1. Go to a search page on the Canada.ca preview such as: **/en/sr/srb.html**. +2. Open the inspector (developer tool) and look for the `div` tag that has the attribute called `data-gc-search`. +3. Inside this attribute, you'll find a Javascript object that has a field called `accessToken`. Grab the value of that token. +4. Add a file named `token.yml` in the `_data` folder. This file needs to simply have a key-value pair of `API_KEY: "[API KEY HERE]"` on line 1. Add the token value as the key in `[API KEY HERE]`. +5. If the token doesn't seem valid, take another one from the Canada.ca Preview server or you may have passed the 24 hours TTL of the token; get another one. ### Deployment -1. Take the content of the "dist" folder and put it on a server. Make sure you have a mechanism in place to handle a key/token +1. The content of the "dist" folder is what's needed for a release / deployment. See [Build files](#build-files) section above to generate this folder. ### Configurations, templates and parameters @@ -84,9 +99,7 @@ They must be used within the `[data-gc-search]` attribute. See the **/test/src-e - `lang` : Langague of the text to output, in short format (`en` or `fr`). Will detect the langauge of the HTML page if not defined. If not determined, default is: `en` - `numberOfSuggestions` -: Number of suggestions to show in the Query suggestion box. Default: `0` -- `unsupportedSuggestions` -: Extra mechanism to allow the use of the very early on Query suggestion feature. Default: `false` +: Number of suggestions to show in the Query Suggestion (QS) box. This will activate the QS feature on your search page. Default: `0` - `enableHistoryPush` : Allows for UI elements that are not hyperlink tags to register their action in the history, such as pagination. Default: `true` - `isContextSearch` @@ -202,3 +215,9 @@ Sometimes your search pages contain more than one input relevant to the search's : Search , within documents of a certain file type. Options are: `application/pdf`, `ps`, `application/msword`, `application/vnd.ms-excel`, `application/vnd.ms-powerpoint`, `application/rtf` - `originLevel3` : Allows for mimicking a specific search page/context by setting its path through this URL parameter + +### Other + +#### Analytics tracking + +Custom event named `searchEvent` can used to hook onto from Analytics tools, such as Adobe Analytics. This allows to listen to search actions, more specifically "doing a search", since the Search UI is acting similar to a Single Page App (SPA). diff --git a/_config.yml b/_config.yml index 9695591..393f475 100644 --- a/_config.yml +++ b/_config.yml @@ -1,10 +1,35 @@ +plugins: + - jekyll-remote-theme + remote_theme: wet-boew/gcweb-jekyll + title: Search UI for Canada.ca Search -# -# Page front matter defaults defaults: - scope: path: "" # Ensure it's applied to all pages values: layout: default + +exclude: + - .sass-cache/ + - .jekyll-cache/ + - gemfiles/ + - Gemfile + - Gemfile.lock + - node_modules/ + - vendor/bundle/ + - vendor/cache/ + - vendor/gems/ + - vendor/ruby/ + - docker-compose.yml + - Gruntfile.js + - dist/ + - package.json + - package-lock.json + - LICENSE + - CONDE_OF_CONDUCT.md + - CONTRIBUTING.md + - SECURITY.md + - README.md + - todo.md diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8e2b198 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + jekyll: + image: bretfisher/jekyll-serve + container_name: search-ui-site + volumes: + - .:/site + ports: + - '4000:4000' diff --git a/index.html b/index.html index 64d4e83..bd983a8 100644 --- a/index.html +++ b/index.html @@ -2,15 +2,21 @@ title: Search user interface (UI) with Headless --- -

This is a demo site for the Search UI.

+

This is a demo site for the GC Search UI.

-

Testing

+

Test pages

+ +

Please refer to the README documentation to get more information on the GC Search UI.

diff --git a/package-lock.json b/package-lock.json index 1367fea..2dcb483 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,25 +4,19 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true - }, "@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", "dev": true, "requires": { - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.3" } }, "@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true }, "@eslint/eslintrc": { @@ -75,18 +69,18 @@ } }, "@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^2.0.2", + "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", "minimatch": "^3.0.5" }, @@ -109,9 +103,9 @@ "dev": true }, "@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "@nodelib/fs.scandir": { @@ -141,9 +135,9 @@ } }, "@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", "dev": true }, "abbrev": { @@ -153,9 +147,9 @@ "dev": true }, "acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true }, "acorn-jsx": { @@ -380,9 +374,9 @@ "dev": true }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -414,12 +408,12 @@ "dev": true }, "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, "requires": { - "ms": "2.1.2" + "ms": "^2.1.3" } }, "deep-is": { @@ -468,18 +462,18 @@ "dev": true }, "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", + "integrity": "sha512-q9bUwjfp7Eif8jWxxxPSykdRZAb6GkguBGSgvvCrhI9wB71W2K/Kvv4E61CF/mcCfnVJDeDWx/Vb/uAqbDj6UQ==", "dev": true, "requires": { "domelementtype": "1" } }, "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==", "dev": true, "requires": { "dom-serializer": "0", @@ -493,9 +487,9 @@ "dev": true }, "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", + "integrity": "sha512-LbLqfXgJMmy81t+7c14mnulFHJ170cM6E+0vMXR9k/ZiZwgX8i5pNgjTCX3SO4VeUsFLV+8InixoretwU+MjBQ==", "dev": true }, "escape-string-regexp": { @@ -505,16 +499,16 @@ "dev": true }, "eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -659,9 +653,9 @@ "dev": true }, "esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -719,9 +713,9 @@ "dev": true }, "fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", + "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -845,9 +839,9 @@ } }, "flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true }, "fs.realpath": { @@ -959,9 +953,9 @@ }, "dependencies": { "async": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", - "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", "dev": true }, "glob": { @@ -1291,26 +1285,65 @@ "promise": "^8.0.2" }, "dependencies": { + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dev": true, + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } } } }, "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", + "integrity": "sha512-hBxEg3CYXe+rPIua8ETe7tmG3XDn9B0edOE/e9wH2nLczxzgdu0m0aNHY+5wFZiviLWLdANPJTssa92dMcXQ5Q==", "dev": true, "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" + "domelementtype": "1", + "domhandler": "2.3", + "domutils": "1.5", + "entities": "1.0", + "readable-stream": "1.1" } }, "iconv-lite": { @@ -1320,15 +1353,15 @@ "dev": true }, "ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true }, "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -1415,44 +1448,6 @@ "strip-json-comments": "1.0.x" }, "dependencies": { - "domhandler": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", - "integrity": "sha512-q9bUwjfp7Eif8jWxxxPSykdRZAb6GkguBGSgvvCrhI9wB71W2K/Kvv4E61CF/mcCfnVJDeDWx/Vb/uAqbDj6UQ==", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha512-LbLqfXgJMmy81t+7c14mnulFHJ170cM6E+0vMXR9k/ZiZwgX8i5pNgjTCX3SO4VeUsFLV+8InixoretwU+MjBQ==", - "dev": true - }, - "htmlparser2": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "integrity": "sha512-hBxEg3CYXe+rPIua8ETe7tmG3XDn9B0edOE/e9wH2nLczxzgdu0m0aNHY+5wFZiviLWLdANPJTssa92dMcXQ5Q==", - "dev": true, - "requires": { - "domelementtype": "1", - "domhandler": "2.3", - "domutils": "1.5", - "entities": "1.0", - "readable-stream": "1.1" - } - }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1467,24 +1462,6 @@ "requires": { "brace-expansion": "^1.1.7" } - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "dev": true } } }, @@ -1605,9 +1582,9 @@ } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "natural-compare": { @@ -1635,17 +1612,17 @@ } }, "optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "requires": { - "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" } }, "p-limit": { @@ -1733,14 +1710,15 @@ "dev": true }, "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", "dev": true, "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" } }, "resolve-from": { @@ -1804,13 +1782,10 @@ "dev": true }, "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", + "dev": true }, "strip-ansi": { "version": "3.0.1", @@ -1855,9 +1830,9 @@ "dev": true }, "uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", "dev": true }, "underscore": { @@ -1899,6 +1874,12 @@ "integrity": "sha512-E87fdQ/eRJr9W1X4wTPejNy9zTW3FI2vpCZSJ/HAY+TkjKVC0TUm1jk6vn2Z7qay0DQy0+RBGdXxj+RmmiGZKQ==", "dev": true }, + "word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/test/demoted/v1_1_0_srb-en.html b/test/demoted/v1_1_0_srb-en.html index 393dc8f..ed062b2 100644 --- a/test/demoted/v1_1_0_srb-en.html +++ b/test/demoted/v1_1_0_srb-en.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../../src/connector.css" -script: "../../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -29,7 +31,7 @@

Perform an advanced search

diff --git a/test/demoted/v1_1_0_srb-fr.html b/test/demoted/v1_1_0_srb-fr.html index f621d9d..ecc1162 100644 --- a/test/demoted/v1_1_0_srb-fr.html +++ b/test/demoted/v1_1_0_srb-fr.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../../src/connector.css" -script: "../../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -29,7 +31,7 @@

Effectuer une recherche avancée

diff --git a/test/demoted/v1_1_0_src-en.html b/test/demoted/v1_1_0_src-en.html index bee63fa..54993ff 100644 --- a/test/demoted/v1_1_0_src-en.html +++ b/test/demoted/v1_1_0_src-en.html @@ -9,10 +9,10 @@ share: false deptfeature: false dateModified: 2024-06-05 -css: - - "../../src/connector.css" +css: "../../src/connector.css" script: - - "../../src/connector.js" +- src: "../src/connector.js" + type: module --- @@ -40,7 +40,7 @@
diff --git a/test/demoted/v1_1_0_src-fr.html b/test/demoted/v1_1_0_src-fr.html index ae51101..a4f61c0 100644 --- a/test/demoted/v1_1_0_src-fr.html +++ b/test/demoted/v1_1_0_src-fr.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../../src/connector.css" -script: "../../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -38,7 +40,7 @@
diff --git a/test/qs-en.html b/test/qs-en.html new file mode 100644 index 0000000..33950f4 --- /dev/null +++ b/test/qs-en.html @@ -0,0 +1,45 @@ +--- +title: Search page with Query Suggestions (QS) +description: Demo page for the QS feature in the Canada.ca Search UI Basic +lang: en +altLangPage: qs-fr.html +nositesearch: true +pageclass: page-type-search +pageType: recherche +share: false +deptfeature: false +dateModified: 2025-02-19 +css: "../src/connector.css" +script: +- src: "../src/connector.js" + type: module +--- + + + + + +
+

Perform an advanced search

+ + +

Expected output for the result section

+
+ Output for Results section + [To be completed, see Connector.js for reference until then] +
diff --git a/test/qs-fr.html b/test/qs-fr.html new file mode 100644 index 0000000..d069595 --- /dev/null +++ b/test/qs-fr.html @@ -0,0 +1,45 @@ +--- +title: Résultats de la recherche avec Suggestions de termes +description: Page démo pour la fonctionnalité Suggestions de termes dans l'interface utilisateur de recherche Canada.ca +lang: fr +altLangPage: qs-en.html +nositesearch: true +pageclass: page-type-search +pageType: recherche +share: false +deptfeature: false +dateModified: 2025-02-19 +css: "../src/connector.css" +script: +- src: "../src/connector.js" + type: module +--- + + + + + +
+

Effectuer une recherche avancée

+ + +

Section Résultats attendu pour la section de résultats

+
+ Section Résultats générée + [À compléter, voir Connector.js comme référence pour l'instant] +
diff --git a/test/sra-en.html b/test/sra-en.html index 3197bcb..78f58d5 100644 --- a/test/sra-en.html +++ b/test/sra-en.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../src/connector.css" -script: "../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -65,7 +67,7 @@
diff --git a/test/sra-fr.html b/test/sra-fr.html index 131a1bc..2e9e6f8 100644 --- a/test/sra-fr.html +++ b/test/sra-fr.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../src/connector.css" -script: "../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -65,7 +67,7 @@
diff --git a/test/srb-en.html b/test/srb-en.html index 61f269a..05ca524 100644 --- a/test/srb-en.html +++ b/test/srb-en.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../src/connector.css" -script: "../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -29,7 +31,7 @@

Perform an advanced search

diff --git a/test/srb-fr.html b/test/srb-fr.html index 8c10702..baa08e5 100644 --- a/test/srb-fr.html +++ b/test/srb-fr.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../src/connector.css" -script: "../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -29,7 +31,7 @@

Effectuer une recherche avancée

diff --git a/test/src-en.html b/test/src-en.html index a9eda6e..93de847 100644 --- a/test/src-en.html +++ b/test/src-en.html @@ -9,10 +9,10 @@ share: false deptfeature: false dateModified: 2024-06-05 -css: - - "../src/connector.css" +css: "../src/connector.css" script: - - "../src/connector.js" +- src: "../src/connector.js" + type: module --- @@ -40,7 +40,7 @@
diff --git a/test/src-fr.html b/test/src-fr.html index 2b33c66..21e32cf 100644 --- a/test/src-fr.html +++ b/test/src-fr.html @@ -10,7 +10,9 @@ deptfeature: false dateModified: 2024-06-05 css: "../src/connector.css" -script: "../src/connector.js" +script: +- src: "../src/connector.js" + type: module --- @@ -38,7 +40,7 @@
diff --git a/test/tpl-en.html b/test/tpl-en.html new file mode 100644 index 0000000..9b2c0b0 --- /dev/null +++ b/test/tpl-en.html @@ -0,0 +1,60 @@ +--- +title: Search page with custom templates for summary and results +description: Demo page for custom summary and results templates in the Canada.ca Search UI +lang: en +altLangPage: tpl-fr.html +nositesearch: true +pageclass: page-type-search +pageType: recherche +share: false +deptfeature: false +dateModified: 2025-02-19 +css: "../src/connector.css" +script: +- src: "../src/connector.js" + type: module +--- + + + + + +
+

Perform an advanced search

+ + + + + + +

Expected output for the result section

+
+ Output for Results section + [To be completed, see Connector.js for reference until then] +
diff --git a/test/tpl-fr.html b/test/tpl-fr.html new file mode 100644 index 0000000..a5277c9 --- /dev/null +++ b/test/tpl-fr.html @@ -0,0 +1,60 @@ +--- +title: Résultats de la recherche avec gabarits de résumé et résultats personnalisés +description: Page démo pour les gabarits de résumé et résultats personnalisés dans l'interface utilisateur de recherche Canada.ca +lang: fr +altLangPage: tpl-en.html +nositesearch: true +pageclass: page-type-search +pageType: recherche +share: false +deptfeature: false +dateModified: 2025-02-19 +css: "../src/connector.css" +script: +- src: "../src/connector.js" + type: module +--- + + + + + +
+

Effectuer une recherche avancée

+ + + + + + +

Section Résultats attendu pour la section de résultats

+
+ Section Résultats générée + [À compléter, voir Connector.js comme référence pour l'instant] +
diff --git a/todo.md b/todo.md index cf7f0a8..6af20b0 100644 --- a/todo.md +++ b/todo.md @@ -2,12 +2,18 @@ This list contains outstanding suggestions / non-critical issues identified in previously merged pull requests. The following items do need to be addressed in due time. +- [x] Potentially come up with an easier way to test locally +- [x] Add includes of JS (src) files in a baked in Jekyll variables instead of hardcoded +- [x] Revisit the need to search for postscript and rich text documents (ps and rtf. Are they needed? What's the usecase? +- [x] Revisit the "window.location.origin.startsWith( 'file://' )" condition +- [x] Investigate Pagination styles when testing from GitHub +- [x] Investigate #wb-land focus on Advanced search +- [x] Document customEvent +- [x] Finish proper development of Query Suggestion (QS), outside of GCWeb +- [ ] Move QS generic integration to GCWeb - [ ] Remove the need for having a CSS file to be handled by GCWeb instead! - [ ] Add missing pieces such as "error message", "no result" and "did you mean" into our reference implementation as an example -- [ ] Potentially come up with an easier way to test locally - [ ] Add Expected output on test pages (HTML) and use Jekyll highlights -- [ ] Finish proper development of Suggestion box (type-ahead) -- [x] Add includes of JS (src) files in a baked in Jekyll variables instead of hardcoded - [ ] Align search pages with new GCWeb template and/or define new GCWeb templates - [ ] Ensure no section or heading or any element with semantic is added alone/empty on the page - [ ] Improve the form code to not rely on an action that points to an anchor for a dynamically added element, which doesn't exist on the page prior to JS @@ -17,10 +23,5 @@ This list contains outstanding suggestions / non-critical issues identified in p - [ ] Revisit how dates are handled for output formats (need an array of months?) - [ ] Make IDs configurable for "suggestion", "result-list", "result-link", "query-summary", "pager" - [ ] Revisit customEvent to potentially be scoped to the search-ui element instead of document -- [ ] Document customEvent - [ ] Improve warning message when Headless doesn't load - [ ] "numberOfPages: 9" and "automaticallyCorrectQuery: false" should be configurable through parameters -- [ ] Revisit the need to search for postscript and rich text documents (ps and rtf. Are they needed? What's the usecase? -- [ ] Revisit the "window.location.origin.startsWith( 'file://' )" condition -- [x] Investigate Pagination styles when testing from GitHub -- [x] Investigate #wb-land focus on Advanced search