Skip to content

feat(DTCRCMERC-4687): implement v5 text-layout styles for renderV2Message#1331

Open
sailaya99 wants to merge 3 commits into
paypal:developfrom
sailaya99:DTCRCMERC-4687-v5-styles-render-v2-message
Open

feat(DTCRCMERC-4687): implement v5 text-layout styles for renderV2Message#1331
sailaya99 wants to merge 3 commits into
paypal:developfrom
sailaya99:DTCRCMERC-4687-v5-styles-render-v2-message

Conversation

@sailaya99

Copy link
Copy Markdown
Collaborator

Description

Implements v5 text-layout styles for the renderV2Message SSR module (DTCRCMERC-4687).

Previously, renderV2Message rendered with a bare .pp-message container and minimal CSS — no color treatment, no logo positioning styles, no font configuration, and no alignment support. This PR introduces a static, class-based stylesheet (no legacy mutation system) that covers all v5 text style options:

  • text.color → CSS class on .main/.action spans (black, white, monochrome, grayscale)
  • text.size → font-size in px (10–16)
  • text.align → text-align on .pp-message (left, center, right)
  • logo.position → margin/display treatment on .logo (left, right, top)
  • logo.type → passed through as a root data-pp-style-logo-type attribute
  • text.fontFamily / text.fontSource → @font-face generation with https-only URL validation and XSS-safe font name filtering
  • greyscale alias normalized to grayscale via validateStyle before reaching render()

Root data-pp-style-* attributes are added to the .pp-message div for downstream observability and potential CSS hook use.

…sage

- Add body reset and scoped .pp-message stylesheet (display:block, width:100%)
- Map text.color to CSS classes on .main/.action spans with vertical-align:middle
- Add CSS filters on .logo img for white (invert), monochrome (grayscale+black), grayscale variants
- Handle logo positions: left (default), right (margin swap), top (block display)
- Implement fontSource @font-face generation with URL/name security validation
- Wire fontSource through message.jsx into styles()
- Add data-pp-style-* root attributes for layout, logo-type, logo-position, text-align, text-color, text-size
- Add greyscale alias pipeline test (validateStyle -> render -> class)
- Expand snapshot coverage to all 7 text sizes (10-16) and full logo/color/align matrix (21 snapshots)

@Braluna-pp Braluna-pp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thermo-nuclear code quality review: a few maintainability and coverage issues worth tightening before this lands.

Comment thread tests/unit/spec/server/v2/render.test.js Outdated
Comment thread src/server/v2/message.jsx
Comment thread tests/unit/spec/server/v2/render.test.js
- Separate logoType/logoPosition in message.jsx; buildLogoConfiguration
  now branches on logoType=inline without using it as a pseudo-position
- Replace full-matrix snapshots with one representative render snapshot,
  one stylesheet snapshot, and test.each matrix assertions (119 lines vs ~1240)
- Add stylesheet isolation tests (inline embed + selector scope check)
- Simplify redundant selector-parsing filter in isolation test

@Braluna-pp Braluna-pp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thermo-nuclear code-quality review: leaving three maintainability findings inline.

Comment thread src/server/v2/utils/buildLogoConfiguration.js Outdated
Comment thread src/server/v2/styles.js Outdated
Comment thread tests/unit/spec/server/v2/render.test.js Outdated

@Braluna-pp Braluna-pp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM thank you for addressing the feedback

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