From eef3a796bf47e665382a2ccfe957095f5c402ecd Mon Sep 17 00:00:00 2001 From: "developer-experience-bot[bot]" <91079284+developer-experience-bot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:30:19 +0000 Subject: [PATCH 01/15] [Version Bump][skip ci]: ui-kit publish @coveo/headless@3.4.0 @coveo/atomic@3.4.0 @coveo/headless-react@2.0.7 @coveo/atomic-react@3.1.6 @coveo/atomic-angular@3.1.6 @coveo/atomic-hosted-page@1.0.7 @coveo/quantic@3.2.1 **/CHANGELOG.md **/package.json CHANGELOG.md package.json package-lock.json --- package-lock.json | 76 +++++++++---------- packages/atomic-angular/package.json | 6 +- .../projects/atomic-angular/package.json | 6 +- packages/atomic-hosted-page/package.json | 4 +- packages/atomic-react/package.json | 6 +- packages/atomic/CHANGELOG.md | 12 +++ packages/atomic/package.json | 6 +- packages/headless-react/package.json | 4 +- packages/headless/CHANGELOG.md | 7 ++ packages/headless/package.json | 2 +- packages/quantic/CHANGELOG.md | 5 ++ packages/quantic/package.json | 4 +- packages/samples/angular/package.json | 2 +- packages/samples/atomic-next/package.json | 6 +- packages/samples/atomic-react/package.json | 6 +- .../headless-commerce-react/package.json | 2 +- packages/samples/headless-react/package.json | 2 +- .../headless-ssr-commerce/package.json | 2 +- packages/samples/headless-ssr/package.json | 4 +- packages/samples/iife/package.json | 8 +- packages/samples/stencil/package.json | 4 +- packages/samples/vuejs/package.json | 2 +- 22 files changed, 100 insertions(+), 76 deletions(-) diff --git a/package-lock.json b/package-lock.json index a805f194377..b7d5628a933 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53537,11 +53537,11 @@ }, "packages/atomic": { "name": "@coveo/atomic", - "version": "3.3.0", + "version": "3.4.0", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@popperjs/core": "^2.11.6", "@salesforce-ux/design-system": "^2.16.1", "@stencil/store": "2.0.16", @@ -53640,7 +53640,7 @@ }, "peerDependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" } }, "packages/atomic-angular": { @@ -53655,14 +53655,14 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "rxjs": "7.8.1" }, "devDependencies": { "@angular-devkit/build-angular": "17.3.9", "@angular/cli": "17.3.9", "@angular/compiler-cli": "17.3.12", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@types/node": "20.14.12", "jasmine-core": "5.2.0", "karma": "6.4.3", @@ -53678,7 +53678,7 @@ "node": "^20.9.0" }, "peerDependencies": { - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" } }, "packages/atomic-angular/node_modules/jasmine-core": { @@ -53707,10 +53707,10 @@ }, "packages/atomic-angular/projects/atomic-angular": { "name": "@coveo/atomic-angular", - "version": "3.1.5", + "version": "3.1.6", "license": "Apache-2.0", "dependencies": { - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "tslib": "2.6.3" }, "engines": { @@ -53719,16 +53719,16 @@ "peerDependencies": { "@angular/common": "14 - 17", "@angular/core": "14 - 17", - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" } }, "packages/atomic-hosted-page": { "name": "@coveo/atomic-hosted-page", - "version": "1.0.6", + "version": "1.0.7", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@stencil/core": "4.20.0" }, "devDependencies": { @@ -53810,9 +53810,9 @@ }, "packages/atomic-react": { "name": "@coveo/atomic-react", - "version": "3.1.5", + "version": "3.1.6", "dependencies": { - "@coveo/atomic": "3.3.0" + "@coveo/atomic": "3.4.0" }, "devDependencies": { "@coveo/release": "1.0.0", @@ -53837,7 +53837,7 @@ "node": "^20.9.0" }, "peerDependencies": { - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "react": ">=18.0.0", "react-dom": ">=18.0.0" } @@ -56975,7 +56975,7 @@ }, "packages/headless": { "name": "@coveo/headless", - "version": "3.3.0", + "version": "3.4.0", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "1.0.1", @@ -57016,10 +57016,10 @@ }, "packages/headless-react": { "name": "@coveo/headless-react", - "version": "2.0.6", + "version": "2.0.7", "license": "Apache-2.0", "dependencies": { - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" }, "devDependencies": { "@coveo/release": "1.0.0", @@ -57966,12 +57966,12 @@ }, "packages/quantic": { "name": "@coveo/quantic", - "version": "3.2.0", + "version": "3.2.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "dompurify": "3.1.6", "marked": "12.0.2" }, @@ -59905,7 +59905,7 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic-angular": "3.1.5", + "@coveo/atomic-angular": "3.1.6", "rxjs": "7.8.1", "tslib": "2.6.3", "zone.js": "0.14.8" @@ -60205,9 +60205,9 @@ "name": "@coveo/atomic-next-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.3.0", - "@coveo/atomic-react": "3.1.5", - "@coveo/headless": "3.3.0", + "@coveo/atomic": "3.4.0", + "@coveo/atomic-react": "3.1.6", + "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "18.3.1", "react-dom": "18.3.1" @@ -60270,9 +60270,9 @@ "name": "@coveo/atomic-react-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.3.0", - "@coveo/atomic-react": "3.1.5", - "@coveo/headless": "3.3.0", + "@coveo/atomic": "3.4.0", + "@coveo/atomic-react": "3.1.6", + "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" }, @@ -60760,7 +60760,7 @@ "name": "@coveo/headless-commerce-react-samples", "version": "0.1.0", "dependencies": { - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" }, @@ -62053,7 +62053,7 @@ "version": "0.0.0", "dependencies": { "@coveo/auth": "2.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@testing-library/jest-dom": "6.4.8", "@testing-library/react": "14.3.1", "@testing-library/user-event": "14.5.2", @@ -64139,8 +64139,8 @@ "name": "@coveo/headless-ssr-samples-common", "version": "0.0.0", "dependencies": { - "@coveo/headless": "3.3.0", - "@coveo/headless-react": "2.0.6", + "@coveo/headless": "3.4.0", + "@coveo/headless-react": "2.0.7", "next": "14.2.5", "react": "^18.2.0", "react-dom": "^18.2.0" @@ -64161,7 +64161,7 @@ "name": "@coveo/headless-ssr-commerce-samples", "version": "0.0.0", "dependencies": { - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "^18.2.0", "react-dom": "^18.2.0" @@ -64280,10 +64280,10 @@ "version": "0.1.0", "dependencies": { "@babel/standalone": "7.25.0", - "@coveo/atomic": "3.3.0", - "@coveo/atomic-hosted-page": "1.0.6", - "@coveo/atomic-react": "3.1.5", - "@coveo/headless": "3.3.0", + "@coveo/atomic": "3.4.0", + "@coveo/atomic-hosted-page": "1.0.7", + "@coveo/atomic-react": "3.1.6", + "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" }, @@ -64352,9 +64352,9 @@ "name": "@coveo/atomic-stencil-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@stencil/core": "4.20.0", "stencil-router-v2": "0.6.0" }, @@ -64637,7 +64637,7 @@ "name": "@coveo/atomic-vuejs-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "vue": "^3.4.15" }, "devDependencies": { diff --git a/packages/atomic-angular/package.json b/packages/atomic-angular/package.json index 702268d9d07..a0c6584a746 100644 --- a/packages/atomic-angular/package.json +++ b/packages/atomic-angular/package.json @@ -20,17 +20,17 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "rxjs": "7.8.1" }, "peerDependencies": { - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" }, "devDependencies": { "@angular-devkit/build-angular": "17.3.9", "@angular/cli": "17.3.9", "@angular/compiler-cli": "17.3.12", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@types/node": "20.14.12", "jasmine-core": "5.2.0", "karma": "6.4.3", diff --git a/packages/atomic-angular/projects/atomic-angular/package.json b/packages/atomic-angular/projects/atomic-angular/package.json index b38c14e902f..7ccbf6fbd09 100644 --- a/packages/atomic-angular/projects/atomic-angular/package.json +++ b/packages/atomic-angular/projects/atomic-angular/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/atomic-angular", - "version": "3.1.5", + "version": "3.1.6", "license": "Apache-2.0", "repository": { "url": "https://github.com/coveo/ui-kit" @@ -8,10 +8,10 @@ "peerDependencies": { "@angular/common": "14 - 17", "@angular/core": "14 - 17", - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" }, "dependencies": { - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "tslib": "2.6.3" }, "engines": { diff --git a/packages/atomic-hosted-page/package.json b/packages/atomic-hosted-page/package.json index 6202f75ca89..f8b5b44a613 100644 --- a/packages/atomic-hosted-page/package.json +++ b/packages/atomic-hosted-page/package.json @@ -1,7 +1,7 @@ { "name": "@coveo/atomic-hosted-page", "description": "Web Component used to inject a Coveo Hosted Search Page in the DOM.", - "version": "1.0.6", + "version": "1.0.7", "repository": { "type": "git", "url": "git+https://github.com/coveo/ui-kit.git", @@ -31,7 +31,7 @@ }, "dependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@stencil/core": "4.20.0" }, "devDependencies": { diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index 6dd5dda9f69..b15d2557294 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -2,7 +2,7 @@ "name": "@coveo/atomic-react", "sideEffects": false, "type": "module", - "version": "3.1.5", + "version": "3.1.6", "description": "React specific wrapper for the Atomic component library", "repository": { "type": "git", @@ -30,7 +30,7 @@ "commerce/" ], "dependencies": { - "@coveo/atomic": "3.3.0" + "@coveo/atomic": "3.4.0" }, "devDependencies": { "@coveo/release": "1.0.0", @@ -52,7 +52,7 @@ "rollup-plugin-polyfill-node": "^0.13.0" }, "peerDependencies": { - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "react": ">=18.0.0", "react-dom": ">=18.0.0" }, diff --git a/packages/atomic/CHANGELOG.md b/packages/atomic/CHANGELOG.md index f76a4f5ea5e..3d8c2882dcd 100644 --- a/packages/atomic/CHANGELOG.md +++ b/packages/atomic/CHANGELOG.md @@ -1,3 +1,15 @@ +## 3.4.0 (2024-10-16) + +- fix(atomic): add hover effect for atomic-product clickable element in mobile/grid (#4519) ([0828b1f](https://github.com/coveo/ui-kit/commits/0828b1f)), closes [#4519](https://github.com/coveo/ui-kit/issues/4519) +- fix(atomic): fix product image not always respect imageSize on grid display mode (#4520) ([95b6571](https://github.com/coveo/ui-kit/commits/95b6571)), closes [#4520](https://github.com/coveo/ui-kit/issues/4520) +- fix(atomic): hide carousel buttons when image size is set to icon (#4518) ([479cc41](https://github.com/coveo/ui-kit/commits/479cc41)), closes [#4518](https://github.com/coveo/ui-kit/issues/4518) +- test(atomic): fix flaky atomic did you mean tests (#4516) ([ec36b2e](https://github.com/coveo/ui-kit/commits/ec36b2e)), closes [#4516](https://github.com/coveo/ui-kit/issues/4516) +- test(atomic): skip quickview cypress tests (#4532) ([bb65136](https://github.com/coveo/ui-kit/commits/bb65136)), closes [#4532](https://github.com/coveo/ui-kit/issues/4532) +- feat(atomic): added logic to send analytics when opening user actions (#4512) ([06bea5a](https://github.com/coveo/ui-kit/commits/06bea5a)), closes [#4512](https://github.com/coveo/ui-kit/issues/4512) +- feat(didyoumean): allow shifting queryCorrectionMode on the fly (#4305) ([7b007a2](https://github.com/coveo/ui-kit/commits/7b007a2)), closes [#4305](https://github.com/coveo/ui-kit/issues/4305) +- feat(ipx): add exportparts to atomic-ipx-body (#4523) ([70754a0](https://github.com/coveo/ui-kit/commits/70754a0)), closes [#4523](https://github.com/coveo/ui-kit/issues/4523) +- ci(atomic): run only affected E2E tests in atomic (#4484) ([497ede3](https://github.com/coveo/ui-kit/commits/497ede3)), closes [#4484](https://github.com/coveo/ui-kit/issues/4484) + ## 3.3.0 (2024-10-10) - test(atomic): add tests & stories for atomic-product-image (#4469) ([bc09766](https://github.com/coveo/ui-kit/commits/bc09766)), closes [#4469](https://github.com/coveo/ui-kit/issues/4469) diff --git a/packages/atomic/package.json b/packages/atomic/package.json index 8a447ac36b5..6627093b5de 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -1,7 +1,7 @@ { "name": "@coveo/atomic", "type": "module", - "version": "3.3.0", + "version": "3.4.0", "description": "A web-component library for building modern UIs interfacing with the Coveo platform", "homepage": "https://docs.coveo.com/en/atomic/latest/", "repository": { @@ -67,7 +67,7 @@ }, "dependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@popperjs/core": "^2.11.6", "@salesforce-ux/design-system": "^2.16.1", "@stencil/store": "2.0.16", @@ -163,7 +163,7 @@ }, "peerDependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" }, "license": "Apache-2.0", "engines": { diff --git a/packages/headless-react/package.json b/packages/headless-react/package.json index 9cf811a4b05..78535a8216d 100644 --- a/packages/headless-react/package.json +++ b/packages/headless-react/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/headless-react", - "version": "2.0.6", + "version": "2.0.7", "description": "React utilities for SSR (Server Side Rendering) with headless", "homepage": "https://docs.coveo.com/en/headless/latest/", "repository": { @@ -33,7 +33,7 @@ "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "dependencies": { - "@coveo/headless": "3.3.0" + "@coveo/headless": "3.4.0" }, "devDependencies": { "@coveo/release": "1.0.0", diff --git a/packages/headless/CHANGELOG.md b/packages/headless/CHANGELOG.md index 0acfc9ed175..de1763f0739 100644 --- a/packages/headless/CHANGELOG.md +++ b/packages/headless/CHANGELOG.md @@ -1,3 +1,10 @@ +## 3.4.0 (2024-10-16) + +- fix(headless): set wasCorrectedTo to empty string unless query was automatically corrected (#4538) ([f44de0f](https://github.com/coveo/ui-kit/commits/f44de0f)), closes [#4538](https://github.com/coveo/ui-kit/issues/4538) +- test(quantic): ep analytics tests fixed in the e2e (#4529) ([435e2c2](https://github.com/coveo/ui-kit/commits/435e2c2)), closes [#4529](https://github.com/coveo/ui-kit/issues/4529) +- feat(didyoumean): allow shifting queryCorrectionMode on the fly (#4305) ([7b007a2](https://github.com/coveo/ui-kit/commits/7b007a2)), closes [#4305](https://github.com/coveo/ui-kit/issues/4305) +- feat(headless): remove visitorId (#4485) ([afe47a3](https://github.com/coveo/ui-kit/commits/afe47a3)), closes [#4485](https://github.com/coveo/ui-kit/issues/4485) + ## 3.3.0 (2024-10-10) - fix(atomic, headless): use `next` as default value for queryCorrectionMode (#4495) ([ddce004](https://github.com/coveo/ui-kit/commits/ddce004)), closes [#4495](https://github.com/coveo/ui-kit/issues/4495) diff --git a/packages/headless/package.json b/packages/headless/package.json index f4eb2b70284..ae52d4511b8 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -118,7 +118,7 @@ }, "types": "./dist/definitions/index.d.ts", "license": "Apache-2.0", - "version": "3.3.0", + "version": "3.4.0", "files": [ "dist/" ], diff --git a/packages/quantic/CHANGELOG.md b/packages/quantic/CHANGELOG.md index ab519592e00..948d126cb42 100644 --- a/packages/quantic/CHANGELOG.md +++ b/packages/quantic/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.2.1 (2024-10-16) + +- chore(quantic): skip consistently failing quantic tests (#4540) ([4a1b1f6](https://github.com/coveo/ui-kit/commits/4a1b1f6)), closes [#4540](https://github.com/coveo/ui-kit/issues/4540) +- test(quantic): ep analytics tests fixed in the e2e (#4529) ([435e2c2](https://github.com/coveo/ui-kit/commits/435e2c2)), closes [#4529](https://github.com/coveo/ui-kit/issues/4529) + ## 3.2.0 (2024-10-10) - fix(atomic, headless): use `next` as default value for queryCorrectionMode (#4495) ([ddce004](https://github.com/coveo/ui-kit/commits/ddce004)), closes [#4495](https://github.com/coveo/ui-kit/issues/4495) diff --git a/packages/quantic/package.json b/packages/quantic/package.json index 3710e3be00e..82d83d510dd 100644 --- a/packages/quantic/package.json +++ b/packages/quantic/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/quantic", - "version": "3.2.0", + "version": "3.2.1", "description": "A Salesforce Lightning Web Component (LWC) library for building modern UIs interfacing with the Coveo platform", "author": "coveo.com", "homepage": "https://coveo.com", @@ -46,7 +46,7 @@ }, "dependencies": { "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "dompurify": "3.1.6", "marked": "12.0.2" }, diff --git a/packages/samples/angular/package.json b/packages/samples/angular/package.json index 42eb41c9d17..6eeee45f6e6 100644 --- a/packages/samples/angular/package.json +++ b/packages/samples/angular/package.json @@ -19,7 +19,7 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic-angular": "3.1.5", + "@coveo/atomic-angular": "3.1.6", "rxjs": "7.8.1", "tslib": "2.6.3", "zone.js": "0.14.8" diff --git a/packages/samples/atomic-next/package.json b/packages/samples/atomic-next/package.json index 547d750d15f..dd0d67b5336 100644 --- a/packages/samples/atomic-next/package.json +++ b/packages/samples/atomic-next/package.json @@ -4,9 +4,9 @@ "private": true, "type": "module", "dependencies": { - "@coveo/atomic": "3.3.0", - "@coveo/atomic-react": "3.1.5", - "@coveo/headless": "3.3.0", + "@coveo/atomic": "3.4.0", + "@coveo/atomic-react": "3.1.6", + "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "18.3.1", "react-dom": "18.3.1" diff --git a/packages/samples/atomic-react/package.json b/packages/samples/atomic-react/package.json index bd5e426611b..12edd1a08ff 100644 --- a/packages/samples/atomic-react/package.json +++ b/packages/samples/atomic-react/package.json @@ -4,9 +4,9 @@ "description": "Samples with atomic-react", "private": true, "dependencies": { - "@coveo/atomic": "3.3.0", - "@coveo/atomic-react": "3.1.5", - "@coveo/headless": "3.3.0", + "@coveo/atomic": "3.4.0", + "@coveo/atomic-react": "3.1.6", + "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/packages/samples/headless-commerce-react/package.json b/packages/samples/headless-commerce-react/package.json index 2eaf2673520..f663b12e7e5 100644 --- a/packages/samples/headless-commerce-react/package.json +++ b/packages/samples/headless-commerce-react/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "dependencies": { - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/packages/samples/headless-react/package.json b/packages/samples/headless-react/package.json index 1470a06cc43..cd47471f5f7 100644 --- a/packages/samples/headless-react/package.json +++ b/packages/samples/headless-react/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@coveo/auth": "2.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@testing-library/jest-dom": "6.4.8", "@testing-library/react": "14.3.1", "@testing-library/user-event": "14.5.2", diff --git a/packages/samples/headless-ssr-commerce/package.json b/packages/samples/headless-ssr-commerce/package.json index 63168b388c7..a5d0a12a1d0 100644 --- a/packages/samples/headless-ssr-commerce/package.json +++ b/packages/samples/headless-ssr-commerce/package.json @@ -11,7 +11,7 @@ "build:next": "next build" }, "dependencies": { - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/samples/headless-ssr/package.json b/packages/samples/headless-ssr/package.json index 25ca2a915a1..51446d4cf73 100644 --- a/packages/samples/headless-ssr/package.json +++ b/packages/samples/headless-ssr/package.json @@ -8,8 +8,8 @@ "e2e:watch": "cypress open --browser chrome --e2e" }, "dependencies": { - "@coveo/headless-react": "2.0.6", - "@coveo/headless": "3.3.0", + "@coveo/headless-react": "2.0.7", + "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/samples/iife/package.json b/packages/samples/iife/package.json index 738dce38293..e7a493af687 100644 --- a/packages/samples/iife/package.json +++ b/packages/samples/iife/package.json @@ -12,10 +12,10 @@ }, "dependencies": { "@babel/standalone": "7.25.0", - "@coveo/atomic": "3.3.0", - "@coveo/atomic-hosted-page": "1.0.6", - "@coveo/atomic-react": "3.1.5", - "@coveo/headless": "3.3.0", + "@coveo/atomic": "3.4.0", + "@coveo/atomic-hosted-page": "1.0.7", + "@coveo/atomic-react": "3.1.6", + "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/packages/samples/stencil/package.json b/packages/samples/stencil/package.json index 4276a34b058..eb7e698fe73 100644 --- a/packages/samples/stencil/package.json +++ b/packages/samples/stencil/package.json @@ -8,9 +8,9 @@ "e2e:watch": "cypress open --browser chrome --e2e" }, "dependencies": { - "@coveo/atomic": "3.3.0", + "@coveo/atomic": "3.4.0", "@coveo/bueno": "1.0.1", - "@coveo/headless": "3.3.0", + "@coveo/headless": "3.4.0", "@stencil/core": "4.20.0", "stencil-router-v2": "0.6.0" }, diff --git a/packages/samples/vuejs/package.json b/packages/samples/vuejs/package.json index 1dac2e1b131..2fe855e34b5 100644 --- a/packages/samples/vuejs/package.json +++ b/packages/samples/vuejs/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "vue": "^3.4.15", - "@coveo/atomic": "3.3.0" + "@coveo/atomic": "3.4.0" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.3", From c423e1507fbb71f02cac0a265babd035916a98cd Mon Sep 17 00:00:00 2001 From: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:33:11 -0400 Subject: [PATCH 02/15] test(atomic): fix failing atomic-color-facet test because of source change (#4543) https://coveord.atlassian.net/browse/KIT-3662 --- .../cypress/e2e/facets/color-facet/color-facet.cypress.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/atomic/cypress/e2e/facets/color-facet/color-facet.cypress.ts b/packages/atomic/cypress/e2e/facets/color-facet/color-facet.cypress.ts index 098cd9ad021..6aa03d46f8c 100644 --- a/packages/atomic/cypress/e2e/facets/color-facet/color-facet.cypress.ts +++ b/packages/atomic/cypress/e2e/facets/color-facet/color-facet.cypress.ts @@ -647,7 +647,7 @@ describe('Color Facet Test Suites', () => { describe('as a dependent', () => { const parentFacetId = 'def'; const parentField = 'author'; - const expectedValue = 'amoreau'; + const expectedValue = 'Susan Cook'; beforeEach(() => { new TestFixture() .with( From 4d53962365d481d8cfc019b46156d5b569f542cc Mon Sep 17 00:00:00 2001 From: Felix Perron-Brault Date: Wed, 16 Oct 2024 11:07:20 -0400 Subject: [PATCH 03/15] fix(atomic): prevent clicks on atomic-product-image indicators from opening the product page (#4534) This PR prevents the product page from opening when clicking the indicator buttons of the atomic-product-image carousel. https://coveord.atlassian.net/browse/KIT-3652 --- .../common/image-carousel/image-carousel-indicators.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/atomic/src/components/common/image-carousel/image-carousel-indicators.tsx b/packages/atomic/src/components/common/image-carousel/image-carousel-indicators.tsx index 01e8fc4d855..069a48f4156 100644 --- a/packages/atomic/src/components/common/image-carousel/image-carousel-indicators.tsx +++ b/packages/atomic/src/components/common/image-carousel/image-carousel-indicators.tsx @@ -51,7 +51,10 @@ const CarouselIndicator: FunctionalComponent = ({ ? 'pointer-events-auto opacity-80' : 'pointer-events-none hidden opacity-0' }`} - onClick={() => navigateToImage(index)} + onClick={(event) => { + event.stopPropagation(); + navigateToImage(index); + }} > ); })} From ee7e1d957ba9c41fec452799e7df7a8ee2d637ee Mon Sep 17 00:00:00 2001 From: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:22:34 -0400 Subject: [PATCH 04/15] feat(atomic): remove imageAltField as an array option & use image alt field prior to image not found when it is valid (#4511) https://coveord.atlassian.net/browse/KIT-3641 --------- Co-authored-by: Frederic Beaudoin --- packages/atomic/src/components.d.ts | 4 +- .../atomic-product-image.tsx | 44 ++++----- .../e2e/atomic-product-image.e2e.ts | 98 +++++-------------- packages/atomic/src/locales.json | 50 +++++----- 4 files changed, 72 insertions(+), 124 deletions(-) diff --git a/packages/atomic/src/components.d.ts b/packages/atomic/src/components.d.ts index 9c0fab20869..1e258dc0818 100644 --- a/packages/atomic/src/components.d.ts +++ b/packages/atomic/src/components.d.ts @@ -2062,7 +2062,7 @@ export namespace Components { */ "field": string; /** - * The product field that contains the alt text for the images. This will look for the field in the product object first, then in the product.additionalFields object. The field can be a string or an array of strings. If the value of the field is a string, it will be used as the alt text for all the images. If the value of the field is an array of strings, the alt text will be used in the order of the images. If the field is not specified, or does not contain a valid value, the alt text will be set to "Image {index} out of {totalImages} for {productName}". + * The product field that contains the alt text for the images. This will look for the field in the product object first, then in the product.additionalFields object. If the product has multiple images, the value of the `imageAltField` will be used as the alt text for every image. If the field is not specified, or does not contain a valid value, the alt text will be set to "Image {index} out of {totalImages} for {productName}". * @type {string} */ "imageAltField"?: string; @@ -7959,7 +7959,7 @@ declare namespace LocalJSX { */ "field"?: string; /** - * The product field that contains the alt text for the images. This will look for the field in the product object first, then in the product.additionalFields object. The field can be a string or an array of strings. If the value of the field is a string, it will be used as the alt text for all the images. If the value of the field is an array of strings, the alt text will be used in the order of the images. If the field is not specified, or does not contain a valid value, the alt text will be set to "Image {index} out of {totalImages} for {productName}". + * The product field that contains the alt text for the images. This will look for the field in the product object first, then in the product.additionalFields object. If the product has multiple images, the value of the `imageAltField` will be used as the alt text for every image. If the field is not specified, or does not contain a valid value, the alt text will be set to "Image {index} out of {totalImages} for {productName}". * @type {string} */ "imageAltField"?: string; diff --git a/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/atomic-product-image.tsx b/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/atomic-product-image.tsx index f099ac61e61..c8c2b041a78 100644 --- a/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/atomic-product-image.tsx +++ b/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/atomic-product-image.tsx @@ -41,11 +41,7 @@ export class AtomicProductImage implements InitializableComponent { /** * The product field that contains the alt text for the images. This will look for the field in the product object first, then in the product.additionalFields object. - * The field can be a string or an array of strings. - * - * If the value of the field is a string, it will be used as the alt text for all the images. - * - * If the value of the field is an array of strings, the alt text will be used in the order of the images. + * If the product has multiple images, the value of the `imageAltField` will be used as the alt text for every image. * * If the field is not specified, or does not contain a valid value, the alt text will be set to "Image {index} out of {totalImages} for {productName}". * @type {string} @@ -138,9 +134,7 @@ export class AtomicProductImage implements InitializableComponent { this.validateUrl(finalUrl); let altText; - if (Array.isArray(validImageAlt) && validImageAlt[index]) { - altText = validImageAlt[index]; - } else if (typeof validImageAlt === 'string') { + if (typeof validImageAlt === 'string') { altText = validImageAlt; } else { altText = this.bindings.i18n.t('image-alt-fallback-multiple', { @@ -167,22 +161,17 @@ export class AtomicProductImage implements InitializableComponent { } private get imageAlt() { - if (this.imageAltField) { - const value = ProductTemplatesHelpers.getProductProperty( - this.product, - this.imageAltField - ); - - if (isNullOrUndefined(value)) { - return null; - } - - if (Array.isArray(value)) { - return value.map((v) => `${v}`.trim()); - } - return (value as string).trim(); + if (!this.imageAltField) { + return null; } - return null; + const value = ProductTemplatesHelpers.getProductProperty( + this.product, + this.imageAltField + ); + if (isNullOrUndefined(value)) { + return null; + } + return (value as string).trim(); } private get numberOfImages() { @@ -212,13 +201,18 @@ export class AtomicProductImage implements InitializableComponent { alt: image.alt, }; }); + if (this.images.length === 0) { this.validateUrl(this.fallback); + const alt = this.imageAlt + ? this.imageAlt + : this.bindings.i18n.t('image-not-found-alt', { + itemName: this.product.ec_name, + }); return ( {this.bindings.i18n.t('image-not-found-alt')} diff --git a/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/e2e/atomic-product-image.e2e.ts b/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/e2e/atomic-product-image.e2e.ts index 1a3cd5f4b1d..d9ba1841e83 100644 --- a/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/e2e/atomic-product-image.e2e.ts +++ b/packages/atomic/src/components/commerce/product-template-components/atomic-product-image/e2e/atomic-product-image.e2e.ts @@ -125,100 +125,57 @@ test.describe('with an alt text field', async () => { }); }); - test.describe('when imageAltField is an array of valid strings', () => { - const NO_CAROUSEL_CUSTOM_FIELDS = [ - 'FIRST Nublu Water Bottle', - 'SECOND Nublu Water Bottle 2', - ]; - const CAROUSEL_CUSTOM_FIELDS = [ - 'FIRST Blue Lagoon Mat', - 'SECOND Blue Lagoon Mat', - ]; - + test.describe('when imageAltField is a valid string, image is invalid and fallback is not specified', () => { test.beforeEach(async ({productImage}) => { - await productImage.withCustomField( - NO_CAROUSEL_CUSTOM_FIELDS, - CAROUSEL_CUSTOM_FIELDS - ); await productImage.load({ story: 'with-an-alt-text-field', args: { - field: 'ec_thumbnails', + field: 'invalid', fallback: undefined, - imageAltField: 'custom_alt_field', + imageAltField: 'ec_name', }, }); await productImage.noCarouselImage.waitFor(); }); - test('should be accessible', async ({makeAxeBuilder}) => { - const accessibilityResults = await makeAxeBuilder().analyze(); - expect(accessibilityResults.violations.length).toEqual(0); - }); - - test('should correctly assign alt text for the first image', async ({ + test('should have alt text as the image alt field', async ({ productImage, }) => { - const noCarouselAlt = - await productImage.noCarouselImage.getAttribute('alt'); - expect(noCarouselAlt).toContain(NO_CAROUSEL_CUSTOM_FIELDS[0]); + const alt = await productImage.noCarouselImage.getAttribute('alt'); + expect(alt).toEqual('Nublu Water Bottle'); const carouselAlt = await productImage.carouselImage.getAttribute('alt'); - expect(carouselAlt).toContain(CAROUSEL_CUSTOM_FIELDS[0]); - }); - - test('should correctly assign alt text for the last image', async ({ - productImage, - }) => { - await productImage.nextButton.click(); - - await expect - .poll(async () => { - return await productImage.carouselImage.getAttribute('alt'); - }) - .toContain(CAROUSEL_CUSTOM_FIELDS[1]); + expect(carouselAlt).toEqual('Blue Lagoon Mat'); }); }); - test.describe('when imageAltField is not specified', () => { + test.describe('when imageAltField is invalid, image is invalid and fallback is not specified', () => { test.beforeEach(async ({productImage}) => { - await productImage.load(); + await productImage.load({ + story: 'with-an-alt-text-field', + args: { + field: 'invalid', + fallback: undefined, + imageAltField: 'invalid', + }, + }); await productImage.noCarouselImage.waitFor(); }); - test('should be accessible', async ({makeAxeBuilder}) => { - const accessibilityResults = await makeAxeBuilder().analyze(); - expect(accessibilityResults.violations.length).toEqual(0); - }); - - test('should generate default alt text for all images', async ({ + test('should have image-not-found-alt as the alt text', async ({ productImage, }) => { - expect(await productImage.noCarouselImage.getAttribute('alt')).toEqual( - 'Image 1 out of 1 for Nublu Water Bottle' - ); - expect(await productImage.carouselImage.getAttribute('alt')).toEqual( - 'Image 1 out of 2 for Blue Lagoon Mat' - ); - await productImage.nextButton.click(); - await expect - .poll(async () => { - return await productImage.carouselImage.getAttribute('alt'); - }) - .toContain('Image 2 out of 2 for Blue Lagoon Mat'); + const alt = await productImage.noCarouselImage.getAttribute('alt'); + expect(alt).toEqual('No image available for Nublu Water Bottle.'); + + const carouselAlt = await productImage.carouselImage.getAttribute('alt'); + expect(carouselAlt).toEqual('No image available for Blue Lagoon Mat.'); }); }); - test.describe('when imageAltField is invalid', () => { + test.describe('when imageAltField is not specified', () => { test.beforeEach(async ({productImage}) => { - await productImage.load({ - story: 'with-an-alt-text-field', - args: { - field: 'ec_thumbnails', - fallback: undefined, - imageAltField: 'custom_alt_field', - }, - }); + await productImage.load(); await productImage.noCarouselImage.waitFor(); }); @@ -227,11 +184,9 @@ test.describe('with an alt text field', async () => { expect(accessibilityResults.violations.length).toEqual(0); }); - test('should use the default alt text for all images', async ({ + test('should generate default alt text for all images', async ({ productImage, - page, }) => { - await page.waitForTimeout(10000); expect(await productImage.noCarouselImage.getAttribute('alt')).toEqual( 'Image 1 out of 1 for Nublu Water Bottle' ); @@ -247,9 +202,8 @@ test.describe('with an alt text field', async () => { }); }); - test.describe('when imageAltField is an empty array', () => { + test.describe('when imageAltField is invalid', () => { test.beforeEach(async ({productImage}) => { - await productImage.withCustomField([], []); await productImage.load({ story: 'with-an-alt-text-field', args: { diff --git a/packages/atomic/src/locales.json b/packages/atomic/src/locales.json index 35dc6aebbac..b1c0a22959c 100644 --- a/packages/atomic/src/locales.json +++ b/packages/atomic/src/locales.json @@ -6698,31 +6698,31 @@ "zh-TW": "{{itemName}}的圖片" }, "image-not-found-alt": { - "en": "No image available.", - "fr": "Aucune image disponible.", - "cs": "Žádný obrázek není k dispozici.", - "da": "Ingen billede tilgængelig.", - "de": "Kein Bild verfügbar.", - "el": "Δεν υπάρχει διαθέσιμη εικόνα.", - "es": "No hay imagen disponible.", - "fi": "Kuvaa ei ole saatavilla.", - "hu": "Nincs kép elérhető.", - "id": "Tidak ada gambar tersedia.", - "it": "Nessuna immagine disponibile.", - "ja": "画像はありません。", - "ko": "이미지를 사용할 수 없습니다.", - "nl": "Geen afbeelding beschikbaar.", - "no": "Ingen bilde tilgjengelig.", - "pl": "Brak dostępnych obrazów.", - "pt": "Nenhuma imagem disponível.", - "pt-BR": "Nenhuma imagem disponível.", - "ru": "Изображение недоступно.", - "sv": "Ingen bild tillgänglig.", - "th": "ไม่มีภาพ", - "tr": "Resim bulunamadı.", - "zh": "无可用图片。", - "zh-CN": "没有可用的图片。", - "zh-TW": "沒有可用的圖片。" + "en": "No image available for {{itemName}}.", + "fr": "Aucune image disponible pour {{itemName}}.", + "cs": "Žádný obrázek není k dispozici pro {{itemName}}.", + "da": "Ingen billede tilgængelig for {{itemName}}.", + "de": "Kein Bild verfügbar für {{itemName}}.", + "el": "Δεν υπάρχει διαθέσιμη εικόνα για το {{itemName}}.", + "es": "No hay imagen disponible para {{itemName}}.", + "fi": "Kuvaa ei ole saatavilla kohteelle {{itemName}}.", + "hu": "Nincs kép elérhető a(z) {{itemName}} számára.", + "id": "Tidak ada gambar tersedia untuk {{itemName}}.", + "it": "Nessuna immagine disponibile per {{itemName}}.", + "ja": "{{itemName}} の画像はありません。", + "ko": "{{itemName}}에 대한 이미지를 사용할 수 없습니다.", + "nl": "Geen afbeelding beschikbaar voor {{itemName}}.", + "no": "Ingen bilde tilgjengelig for {{itemName}}.", + "pl": "Brak dostępnych obrazów dla {{itemName}}.", + "pt": "Nenhuma imagem disponível para {{itemName}}.", + "pt-BR": "Nenhuma imagem disponível para {{itemName}}.", + "ru": "Изображение недоступно для {{itemName}}.", + "sv": "Ingen bild tillgänglig för {{itemName}}.", + "th": "ไม่มีภาพสำหรับ {{itemName}}", + "tr": "{{itemName}} için resim bulunamadı.", + "zh": "{{itemName}} 无可用图片。", + "zh-CN": "没有可用的图片为 {{itemName}}。", + "zh-TW": "沒有可用的圖片為 {{itemName}}。" }, "feedback-modal-title": { "en": "Help us improve!", From 7739951b84c2f737a331002bacd71e5680f9d05f Mon Sep 17 00:00:00 2001 From: Felix Perron-Brault Date: Wed, 16 Oct 2024 11:32:20 -0400 Subject: [PATCH 05/15] fix(atomic): prevent touch events on atomic-product-children from opening the product page (#4533) This PR prevents the product page from opening when touching the product variants/children on mobile. This was preventing switching between variants on mobile devices. https://coveord.atlassian.net/browse/KIT-3649 --- .../atomic-product-children/atomic-product-children.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/atomic/src/components/commerce/product-template-components/atomic-product-children/atomic-product-children.tsx b/packages/atomic/src/components/commerce/product-template-components/atomic-product-children/atomic-product-children.tsx index fe6ddc087e1..26331cc6102 100644 --- a/packages/atomic/src/components/commerce/product-template-components/atomic-product-children/atomic-product-children.tsx +++ b/packages/atomic/src/components/commerce/product-template-components/atomic-product-children/atomic-product-children.tsx @@ -132,7 +132,11 @@ export class AtomicProductChildren event.key === 'Enter' && this.onSelectChild(child) } onMouseEnter={() => this.onSelectChild(child)} - onTouchStart={() => this.onSelectChild(child)} + onTouchStart={(event) => { + event.stopPropagation(); + event.preventDefault(); + this.onSelectChild(child); + }} > Date: Wed, 16 Oct 2024 13:48:53 -0400 Subject: [PATCH 06/15] fix(insight): error "getAllFacets is undefined" in insight panel interface (#4474) This aims to resolve the error we're encountering when integrating the Insight Panel using the html request in ServiceNow. The issue arises because the HTML markup includes , and the atomic-insight-interface is missing some necessary components to support the atomic-facet-manager. ![image](https://github.com/user-attachments/assets/af16e777-9729-48d3-add0-2705075a008b) [SVCINT-3054](https://coveord.atlassian.net/browse/SVCINT-3054) [SVCINT-3054]: https://coveord.atlassian.net/browse/SVCINT-3054?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .../insight/atomic-insight-interface/store.ts | 31 ++++++++++++- .../atomic/src/pages/examples/insights.html | 46 ++++++++++--------- 2 files changed, 54 insertions(+), 23 deletions(-) diff --git a/packages/atomic/src/components/insight/atomic-insight-interface/store.ts b/packages/atomic/src/components/insight/atomic-insight-interface/store.ts index 645cad92d39..a548b58bf33 100644 --- a/packages/atomic/src/components/insight/atomic-insight-interface/store.ts +++ b/packages/atomic/src/components/insight/atomic-insight-interface/store.ts @@ -3,6 +3,7 @@ import { InsightEngine, InsightNumericFacetValue, } from '..'; +import {DEFAULT_MOBILE_BREAKPOINT} from '../../../utils/replace-breakpoint'; import { FacetInfo, FacetStore, @@ -13,6 +14,7 @@ import { AtomicCommonStoreData, createAtomicCommonStore, } from '../../common/interface/store'; +import {makeDesktopQuery} from '../../search/atomic-layout/search-layout'; export interface AtomicInsightStoreData extends AtomicCommonStoreData { fieldsToInclude: string[]; @@ -22,10 +24,21 @@ export interface AtomicInsightStoreData extends AtomicCommonStoreData { >; dateFacets: FacetStore>; categoryFacets: FacetStore; + mobileBreakpoint: string; +} + +export interface FacetInfoMap { + [facetId: string]: + | FacetInfo + | (FacetInfo & FacetValueFormat) + | (FacetInfo & FacetValueFormat); } export interface AtomicInsightStore - extends AtomicCommonStore {} + extends AtomicCommonStore { + getAllFacets(): FacetInfoMap; + isMobile(): boolean; +} export function createAtomicInsightStore(): AtomicInsightStore { const commonStore = createAtomicCommonStore({ @@ -37,10 +50,26 @@ export function createAtomicInsightStore(): AtomicInsightStore { iconAssetsPath: '', fieldsToInclude: [], facetElements: [], + mobileBreakpoint: DEFAULT_MOBILE_BREAKPOINT, }); return { ...commonStore, + getAllFacets() { + return { + ...commonStore.state.facets, + ...commonStore.state.dateFacets, + ...commonStore.state.categoryFacets, + ...commonStore.state.numericFacets, + }; + }, + + isMobile() { + return !window.matchMedia( + makeDesktopQuery(commonStore.state.mobileBreakpoint) + ).matches; + }, + getUniqueIDFromEngine(engine: InsightEngine): string { return engine.state.search.searchResponseId; }, diff --git a/packages/atomic/src/pages/examples/insights.html b/packages/atomic/src/pages/examples/insights.html index 24f9292fc3e..1d30285d30a 100644 --- a/packages/atomic/src/pages/examples/insights.html +++ b/packages/atomic/src/pages/examples/insights.html @@ -66,28 +66,30 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + From 9e15c6c40a0b88d798a2eb22a254d04b49684911 Mon Sep 17 00:00:00 2001 From: Luc Bergeron <10946843+lbergeron@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:30:31 -0400 Subject: [PATCH 07/15] fix(atomic): broken HTML because of formatting in CRGA markdown heading (#4522) [SVCC-4245](https://coveord.atlassian.net/browse/SVCC-4245) A CRGA model generally generates markdown headings like this: ``` # Title ``` However, in some cases, it can generate headings this way: ``` **Title** ===== ``` When it does, the HTML returned by the `generated-answer` component is broken and the heading reads like this: ``` Title>Title ``` The core of the issue is in [this custom Marked renderer](https://github.com/coveo/ui-kit/blob/master/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts#L50). When the heading has formatting, the `text` parameter contains the HTML rendering of the heading content. Inserting non-escaped HTML into the `aria-label` attribute then breaks the `div` element. This PR fixes the issue by affecting only the heading text content to the `aria-label` attribute. To do so, the HTML elements are removed from the heading content when setting `aria-label`. The heading content HTML is kept intact when setting the heading inner HTML though in order to keep the heading formatting. For example: ``` **Title** ===== ``` Would generate this HTML ```
Title
``` [SVCC-4245]: https://coveord.atlassian.net/browse/SVCC-4245?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .../generated-content/markdown-utils.test.ts | 20 +++++++++++++++++++ .../generated-content/markdown-utils.ts | 11 +++++++++- .../__tests__/markdownUtils.test.js | 8 ++++++++ .../default/lwc/quanticUtils/markdownUtils.js | 16 ++++++++++++++- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.test.ts b/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.test.ts index 6a02911344d..6fff8906bb0 100644 --- a/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.test.ts +++ b/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.test.ts @@ -302,6 +302,26 @@ describe('markdownUtils', () => { ); }); }); + + it('should transform formatted heading', () => { + const text = '# **bold** *emphasized* with `code` title'; + + const html = transformMarkdownToHtml(text); + + expect(removeLineBreaks(html)).toBe( + '
bold emphasized with code title
' + ); + }); + + it('should transform heading with nested formatting', () => { + const text = '# ***bold** emphasized with `code`* title'; + + const html = transformMarkdownToHtml(text); + + expect(removeLineBreaks(html)).toBe( + '
bold emphasized with code title
' + ); + }); }); describe('with unclosed inline elements in text', () => { diff --git a/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts b/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts index 8659f42840a..7dc0cf3ab4e 100644 --- a/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts +++ b/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts @@ -1,5 +1,12 @@ import {marked} from 'marked'; +const toInlinePlainText = (textWithHtml: string): string => { + const withoutHtmlTags = textWithHtml.replace(/<[^>]*>/g, ' '); + const withCollapsedWhitespaces = withoutHtmlTags.replace(/\s{2,}/g, ' '); + + return withCollapsedWhitespaces.trim(); +}; + const unclosedElement = /(\*{1,3}|`)($|\w[\w\s]*$)/; const completeUnclosedElement = (text: string) => { @@ -48,7 +55,9 @@ const customRenderer = { }, heading(text: string, level: number) { - return `
${text}
`; + const plainText = toInlinePlainText(text); + + return `
${text}
`; }, html(text: string) { diff --git a/packages/quantic/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js b/packages/quantic/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js index 3a161743252..e2cbe00e963 100644 --- a/packages/quantic/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +++ b/packages/quantic/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js @@ -28,6 +28,14 @@ describe('c/markdownUtils', () => { ); }); + it('should transform markdown heading with formatting to HTML
', () => { + const text = '# **bold** and *emphasized* title'; + const result = transformMarkdownToHtml(text, marked); + expect(removeLineBreaks(result)).toEqual( + '
bold and emphasized title
' + ); + }); + it('should transform markdown list item to HTML
  • ', () => { const text = '- Hello, world!'; const result = transformMarkdownToHtml(text, marked); diff --git a/packages/quantic/force-app/main/default/lwc/quanticUtils/markdownUtils.js b/packages/quantic/force-app/main/default/lwc/quanticUtils/markdownUtils.js index 88e87d83f03..11858dcab75 100644 --- a/packages/quantic/force-app/main/default/lwc/quanticUtils/markdownUtils.js +++ b/packages/quantic/force-app/main/default/lwc/quanticUtils/markdownUtils.js @@ -3,6 +3,18 @@ import MARKED_JS from '@salesforce/resourceUrl/marked'; // @ts-ignore import {loadScript} from 'lightning/platformResourceLoader'; +/** + * Transforms a single line of text that may contain HTML to plain text. + * @param {string} textWithHtml A single line of text that may contain HTML + * @returns {string} The value as plain text + */ +const toInlinePlainText = (textWithHtml) => { + const withoutHtmlTags = textWithHtml.replace(/<[^>]*>/g, ' '); + const withCollapsedWhitespaces = withoutHtmlTags.replace(/\s{2,}/g, ' '); + + return withCollapsedWhitespaces.trim(); +}; + // Any number of `*` between 1 and 3, or a single backtick, followed by a word character or whitespace character const unclosedElement = /(\*{1,3}|`)($|\w[\w\s]*$)/; @@ -49,7 +61,9 @@ const customRenderer = { * @param {string} level */ heading(text, level) { - return `
    ${text}
    `; + const plainText = toInlinePlainText(text); + + return `
    ${text}
    `; }, /** From cbfca7f2539f2326f5e4d718b39c269ab48edba7 Mon Sep 17 00:00:00 2001 From: Felix Perron-Brault Date: Thu, 17 Oct 2024 09:38:00 -0400 Subject: [PATCH 08/15] fix(atomic): fix layout issue on product variants with imageSize set to none (#4521) This PR fixes the product variant icons from taking the full width of the product element when the imageSize is set to none image https://coveord.atlassian.net/browse/KIT-3608 --- .../components/commerce/atomic-product/atomic-product.pcss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/atomic/src/components/commerce/atomic-product/atomic-product.pcss b/packages/atomic/src/components/commerce/atomic-product/atomic-product.pcss index e8a818fc451..571ecf189e5 100644 --- a/packages/atomic/src/components/commerce/atomic-product/atomic-product.pcss +++ b/packages/atomic/src/components/commerce/atomic-product/atomic-product.pcss @@ -29,7 +29,8 @@ } } - &.image-icon { + &.image-icon, + &.image-none { atomic-product-section-children .product-child { width: 2rem; height: 2rem; @@ -46,7 +47,8 @@ } } - &.image-icon { + &.image-icon, + &.image-none { atomic-product-section-children .product-child { width: 2rem; height: 2rem; From c39f7167ae0dcb2104f14825266253e10975bd6f Mon Sep 17 00:00:00 2001 From: Frederic Beaudoin Date: Thu, 17 Oct 2024 11:01:34 -0400 Subject: [PATCH 09/15] fix(atomic): delete ./loader/package.json when building atomic (#4539) https://coveord.atlassian.net/browse/KIT-3654 --- packages/atomic/project.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/atomic/project.json b/packages/atomic/project.json index 1b1eb78f69a..6b1ab3fa7a9 100644 --- a/packages/atomic/project.json +++ b/packages/atomic/project.json @@ -50,6 +50,7 @@ "build": { "dependsOn": [ "cached:build:stencil", + "delete-loader-package-json", "validate:definitions", "build-storybook" ], @@ -146,6 +147,14 @@ "options": { "command": "test-storybook -c packages/atomic/.storybook --url=http://localhost:4400" } + }, + "delete-loader-package-json": { + "dependsOn": ["^build", "cached:build:stencil"], + "executor": "nx:run-commands", + "options": { + "command": "rm ./loader/package.json", + "cwd": "packages/atomic" + } } } } From 874286ecc20734fb2ae35ad1b35fc112a2a0802f Mon Sep 17 00:00:00 2001 From: Frederic Beaudoin Date: Thu, 17 Oct 2024 11:37:56 -0400 Subject: [PATCH 10/15] chore(deps): bump rollup (#4525) https://coveord.atlassian.net/browse/KIT-3646 Addresses https://github.com/coveo/ui-kit/security/dependabot/626 --- package-lock.json | 392 +++++++++++++++++++++++------ packages/atomic-react/package.json | 2 +- packages/atomic/package.json | 2 +- 3 files changed, 320 insertions(+), 76 deletions(-) diff --git a/package-lock.json b/package-lock.json index b7d5628a933..0c504f531fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11062,9 +11062,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", - "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.0.tgz", + "integrity": "sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==", "cpu": [ "arm" ], @@ -53623,7 +53623,7 @@ "postcss-nested": "6.2.0", "puppeteer": "22.14.0", "react": "18.3.1", - "rollup": "4.22.4", + "rollup": "4.24.0", "rollup-plugin-html": "0.2.1", "shadow-dom-testing-library": "1.11.2", "storybook": "8.1.2", @@ -53830,7 +53830,7 @@ "ncp": "2.0.0", "react": "18.3.1", "react-dom": "18.3.1", - "rollup": "3.29.4", + "rollup": "4.24.0", "rollup-plugin-polyfill-node": "^0.13.0" }, "engines": { @@ -53867,6 +53867,223 @@ } } }, + "packages/atomic-react/node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz", + "integrity": "sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-android-arm64": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.0.tgz", + "integrity": "sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.0.tgz", + "integrity": "sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-darwin-x64": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.0.tgz", + "integrity": "sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.0.tgz", + "integrity": "sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.0.tgz", + "integrity": "sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.0.tgz", + "integrity": "sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.0.tgz", + "integrity": "sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.0.tgz", + "integrity": "sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.0.tgz", + "integrity": "sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.0.tgz", + "integrity": "sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz", + "integrity": "sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.0.tgz", + "integrity": "sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.0.tgz", + "integrity": "sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "packages/atomic-react/node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.0.tgz", + "integrity": "sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "packages/atomic-react/node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, "packages/atomic-react/node_modules/@types/resolve": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", @@ -53874,18 +54091,38 @@ "dev": true }, "packages/atomic-react/node_modules/rollup": { - "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.0.tgz", + "integrity": "sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==", "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.6" + }, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=14.18.0", + "node": ">=18.0.0", "npm": ">=8.0.0" }, "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.24.0", + "@rollup/rollup-android-arm64": "4.24.0", + "@rollup/rollup-darwin-arm64": "4.24.0", + "@rollup/rollup-darwin-x64": "4.24.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.24.0", + "@rollup/rollup-linux-arm-musleabihf": "4.24.0", + "@rollup/rollup-linux-arm64-gnu": "4.24.0", + "@rollup/rollup-linux-arm64-musl": "4.24.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.24.0", + "@rollup/rollup-linux-riscv64-gnu": "4.24.0", + "@rollup/rollup-linux-s390x-gnu": "4.24.0", + "@rollup/rollup-linux-x64-gnu": "4.24.0", + "@rollup/rollup-linux-x64-musl": "4.24.0", + "@rollup/rollup-win32-arm64-msvc": "4.24.0", + "@rollup/rollup-win32-ia32-msvc": "4.24.0", + "@rollup/rollup-win32-x64-msvc": "4.24.0", "fsevents": "~2.3.2" } }, @@ -54895,9 +55132,9 @@ } }, "packages/atomic/node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", - "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz", + "integrity": "sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==", "cpu": [ "arm" ], @@ -54909,9 +55146,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-android-arm64": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", - "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.0.tgz", + "integrity": "sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==", "cpu": [ "arm64" ], @@ -54923,9 +55160,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", - "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.0.tgz", + "integrity": "sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==", "cpu": [ "arm64" ], @@ -54937,9 +55174,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-darwin-x64": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", - "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.0.tgz", + "integrity": "sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==", "cpu": [ "x64" ], @@ -54951,9 +55188,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", - "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.0.tgz", + "integrity": "sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==", "cpu": [ "arm" ], @@ -54965,9 +55202,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", - "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.0.tgz", + "integrity": "sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==", "cpu": [ "arm64" ], @@ -54979,9 +55216,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", - "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.0.tgz", + "integrity": "sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==", "cpu": [ "arm64" ], @@ -54993,9 +55230,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", - "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.0.tgz", + "integrity": "sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==", "cpu": [ "ppc64" ], @@ -55007,9 +55244,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", - "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.0.tgz", + "integrity": "sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==", "cpu": [ "riscv64" ], @@ -55021,9 +55258,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", - "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.0.tgz", + "integrity": "sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==", "cpu": [ "s390x" ], @@ -55035,9 +55272,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", - "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.0.tgz", + "integrity": "sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==", "cpu": [ "x64" ], @@ -55049,9 +55286,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", - "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz", + "integrity": "sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==", "cpu": [ "x64" ], @@ -55063,9 +55300,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", - "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.0.tgz", + "integrity": "sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==", "cpu": [ "arm64" ], @@ -55077,9 +55314,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", - "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.0.tgz", + "integrity": "sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==", "cpu": [ "ia32" ], @@ -55091,9 +55328,9 @@ ] }, "packages/atomic/node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", - "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.0.tgz", + "integrity": "sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==", "cpu": [ "x64" ], @@ -55132,6 +55369,13 @@ "url": "https://opencollective.com/storybook" } }, + "packages/atomic/node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, "packages/atomic/node_modules/@types/lodash": { "version": "4.17.7", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", @@ -55901,13 +56145,13 @@ } }, "packages/atomic/node_modules/rollup": { - "version": "4.22.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", - "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.0.tgz", + "integrity": "sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "1.0.5" + "@types/estree": "1.0.6" }, "bin": { "rollup": "dist/bin/rollup" @@ -55917,22 +56161,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.22.4", - "@rollup/rollup-android-arm64": "4.22.4", - "@rollup/rollup-darwin-arm64": "4.22.4", - "@rollup/rollup-darwin-x64": "4.22.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", - "@rollup/rollup-linux-arm-musleabihf": "4.22.4", - "@rollup/rollup-linux-arm64-gnu": "4.22.4", - "@rollup/rollup-linux-arm64-musl": "4.22.4", - "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", - "@rollup/rollup-linux-riscv64-gnu": "4.22.4", - "@rollup/rollup-linux-s390x-gnu": "4.22.4", - "@rollup/rollup-linux-x64-gnu": "4.22.4", - "@rollup/rollup-linux-x64-musl": "4.22.4", - "@rollup/rollup-win32-arm64-msvc": "4.22.4", - "@rollup/rollup-win32-ia32-msvc": "4.22.4", - "@rollup/rollup-win32-x64-msvc": "4.22.4", + "@rollup/rollup-android-arm-eabi": "4.24.0", + "@rollup/rollup-android-arm64": "4.24.0", + "@rollup/rollup-darwin-arm64": "4.24.0", + "@rollup/rollup-darwin-x64": "4.24.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.24.0", + "@rollup/rollup-linux-arm-musleabihf": "4.24.0", + "@rollup/rollup-linux-arm64-gnu": "4.24.0", + "@rollup/rollup-linux-arm64-musl": "4.24.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.24.0", + "@rollup/rollup-linux-riscv64-gnu": "4.24.0", + "@rollup/rollup-linux-s390x-gnu": "4.24.0", + "@rollup/rollup-linux-x64-gnu": "4.24.0", + "@rollup/rollup-linux-x64-musl": "4.24.0", + "@rollup/rollup-win32-arm64-msvc": "4.24.0", + "@rollup/rollup-win32-ia32-msvc": "4.24.0", + "@rollup/rollup-win32-x64-msvc": "4.24.0", "fsevents": "~2.3.2" } }, diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index b15d2557294..5d59ed54a9a 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -48,7 +48,7 @@ "ncp": "2.0.0", "react": "18.3.1", "react-dom": "18.3.1", - "rollup": "3.29.4", + "rollup": "4.24.0", "rollup-plugin-polyfill-node": "^0.13.0" }, "peerDependencies": { diff --git a/packages/atomic/package.json b/packages/atomic/package.json index 6627093b5de..697c058ec44 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -149,7 +149,7 @@ "postcss-nested": "6.2.0", "puppeteer": "22.14.0", "react": "18.3.1", - "rollup": "4.22.4", + "rollup": "4.24.0", "rollup-plugin-html": "0.2.1", "shadow-dom-testing-library": "1.11.2", "storybook": "8.1.2", From 45e156a66f15fa613b193119345b82bc6f25305b Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Mon, 21 Oct 2024 12:10:28 -0400 Subject: [PATCH 11/15] chore: ensure we check only the tags from the current release branch (#4557) https://coveord.atlassian.net/browse/KIT-3668 --- package-lock.json | 29 +++++++++++++++-------------- utils/release/bump-package.mjs | 6 +++++- utils/release/common/constants.mjs | 2 ++ utils/release/git-publish-all.mjs | 4 ++-- utils/release/package.json | 2 +- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0c504f531fb..8761edede7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5063,19 +5063,6 @@ "resolved": "packages/rollup-plugin-replace-with-ast", "link": true }, - "node_modules/@coveo/semantic-monorepo-tools": { - "version": "2.4.43", - "resolved": "https://registry.npmjs.org/@coveo/semantic-monorepo-tools/-/semantic-monorepo-tools-2.4.43.tgz", - "integrity": "sha512-l3drdwCw7mHcQNUBJn9yF8/gDTFDWLp7iNhJ/g9rs8gV9Vfv+TG83w8eKyNDFX17FzzHkAz/dYJ0ealKAXRmuA==", - "dependencies": { - "conventional-changelog-writer": "^7.0.0", - "conventional-commits-parser": "^5.0.0", - "debug": "^4.3.3", - "git-raw-commits": "^4.0.0", - "semver": "^7.3.7", - "tempfile": "^5.0.0" - } - }, "node_modules/@cspell/cspell-bundled-dicts": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-8.12.1.tgz", @@ -65491,7 +65478,7 @@ "name": "@coveo/release", "version": "1.0.0", "dependencies": { - "@coveo/semantic-monorepo-tools": "2.4.43", + "@coveo/semantic-monorepo-tools": "2.4.61", "@npmcli/arborist": "7.5.4", "@octokit/auth-app": "6.1.1", "async-retry": "1.3.3", @@ -65508,6 +65495,20 @@ "typescript": "5.4.5" } }, + "utils/release/node_modules/@coveo/semantic-monorepo-tools": { + "version": "2.4.61", + "resolved": "https://registry.npmjs.org/@coveo/semantic-monorepo-tools/-/semantic-monorepo-tools-2.4.61.tgz", + "integrity": "sha512-zYOUlRsEXc0p5/rhHUa3ApVb3SXIh50iwRbHQVwTNoaNOTKlp5YDxX8rzpqVVEb1TlfV0GYAaZ2WaVZ9TLKwxQ==", + "license": "Apache-2.0", + "dependencies": { + "conventional-changelog-writer": "^7.0.0", + "conventional-commits-parser": "^5.0.0", + "debug": "^4.3.3", + "git-raw-commits": "^4.0.0", + "semver": "^7.3.7", + "tempfile": "^5.0.0" + } + }, "utils/release/node_modules/@npmcli/arborist": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-7.5.4.tgz", diff --git a/utils/release/bump-package.mjs b/utils/release/bump-package.mjs index afcb266c419..750523ceeda 100755 --- a/utils/release/bump-package.mjs +++ b/utils/release/bump-package.mjs @@ -21,6 +21,7 @@ import { REPO_HOST, REPO_NAME, REPO_OWNER, + REPO_RELEASE_BRANCH, } from './common/constants.mjs'; if (!process.env.INIT_CWD) { @@ -82,7 +83,10 @@ await (async () => { ); const versionPrefix = `${packageJson.name}@`; const convention = await changelogConvention(); - const lastTag = await getLastTag(versionPrefix); + const lastTag = await getLastTag({ + prefix: versionPrefix, + onBranch: REPO_RELEASE_BRANCH, + }); const commits = await getCommits(PATH, lastTag); if (commits.length === 0 && !hasPackageJsonChanged(PATH)) { return; diff --git a/utils/release/common/constants.mjs b/utils/release/common/constants.mjs index a4469049a39..9b348a34525 100644 --- a/utils/release/common/constants.mjs +++ b/utils/release/common/constants.mjs @@ -5,6 +5,8 @@ export const REPO_HOST = 'https://github.com'; export const REPO_OWNER = 'coveo'; export const REPO_NAME = 'ui-kit'; export const REPO_MAIN_BRANCH = 'master'; +export const REPO_RELEASE_BRANCH = 'release/v3'; + export const REPO_FS_ROOT = resolve( dirname(fileURLToPath(import.meta.url)), '..', diff --git a/utils/release/git-publish-all.mjs b/utils/release/git-publish-all.mjs index a1a8a776010..5e1d11f9944 100755 --- a/utils/release/git-publish-all.mjs +++ b/utils/release/git-publish-all.mjs @@ -24,6 +24,7 @@ import { RELEASER_AUTH_SECRETS, REPO_NAME, REPO_OWNER, + REPO_RELEASE_BRANCH, } from './common/constants.mjs'; import {removeWriteAccessRestrictions} from './lock-master.mjs'; @@ -73,11 +74,10 @@ process.chdir(process.env.INIT_CWD); await gitPushTags(); // Current release branch - const currentReleaseBranch = 'release/v3'; await octokit.rest.git.updateRef({ owner: REPO_OWNER, repo: REPO_NAME, - ref: `heads/${currentReleaseBranch}`, + ref: `heads/${REPO_RELEASE_BRANCH}`, sha: commit, force: false, }); diff --git a/utils/release/package.json b/utils/release/package.json index 70ec936c82f..8a7cc14c259 100644 --- a/utils/release/package.json +++ b/utils/release/package.json @@ -5,7 +5,7 @@ "version": "1.0.0", "type": "module", "dependencies": { - "@coveo/semantic-monorepo-tools": "2.4.43", + "@coveo/semantic-monorepo-tools": "2.4.61", "@npmcli/arborist": "7.5.4", "@octokit/auth-app": "6.1.1", "async-retry": "1.3.3", From f42d055a41e4ec65ca1e49b81e64f83f127ecc68 Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Mon, 21 Oct 2024 14:31:53 -0400 Subject: [PATCH 12/15] chore: ensure we get the remote branch for getLastTag (#4563) https://coveord.atlassian.net/browse/KIT-3668 --------- Co-authored-by: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com> --- utils/release/bump-package.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/release/bump-package.mjs b/utils/release/bump-package.mjs index 750523ceeda..76d1104f2dc 100755 --- a/utils/release/bump-package.mjs +++ b/utils/release/bump-package.mjs @@ -85,7 +85,7 @@ await (async () => { const convention = await changelogConvention(); const lastTag = await getLastTag({ prefix: versionPrefix, - onBranch: REPO_RELEASE_BRANCH, + onBranch: `refs/remotes/origin/${REPO_RELEASE_BRANCH}`, }); const commits = await getCommits(PATH, lastTag); if (commits.length === 0 && !hasPackageJsonChanged(PATH)) { From b3d75b2360d58d81400babb87ad6255c0d3a0820 Mon Sep 17 00:00:00 2001 From: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:37:47 -0400 Subject: [PATCH 13/15] chore: lockfile update (#4580) KIT-282 --- package-lock.json | 94 +++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8761edede7d..84640416b6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2022,12 +2022,11 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.7.tgz", - "integrity": "sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.9.tgz", + "integrity": "sha512-z88xeGxnzehn2sqZ8UdGQEvYErF1odv2CftxInpSYJt6uHuPe9YjahKZITGs3l5LeI9d2ROG+obuDAoSlqbNfQ==", "dependencies": { - "@babel/highlight": "^7.25.7", + "@babel/highlight": "^7.25.9", "picocolors": "^1.0.0" }, "engines": { @@ -2525,19 +2524,17 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz", - "integrity": "sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz", - "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "engines": { "node": ">=6.9.0" } @@ -2582,12 +2579,11 @@ } }, "node_modules/@babel/highlight": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.7.tgz", - "integrity": "sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.9.tgz", + "integrity": "sha512-llL88JShoCsth8fF8R4SJnIn+WLvR6ccFxu1H3FlMhDontdcmZWf2HgIZ7AIqV3Xcck1idlohrN4EUBQz6klbw==", "dependencies": { - "@babel/helper-validator-identifier": "^7.25.7", + "@babel/helper-validator-identifier": "^7.25.9", "chalk": "^2.4.2", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" @@ -2597,12 +2593,11 @@ } }, "node_modules/@babel/parser": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.7.tgz", - "integrity": "sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.9.tgz", + "integrity": "sha512-aI3jjAAO1fh7vY/pBGsn1i9LDbRP43+asrRlkPuTXW5yHXtd1NgTEMudbBoDDxrf1daEEfPJqR+JBMakzrR4Dg==", "dependencies": { - "@babel/types": "^7.25.7" + "@babel/types": "^7.25.9" }, "bin": { "parser": "bin/babel-parser.js" @@ -4539,32 +4534,30 @@ } }, "node_modules/@babel/template": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.7.tgz", - "integrity": "sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.7", - "@babel/parser": "^7.25.7", - "@babel/types": "^7.25.7" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.7.tgz", - "integrity": "sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.9.tgz", + "integrity": "sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.7", - "@babel/generator": "^7.25.7", - "@babel/parser": "^7.25.7", - "@babel/template": "^7.25.7", - "@babel/types": "^7.25.7", + "@babel/code-frame": "^7.25.9", + "@babel/generator": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/template": "^7.25.9", + "@babel/types": "^7.25.9", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -4573,13 +4566,12 @@ } }, "node_modules/@babel/traverse/node_modules/@babel/generator": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.7.tgz", - "integrity": "sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.9.tgz", + "integrity": "sha512-omlUGkr5EaoIJrhLf9CJ0TvjBRpd9+AXRG//0GEQ9THSo8wPiTlbpy1/Ow8ZTrbXpjd9FHXfbFQx32I04ht0FA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/types": "^7.25.7", + "@babel/types": "^7.25.9", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -4593,7 +4585,6 @@ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "dev": true, - "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, @@ -4602,14 +4593,12 @@ } }, "node_modules/@babel/types": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.7.tgz", - "integrity": "sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.9.tgz", + "integrity": "sha512-OwS2CM5KocvQ/k7dFJa8i5bNGJP0hXWfVCfDkqRFP1IreH1JDC7wG6eCYCi0+McbfT8OR/kNqsI0UU0xP9H6PQ==", "dependencies": { - "@babel/helper-string-parser": "^7.25.7", - "@babel/helper-validator-identifier": "^7.25.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -50496,6 +50485,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, "engines": { "node": ">=4" } From cde560e4583d1f34c5948bfcf0e3b303206a5afc Mon Sep 17 00:00:00 2001 From: "developer-experience-bot[bot]" <91079284+developer-experience-bot[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:46:03 +0000 Subject: [PATCH 14/15] [Version Bump][skip ci]: ui-kit publish @coveo/atomic@3.6.2 @coveo/atomic-react@3.1.10 @coveo/atomic-angular@3.1.10 @coveo/quantic@3.2.5 **/CHANGELOG.md **/package.json CHANGELOG.md package.json package-lock.json --- package-lock.json | 32 +++++++++---------- packages/atomic-angular/package.json | 2 +- .../projects/atomic-angular/package.json | 4 +-- packages/atomic-react/CHANGELOG.md | 4 +++ packages/atomic-react/package.json | 4 +-- packages/atomic/CHANGELOG.md | 12 +++++++ packages/atomic/package.json | 2 +- packages/quantic/CHANGELOG.md | 4 +++ packages/quantic/package.json | 2 +- packages/samples/angular/package.json | 2 +- packages/samples/atomic-next/package.json | 4 +-- packages/samples/atomic-react/package.json | 4 +-- packages/samples/iife/package.json | 4 +-- packages/samples/stencil/package.json | 2 +- packages/samples/vuejs/package.json | 2 +- 15 files changed, 52 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84640416b6d..b20c3ea94b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53514,7 +53514,7 @@ }, "packages/atomic": { "name": "@coveo/atomic", - "version": "3.4.0", + "version": "3.6.2", "license": "Apache-2.0", "dependencies": { "@coveo/bueno": "1.0.1", @@ -53632,7 +53632,7 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "rxjs": "7.8.1" }, "devDependencies": { @@ -53684,10 +53684,10 @@ }, "packages/atomic-angular/projects/atomic-angular": { "name": "@coveo/atomic-angular", - "version": "3.1.6", + "version": "3.1.10", "license": "Apache-2.0", "dependencies": { - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "tslib": "2.6.3" }, "engines": { @@ -53787,9 +53787,9 @@ }, "packages/atomic-react": { "name": "@coveo/atomic-react", - "version": "3.1.6", + "version": "3.1.10", "dependencies": { - "@coveo/atomic": "3.4.0" + "@coveo/atomic": "3.6.2" }, "devDependencies": { "@coveo/release": "1.0.0", @@ -58187,7 +58187,7 @@ }, "packages/quantic": { "name": "@coveo/quantic", - "version": "3.2.1", + "version": "3.2.5", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -60126,7 +60126,7 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic-angular": "3.1.6", + "@coveo/atomic-angular": "3.1.10", "rxjs": "7.8.1", "tslib": "2.6.3", "zone.js": "0.14.8" @@ -60426,8 +60426,8 @@ "name": "@coveo/atomic-next-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.4.0", - "@coveo/atomic-react": "3.1.6", + "@coveo/atomic": "3.6.2", + "@coveo/atomic-react": "3.1.10", "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "18.3.1", @@ -60491,8 +60491,8 @@ "name": "@coveo/atomic-react-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.4.0", - "@coveo/atomic-react": "3.1.6", + "@coveo/atomic": "3.6.2", + "@coveo/atomic-react": "3.1.10", "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" @@ -64501,9 +64501,9 @@ "version": "0.1.0", "dependencies": { "@babel/standalone": "7.25.0", - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "@coveo/atomic-hosted-page": "1.0.7", - "@coveo/atomic-react": "3.1.6", + "@coveo/atomic-react": "3.1.10", "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" @@ -64573,7 +64573,7 @@ "name": "@coveo/atomic-stencil-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "@coveo/bueno": "1.0.1", "@coveo/headless": "3.4.0", "@stencil/core": "4.20.0", @@ -64858,7 +64858,7 @@ "name": "@coveo/atomic-vuejs-samples", "version": "0.0.0", "dependencies": { - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "vue": "^3.4.15" }, "devDependencies": { diff --git a/packages/atomic-angular/package.json b/packages/atomic-angular/package.json index a0c6584a746..7eed33f803a 100644 --- a/packages/atomic-angular/package.json +++ b/packages/atomic-angular/package.json @@ -20,7 +20,7 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "rxjs": "7.8.1" }, "peerDependencies": { diff --git a/packages/atomic-angular/projects/atomic-angular/package.json b/packages/atomic-angular/projects/atomic-angular/package.json index 7ccbf6fbd09..762be0c6edd 100644 --- a/packages/atomic-angular/projects/atomic-angular/package.json +++ b/packages/atomic-angular/projects/atomic-angular/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/atomic-angular", - "version": "3.1.6", + "version": "3.1.10", "license": "Apache-2.0", "repository": { "url": "https://github.com/coveo/ui-kit" @@ -11,7 +11,7 @@ "@coveo/headless": "3.4.0" }, "dependencies": { - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "tslib": "2.6.3" }, "engines": { diff --git a/packages/atomic-react/CHANGELOG.md b/packages/atomic-react/CHANGELOG.md index ec24eb5e323..edca716873a 100644 --- a/packages/atomic-react/CHANGELOG.md +++ b/packages/atomic-react/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.1.10 (2024-10-23) + +- chore(deps): bump rollup (#4525) ([874286e](https://github.com/coveo/ui-kit/commits/874286e)), closes [#4525](https://github.com/coveo/ui-kit/issues/4525) + ## 3.1.1 (2024-09-24) - docs: document headless, atomic, and atomic-react entry points (#4455) ([3853bdc](https://github.com/coveo/ui-kit/commits/3853bdc)), closes [#4455](https://github.com/coveo/ui-kit/issues/4455) diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index 5d59ed54a9a..1a588ee903b 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -2,7 +2,7 @@ "name": "@coveo/atomic-react", "sideEffects": false, "type": "module", - "version": "3.1.6", + "version": "3.1.10", "description": "React specific wrapper for the Atomic component library", "repository": { "type": "git", @@ -30,7 +30,7 @@ "commerce/" ], "dependencies": { - "@coveo/atomic": "3.4.0" + "@coveo/atomic": "3.6.2" }, "devDependencies": { "@coveo/release": "1.0.0", diff --git a/packages/atomic/CHANGELOG.md b/packages/atomic/CHANGELOG.md index 3d8c2882dcd..601c16fc587 100644 --- a/packages/atomic/CHANGELOG.md +++ b/packages/atomic/CHANGELOG.md @@ -1,3 +1,15 @@ +## 3.6.2 (2024-10-23) + +- chore(deps): bump rollup (#4525) ([874286e](https://github.com/coveo/ui-kit/commits/874286e)), closes [#4525](https://github.com/coveo/ui-kit/issues/4525) +- fix(atomic): broken HTML because of formatting in CRGA markdown heading (#4522) ([9e15c6c](https://github.com/coveo/ui-kit/commits/9e15c6c)), closes [#4522](https://github.com/coveo/ui-kit/issues/4522) [/github.com/coveo/ui-kit/blob/master/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts#L50](https://github.com//github.com/coveo/ui-kit/blob/master/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts/issues/L50) +- fix(atomic): delete ./loader/package.json when building atomic (#4539) ([c39f716](https://github.com/coveo/ui-kit/commits/c39f716)), closes [#4539](https://github.com/coveo/ui-kit/issues/4539) +- fix(atomic): fix layout issue on product variants with imageSize set to none (#4521) ([cbfca7f](https://github.com/coveo/ui-kit/commits/cbfca7f)), closes [#4521](https://github.com/coveo/ui-kit/issues/4521) +- fix(atomic): prevent clicks on atomic-product-image indicators from opening the product page (#4534) ([4d53962](https://github.com/coveo/ui-kit/commits/4d53962)), closes [#4534](https://github.com/coveo/ui-kit/issues/4534) +- fix(atomic): prevent touch events on atomic-product-children from opening the product page (#4533) ([7739951](https://github.com/coveo/ui-kit/commits/7739951)), closes [#4533](https://github.com/coveo/ui-kit/issues/4533) +- fix(insight): error "getAllFacets is undefined" in insight panel interface (#4474) ([836ef3a](https://github.com/coveo/ui-kit/commits/836ef3a)), closes [#4474](https://github.com/coveo/ui-kit/issues/4474) +- feat(atomic): remove imageAltField as an array option & use image alt field prior to image not found ([ee7e1d9](https://github.com/coveo/ui-kit/commits/ee7e1d9)), closes [#4511](https://github.com/coveo/ui-kit/issues/4511) +- test(atomic): fix failing atomic-color-facet test because of source change (#4543) ([c423e15](https://github.com/coveo/ui-kit/commits/c423e15)), closes [#4543](https://github.com/coveo/ui-kit/issues/4543) + ## 3.4.0 (2024-10-16) - fix(atomic): add hover effect for atomic-product clickable element in mobile/grid (#4519) ([0828b1f](https://github.com/coveo/ui-kit/commits/0828b1f)), closes [#4519](https://github.com/coveo/ui-kit/issues/4519) diff --git a/packages/atomic/package.json b/packages/atomic/package.json index 697c058ec44..3027abaefca 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -1,7 +1,7 @@ { "name": "@coveo/atomic", "type": "module", - "version": "3.4.0", + "version": "3.6.2", "description": "A web-component library for building modern UIs interfacing with the Coveo platform", "homepage": "https://docs.coveo.com/en/atomic/latest/", "repository": { diff --git a/packages/quantic/CHANGELOG.md b/packages/quantic/CHANGELOG.md index 948d126cb42..9848ac27c8d 100644 --- a/packages/quantic/CHANGELOG.md +++ b/packages/quantic/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.2.5 (2024-10-23) + +- fix(atomic): broken HTML because of formatting in CRGA markdown heading (#4522) ([9e15c6c](https://github.com/coveo/ui-kit/commits/9e15c6c)), closes [#4522](https://github.com/coveo/ui-kit/issues/4522) [/github.com/coveo/ui-kit/blob/master/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts#L50](https://github.com//github.com/coveo/ui-kit/blob/master/packages/atomic/src/components/common/generated-answer/generated-content/markdown-utils.ts/issues/L50) + ## 3.2.1 (2024-10-16) - chore(quantic): skip consistently failing quantic tests (#4540) ([4a1b1f6](https://github.com/coveo/ui-kit/commits/4a1b1f6)), closes [#4540](https://github.com/coveo/ui-kit/issues/4540) diff --git a/packages/quantic/package.json b/packages/quantic/package.json index 82d83d510dd..3c9e47fb901 100644 --- a/packages/quantic/package.json +++ b/packages/quantic/package.json @@ -1,6 +1,6 @@ { "name": "@coveo/quantic", - "version": "3.2.1", + "version": "3.2.5", "description": "A Salesforce Lightning Web Component (LWC) library for building modern UIs interfacing with the Coveo platform", "author": "coveo.com", "homepage": "https://coveo.com", diff --git a/packages/samples/angular/package.json b/packages/samples/angular/package.json index 6eeee45f6e6..0fc577ccf5f 100644 --- a/packages/samples/angular/package.json +++ b/packages/samples/angular/package.json @@ -19,7 +19,7 @@ "@angular/platform-browser": "17.3.12", "@angular/platform-browser-dynamic": "17.3.12", "@angular/router": "17.3.12", - "@coveo/atomic-angular": "3.1.6", + "@coveo/atomic-angular": "3.1.10", "rxjs": "7.8.1", "tslib": "2.6.3", "zone.js": "0.14.8" diff --git a/packages/samples/atomic-next/package.json b/packages/samples/atomic-next/package.json index dd0d67b5336..a423584f792 100644 --- a/packages/samples/atomic-next/package.json +++ b/packages/samples/atomic-next/package.json @@ -4,8 +4,8 @@ "private": true, "type": "module", "dependencies": { - "@coveo/atomic": "3.4.0", - "@coveo/atomic-react": "3.1.6", + "@coveo/atomic": "3.6.2", + "@coveo/atomic-react": "3.1.10", "@coveo/headless": "3.4.0", "next": "14.2.5", "react": "18.3.1", diff --git a/packages/samples/atomic-react/package.json b/packages/samples/atomic-react/package.json index 12edd1a08ff..14fb8d33c3a 100644 --- a/packages/samples/atomic-react/package.json +++ b/packages/samples/atomic-react/package.json @@ -4,8 +4,8 @@ "description": "Samples with atomic-react", "private": true, "dependencies": { - "@coveo/atomic": "3.4.0", - "@coveo/atomic-react": "3.1.6", + "@coveo/atomic": "3.6.2", + "@coveo/atomic-react": "3.1.10", "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" diff --git a/packages/samples/iife/package.json b/packages/samples/iife/package.json index e7a493af687..4415c2cab17 100644 --- a/packages/samples/iife/package.json +++ b/packages/samples/iife/package.json @@ -12,9 +12,9 @@ }, "dependencies": { "@babel/standalone": "7.25.0", - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "@coveo/atomic-hosted-page": "1.0.7", - "@coveo/atomic-react": "3.1.6", + "@coveo/atomic-react": "3.1.10", "@coveo/headless": "3.4.0", "react": "18.3.1", "react-dom": "18.3.1" diff --git a/packages/samples/stencil/package.json b/packages/samples/stencil/package.json index eb7e698fe73..839caa516a2 100644 --- a/packages/samples/stencil/package.json +++ b/packages/samples/stencil/package.json @@ -8,7 +8,7 @@ "e2e:watch": "cypress open --browser chrome --e2e" }, "dependencies": { - "@coveo/atomic": "3.4.0", + "@coveo/atomic": "3.6.2", "@coveo/bueno": "1.0.1", "@coveo/headless": "3.4.0", "@stencil/core": "4.20.0", diff --git a/packages/samples/vuejs/package.json b/packages/samples/vuejs/package.json index 2fe855e34b5..e8002a92981 100644 --- a/packages/samples/vuejs/package.json +++ b/packages/samples/vuejs/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "vue": "^3.4.15", - "@coveo/atomic": "3.4.0" + "@coveo/atomic": "3.6.2" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.3", From 1dbd9a9341ba705338f69441f3e8c25312023375 Mon Sep 17 00:00:00 2001 From: Nico Labarre Date: Wed, 23 Oct 2024 12:14:14 -0400 Subject: [PATCH 15/15] feat(commerce): add location facets (#4562) Add support for location facets. We went with the separate controller approach as we believe the location facets might evolve differently from the regular facets over time. In follow-up PRs I: - Added support for breadcrumbs and parameters: https://github.com/coveo/ui-kit/pull/4571 - Added support in the context controller to pass-in the latitude and longitude: https://github.com/coveo/ui-kit/pull/4572 - Exported the actions through an actions loader: https://github.com/coveo/ui-kit/pull/4569 --- packages/headless/src/commerce.index.ts | 7 + .../headless-core-breadcrumb-manager.ts | 13 +- ...dless-commerce-facet-generator.ssr.test.ts | 10 +- .../headless-commerce-facet-generator.ssr.ts | 17 +- .../headless-commerce-facet-generator.test.ts | 37 ++- .../headless-commerce-facet-generator.ts | 10 +- .../facets/headless-core-commerce-facet.ts | 4 + .../headless-commerce-location-facet.test.ts | 104 ++++++ .../headless-commerce-location-facet.ts | 84 +++++ .../sub-controller/headless-sub-controller.ts | 3 + .../facets/facet-set/facet-set-slice.test.ts | 307 +++++++++++++++++- .../facets/facet-set/facet-set-slice.ts | 71 +++- .../facets/facet-set/interfaces/common.ts | 3 +- .../facets/facet-set/interfaces/request.ts | 8 + .../facets/facet-set/interfaces/response.ts | 14 +- .../location-facet/location-facet-actions.ts | 29 ++ .../pagination/pagination-slice.test.ts | 12 + .../commerce/pagination/pagination-slice.ts | 6 + .../src/test/mock-commerce-facet-response.ts | 12 + .../src/test/mock-commerce-facet-value.ts | 15 + 20 files changed, 745 insertions(+), 21 deletions(-) create mode 100644 packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.test.ts create mode 100644 packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.ts create mode 100644 packages/headless/src/features/commerce/facets/location-facet/location-facet-actions.ts diff --git a/packages/headless/src/commerce.index.ts b/packages/headless/src/commerce.index.ts index a1b9ace2b2c..4bb4ee6ab96 100644 --- a/packages/headless/src/commerce.index.ts +++ b/packages/headless/src/commerce.index.ts @@ -51,6 +51,7 @@ export * from './features/commerce/sort/sort-actions-loader.js'; export * from './features/commerce/facets/core-facet/core-facet-actions-loader.js'; export * from './features/commerce/facets/category-facet/category-facet-actions-loader.js'; export * from './features/commerce/facets/regular-facet/regular-facet-actions-loader.js'; +// TODO COMHUB-247 export location facets actions loader export * from './features/commerce/facets/date-facet/date-facet-actions-loader.js'; export * from './features/commerce/facets/numeric-facet/numeric-facet-actions-loader.js'; export * from './features/commerce/query-set/query-set-actions-loader.js'; @@ -164,6 +165,10 @@ export type { RegularFacet, RegularFacetState, } from './controllers/commerce/core/facets/regular/headless-commerce-regular-facet.js'; +export type { + LocationFacet, + LocationFacetState, +} from './controllers/commerce/core/facets/location/headless-commerce-location-facet.js'; export type { NumericFacet, NumericFacetState, @@ -178,6 +183,8 @@ export type { FacetType, FacetValueRequest, RegularFacetValue, + LocationFacetValueRequest, + LocationFacetValue, NumericRangeRequest, NumericFacetValue, DateRangeRequest, diff --git a/packages/headless/src/controllers/commerce/core/breadcrumb-manager/headless-core-breadcrumb-manager.ts b/packages/headless/src/controllers/commerce/core/breadcrumb-manager/headless-core-breadcrumb-manager.ts index d0155a170e0..9a34e1d17d9 100644 --- a/packages/headless/src/controllers/commerce/core/breadcrumb-manager/headless-core-breadcrumb-manager.ts +++ b/packages/headless/src/controllers/commerce/core/breadcrumb-manager/headless-core-breadcrumb-manager.ts @@ -21,6 +21,7 @@ import { BaseFacetValue, CategoryFacetResponse, DateFacetResponse, + LocationFacetResponse, NumericFacetResponse, RegularFacetResponse, } from '../../../../features/commerce/facets/facet-set/interfaces/response.js'; @@ -116,7 +117,8 @@ interface ActionCreators { const facetTypeWithoutExcludeAction: FacetType = 'hierarchical'; -const actions: Record = { +// TODO: COMHUB-247 add support for location facet +const actions: Record, ActionCreators> = { regular: { toggleSelectActionCreator: toggleSelectFacetValue, toggleExcludeActionCreator: toggleExcludeFacetValue, @@ -153,7 +155,10 @@ export function buildCoreBreadcrumbManager( const controller = buildController(engine); const {dispatch} = engine; - const createBreadcrumb = (facet: AnyFacetResponse) => ({ + // TODO: COMHUB-247 add support for location facet + const createBreadcrumb = ( + facet: Exclude + ) => ({ facetId: facet.facetId, facetDisplayName: facet.displayName, field: facet.field, @@ -253,7 +258,9 @@ export function buildCoreBreadcrumbManager( (facetOrder): BreadcrumbManagerState => { const breadcrumbs = facetOrder.flatMap((facetId) => { const facet = options.facetResponseSelector(engine[stateKey], facetId); - if (hasActiveValue(facet)) { + + // TODO: COMHUB-247 add support for location facet + if (hasActiveValue(facet) && facet.type !== 'location') { return [createBreadcrumb(facet)]; } return []; diff --git a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.test.ts b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.test.ts index 169cb4e7c7e..8670d887c08 100644 --- a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.test.ts +++ b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.test.ts @@ -8,6 +8,7 @@ import { buildMockCommerceDateFacetResponse, buildMockCommerceNumericFacetResponse, buildMockCommerceRegularFacetResponse, + buildMockCommerceLocationFacetResponse, } from '../../../../../test/mock-commerce-facet-response.js'; import {buildMockCommerceState} from '../../../../../test/mock-commerce-state.js'; import { @@ -55,6 +56,9 @@ describe('SSR FacetGenerator', () => { case 'numericalRange': response = buildMockCommerceNumericFacetResponse({facetId, type}); break; + case 'location': + response = buildMockCommerceLocationFacetResponse({facetId, type}); + break; case 'regular': default: response = buildMockCommerceRegularFacetResponse({facetId, type}); @@ -117,6 +121,10 @@ describe('SSR FacetGenerator', () => { facetId: 'regular-facet', type: 'regular', }, + { + facetId: 'location-facet', + type: 'location', + }, ]; state = buildMockCommerceState(); setFacetState(facetsInEngineState); @@ -131,7 +139,7 @@ describe('SSR FacetGenerator', () => { expect(facetGenerator).toBeTruthy(); }); it('#state is an array containing the state of each facet', () => { - expect(facetGenerator.state.length).toBe(4); + expect(facetGenerator.state.length).toBe(5); expect( facetGenerator.state.map((facet) => ({ facetId: facet.facetId, diff --git a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts index 6074be97668..83449e62d2c 100644 --- a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts +++ b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts @@ -11,6 +11,7 @@ import {stateKey} from '../../../../../app/state-key.js'; import {facetRequestSelector} from '../../../../../features/commerce/facets/facet-set/facet-set-selector.js'; import { AnyFacetResponse, + LocationFacetValue, RegularFacetValue, } from '../../../../../features/commerce/facets/facet-set/interfaces/response.js'; import {manualNumericFacetSelector} from '../../../../../features/commerce/facets/numeric-facet/manual-numeric-facet-selectors.js'; @@ -44,6 +45,11 @@ import { FacetType, getCoreFacetState, } from '../headless-core-commerce-facet.js'; +import { + getLocationFacetState, + LocationFacet, + LocationFacetState, +} from '../location/headless-commerce-location-facet.js'; import { getNumericFacetState, NumericFacet, @@ -72,6 +78,9 @@ export type { RegularFacet, RegularFacetState, RegularFacetValue, + LocationFacet, + LocationFacetState, + LocationFacetValue, }; export type FacetGeneratorState = MappedFacetStates; @@ -87,7 +96,9 @@ type MappedFacetState = { ? DateFacetState : T extends 'hierarchical' ? CategoryFacetState - : never; + : T extends 'location' + ? LocationFacetState + : never; }; export function defineFacetGenerator< @@ -235,6 +246,10 @@ export function buildFacetGenerator( createFacetState(facetResponseSelector) as RegularFacetState, specificFacetSearchStateSelector(getEngineState(), facetId) ); + case 'location': + return getLocationFacetState( + createFacetState(facetResponseSelector) as LocationFacetState + ); } }); }, diff --git a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.test.ts b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.test.ts index a22288403df..f19d6eebc7e 100644 --- a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.test.ts +++ b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.test.ts @@ -28,6 +28,7 @@ describe('CSR FacetGenerator', () => { let facetGenerator: FacetGenerator; const mockBuildNumericFacet = vi.fn(); const mockBuildRegularFacet = vi.fn(); + const mockBuildLocationFacet = vi.fn(); const mockBuildDateFacet = vi.fn(); const mockBuildCategoryFacet = vi.fn(); const mockFetchProductsActionCreator = vi.fn(); @@ -61,6 +62,7 @@ describe('CSR FacetGenerator', () => { options = { buildNumericFacet: mockBuildNumericFacet, buildRegularFacet: mockBuildRegularFacet, + buildLocationFacet: mockBuildLocationFacet, buildDateFacet: mockBuildDateFacet, buildCategoryFacet: mockBuildCategoryFacet, fetchProductsActionCreator: mockFetchProductsActionCreator, @@ -97,6 +99,14 @@ describe('CSR FacetGenerator', () => { expect(mockBuildRegularFacet).toHaveBeenCalledWith(engine, {facetId}); }); + it('when engine facet state contains a location facet, generates a location facet controller', () => { + const facetId = 'location_facet_id'; + setFacetState([{facetId, type: 'location'}]); + + expect(facetGenerator.facets.length).toEqual(1); + expect(mockBuildLocationFacet).toHaveBeenCalledWith(engine, {facetId}); + }); + it('when engine facet state contains a numeric facet, generates a numeric facet controller', () => { const facetId = 'numeric_facet_id'; setFacetState([{facetId, type: 'numericalRange'}]); @@ -127,6 +137,10 @@ describe('CSR FacetGenerator', () => { facetId: 'regular_facet_id', type: 'regular', }, + { + facetId: 'location_facet_id', + type: 'location', + }, { facetId: 'numeric_facet_id', type: 'numericalRange', @@ -142,24 +156,29 @@ describe('CSR FacetGenerator', () => { ]; setFacetState(facets); + let index = 0; mockBuildRegularFacet.mockReturnValue({ - state: {facetId: facets[0].facetId}, + state: {facetId: facets[index++].facetId}, + }); + mockBuildLocationFacet.mockReturnValue({ + state: {facetId: facets[index++].facetId}, }); mockBuildNumericFacet.mockReturnValue({ - state: {facetId: facets[1].facetId}, + state: {facetId: facets[index++].facetId}, + }); + mockBuildDateFacet.mockReturnValue({ + state: {facetId: facets[index++].facetId}, }); - mockBuildDateFacet.mockReturnValue({state: {facetId: facets[2].facetId}}); mockBuildCategoryFacet.mockReturnValue({ - state: {facetId: facets[3].facetId}, + state: {facetId: facets[index++].facetId}, }); const facetState = facetGenerator.facets; - expect(facetState.length).toEqual(4); - expect(facetState[0].state.facetId).toEqual(facets[0].facetId); - expect(facetState[1].state.facetId).toEqual(facets[1].facetId); - expect(facetState[2].state.facetId).toEqual(facets[2].facetId); - expect(facetState[3].state.facetId).toEqual(facets[3].facetId); + expect(facetState.length).toEqual(5); + expect(facetState.map((f) => f.state.facetId)).toEqual( + facets.map((f) => f.facetId) + ); }); }); diff --git a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ts b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ts index 42e30440e2f..044173d3ca0 100644 --- a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ts +++ b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ts @@ -27,6 +27,7 @@ import { CommerceFacetOptions, CoreCommerceFacet, } from '../headless-core-commerce-facet.js'; +import {LocationFacet} from '../location/headless-commerce-location-facet.js'; import {NumericFacet} from '../numeric/headless-commerce-numeric-facet.js'; import {RegularFacet} from '../regular/headless-commerce-regular-facet.js'; import {SearchableFacetOptions} from '../searchable/headless-commerce-searchable-facet.js'; @@ -47,7 +48,7 @@ export interface FacetGenerator extends Controller { /** * The facet sub-controllers created by the facet generator. - * Array of [RegularFacet](./regular-facet), [DateRangeFacet](./date-range-facet), [NumericFacet](./numeric-facet), and [CategoryFacet](./category-facet). + * Array of [RegularFacet](./regular-facet), [DateRangeFacet](./date-range-facet), [NumericFacet](./numeric-facet), [CategoryFacet](./category-facet), and [LocationFacet](./location-facet). */ facets: GeneratedFacetControllers; @@ -79,7 +80,9 @@ export type MappedGeneratedFacetController = { ? DateFacet : T extends 'hierarchical' ? CategoryFacet - : never; + : T extends 'location' + ? LocationFacet + : never; }; type CommerceFacetBuilder< @@ -108,6 +111,7 @@ export interface FacetGeneratorOptions { buildNumericFacet: CommerceFacetBuilder; buildDateFacet: CommerceFacetBuilder; buildCategoryFacet: CommerceFacetBuilder; + buildLocationFacet: CommerceFacetBuilder; fetchProductsActionCreator: FetchProductsActionCreator; } @@ -159,6 +163,8 @@ export function buildFacetGenerator( return options.buildNumericFacet(engine, {facetId}); case 'regular': return options.buildRegularFacet(engine, {facetId}); + case 'location': + return options.buildLocationFacet(engine, {facetId}); } } ); diff --git a/packages/headless/src/controllers/commerce/core/facets/headless-core-commerce-facet.ts b/packages/headless/src/controllers/commerce/core/facets/headless-core-commerce-facet.ts index 63a3a8b33a2..4fe382b45e0 100644 --- a/packages/headless/src/controllers/commerce/core/facets/headless-core-commerce-facet.ts +++ b/packages/headless/src/controllers/commerce/core/facets/headless-core-commerce-facet.ts @@ -11,12 +11,14 @@ import {FacetType} from '../../../../features/commerce/facets/facet-set/interfac import { AnyFacetRequest, CategoryFacetValueRequest, + LocationFacetValueRequest, } from '../../../../features/commerce/facets/facet-set/interfaces/request.js'; import { AnyFacetResponse, AnyFacetValueResponse, CategoryFacetValue, DateFacetValue, + LocationFacetValue, NumericFacetValue, RegularFacetValue, } from '../../../../features/commerce/facets/facet-set/interfaces/response.js'; @@ -37,6 +39,8 @@ export type { FacetType, FacetValueRequest, RegularFacetValue, + LocationFacetValueRequest, + LocationFacetValue, NumericRangeRequest, NumericFacetValue, DateRangeRequest, diff --git a/packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.test.ts b/packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.test.ts new file mode 100644 index 00000000000..9878ce4fca7 --- /dev/null +++ b/packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.test.ts @@ -0,0 +1,104 @@ +import {LocationFacetRequest} from '../../../../../features/commerce/facets/facet-set/interfaces/request.js'; +import { + toggleExcludeLocationFacetValue, + toggleSelectLocationFacetValue, +} from '../../../../../features/commerce/facets/location-facet/location-facet-actions.js'; +import {CommerceAppState} from '../../../../../state/commerce-app-state.js'; +import {buildMockCommerceFacetRequest} from '../../../../../test/mock-commerce-facet-request.js'; +import {buildMockCommerceLocationFacetResponse} from '../../../../../test/mock-commerce-facet-response.js'; +import {buildMockCommerceFacetSlice} from '../../../../../test/mock-commerce-facet-slice.js'; +import {buildMockCommerceLocationFacetValue} from '../../../../../test/mock-commerce-facet-value.js'; +import {buildMockCommerceState} from '../../../../../test/mock-commerce-state.js'; +import { + MockedCommerceEngine, + buildMockCommerceEngine, +} from '../../../../../test/mock-engine-v2.js'; +import { + LocationFacet, + LocationFacetOptions, + buildCommerceLocationFacet, +} from './headless-commerce-location-facet.js'; + +vi.mock( + '../../../../../features/commerce/facets/location-facet/location-facet-actions' +); + +describe('LocationFacet', () => { + const facetId: string = 'location_facet_id'; + let engine: MockedCommerceEngine; + let state: CommerceAppState; + let options: LocationFacetOptions; + let facet: LocationFacet; + const facetResponseSelector = vi.fn(); + + function initEngine(preloadedState = buildMockCommerceState()) { + engine = buildMockCommerceEngine(preloadedState); + } + + function initFacet() { + facet = buildCommerceLocationFacet(engine, options); + } + + function setFacetRequest(config: Partial = {}) { + state.commerceFacetSet[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({facetId, ...config}), + }); + state.productListing.facets = [ + buildMockCommerceLocationFacetResponse({facetId}), + ]; + facetResponseSelector.mockReturnValue( + buildMockCommerceLocationFacetResponse({facetId}) + ); + } + + beforeEach(() => { + vi.resetAllMocks(); + + options = { + facetId, + fetchProductsActionCreator: vi.fn(), + facetResponseSelector, + isFacetLoadingResponseSelector: vi.fn(), + }; + + state = buildMockCommerceState(); + setFacetRequest(); + + initEngine(state); + initFacet(); + }); + + describe('initialization', () => { + it('initializes', () => { + expect(facet).toBeTruthy(); + }); + + it('exposes #subscribe method', () => { + expect(facet.subscribe).toBeTruthy(); + }); + }); + + it('#toggleSelect dispatches #toggleSelectLocationFacetValue with correct payload', () => { + const facetValue = buildMockCommerceLocationFacetValue({value: 'TED'}); + facet.toggleSelect(facetValue); + + expect(toggleSelectLocationFacetValue).toHaveBeenCalledWith({ + facetId, + selection: facetValue, + }); + }); + + it('#toggleExclude dispatches #toggleExcludeLocationFacetValue with correct payload', () => { + const facetValue = buildMockCommerceLocationFacetValue({value: 'TED'}); + facet.toggleExclude(facetValue); + + expect(toggleExcludeLocationFacetValue).toHaveBeenCalledWith({ + facetId, + selection: facetValue, + }); + }); + + it('#type returns "location"', () => { + expect(facet.type).toBe('location'); + }); +}); diff --git a/packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.ts b/packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.ts new file mode 100644 index 00000000000..05d6a2e99e0 --- /dev/null +++ b/packages/headless/src/controllers/commerce/core/facets/location/headless-commerce-location-facet.ts @@ -0,0 +1,84 @@ +import {CommerceEngine} from '../../../../../app/commerce-engine/commerce-engine.js'; +import {LocationFacetValue} from '../../../../../features/commerce/facets/facet-set/interfaces/response.js'; +import { + toggleExcludeLocationFacetValue, + toggleSelectLocationFacetValue, +} from '../../../../../features/commerce/facets/location-facet/location-facet-actions.js'; +import { + CoreCommerceFacet, + CoreCommerceFacetOptions, + CoreCommerceFacetState, + FacetControllerType, + FacetValueRequest, + buildCoreCommerceFacet, +} from '../headless-core-commerce-facet.js'; + +export type LocationFacetOptions = Omit< + CoreCommerceFacetOptions, + 'toggleSelectActionCreator' | 'toggleExcludeActionCreator' +>; + +export type LocationFacetState = Omit< + CoreCommerceFacetState, + 'type' +> & { + type: 'location'; +}; + +/** + * The `LocationFacet` sub-controller offers a high-level programming interface for implementing a location commerce + * facet UI component. + */ +export type LocationFacet = CoreCommerceFacet< + FacetValueRequest, + LocationFacetValue +> & { + state: LocationFacetState; +} & FacetControllerType<'location'>; + +/** + * @internal + * + * **Important:** This initializer is meant for internal use by headless only. + * As an implementer, you must not import or use this initializer directly in your code. + * You will instead interact with `LocationFacet` sub-controller instances through the state of a `FacetGenerator` + * sub-controller. + * + * @param engine - The headless commerce engine. + * @param options - The `LocationFacet` options used internally. + * @returns A `LocationFacet` sub-controller instance. + * */ +export function buildCommerceLocationFacet( + engine: CommerceEngine, + options: LocationFacetOptions +): LocationFacet { + const coreController = buildCoreCommerceFacet< + FacetValueRequest, + LocationFacetValue + >(engine, { + options: { + ...options, + toggleSelectActionCreator: toggleSelectLocationFacetValue, + toggleExcludeActionCreator: toggleExcludeLocationFacetValue, + }, + }); + + return { + ...coreController, + + get state() { + return getLocationFacetState(coreController.state); + }, + + type: 'location', + }; +} + +export const getLocationFacetState = ( + coreState: CoreCommerceFacetState +): LocationFacetState => { + return { + ...coreState, + type: 'location', + }; +}; diff --git a/packages/headless/src/controllers/commerce/core/sub-controller/headless-sub-controller.ts b/packages/headless/src/controllers/commerce/core/sub-controller/headless-sub-controller.ts index b84ea80e63e..8c35a08bc6a 100644 --- a/packages/headless/src/controllers/commerce/core/sub-controller/headless-sub-controller.ts +++ b/packages/headless/src/controllers/commerce/core/sub-controller/headless-sub-controller.ts @@ -29,6 +29,7 @@ import { buildFacetGenerator, FacetGenerator, } from '../facets/generator/headless-commerce-facet-generator.js'; +import {buildCommerceLocationFacet} from '../facets/location/headless-commerce-location-facet.js'; import {buildCommerceNumericFacet} from '../facets/numeric/headless-commerce-numeric-facet.js'; import {buildCommerceRegularFacet} from '../facets/regular/headless-commerce-regular-facet.js'; import { @@ -277,6 +278,8 @@ export function buildSearchAndListingsSubControllers< buildCommerceDateFacet(engine, {...options, ...commonOptions}), buildCategoryFacet: (_engine, options) => buildCategoryFacet(engine, {...options, ...commonOptions}), + buildLocationFacet: (_engine, options) => + buildCommerceLocationFacet(engine, {...options, ...commonOptions}), fetchProductsActionCreator, }); }, diff --git a/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.test.ts b/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.test.ts index 0beae165eb2..3e24102dd3a 100644 --- a/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.test.ts +++ b/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.test.ts @@ -9,6 +9,7 @@ import {buildMockCommerceFacetRequest} from '../../../../test/mock-commerce-face import { buildMockCategoryFacetResponse, buildMockCommerceDateFacetResponse, + buildMockCommerceLocationFacetResponse, buildMockCommerceNumericFacetResponse, buildMockCommerceRegularFacetResponse, } from '../../../../test/mock-commerce-facet-response.js'; @@ -16,6 +17,7 @@ import {buildMockCommerceFacetSlice} from '../../../../test/mock-commerce-facet- import { buildMockCategoryFacetValue, buildMockCommerceDateFacetValue, + buildMockCommerceLocationFacetValue, buildMockCommerceNumericFacetValue, buildMockCommerceRegularFacetValue, } from '../../../../test/mock-commerce-facet-value.js'; @@ -65,6 +67,10 @@ import { updateDateFacetValues, } from '../date-facet/date-facet-actions.js'; import {getFacetIdWithCommerceFieldSuggestionNamespace} from '../facet-search-set/commerce-facet-search-actions.js'; +import { + toggleExcludeLocationFacetValue, + toggleSelectLocationFacetValue, +} from '../location-facet/location-facet-actions.js'; import { toggleExcludeNumericFacetValue, toggleSelectNumericFacetValue, @@ -78,13 +84,17 @@ import * as CommerceFacetReducers from './facet-set-reducer-helpers.js'; import { commerceFacetSetReducer, convertCategoryFacetValueToRequest, + convertLocationFacetValueToRequest, } from './facet-set-slice.js'; import { CommerceFacetSetState, getCommerceFacetSetInitialState, } from './facet-set-state.js'; import {FacetType} from './interfaces/common.js'; -import {CategoryFacetValueRequest} from './interfaces/request.js'; +import { + CategoryFacetValueRequest, + LocationFacetValueRequest, +} from './interfaces/request.js'; import {AnyFacetResponse, CategoryFacetValue} from './interfaces/response.js'; // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -557,6 +567,10 @@ describe('commerceFacetSetReducer', () => { type: 'regular' as FacetType, facetResponseBuilder: buildMockCommerceRegularFacetResponse, }, + { + type: 'location' as FacetType, + facetResponseBuilder: buildMockCommerceLocationFacetResponse, + }, { type: 'numericalRange' as FacetType, facetResponseBuilder: buildMockCommerceNumericFacetResponse, @@ -983,6 +997,296 @@ describe('commerceFacetSetReducer', () => { }); }); + describe('for location facets', () => { + describe.each([ + { + title: + 'dispatching #toggleSelectLocationFacetValue with a registered facet id', + facetValueState: 'selected' as FacetValueState, + toggleAction: toggleSelectLocationFacetValue, + }, + { + title: + 'dispatching #toggleExcludeLocationFacetValue with a registered facet id', + facetValueState: 'excluded' as FacetValueState, + toggleAction: toggleExcludeLocationFacetValue, + }, + ])( + '$title', + ({ + facetValueState, + toggleAction, + }: { + facetValueState: FacetValueState; + toggleAction: Function; + }) => { + const facetId = '1'; + const oppositeFacetValueState = facetValueStates.find( + (valueState) => ![facetValueState, 'idle'].includes(valueState) + ); + describe('when the facet value exists', () => { + it(`sets the state of an idle value to ${facetValueState}`, () => { + const facetValue = buildMockCommerceLocationFacetValue({ + value: 'TED', + }); + const facetValueRequest = + convertLocationFacetValueToRequest(facetValue); + + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({ + values: [facetValueRequest], + type: 'location', + }), + }); + + const action = toggleAction({ + facetId, + selection: facetValue, + }); + const finalState = commerceFacetSetReducer(state, action); + + const targetValue = ( + finalState[facetId]?.request.values as LocationFacetValueRequest[] + ).find((req) => req.value === facetValue.value); + expect(targetValue?.state).toBe(facetValueState); + }); + + it(`sets the state of an ${oppositeFacetValueState} value to ${facetValueState}`, () => { + const facetValue = buildMockCommerceLocationFacetValue({ + value: 'TED', + state: oppositeFacetValueState, + }); + const facetValueRequest = + convertLocationFacetValueToRequest(facetValue); + + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({ + values: [facetValueRequest], + type: 'location', + }), + }); + + const action = toggleAction({ + facetId, + selection: facetValue, + }); + const finalState = commerceFacetSetReducer(state, action); + + const targetValue = ( + finalState[facetId]?.request.values as LocationFacetValueRequest[] + ).find((req) => req.value === facetValue.value); + expect(targetValue?.state).toBe(facetValueState); + }); + + it(`sets the state of a ${facetValueState} value to idle`, () => { + const facetValue = buildMockCommerceLocationFacetValue({ + value: 'TED', + state: facetValueState, + }); + const facetValueRequest = + convertLocationFacetValueToRequest(facetValue); + + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({ + values: [facetValueRequest], + type: 'location', + }), + }); + + const action = toggleAction({ + facetId, + selection: facetValue, + }); + const finalState = commerceFacetSetReducer(state, action); + + const targetValue = ( + finalState[facetId]?.request.values as LocationFacetValueRequest[] + ).find((req) => req.value === facetValue.value); + expect(targetValue?.state).toBe('idle'); + }); + + it('sets #preventAutoSelect to true', () => { + const facetValue = buildMockCommerceLocationFacetValue({ + value: 'TED', + }); + const facetValueRequest = + convertLocationFacetValueToRequest(facetValue); + + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({ + values: [facetValueRequest], + type: 'location', + }), + }); + + const action = toggleAction({ + facetId, + selection: facetValue, + }); + const finalState = commerceFacetSetReducer(state, action); + + expect(finalState[facetId]?.request.preventAutoSelect).toBe(true); + }); + + it('sets #freezeCurrentValues to true', () => { + const facetValue = buildMockCommerceLocationFacetValue({ + value: 'TED', + }); + const facetValueRequest = + convertLocationFacetValueToRequest(facetValue); + + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({ + values: [facetValueRequest], + type: 'location', + }), + }); + + const action = toggleAction({ + facetId, + selection: facetValue, + }); + const finalState = commerceFacetSetReducer(state, action); + + expect(finalState[facetId]?.request.freezeCurrentValues).toBe(true); + }); + }); + + describe.each([ + { + facetValueState: 'selected' as FacetValueState, + toggleAction: toggleSelectLocationFacetValue, + }, + { + facetValueState: 'excluded' as FacetValueState, + toggleAction: toggleExcludeLocationFacetValue, + }, + ])( + 'when the facet value does not exist', + ({ + facetValueState, + toggleAction, + }: { + facetValueState: FacetValueState; + toggleAction: Function; + }) => { + it('replaces the first idle value with the new value', () => { + const newFacetValue = buildMockCommerceLocationFacetValue({ + value: 'TED', + state: facetValueState, + }); + + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({ + type: 'location', + values: [ + buildMockCommerceLocationFacetValue({ + value: 'active1', + state: facetValueState, + }), + buildMockCommerceLocationFacetValue({ + value: 'active2', + state: facetValueState, + }), + buildMockCommerceLocationFacetValue({ + value: 'idle1', + state: 'idle', + }), + buildMockCommerceLocationFacetValue({ + value: 'idle2', + state: 'idle', + }), + ], + }), + }); + + const action = toggleAction({ + facetId, + selection: newFacetValue, + }); + + const finalState = commerceFacetSetReducer(state, action); + expect( + ( + finalState[facetId]?.request + .values as LocationFacetValueRequest[] + ).indexOf(newFacetValue) + ).toBe(2); + expect(finalState[facetId]?.request.values.length).toBe(4); + }); + + it('sets #preventAutoSelect to true', () => { + state[facetId] = buildMockCommerceFacetSlice({ + request: buildMockCommerceFacetRequest({type: 'location'}), + }); + + const action = toggleAction({ + facetId, + selection: buildMockCommerceLocationFacetValue({value: 'TED'}), + }); + const finalState = commerceFacetSetReducer(state, action); + + expect(finalState[facetId]?.request.preventAutoSelect).toBe(true); + }); + } + ); + } + ); + it('dispatching #toggleSelectLocationFacetValue with an invalid id does not throw', () => { + const facetValue = buildMockCommerceLocationFacetValue({value: 'TED'}); + const action = toggleSelectLocationFacetValue({ + facetId: '1', + selection: facetValue, + }); + + expect(() => commerceFacetSetReducer(state, action)).not.toThrow(); + }); + + it('dispatching #toggleSelectLocationFacetValue with an invalid facet type does not throw', () => { + const facetValue = buildMockCommerceLocationFacetValue({value: 'TED'}); + const facet = buildMockCommerceFacetRequest({ + type: 'numericalRange', + values: [facetValue], + }); + state[facet.facetId] = buildMockCommerceFacetSlice({ + request: facet, + }); + const action = toggleSelectLocationFacetValue({ + facetId: facet.facetId, + selection: facetValue, + }); + + expect(() => commerceFacetSetReducer(state, action)).not.toThrow(); + }); + + it('dispatching #toggleExcludeLocationFacetValue with an invalid id does not throw', () => { + const facetValue = buildMockCommerceLocationFacetValue({value: 'TED'}); + const action = toggleExcludeLocationFacetValue({ + facetId: '1', + selection: facetValue, + }); + + expect(() => commerceFacetSetReducer(state, action)).not.toThrow(); + }); + + it('dispatching #toggleExcludeLocationFacetValue with an invalid facet type does not throw', () => { + const facetValue = buildMockCommerceLocationFacetValue({value: 'TED'}); + const facet = buildMockCommerceFacetRequest({ + type: 'numericalRange', + values: [facetValue], + }); + state[facet.facetId] = buildMockCommerceFacetSlice({ + request: facet, + }); + const action = toggleExcludeLocationFacetValue({ + facetId: facet.facetId, + selection: facetValue, + }); + + expect(() => commerceFacetSetReducer(state, action)).not.toThrow(); + }); + }); + describe('for numericalRange facets', () => { describe.each([ { @@ -2365,6 +2669,7 @@ describe('commerceFacetSetReducer', () => { describe('#updateCoreFacetIsFieldExpanded', () => { describe.each([ {type: 'regular' as FacetType}, + {type: 'location' as FacetType}, {type: 'numericalRange' as FacetType}, {type: 'dateRange' as FacetType}, {type: 'hierarchical' as FacetType}, diff --git a/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.ts b/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.ts index f74142e0daa..25193bb8f84 100644 --- a/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.ts +++ b/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.ts @@ -44,6 +44,10 @@ import { executeCommerceFieldSuggest, getFacetIdWithCommerceFieldSuggestionNamespace, } from '../facet-search-set/commerce-facet-search-actions.js'; +import { + toggleExcludeLocationFacetValue, + toggleSelectLocationFacetValue, +} from '../location-facet/location-facet-actions.js'; import { toggleExcludeNumericFacetValue, toggleSelectNumericFacetValue, @@ -72,8 +76,10 @@ import { NumericFacetRequest, DateFacetRequest, CategoryFacetRequest, + LocationFacetRequest, + LocationFacetValueRequest, } from './interfaces/request.js'; -import {CategoryFacetValue} from './interfaces/response.js'; +import {CategoryFacetValue, LocationFacetValue} from './interfaces/response.js'; import {AnyFacetResponse} from './interfaces/response.js'; export const commerceFacetSetReducer = createReducer( @@ -122,6 +128,27 @@ export const commerceFacetSetReducer = createReducer( updateExistingFacetValueState(existingValue, 'select'); facetRequest.freezeCurrentValues = true; }) + .addCase(toggleSelectLocationFacetValue, (state, action) => { + const {facetId, selection} = action.payload; + const facetRequest = state[facetId]?.request; + + if (!facetRequest || !ensureLocationFacetRequest(facetRequest)) { + return; + } + + facetRequest.preventAutoSelect = true; + + const existingValue = facetRequest.values.find( + (req) => req.value === selection.value + ); + if (!existingValue) { + insertNewValue(facetRequest, selection); + return; + } + + updateExistingFacetValueState(existingValue, 'select'); + facetRequest.freezeCurrentValues = true; + }) .addCase(toggleSelectNumericFacetValue, (state, action) => { const {facetId, selection} = action.payload; const facetRequest = state[facetId]?.request; @@ -223,6 +250,27 @@ export const commerceFacetSetReducer = createReducer( updateExistingFacetValueState(existingValue, 'exclude'); facetRequest.freezeCurrentValues = true; }) + .addCase(toggleExcludeLocationFacetValue, (state, action) => { + const {facetId, selection} = action.payload; + const facetRequest = state[facetId]?.request; + + if (!facetRequest || !ensureLocationFacetRequest(facetRequest)) { + return; + } + + facetRequest.preventAutoSelect = true; + + const existingValue = facetRequest.values.find( + (req) => req.value === selection.value + ); + if (!existingValue) { + insertNewValue(facetRequest, selection); + return; + } + + updateExistingFacetValueState(existingValue, 'exclude'); + facetRequest.freezeCurrentValues = true; + }) .addCase(toggleExcludeNumericFacetValue, (state, action) => { const {facetId, selection} = action.payload; const facetRequest = state[facetId]?.request; @@ -450,6 +498,12 @@ function ensureRegularFacetRequest( return facetRequest.type === 'regular'; } +function ensureLocationFacetRequest( + facetRequest: AnyFacetRequest +): facetRequest is LocationFacetRequest { + return facetRequest.type === 'location'; +} + function ensureNumericFacetRequest( facetRequest: AnyFacetRequest ): facetRequest is NumericFacetRequest { @@ -533,7 +587,10 @@ function ensurePathAndReturnChildren( } function updateExistingFacetValueState( existingFacetValue: WritableDraft< - FacetValueRequest | NumericRangeRequest | DateRangeRequest + | FacetValueRequest + | LocationFacetValueRequest + | NumericRangeRequest + | DateRangeRequest >, toggleAction: 'select' | 'exclude' ) { @@ -613,6 +670,8 @@ function getFacetRequestValuesFromFacetResponse( : facetResponse.values.map(convertCategoryFacetValueToRequest); case 'regular': return facetResponse.values.map(convertFacetValueToRequest); + case 'location': + return facetResponse.values.map(convertLocationFacetValueToRequest); default: return; } @@ -635,6 +694,14 @@ export function convertCategoryFacetValueToRequest( }; } +export function convertLocationFacetValueToRequest( + facetValue: LocationFacetValue +): LocationFacetValueRequest { + const {value, state} = facetValue; + + return {value, state}; +} + function insertNewValue( facetRequest: AnyFacetRequest, facetValue: AnyFacetValueRequest diff --git a/packages/headless/src/features/commerce/facets/facet-set/interfaces/common.ts b/packages/headless/src/features/commerce/facets/facet-set/interfaces/common.ts index 67f2563fe21..42d7526900b 100644 --- a/packages/headless/src/features/commerce/facets/facet-set/interfaces/common.ts +++ b/packages/headless/src/features/commerce/facets/facet-set/interfaces/common.ts @@ -19,4 +19,5 @@ export type FacetType = | 'regular' | 'dateRange' | 'numericalRange' - | 'hierarchical'; + | 'hierarchical' + | 'location'; diff --git a/packages/headless/src/features/commerce/facets/facet-set/interfaces/request.ts b/packages/headless/src/features/commerce/facets/facet-set/interfaces/request.ts index ebe344f3a27..ed34d45d8ec 100644 --- a/packages/headless/src/features/commerce/facets/facet-set/interfaces/request.ts +++ b/packages/headless/src/features/commerce/facets/facet-set/interfaces/request.ts @@ -41,6 +41,13 @@ export type RegularFacetRequest = BaseCommerceFacetRequest< 'regular' >; +export type LocationFacetValueRequest = FacetValueRequest; + +export type LocationFacetRequest = BaseCommerceFacetRequest< + LocationFacetValueRequest, + 'location' +>; + export type BaseCommerceFacetRequest = Pick< FacetRequest, | 'facetId' @@ -59,6 +66,7 @@ export type BaseCommerceFacetRequest = Pick< export type AnyFacetValueRequest = | FacetValueRequest + | LocationFacetValueRequest | CategoryFacetValueRequest | NumericRangeRequest | DateRangeRequest; diff --git a/packages/headless/src/features/commerce/facets/facet-set/interfaces/response.ts b/packages/headless/src/features/commerce/facets/facet-set/interfaces/response.ts index 6ade7b0b585..505973ea6cf 100644 --- a/packages/headless/src/features/commerce/facets/facet-set/interfaces/response.ts +++ b/packages/headless/src/features/commerce/facets/facet-set/interfaces/response.ts @@ -39,6 +39,15 @@ export interface RegularFacetValue extends BaseFacetValue { value: string; } +export type LocationFacetResponse = BaseFacetResponse< + LocationFacetValue, + 'location' +>; + +export interface LocationFacetValue extends BaseFacetValue { + value: string; +} + export interface RangeFacetValue extends BaseFacetValue { start: T; end: T; @@ -70,6 +79,7 @@ export interface BaseFacetValue { export type AnyFacetValueResponse = | RegularFacetValue + | LocationFacetValue | NumericFacetValue | DateFacetValue | CategoryFacetValue; @@ -83,7 +93,9 @@ type MappedFacetResponse = { ? DateFacetResponse : T extends 'hierarchical' ? CategoryFacetResponse - : never; + : T extends 'location' + ? LocationFacetResponse + : never; }; export type AnyFacetResponse = MappedFacetResponse[FacetType]; diff --git a/packages/headless/src/features/commerce/facets/location-facet/location-facet-actions.ts b/packages/headless/src/features/commerce/facets/location-facet/location-facet-actions.ts new file mode 100644 index 00000000000..04db303b72c --- /dev/null +++ b/packages/headless/src/features/commerce/facets/location-facet/location-facet-actions.ts @@ -0,0 +1,29 @@ +import {RecordValue} from '@coveo/bueno'; +import {createAction} from '@reduxjs/toolkit'; +import { + requiredNonEmptyString, + validatePayload, +} from '../../../../utils/validate-payload.js'; +import {facetValueDefinition} from '../../../facets/facet-set/facet-set-validate-payload.js'; +import { + ToggleExcludeFacetValuePayload, + ToggleSelectFacetValuePayload, +} from '../regular-facet/regular-facet-actions.js'; + +export const toggleExcludeLocationFacetValue = createAction( + 'commerce/facets/locationFacet/toggleExcludeValue', + (payload: ToggleExcludeFacetValuePayload) => + validatePayload(payload, { + facetId: requiredNonEmptyString, + selection: new RecordValue({values: facetValueDefinition}), + }) +); + +export const toggleSelectLocationFacetValue = createAction( + 'commerce/facets/locationFacet/toggleSelectValue', + (payload: ToggleSelectFacetValuePayload) => + validatePayload(payload, { + facetId: requiredNonEmptyString, + selection: new RecordValue({values: facetValueDefinition}), + }) +); diff --git a/packages/headless/src/features/commerce/pagination/pagination-slice.test.ts b/packages/headless/src/features/commerce/pagination/pagination-slice.test.ts index ef7374d0037..b4dca0520c6 100644 --- a/packages/headless/src/features/commerce/pagination/pagination-slice.test.ts +++ b/packages/headless/src/features/commerce/pagination/pagination-slice.test.ts @@ -11,6 +11,10 @@ import { toggleExcludeDateFacetValue, toggleSelectDateFacetValue, } from '../facets/date-facet/date-facet-actions.js'; +import { + toggleExcludeLocationFacetValue, + toggleSelectLocationFacetValue, +} from '../facets/location-facet/location-facet-actions.js'; import { toggleExcludeNumericFacetValue, toggleSelectNumericFacetValue, @@ -269,6 +273,14 @@ describe('pagination slice', () => { actionName: '#toggleExcludeFacetValue', action: toggleExcludeFacetValue, }, + { + actionName: '#toggleSelectLocationFacetValue', + action: toggleSelectLocationFacetValue, + }, + { + actionName: '#toggleExcludeLocationFacetValue', + action: toggleExcludeLocationFacetValue, + }, { actionName: '#toggleSelectNumericFacetValue', action: toggleSelectNumericFacetValue, diff --git a/packages/headless/src/features/commerce/pagination/pagination-slice.ts b/packages/headless/src/features/commerce/pagination/pagination-slice.ts index daf24ac1a3b..b7adff645b0 100644 --- a/packages/headless/src/features/commerce/pagination/pagination-slice.ts +++ b/packages/headless/src/features/commerce/pagination/pagination-slice.ts @@ -9,6 +9,10 @@ import { toggleExcludeDateFacetValue, toggleSelectDateFacetValue, } from '../facets/date-facet/date-facet-actions.js'; +import { + toggleExcludeLocationFacetValue, + toggleSelectLocationFacetValue, +} from '../facets/location-facet/location-facet-actions.js'; import { toggleExcludeNumericFacetValue, toggleSelectNumericFacetValue, @@ -109,6 +113,8 @@ export const paginationReducer = createReducer( .addCase(deselectAllValuesInCoreFacet, handlePaginationReset) .addCase(toggleSelectFacetValue, handlePaginationReset) .addCase(toggleExcludeFacetValue, handlePaginationReset) + .addCase(toggleSelectLocationFacetValue, handlePaginationReset) + .addCase(toggleExcludeLocationFacetValue, handlePaginationReset) .addCase(toggleSelectNumericFacetValue, handlePaginationReset) .addCase(toggleExcludeNumericFacetValue, handlePaginationReset) .addCase(toggleSelectDateFacetValue, handlePaginationReset) diff --git a/packages/headless/src/test/mock-commerce-facet-response.ts b/packages/headless/src/test/mock-commerce-facet-response.ts index 0fb0d568de9..9c188778637 100644 --- a/packages/headless/src/test/mock-commerce-facet-response.ts +++ b/packages/headless/src/test/mock-commerce-facet-response.ts @@ -4,6 +4,7 @@ import { DateFacetResponse, AnyFacetResponse, CategoryFacetResponse, + LocationFacetResponse, } from '../features/commerce/facets/facet-set/interfaces/response.js'; function getMockBaseCommerceFacetResponse(): Omit< @@ -32,6 +33,17 @@ export function buildMockCommerceRegularFacetResponse( }; } +export function buildMockCommerceLocationFacetResponse( + config: Partial = {} +): LocationFacetResponse { + return { + ...getMockBaseCommerceFacetResponse(), + type: 'location', + values: [], + ...config, + }; +} + export function buildMockCommerceNumericFacetResponse( config: Partial = {} ): NumericFacetResponse { diff --git a/packages/headless/src/test/mock-commerce-facet-value.ts b/packages/headless/src/test/mock-commerce-facet-value.ts index dffd169cd16..09130506392 100644 --- a/packages/headless/src/test/mock-commerce-facet-value.ts +++ b/packages/headless/src/test/mock-commerce-facet-value.ts @@ -3,6 +3,7 @@ import { NumericFacetValue, DateFacetValue, CategoryFacetValue, + LocationFacetValue, } from '../features/commerce/facets/facet-set/interfaces/response.js'; export function buildMockCommerceRegularFacetValue( @@ -19,6 +20,20 @@ export function buildMockCommerceRegularFacetValue( }; } +export function buildMockCommerceLocationFacetValue( + config: Partial = {} +): LocationFacetValue { + return { + value: '', + state: 'idle', + numberOfResults: 0, + isAutoSelected: false, + isSuggested: false, + moreValuesAvailable: false, + ...config, + }; +} + export function buildMockCommerceNumericFacetValue( config: Partial = {} ): NumericFacetValue {