Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(commerce): atomic-product-field-condition #3959

Merged
merged 8 commits into from
Jun 1, 2024

Conversation

louis-bompart
Copy link
Collaborator

@louis-bompart louis-bompart commented May 16, 2024

Related to #3956

Adds the atomic-product-field-condition component to enable conditional rendering based on commerce-specific fields in Coveo's UI Kit.

  • Implements the component with properties ifDefined and ifNotDefined to check for the presence or absence of specified fields.
  • Introduces mustMatch and mustNotMatch properties for conditional rendering based on matching field values, utilizing ProductTemplatesHelpers.
  • Ensures the component evaluates conditions on component load and removes itself from the DOM if conditions are not met, maintaining clean template structure.
  • Utilizes @ProductContext to access the current product's properties for condition evaluation.

KIT-3058

For more details, open the Copilot Workspace session.

Related to #3956

Adds the `atomic-product-field-condition` component to enable conditional rendering based on commerce-specific fields in Coveo's UI Kit.
- Implements the component with properties `ifDefined` and `ifNotDefined` to check for the presence or absence of specified fields.
- Introduces `mustMatch` and `mustNotMatch` properties for conditional rendering based on matching field values, utilizing `ProductTemplatesHelpers`.
- Ensures the component evaluates conditions on component load and removes itself from the DOM if conditions are not met, maintaining clean template structure.
- Utilizes `@ProductContext` to access the current product's properties for condition evaluation.


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/coveo/ui-kit/issues/3956?shareId=c1d4fa4c-3d58-4aab-a30d-db1259b300e5).
Copy link

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:

(optional scope):

Example:

feat(headless): add result-list controller

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 202.8 202.8 0
commerce 274.9 274.9 0
search 367.3 367.3 0
insight 347.8 347.8 0
product-listing 261.9 261.9 0
product-recommendation 171.9 171.9 0
recommendation 215.7 215.7 0
ssr 360.1 360.1 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
product-recommendation 0 10 0
product-listing 0 13 0
case-assist 0 6 0
insight 0 27 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
product-recommendation : missing SSR support
product-listing : missing SSR support
case-assist : missing SSR support
insight : missing SSR support

@louis-bompart
Copy link
Collaborator Author

Introduces the atomic-product-field-condition component and implements it in commerce example pages.

  • Adds the atomic-product-field-condition component definition in components.d.ts, including properties for verifying if specified fields are defined or not defined.
  • Implements the atomic-product-field-condition component in the atomic-product-field-condition.tsx file, with logic to conditionally render content based on product field definitions.
  • Updates commerce example pages (homepage.html and search.html) to replace atomic-field-condition with the new atomic-product-field-condition component for conditional rendering based on product fields.

For more details, open the Copilot Workspace session.

Introduces the `atomic-product-field-condition` component and implements it in commerce example pages.

- Adds the `atomic-product-field-condition` component definition in `components.d.ts`, including properties for verifying if specified fields are defined or not defined.
- Implements the `atomic-product-field-condition` component in the `atomic-product-field-condition.tsx` file, with logic to conditionally render content based on product field definitions.
- Updates commerce example pages (`homepage.html` and `search.html`) to replace `atomic-field-condition` with the new `atomic-product-field-condition` component for conditional rendering based on product fields.


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/coveo/ui-kit/pull/3959?shareId=052a354e-c767-4be7-a8ed-fd0a509dea68).
@louis-bompart louis-bompart marked this pull request as ready for review May 16, 2024 20:29
@louis-bompart louis-bompart requested a review from a team as a code owner May 16, 2024 20:29
@louis-bompart louis-bompart changed the title Add atomic-product-field-condition component for commerce feat(commerce): atomic-product-field-condition May 16, 2024
Copy link
Contributor

@y-lakhdar y-lakhdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be marked as internal?

…ondition/atomic-product-field-condition.tsx

Co-authored-by: ylakhdar <[email protected]>
Copy link

github-actions bot commented May 31, 2024

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 202.8 202.8 0
commerce 285.9 285.9 0
search 367.5 367.5 0
insight 347.8 347.8 0
product-listing 262.3 262.3 0
product-recommendation 171.9 171.9 0
recommendation 215.8 215.8 0
ssr 360.3 360.3 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
product-recommendation 0 10 0
product-listing 0 13 0
case-assist 0 6 0
insight 0 27 0
commerce 0 7 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
product-recommendation : missing SSR support
product-listing : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

@louis-bompart louis-bompart force-pushed the louis-bompart/add-product-field-condition-1 branch from 913d1b8 to 565c1dd Compare May 31, 2024 02:39
@louis-bompart louis-bompart force-pushed the louis-bompart/add-product-field-condition-1 branch from 565c1dd to 7068d88 Compare May 31, 2024 08:02
@louis-bompart louis-bompart dismissed y-lakhdar’s stale review June 1, 2024 22:27

Changes applied

@louis-bompart louis-bompart added this pull request to the merge queue Jun 1, 2024
Merged via the queue into master with commit 5e14eec Jun 1, 2024
87 checks passed
@louis-bompart louis-bompart deleted the louis-bompart/add-product-field-condition-1 branch June 1, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants