Skip to content

feat(website): Support HS merchant themes in embed workspace - #458

Open
raunak23427 wants to merge 4 commits into
juspay:mainfrom
raunak23427:feature/hs-merchant-themes
Open

raunak23427 wants to merge 4 commits into
juspay:mainfrom
raunak23427:feature/hs-merchant-themes

Conversation

@raunak23427

Copy link
Copy Markdown

This commit implements the theme handshake for the embedded Decision Engine workspace, resolving Issue #455.

Changes include:

  1. embedBridge.ts: Created a setupEmbedBridge function to listen for de:theme-update messages from the parent window. It verifies the frame ID and forwards validated theme tokens.
  2. theme.ts: Added an applyThemeTokens function that securely validates and maps incoming tokens as CSS Custom Properties to the document root (e.g., --color-brand-500). It strictly filters for expected prefixes and rejects dangerous values like URLs or JS execution.
  3. main.tsx: Initialized the setupEmbedBridge listener on application mount to ensure themes are received early.
  4. index.css: Predefined the default fallback hex values for --color-brand-* variables.
  5. tailwind.config.ts: Updated the Tailwind theme configuration to consume the dynamic CSS variables instead of hard-coded hex colors.

This commit implements the theme handshake for the embedded Decision Engine workspace, resolving Issue juspay#455.

Changes include:
1. embedBridge.ts: Created a setupEmbedBridge function to listen for de:theme-update messages from the parent window. It verifies the frame ID and forwards validated theme tokens.
2. theme.ts: Added an applyThemeTokens function that securely validates and maps incoming tokens as CSS Custom Properties to the document root (e.g., --color-brand-500). It strictly filters for expected prefixes and rejects dangerous values like URLs or JS execution.
3. main.tsx: Initialized the setupEmbedBridge listener on application mount to ensure themes are received early.
4. index.css: Predefined the default fallback hex values for --color-brand-* variables.
5. tailwind.config.ts: Updated the Tailwind theme configuration to consume the dynamic CSS variables instead of hard-coded hex colors.
This extends the GSM decision model to correctly represent RETRY_SAME_GATEWAY, RETRY_DIFFERENT_GATEWAY, and DO_NOT_RETRY based on the underlying rule. It safely centralizes the decision mapping while preserving existing gsm_info compatibility, and updates the OpenAPI specification appropriately.
@raunak23427

Copy link
Copy Markdown
Author

Implementation Notes for Reviewers: While reviewing Issue #236, I noticed that PR #284 recently migrated the GSM architecture to a high-performance in-memory CSV/S3 model. To respect this new architecture, I intentionally avoided introducing the PostgreSQL override layer originally suggested in the issue description.

Instead, I implemented the smallest, cleanest API extension possible:

Extended the internal GsmDecision enum with a Requeue state (mapped to RETRY_DIFFERENT_GATEWAY).
Added retry_decision, unified_code, and unified_message safely via .and_then() directly from the existing gsm_info cache hit.
Preserved the raw gsm_info object in the API response to ensure strict backward compatibility for any existing clients.
Handled the fail-closed fallback gracefully (defaulting to DO_NOT_RETRY if no rule matches).

@raunak23427
raunak23427 marked this pull request as draft October 1, 2026 14:01
@raunak23427
raunak23427 marked this pull request as ready for review October 1, 2026 14:01
@raunak23427

Copy link
Copy Markdown
Author

"Hi @prajjwalkumar17 and @GauravRawat369! This PR finishes up the GSM retry mapping (Issue #236) on top of the new CSV architecture. It is fully green and passing all CI checks. I would really appreciate a review when you have a moment!"

This branch has not been deployed

No deployments
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.

1 participant