feat(VCST-4933): add Page Builder Shared Components - #159
Open
ToxaKZ wants to merge 5 commits into
Open
Conversation
|
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.



Description
Implements reusable Shared Components for Page Builder.
Content authors can convert adjacent top-level sections into a store-scoped Shared Component, reuse it as a linked instance or an independent copy, edit the original, detach an instance, inspect where it is used, and manage the library from VC Shell.
Terminology follows VCST-4933:
LinkedComponentis the code/API domain name.componentRefis the compact reference stored in raw Page Builder page JSON.Authoring and management
Domain and persistence
Raw page content stores a reference rather than duplicated component content:
{ "id": "componentRef-placement-id", "type": "componentRef", "componentRef": "<shared-component-id>" }A Shared Component stores a regular Page Builder template containing a group of top-level sections:
{ "settings": {}, "content": [ { "id": "...", "type": "..." } ] }Persistence includes:
PageBuilderLinkedComponent— store-scoped metadata and audit information.PageBuilderLinkedComponentContent— component template JSON.PageBuilderLinkedComponentReference— page-to-component usage index.PageBuilderLinkedComponentAssetReference— assets referenced by component content.Migrations are included for SQL Server, PostgreSQL, and MySQL.
API, permissions, and authorization
Authenticated operations are exposed under:
The API supports search, get, create, metadata update/rename, delete, load content, and save content.
Dedicated permissions:
builder:linked-components:readbuilder:linked-components:createbuilder:linked-components:updatebuilder:linked-components:deletePage and component resources continue to use Page Builder resource-based store authorization. Usage-page details are returned only when the caller can read pages.
Consistency and concurrency
Component metadata, content, asset references, and page-reference indexes are maintained as one aggregate.
The implementation provides:
Publish and Storefront architecture
Raw Page Builder content remains reference-based while authoring.
PageBuilderContentProviderexpands everycomponentRefbefore the content reaches Pages indexing.flowchart LR D["Page Builder Designer"] -->|"save page with componentRef"| PB["Page Builder storage"] D -->|"save component template"| SC["Shared Component aggregate"] PB --> RI["Page/component reference index"] SC --> AR["Component asset-reference index"] PB --> CP["PageBuilderContentProvider"] SC --> R["LinkedComponentResolver"] CP --> R R -->|"expanded ordinary sections"| P["Pages indexing"] P -->|"resolved page document"| SF["Storefront"]Expanded IDs are deterministically derived from placement ID and structural path. The same component can therefore be placed more than once without ID collisions, while IDs remain stable across reindex operations.
When component content changes:
The production Storefront does not call the Shared Components API. It receives ordinary, fully expanded Page Builder blocks from Pages.
Assets Library integration
Component asset references are indexed with the Shared Component aggregate. Assets Library can return direct component references, affected usage pages, and separate/total reference counts.
Pages using component assets are derived through the component-placement index instead of duplicating component assets into every page index. This keeps component content and its asset index atomic and avoids fan-out partial-update windows.
Export/import
Export writes Shared Components and their content before Page Builder pages.
Import loads components first, then validates page
componentRefvalues before replacing page groups and variants. References must exist, have content, and belong to the target store. Existing exports without Shared Components remain supported.Constraints
Companion Storefront PR
VirtoCommerce/vc-frontend#2410
References
QA-test:
Assume the Page Builder module and companion Storefront build are already installed and configured.
1. Ordinary Page Builder regression
2. Create a Shared Component
3. Insert from Add block
4. Edit and detach
5. Shared Components workspace
6. Publish and propagation
componentRefplaceholder is exposed.7. Assets Library
8. Permissions, validation, and races
Jira-link:
https://virtocommerce.atlassian.net/browse/VCST-4933
Artifact URL:
https://vc3prerelease.blob.core.windows.net/packages/VirtoCommerce.PageBuilderModule_3.1021.0-pr-159-28aa.zip