-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(headless): update product interface to reflect how the commerce a…
…pi behaves (#4104) This is less changes that what I had originally thought. The `BaseProduct` interface should now properly reflect what's returned by the commerce API, following the source of truth (the code of the service itself). * Most of the change are about changing from `foo | undefined` to `foo | null`. * Array values are never null, but might be an empty array (due to how the service is coded) * ec_category is always an array, not a string * Added couple missing properties (non breaking) There is only "one lie" in this change: `excerpts, nameHighlights, excerptsHighlights` are "always defined when in a search use case", and "always undefined when in a listing or recommendation use case". I thought about splitting and creating multiple interface `SearchProduct, ListingProduct, RecommendationProduct`, and remove `Product` as it exists right now. However this would be a very noisy change, for existing deployments. `Product` is an *important* interface, which is nearly always referenced by any implementer using TypeScript. So I made the judgment call to "lie a little bit, for the greater good" 😂 They are marked as possibly undefined for all use cases. https://coveord.atlassian.net/browse/KIT-3164
- Loading branch information
Showing
10 changed files
with
81 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters