Repository navigation
feat: [CP-432] [CP-433] Adding CP integration as a data source alternative to hCMS - #2807
Merged
Merged
Conversation
marcopaulo7
requested review from
eduardoformiga and
lariciamota
and removed request for
a team
April 25, 2025 14:10
marcopaulo7
marked this pull request as draft
April 25, 2025 14:11
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
marcopaulo7
marked this pull request as ready for review
April 28, 2025 14:05
lariciamota
reviewed
Apr 29, 2025
lariciamota
reviewed
Apr 30, 2025
marcopaulo7
force-pushed
the
feat/cp-data-plane-integration
branch
from
May 2, 2025 18:40
a255e1c to
930482c
Compare
lariciamota
reviewed
May 5, 2025
lariciamota
approved these changes
May 5, 2025
lariciamota
left a comment
Contributor
There was a problem hiding this comment.
🎉
I've tested using the CMS config - the pages (GlobalSections, LandingPage, PLP, PDP, 404, 500 and search) are working as they should!
victorhmp
approved these changes
May 7, 2025
lucasfp13
requested changes
May 7, 2025
marcopaulo7
force-pushed
the
feat/cp-data-plane-integration
branch
from
May 8, 2025 13:01
8ee8a7c to
1a68929
Compare
lucasfp13
approved these changes
May 9, 2025
lariciamota
reviewed
May 12, 2025
lariciamota
pushed a commit
that referenced
this pull request
Aug 1, 2025
…omponentKey (#2915) ## What's the purpose of this pull request? This PR makes it so FastStore Core is capable of rendering components based on data from the CMS, using `$componentKey`s to identity each component. It also adds the `$componentKey`s to each component, based on their new schemas (for Content Platform) added in [this PR](#2742). ## How it works? The implementation here is backwards compatible, so during the existing rendering flow a new check was added to look for the `$componentKey` property in a section's data. Also, for each component that renders a section, the `$componentKey` property was added, then, when indexing all available components, the new property will now be used if its present. To keep backwards compatibility, the `$componentKey`s are matching the names of the components. ## How to test it? Since this change should be totally backwards compatible, if you're testing this branch with any current store, fetching data from hCMS, you should see no change in behaviour and everything should still render normally. Running `@faststore/core` locally also should look normal. You can also test this by using this branch alongside the new CP client being used in #2807.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the purpose of this pull request?
This PR introduces the code necessary to enable the use of Content Platform as a data source for the store.
How it works?
The changes in this pull request introduce a new content service (
contentService) that replaces the previous direct usage of thegetPagefunction from@vtex/client-cms. The contentService decides which source should be used (hCMS or CP, based on the newcontentSource.typeconfig) and uses the related client,@vtex/client-cmsfor hCMS queries or the new@vtex/client-cpfor CP queries.Key Changes
Centralized Content Service:
contentServiceto unify content retrieval logic across CMS platforms (hCMS and CP).ContentOptionsand converts them toEntryPathParamsfor CP data sources (seeconvertOptionsToParams).PreviewData Type:
PreviewDatatype combines the existingLocatorwith CP-specific parameters, enabling preview enhancements without breaking changes.Slug-Based Previews (CP):
How to Test
contentTypeentries (e.g., pages, blogs) render correctly.For Local CP Testing:
Starters Deploy Preview
References
Checklist
You may erase this after checking them all 😉
PR Title and Commit Messages
feat,fix,chore,docs,style,refactor,ciandtestPR Description
breaking change,bug,contributing,performance,documentation..Dependencies
pnpm-lock.yamlfile when there were changes to the packagesDocumentation
@Mariana-Caetanoto review and update (Or submit a doc request)