Skip to content

[feat] Add BidiComponent and tests#12756

Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom
bnisco/ccv2-stack-33
Oct 25, 2025
Merged

[feat] Add BidiComponent and tests#12756
sfc-gh-bnisco merged 1 commit intodevelopfrom
bnisco/ccv2-stack-33

Conversation

@sfc-gh-bnisco
Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Oct 10, 2025

Describe your changes

Added the main BidiComponent component. This component composes everything from the prior few components:

  • HTML content injection
  • CSS styling (both inline and via source paths)
  • JavaScript execution (both inline and via source paths)
  • Multiple data formats (JSON, Arrow, bytes)
  • Widget state management for bidirectional communication

GitHub Issue Link (if applicable)

Testing Plan

  • Unit Tests: Comprehensive test suite covering all component functionality including:
    • Component selection between isolated and non-isolated modes
    • HTML content handling with various complexity levels
    • CSS content handling and style isolation
    • Data handling for different formats
    • Widget state integration
    • Error handling for various scenarios
    • JavaScript content execution
    • Component memoization

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Oct 10, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Collaborator Author

sfc-gh-bnisco commented Oct 10, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-33 branch 2 times, most recently from 07eba44 to 20309b7 Compare October 24, 2025 19:57
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-32 branch 2 times, most recently from 1b4face to 83046b6 Compare October 24, 2025 20:00
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-33 branch 2 times, most recently from 8fa7a97 to d4a0e93 Compare October 24, 2025 22:04
sfc-gh-bnisco added a commit that referenced this pull request Oct 24, 2025
## Describe your changes

Added two new hooks for CCv2 to handle HTML, CSS, and JavaScript content from the user's component:

1. `useHandleHtmlAndCssContent`: Safely injects HTML content (including script tags) and CSS into the component container. It supports both inline CSS and external CSS files.
2. `useHandleJsContent`: Manages JavaScript content execution for CCv2. It supports both inline JS and external JS files, and provides proper lifecycle management with cleanup functions.

These hooks provide a clean separation of concerns for handling different types of content in BidiComponents, with proper error handling and resource cleanup.

## GitHub Issue Link (if applicable)

## Testing Plan

- These code paths are tested when they are actually used by the composed component in #12756

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Copy link
Copy Markdown
Collaborator Author

sfc-gh-bnisco commented Oct 24, 2025

Merge activity

  • Oct 24, 11:01 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 24, 11:54 PM UTC: Graphite rebased this pull request as part of a merge.
  • Oct 25, 12:20 AM UTC: @sfc-gh-bnisco merged this pull request with Graphite.

sfc-gh-bnisco added a commit that referenced this pull request Oct 24, 2025
## Describe your changes

Added isolated and non-isolated component implementations for the CCv2 widget. This includes:

1. `IsolatedComponent.tsx` - A component that uses Shadow DOM for content isolation
2. `NonIsolatedComponent.tsx` - A component that renders content directly without isolation
3. `styled-components.ts` - Shared styled components for both implementations

The isolated component creates a shadow root for content encapsulation, while the non-isolated version renders directly to a div. Both components use shared hooks for handling HTML, CSS, and JavaScript content.

## GitHub Issue Link (if applicable)

## Testing Plan

- These code paths are tested when they are actually used by the composed component in #12756 and in the e2e tests #12758

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
@sfc-gh-bnisco sfc-gh-bnisco changed the base branch from bnisco/ccv2-stack-32 to graphite-base/12756 October 24, 2025 23:28
@sfc-gh-bnisco sfc-gh-bnisco changed the base branch from graphite-base/12756 to develop October 24, 2025 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:internal PR changes only affect internal code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants